From patchwork Sat Oct 1 14:19:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Burton X-Patchwork-Id: 677361 X-Patchwork-Delegate: trini@ti.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 3smVtV5K4kz9s2G for ; Sun, 2 Oct 2016 00:24:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F7B6B380E; Sat, 1 Oct 2016 16:24:17 +0200 (CEST) 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 fuu4dg7X7UsB; Sat, 1 Oct 2016 16:24:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5661AA7600; Sat, 1 Oct 2016 16:24:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8BF1AA7612 for ; Sat, 1 Oct 2016 16:24:13 +0200 (CEST) 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 Kf-lor_9upr2 for ; Sat, 1 Oct 2016 16:24:13 +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 mailapp01.imgtec.com (mailapp02.imgtec.com [217.156.133.132]) by theia.denx.de (Postfix) with ESMTP id 63CA6A75F6 for ; Sat, 1 Oct 2016 16:24:13 +0200 (CEST) Received: from HHMAIL03.hh.imgtec.org (unknown [10.44.0.21]) by Forcepoint Email with ESMTPS id 04B2929233C6C; Sat, 1 Oct 2016 15:24:09 +0100 (IST) Received: from localhost (192.168.159.74) by HHMAIL03.hh.imgtec.org (10.44.0.22) with Microsoft SMTP Server (TLS) id 14.3.294.0; Sat, 1 Oct 2016 15:24:12 +0100 From: Paul Burton To: Date: Sat, 1 Oct 2016 15:19:21 +0100 Message-ID: <20161001141931.32354-19-paul.burton@imgtec.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161001141931.32354-1-paul.burton@imgtec.com> References: <20161001141931.32354-1-paul.burton@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.159.74] Subject: [U-Boot] [PATCH 18/27] board_f: Account for CONFIG_SYS_SDRAM_BASE being physical X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" README declares that CONFIG_SYS_SDRAM_BASE is meant to be the physical address of SDRAM, but right now that is not the case on MIPS systems. In preparation for making it so, use phys_to_virt to translate CONFIG_SYS_SDRAM_BASE to the ram_top field of struct global_data which is then used to calculate most memory addresses used by U-Boot. Signed-off-by: Paul Burton Reviewed-by: Simon Glass --- common/board_f.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 2c88595..1afc80d 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -315,7 +315,7 @@ __weak ulong board_get_usable_ram_top(ulong total_size) * Detect whether we have so much RAM that it goes past the end of our * 32-bit address space. If so, clip the usable RAM so it doesn't. */ - if (gd->ram_top < CONFIG_SYS_SDRAM_BASE) + if (gd->ram_top < (ulong)phys_to_virt(CONFIG_SYS_SDRAM_BASE)) /* * Will wrap back to top of 32-bit space when reservations * are made. @@ -362,7 +362,7 @@ static int setup_dest_addr(void) gd->ram_size = board_reserve_ram_top(gd->ram_size); #ifdef CONFIG_SYS_SDRAM_BASE - gd->ram_top = CONFIG_SYS_SDRAM_BASE; + gd->ram_top = (ulong)phys_to_virt(CONFIG_SYS_SDRAM_BASE); #endif gd->ram_top += get_effective_memsize(); gd->ram_top = board_get_usable_ram_top(gd->mon_len);