Thanks Yes.
as I said if there was a code problem, it would crash significantly later than SDRAM Init. To reiterate, the software runs fine on an initial power-up. Or, if we power down, wait for 10 seconds, and power on. It will fail on power off and immediate power on.
I suspect the SDRAM init using UPM B. I am attaching what we do. If you have any comments or have UPM B Init code, please send me:
### Sub-Command Locations
UPM_CMD_LOADMODE .equ 0x10
UPM_CMD_NOP_LONG .equ 0x2c
UPM_CMD_NOP_SINGLE .equ 0x2e
UPM_CMD_REFRESH .equ 0x30
UPM_CMD_INIT .equ 0x37
INT_UPMB_Table:
# /* single read. (offset 0x00 in upm RAM) */
.long 0x0f07fc04, 0x0ffffc04, 0x00bdfc04, 0x0ff77c00
.long 0x1ffffc05, 0xef3abc34, 0x1f357c35, 0x0ffffc04
# /* burst read. (offset 0x08 in upm RAM) */
.long 0x0f07fc04, 0x0ffffc04, 0x00bdfc04, 0x00fffc00
.long 0x00fffc00, 0x00fffc00, 0x0ff77c00, 0x1ffffc05
.long 0xef3abc34, 0x0f357c34, 0x1ffffc05, 0x0ffffc04 # UPM_CMD_LOADMODE at 0x10
.long 0x0ffffc04, 0x0ffffc04, 0x0ffffc04, 0x0ffffc04
# /* single write. (offset 0x18 in upm RAM) */
.long 0x0f07fc04, 0x0ffffc00, 0x00bd7c04, 0x0ffffc04
.long 0x0ff77c04, 0x1ffffc05, 0xfffffc04, 0xfffffc04
# /* burst write. (offset 0x20 in upm RAM) */
.long 0x0f07fc04, 0x0ffffc00, 0x00bd7c00, 0x00fffc00
.long 0x00fffc00, 0x00fffc04, 0x0ffffc04, 0x0ff77c04
.long 0x1ffffc05, 0xfffffc04, 0xfffffc04, 0xfffffc04
.long 0x0ffffc84, 0x0ffffc84, 0x1ffffc05, 0xfffffc04 # UPM_CMD_NOP at 0x2C
# /* refresh. (offset 0x30 in upm RAM) */
.long 0x0ff77c04, 0x0ffffc04, 0x0ff5fc84, 0x0ffffc04 # UPM_CMD_REFRESH at 0x30
.long 0x0ffffc04, 0x0ffffc84, 0x1ffffc05, 0x0ff77c04 # UPM_CMD_INIT at 0x37
.long 0x0ffffc04, 0x0ff5fc84, 0x0ffffc04, 0x0ffffc04
# exception is not used, so we are writing init code into the space
# /* exception. (offset 0x3c in upm RAM) */
.long 0x0ffffc04, 0x0ffffc84, 0x0feabc34, 0x1f357c35
addis r5,r0,INT_UPMB_Table@ha # Get beginning address of UPMB table
addi r5,r5,INT_UPMB_Table@l
addi r6,r5,256 # Get end address of UPMB table
lis r7,0x0080 # Load command: write,UPMB,MAD=0
INT_UPMB_Loop:
lwz r3,0(r5) # Get table entry
stw r3,MDR(r4) # Copy to MDR
stw r7,MCR(r4) # Issue command to MCR
addi r5,r5,4 # Point to next entry in table
addi r7,r7,1 # Increment MAD field of MCR command
cmp r5,r6 # Finished?
blt INT_UPMB_Loop # If not, keep looping
lis r3,0x0000
ori r3,r3,0x1111
stw r3,MAMR(r4)
lis r3,0x0492
ori r3,r3,0x4111
stw r3,MBMR(r4)
li r3,0x0200 # MPTPR PTP=32x
sth r3,MPTPR(r4)
# load MAR register with proper format to drive address bus
# 0x22 == burst 4, sequential, etc. ?
lis r3,0x0000
ori r3,r3,(0x0022 << 2)
stw r3,MAR(r4)
# run NOP command 1 times from loc UPM_CMD_NOP_SINGLE -- need at least one NOP
lis r3,0x8080
ori r3,r3,0x4100 + UPM_CMD_NOP_SINGLE
stw r3,MCR(r4)
# run "init" and "load mode register" once from loc UPM_CMD_INIT
lis r3,0x8080
ori r3,r3,0x4200 + UPM_CMD_INIT
stw r3,MCR(r4)
# run NOP command 3 time from loc UPM_CMD_NOP_LONG
lis r3,0x8080
ori r3,r3,0x4100 + UPM_CMD_NOP_LONG
stw r3,MCR(r4)
lis r3,0xfe00 # Burst support; SAM = 1
ori r3,r3,0x0800 # CS2 - SDRAM GPL5 is unused
stw r3,OR2(r4)
lis r3,0x0000 # at 0x00000000 (32 Bits, Parity Dis., UPMB, Valid)
ori r3,r3,0x00C1
stw r3,BR2(r4)