From patchwork Tue Jul 2 08:32:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1126061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="udXA7pjJ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45dHj56jfwz9sNC for ; Tue, 2 Jul 2019 18:39:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A0B94C21DF9; Tue, 2 Jul 2019 08:36:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 07340C21D65; Tue, 2 Jul 2019 08:33:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9F5E9C21DF8; Tue, 2 Jul 2019 08:33:13 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id C80F0C21E1E for ; Tue, 2 Jul 2019 08:33:07 +0000 (UTC) Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x628Wdx7022428; Tue, 2 Jul 2019 17:32:47 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x628Wdx7022428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1562056367; bh=0TN5zZ04LU4/mgBSps8OWRt55wUAJ04RROqJdO9z0cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udXA7pjJ78YB2jyW/wxE/eV8yDXkajKYkY5jfYqjIRjG3A0Rib51BWqw+O6VxL+EW w2CVxKJcHw6OPWcCtKBxiO7vU11aLAYjcCYeSW15fyW7bvOaAF0GVaDEpyhF0+Ix9u PU508XMwiMhMU/VPEX8Ttnqp6s+DTuMjPOv2lmm1NwOaQAuABrGwCv/dPo9ZgN3Sqf Kw6HdC89spEsiho9FvS7B3Kp+26z6BoHJhT46L3AWJQTD6ZzyQ/Ly88kE2ZsEzyiA/ MLI44JCuy9i35dlTYcmssfnRhpSFHY0em7Y/+jvGN/f0E0ifEMqgD/3q4Az8A8pUxD Zpfd+cXYlElTQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Tue, 2 Jul 2019 17:32:26 +0900 Message-Id: <20190702083228.16882-16-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190702083228.16882-1-yamada.masahiro@socionext.com> References: <20190702083228.16882-1-yamada.masahiro@socionext.com> Cc: Tom Rini Subject: [U-Boot] [PATCH 16/18] ARM: uniphier: make dram_init() more generic X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Make this function work with any channel being empty. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/dram_init.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index 4a75d22db540..ab4aa93f42a6 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -212,6 +212,8 @@ static int uniphier_dram_map_get(struct uniphier_dram_map *dram_map) int dram_init(void) { struct uniphier_dram_map dram_map[3] = {}; + bool valid_bank_found = false; + unsigned long prev_top; int ret, i; gd->ram_size = 0; @@ -224,15 +226,14 @@ int dram_init(void) unsigned long max_size; if (!dram_map[i].size) - break; + continue; /* * U-Boot relocates itself to the tail of the memory region, * but it does not expect sparse memory. We use the first * contiguous chunk here. */ - if (i > 0 && dram_map[i - 1].base + dram_map[i - 1].size < - dram_map[i].base) + if (valid_bank_found && prev_top < dram_map[i].base) break; /* @@ -252,6 +253,9 @@ int dram_init(void) } gd->ram_size += dram_map[i].size; + + prev_top = dram_map[i].base + dram_map[i].size; + valid_bank_found = true; } /*