mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ppc: mpc85xx: fix memory size calculation
@ 2014-02-13 16:02 Renaud Barbier
  2014-02-14 20:23 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Renaud Barbier @ 2014-02-13 16:02 UTC (permalink / raw)
  To: barebox

Fix the chip select configuration register offset increment and summing
of bank size so that, for chip select index greater than 0, barebox can
determine the total memory size from enabled banks.

Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
---
 arch/ppc/mach-mpc85xx/cpu.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/ppc/mach-mpc85xx/cpu.c b/arch/ppc/mach-mpc85xx/cpu.c
index 17a1c4c..e5c01fc 100644
--- a/arch/ppc/mach-mpc85xx/cpu.c
+++ b/arch/ppc/mach-mpc85xx/cpu.c
@@ -68,14 +68,14 @@ phys_size_t fsl_get_effective_memsize(void)
 	sdram_size = 0;

 	for (ix = 0; ix < CFG_CHIP_SELECTS_PER_CTRL; ix++) {
-		if (in_be32(regs + DDR_OFF(CS0_CONFIG) + (ix * 8)) &
+		if (in_be32(regs + DDR_OFF(CS0_CONFIG) + (ix * 4)) &
 				SDRAM_CFG_MEM_EN) {
 			reg = in_be32(regs + DDR_OFF(CS0_BNDS) + (ix * 8));
 			/* start address */
 			san = (reg & 0x0fff00000) >>  16;
 			/* end address   */
 			ean = (reg & 0x00000fff);
-			sdram_size =  ((ean - san + 1) << 24);
+			sdram_size += ((ean - san + 1) << 24);
 		}
 	}

--
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-14 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13 16:02 [PATCH] ppc: mpc85xx: fix memory size calculation Renaud Barbier
2014-02-14 20:23 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox