!
rem 
rem  NAND flash programming include file
rem 
rem --------------------
rem Init system register
rem --------------------
rem init mpmc
long 0xb1000000  0x01
long 0xb1000200  0x80
long 0xb1000220  0x81
rem enable nand flash
long 0xb2000064  0x100
long 0xb2000008  0x1
rem ---------------------------
rem  Erase block 0
rem ---------------------------
$port=0xb0000000
rem  deassert WP# Write protect
outport $port+0xa  0x1
rem  deassert SP#
outport $port+0x8  0x1
rem  assert CE#
outport $port+0x1  0x1
rem  assert CLE
outport $port+0x4  0x1
rem  Issue erase command, phase 1
outport $port+0x0  0x60
rem  deassert CLE
outport $port+0x3  0x1
rem  assert ALE
outport $port+0x6  0x1
rem  Issue A13-A16, A22-A17
outport $port  0x00
outport $port  0x00 
rem  deassert ALE
outport $port+0x5  0x1
rem  assert CLE
outport $port+0x4  0x1
rem  Issue erase block command, phase 2
outport $port  0xd0
rem  deassert CLE
outport $port+0x3  0x1
pause 1
rem  deassert CE#
outport $port+0x2  0x1
rem Assert WP# Write protect
outport $port+0x9  0x1
rem ---------------------------

!
