From patchwork Fri Jul 20 12:34:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Brunck X-Patchwork-Id: 172233 X-Patchwork-Delegate: prafulla@marvell.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5551D2C037B for ; Fri, 20 Jul 2012 22:34:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5E5EF2812F; Fri, 20 Jul 2012 14:34:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Il4zA+v+N7yg; Fri, 20 Jul 2012 14:34:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 509CF28119; Fri, 20 Jul 2012 14:34:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 51468280F8 for ; Fri, 20 Jul 2012 14:34:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9om4jdhR2cIl for ; Fri, 20 Jul 2012 14:34:32 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-de.keymile.com (mail-de.keymile.com [195.8.104.1]) by theia.denx.de (Postfix) with SMTP id F3092280F6 for ; Fri, 20 Jul 2012 14:34:31 +0200 (CEST) Received: from mailrelay.de.keymile.net ([10.9.1.54]) by eSafe SMTP Relay 1342775137; Fri, 20 Jul 2012 14:34:31 +0200 Received: from pc005093.de.keymile.net.de.keymile.net (pc005093.de.keymile.net.de.keymile.net [172.30.2.67]) by mailrelay.de.keymile.net (8.12.2/8.12.2) with ESMTP id q6KCXSjA010069; Fri, 20 Jul 2012 14:33:30 +0200 (MEST) From: Holger Brunck To: u-boot@lists.denx.de Date: Fri, 20 Jul 2012 14:34:26 +0200 Message-Id: <1342787667-30073-3-git-send-email-holger.brunck@keymile.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1342787667-30073-1-git-send-email-holger.brunck@keymile.com> References: <1342787667-30073-1-git-send-email-holger.brunck@keymile.com> X-ESAFE-STATUS: [srvhellgate.de.keymile.net] Mail clean Cc: Marek Vasut , Valentin Longchamp , Holger Brunck , Gerlando Falauto Subject: [U-Boot] [PATCH v3 3/4] kirkwood: implement kw_sdram_size_adjust X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Gerlando Falauto Size of the SDRAM chips might differ between any two (otherwise identical) instances of the same board. So add a function which reads out the current ram size and set them in the SDRAM size register of kirkwood. Signed-off-by: Gerlando Falauto Signed-off-by: Holger Brunck cc: Prafulla Wadaskar cc: Valentin Longchamp cc: Marek Vasut --- chages for v3: - rename dram_size_fixup to kw_sdramsize_adjust and move them to kirkwood/dram.c changes for v2: - rebase to current u-boot-marvell.git master branch arch/arm/cpu/arm926ejs/kirkwood/dram.c | 11 +++++++++++ arch/arm/include/asm/arch-kirkwood/cpu.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/kirkwood/dram.c b/arch/arm/cpu/arm926ejs/kirkwood/dram.c index 5e2f9d8..9f97964 100644 --- a/arch/arm/cpu/arm926ejs/kirkwood/dram.c +++ b/arch/arm/cpu/arm926ejs/kirkwood/dram.c @@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank) return result; } +void kw_sdram_size_adjust(void) +{ + u32 size; + + /* probe currently equipped RAM size */ + size = get_ram_size((void *)kw_sdram_bar(0), kw_sdram_bs(0)); + + /* adjust SDRAM window size accordingly */ + kw_sdram_bs_set(0, size); +} + #ifndef CONFIG_SYS_BOARD_DRAM_INIT int dram_init(void) { diff --git a/arch/arm/include/asm/arch-kirkwood/cpu.h b/arch/arm/include/asm/arch-kirkwood/cpu.h index d28c51a..128393c 100644 --- a/arch/arm/include/asm/arch-kirkwood/cpu.h +++ b/arch/arm/include/asm/arch-kirkwood/cpu.h @@ -159,6 +159,7 @@ void reset_cpu(unsigned long ignored); unsigned char get_random_hex(void); unsigned int kw_sdram_bar(enum memory_bank bank); unsigned int kw_sdram_bs(enum memory_bank bank); +void kw_sdram_size_adjust(void); int kw_config_adr_windows(void); void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val, unsigned int gpp0_oe, unsigned int gpp1_oe);