[PATCH v2] at91sam9_ddrsdr: fix register on mdr read and sdram detection for ddr size
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Sun Feb 3 08:49:58 EST 2013
it's currently working by luck
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
v2:
2 bug together make it work
Best Regards,
J.
arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
index 2614f97..88796a6 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -146,7 +146,7 @@ static inline u32 at91_get_ddram_size(void * __iomem base, bool is_nb)
bool is_sdram;
cr = __raw_readl(base + AT91_DDRSDRC_CR);
- mdr = __raw_readl(base + AT91_DDRSDRC_CR);
+ mdr = __raw_readl(base + AT91_DDRSDRC_MDR);
is_sdram = (mdr & AT91_DDRSDRC_MD) <= AT91_DDRSDRC_MD_LOW_POWER_SDR;
@@ -158,7 +158,7 @@ static inline u32 at91_get_ddram_size(void * __iomem base, bool is_nb)
size = 1;
/* COL */
size += (cr & AT91_DDRSDRC_NC) + 8;
- if (is_sdram)
+ if (!is_sdram)
size ++;
/* ROW */
size += ((cr & AT91_DDRSDRC_NR) >> 2) + 11;
--
1.7.10.4
More information about the barebox
mailing list