I am still having trouble getting SBF to work reliably on my board running U-Boot.
Because I want to support different memory configurations via strap pins, I implemented a private SDRAM configuration in my board_config.h and hooked it up in start.S like this:
/* Dram Initialization a1, a2, and d0 */ /* mscr sdram */ move.l #0xFC0A4074, %a1 move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1) nop /* SDRAM Chip 0 and 1 */ move.l #0xFC0B8110, %a1 move.l #0xFC0B8114, %a2#if defined(BOARD_ASM_SDRAM_INIT)BOARD_ASM_SDRAM_INIT#else /* calculate the size */ move.l #0x13, %d1 move.l #(CONFIG_SYS_SDRAM_SIZE), %d2
The start of my BOARD_ASM_SDRAM_INIT looks like this:
#define BOARD_ASM_SDRAM_INIT \ move.l #0xfc008018, %a0; \ move.l #0xc0000000, (%a0); \ move.l #0xfc00801c, %a0;\ move.l #0x001F0001, (%a0); \ move.l #0xfc008020, %a0; \ move.l #0x0000fdc0, (%a0); \ move.l #0xc000000c, %a0; \ move.w #0x000e, (%a0); \ move.l #0xfc0a0012, %a0; \ move.l #0xfc0c4000, %a0; \ move.l #0x0a770F31, (%a0); \ move.l #0xc000000c, %a0; \ move.w #0x07, (%a0); \ \[real SDRAM init starts here]
The first lines init CS2 because I have a CPLD hooked up there with some LEDs that I can use for debugging. The lower nibble of the word written to 0xc000000c is directly output to the LEDs.
I set PLL_PCR there because I once made the observation that PLL_PCR had some strange values after reset which prevented the SDRAM from being correctly initialized. The problem is that, while most of the times this works, sometimes the write to PLL_PCR crashes the CPU. This happens even in cases when only OUTDIV3 and OUTDIV4 are different from the value found there before. (When connected to the debugger, the debugger stops the core after loading RCON from SBF, and I can check register values before starting execution.)
I tried putting the CPU to LIMP mode before setting PLL_PCR:
#define BOARD_ASM_SDRAM_INIT \ move.l #0xfc008018, %a0; \ move.l #0xc0000000, (%a0); \ move.l #0xfc00801c, %a0;\ move.l #0x001F0001, (%a0); \ move.l #0xfc008020, %a0; \ move.l #0x0000fdc0, (%a0); \ move.l #0xc000000c, %a0; \ move.w #0x000e, (%a0); \ move.l #0xfc0a0012, %a0; \ move.w (%a0), %d0; \ and.l #0xff, %d0; \ move.w %d0, (%a0); \ /* enable limp mode */ \ move.l #0xfc0a0010, %a0; \ move.w (%a0), %d0; \ and.l #0xEFFF, %d0; \ move.w %d0, (%a0); \ move.l #0xfc0c4000, %a0; \ move.l #0x0a770F31, (%a0); \ move.l #0xc000000c, %a0; \ move.w #0x07, (%a0); \ /* disable LIMP mode */ \ move.l #0xfc0a0010, %a0; \ move.w (%a0), %d0; \ or.l #0x1000, %d0; \ move.w %d0, (%a0); \ /* wait for pll lock */ \ move.l #0xc000000c, %a0; \ move.w #0x0B, (%a0); \ move.l #0xfc0c4004, %a0; \pll_unlock: \ move.l (%a0), %d0; \ and.l #0x2, %d0; \ cmp.l #0, %d0; \ beq pll_unlock; \ \
but this did not help either, still I see that sometimes code execution stops before writing 0x07 to 0xc000000c while the value of 0x0e gets written.
Does anybody have a clue what I am doing wrong here, or what I can do to get a reliable startup?
Regards,
Wolfgang