From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 29 Jun 2012 12:08:18 +0200 Subject: [U-Boot] [PATCH 1/2] KW: Move the memory register definitions into kirkwood.h In-Reply-To: <4FED7D2E.4020508@keymile.com> References: <1340736582-19815-1-git-send-email-marex@denx.de> <4FED7D2E.4020508@keymile.com> Message-ID: <201206291208.18541.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Gerlando Falauto, > 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(). Read up at [1]. http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/133991 > What do you think? > > Thank you, > Gerlando Best regards, Marek Vasut