I have been working on re-building the loon-2 boot loader with a modern
compiler.
We have come across what appears to be a timing related oddity.
The following code is executed during the Linux boot phase, if the call to
fixup_dram_bank1() is executed then the bootldr crashes with the following
output:
mdcnfg=0000F367
PABT
F985ABDC
40015000
With the call commented out the boot into Linux works. If we put some debug
print statements in that part of the code then it also boots ok, but the
printing immediately after the fixup call is garbled.
Can anyone explain what is happening? Do we actually need to turn off bank 1
if it is enabled but there is no dram there? If we do need to do this is
some sort of settling delay required?
static void fixup_dram_bank1(void)
{
#if !defined(CONFIG_PXA)
if (param_dram_n_banks.value < 2) {
unsigned long mdcnfg = ABS_MDCNFG;
putLabeledWord("mdcnfg=", mdcnfg);
/* turn off bank 1 if it is enabled but there is no dram there */
if (mdcnfg & MDCNFG_BANK1_ENABLE) {
mdcnfg &= ~MDCNFG_BANK1_ENABLE;
ABS_MDCNFG = mdcnfg;
}
}
#endif
}
void setup_linux_params(long bootimg_dest, long memc_ctrl_reg, const char
*cmdline)
{
int rootdev = 0x00ff;
struct tag *tag;
int npartitions = partition_table->npartitions;
int newcmdlinelen = 0;
char *newcmdline = NULL;
fixup_dram_bank1(); // <---------------------- This line
// add the partition table to the commandline
newcmdlinelen = strlen(cmdline) + 128 + 64*npartitions;
newcmdline = mmalloc(newcmdlinelen);
memset(newcmdline, 0, newcmdlinelen);
...
--
Colin Tuckley | colin@tuckley.org | PGP/GnuPG Key Id
+44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE
Do not meddle in the affairs of dragons, for you are crunchy and taste good
with ketchup.