Skip to content

Commit d61fcfe

Browse files
ffainelliralfbaechle
authored andcommitted
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: Florian Fainelli <florian@openwrt.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/3008/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 04712f3 commit d61fcfe

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎arch/mips/bcm63xx/cpu.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ static unsigned int detect_memory_size(void)
170170
unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
171171
u32 val;
172172

173-
if (BCMCPU_IS_6345())
174-
return (8 * 1024 * 1024);
173+
if (BCMCPU_IS_6345()) {
174+
val = bcm_sdram_readl(SDRAM_MBASE_REG);
175+
return (val * 8 * 1024 * 1024);
176+
}
175177

176178
if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
177179
val = bcm_sdram_readl(SDRAM_CFG_REG);

‎arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,8 @@
895895
#define SDRAM_CFG_BANK_SHIFT 13
896896
#define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT)
897897

898+
#define SDRAM_MBASE_REG 0xc
899+
898900
#define SDRAM_PRIO_REG 0x2C
899901
#define SDRAM_PRIO_MIPS_SHIFT 29
900902
#define SDRAM_PRIO_MIPS_MASK (1 << SDRAM_PRIO_MIPS_SHIFT)

0 commit comments

Comments
 (0)