From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gerlando Falauto Date: Fri, 29 Jun 2012 12:02:22 +0200 Subject: [U-Boot] [PATCH 1/2] KW: Move the memory register definitions into kirkwood.h In-Reply-To: <1340736582-19815-1-git-send-email-marex@denx.de> References: <1340736582-19815-1-git-send-email-marex@denx.de> Message-ID: <4FED7D2E.4020508@keymile.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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