From patchwork Tue Dec 2 19:21:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 417014 X-Patchwork-Delegate: yorksun@freescale.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 DC988140277 for ; Wed, 3 Dec 2014 06:21:27 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8E8C14B7C4; Tue, 2 Dec 2014 20:21:25 +0100 (CET) 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 rUlFZmqv4WKq; Tue, 2 Dec 2014 20:21:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 98C844B7A5; Tue, 2 Dec 2014 20:21:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AFF944B7A5 for ; Tue, 2 Dec 2014 20:21:19 +0100 (CET) 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 W82Sbpq8Ou5d for ; Tue, 2 Dec 2014 20:21:19 +0100 (CET) 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 na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0145.outbound.protection.outlook.com [157.56.110.145]) by theia.denx.de (Postfix) with ESMTPS id 37A7F4B77C for ; Tue, 2 Dec 2014 20:21:15 +0100 (CET) Received: from BN3PR0301CA0010.namprd03.prod.outlook.com (25.160.180.148) by BL2PR03MB146.namprd03.prod.outlook.com (10.255.230.18) with Microsoft SMTP Server (TLS) id 15.1.31.17; Tue, 2 Dec 2014 19:21:13 +0000 Received: from BN1BFFO11FD011.protection.gbl (2a01:111:f400:7c10::1:104) by BN3PR0301CA0010.outlook.office365.com (2a01:111:e400:4000::20) with Microsoft SMTP Server (TLS) id 15.1.26.15 via Frontend Transport; Tue, 2 Dec 2014 19:21:13 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD011.mail.protection.outlook.com (10.58.144.74) with Microsoft SMTP Server (TLS) id 15.1.6.13 via Frontend Transport; Tue, 2 Dec 2014 19:21:13 +0000 Received: from oslab-l1.am.freescale.net ([10.214.80.217]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id sB2JLBi4014284; Tue, 2 Dec 2014 12:21:11 -0700 From: York Sun To: Date: Tue, 2 Dec 2014 11:21:09 -0800 Message-ID: <1417548069-32512-1-git-send-email-yorksun@freescale.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(69596002)(19580405001)(84676001)(44976005)(6806004)(19580395003)(20776003)(64706001)(47776003)(92726001)(105606002)(4396001)(50986999)(92566001)(77096005)(50226001)(93916002)(21056001)(31966008)(86362001)(95666004)(106466001)(81156004)(107046002)(229853001)(2351001)(88136002)(87286001)(62966003)(77156002)(87936001)(104016003)(48376002)(102836001)(110136001)(33646002)(46102003)(36756003)(50466002)(104166001)(99396003)(120916001)(68736005)(97736003)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB146; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB146; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB146; X-Forefront-PRVS: 0413C9F1ED Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=yorksun@freescale.com; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB146; X-OriginatorOrg: freescale.com Cc: Scott Wood , York Sun , Alexander Graf Subject: [U-Boot] [Patch v3] powerpc/mpc85xx: Fix DDR TLB mapping leftover X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Commit f29f804a93e87c17670607641d120f431a3b0633 generalized the TLB mapping function, but made the DDR mapping leftover size to zero, causing the message not printed. Signed-off-by: York Sun CC: Alexander Graf CC: Scott Wood --- Change log v3: Add checking for memsize > CONFIG_MAX_MEM_MAPPED for print_size v2: Fix unnecessary parentheses arch/powerpc/cpu/mpc85xx/tlb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c index 4adba95..8e0508f 100644 --- a/arch/powerpc/cpu/mpc85xx/tlb.c +++ b/arch/powerpc/cpu/mpc85xx/tlb.c @@ -299,12 +299,16 @@ unsigned int setup_ddr_tlbs_phys(phys_addr_t p_addr, { unsigned int ram_tlb_address = (unsigned int)CONFIG_SYS_DDR_SDRAM_BASE; u64 memsize = (u64)memsize_in_meg << 20; + u64 size; - memsize = min(memsize, (u64)CONFIG_MAX_MEM_MAPPED); - memsize = tlb_map_range(ram_tlb_address, p_addr, memsize, TLB_MAP_RAM); + size = min(memsize, (u64)CONFIG_MAX_MEM_MAPPED); + size = tlb_map_range(ram_tlb_address, p_addr, size, TLB_MAP_RAM); - if (memsize) - print_size(memsize, " left unmapped\n"); + if (size || memsize > CONFIG_MAX_MEM_MAPPED) { + print_size(memsize > CONFIG_MAX_MEM_MAPPED ? + memsize - CONFIG_MAX_MEM_MAPPED + size : size, + " left unmapped\n"); + } return memsize_in_meg; }