Commit d61fcfe2 authored by Florian Fainelli's avatar Florian Fainelli Committed by Ralf Baechle

MIPS: BCM63xx: Fix SDRAM size computation for BCM6345

Instead of hardcoding the amount of available RAM, read the number of
effective multiples of 8MB from SDRAM_MBASE_REG.
Signed-off-by: default avatarFlorian Fainelli <florian@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/3008/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 04712f3f
...@@ -170,8 +170,10 @@ static unsigned int detect_memory_size(void) ...@@ -170,8 +170,10 @@ static unsigned int detect_memory_size(void)
unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
u32 val; u32 val;
if (BCMCPU_IS_6345()) if (BCMCPU_IS_6345()) {
return (8 * 1024 * 1024); val = bcm_sdram_readl(SDRAM_MBASE_REG);
return (val * 8 * 1024 * 1024);
}
if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
val = bcm_sdram_readl(SDRAM_CFG_REG); val = bcm_sdram_readl(SDRAM_CFG_REG);
......
...@@ -895,6 +895,8 @@ ...@@ -895,6 +895,8 @@
#define SDRAM_CFG_BANK_SHIFT 13 #define SDRAM_CFG_BANK_SHIFT 13
#define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT) #define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT)
#define SDRAM_MBASE_REG 0xc
#define SDRAM_PRIO_REG 0x2C #define SDRAM_PRIO_REG 0x2C
#define SDRAM_PRIO_MIPS_SHIFT 29 #define SDRAM_PRIO_MIPS_SHIFT 29
#define SDRAM_PRIO_MIPS_MASK (1 << SDRAM_PRIO_MIPS_SHIFT) #define SDRAM_PRIO_MIPS_MASK (1 << SDRAM_PRIO_MIPS_SHIFT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment