[U-Boot] [PATCH 1/2] KW: Move the memory register definitions into kirkwood.h

Gerlando Falauto
2012-06-29T10:02:22Z

Dear Maruk,

I am currently trying to address the exact same issue (SDRAM size
detection and fixup).
My idea was however (as opposed to moving register definition as you
did), to add a fixup function to dram.c, say:

/*
* kw_sdram_bs - writes SDRAM Bank size
*/
void kw_sdram_bs_set(enum memory_bank bank, u32 size)
{
/* Read current register value */
u32 reg = readl(KW_REG_CPUCS_WIN_SZ(bank));

printf("Current value: %x\n", reg);
/* Clear window size */
reg &= ~KW_REG_CPUCS_WIN_SIZE(0xFF);

/* Set new window size */
reg |= KW_REG_CPUCS_WIN_SIZE((size - 1) >> 24);

printf("Writing: %x\n", reg);
writel(reg, KW_REG_CPUCS_WIN_SZ(bank));
}

which would then be called to fix the window size according to the total
memory size as reported by get_ram_size().

What do you think?

Thank you,
Gerlando