linux-mips
[Top] [All Lists]

[PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345

To: ralf@linux-mips.org
Subject: [PATCH 2/5] MIPS: bcm63xx: fix SDRAM size computation for BCM6345
From: Florian Fainelli <florian@openwrt.org>
Date: Wed, 21 Sep 2011 15:39:45 +0200
Cc: linux-mips@linux-mips.org, Florian Fainelli <ffainelli@freebox.fr>, Florian Fainelli <florian@openwrt.org>
In-reply-to: <1316612390-6367-1-git-send-email-florian@openwrt.org>
References: <1316612390-6367-1-git-send-email-florian@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
From: Florian Fainelli <ffainelli@freebox.fr>

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>
---
 arch/mips/bcm63xx/cpu.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 7c7e4d4..7ad1b39 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -260,8 +260,10 @@ static unsigned int detect_memory_size(void)
        unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
        u32 val;
 
-       if (BCMCPU_IS_6345())
-               return (8 * 1024 * 1024);
+       if (BCMCPU_IS_6345()) {
+               val = bcm_sdram_readl(SDRAM_MBASE_REG);
+               return (val * 8 * 1024 * 1024);
+       }
 
        if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
                val = bcm_sdram_readl(SDRAM_CFG_REG);
-- 
1.7.4.1


<Prev in Thread] Current Thread [Next in Thread>