From patchwork Sat Jan 6 13:59:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 123625 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp596801qgn; Sat, 6 Jan 2018 06:01:31 -0800 (PST) X-Google-Smtp-Source: ACJfBos8K7hPtDX90RBnkeAePQcD95T7y3L9PhOsK6iTzDKA25WSaRw6gYDaQZ/g0pnycdkesCKR X-Received: by 10.80.169.48 with SMTP id l45mr8816200edc.128.1515247291746; Sat, 06 Jan 2018 06:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515247291; cv=none; d=google.com; s=arc-20160816; b=usJy+5Q/RaLzjfTIPBSVDRz3XbHLAmdsqMVRyPoNKiU26U9vj4Hpdtjt7NwiYftxLF nrLIiI/9Kp29uRwmAbP8X0Kf642LVY81PWNsanEPCD1YO9URU7Q9rPMgrQvymPh1WM2E 1AXZo2domMeNSJl01OyZF5TT9MNaq9KiiY2tfK++Hc1K1RYHXOhKaeDlV0+aSKjbXgJI +3t3QJlIR4peNzaymI8aiuArbxGH5lJ05dNrHV6BXhZ90Ht38jEz2QVgKUaM9SqZpXkS QPaoHZ85zrY4z/Y1denphG8Ed9QNG6GHoHTxuhryDAp64iu6pXbKgEvTrikOtCJeVCLl TB2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=zRY/v7BA6MbDlgJCbd3fHINxSpqcI5yUJSqnVqqrPGY=; b=uTd+n+p1MPSaWaVvpmOaN4NdYFuBUtb9Kx/35Mkg5SHUKE8ewh3m2IqSl5yTBOqq7L OZjfCSimOLqyFVXPPCYEVxIuoRiE9jA9XOmeUUUwksQirMCnQv6i0VaqXLnG82uxk7v+ /jZcngZ8jBsM6jgXNLV1owbbvgkqABO+OZjJdnQrlscs/DEvH23s7Pqqp5XR2ZRyxf4E CC06HJ98FtP5DBg3JVqwIb0in8SFV+B3jPF30tsToiuDP1i4e5Svip3Bgkb6dqawleMF YKQ/yjdc2iXg1c93bgl3NPwtq28dIpuEHnQNmt5gG0t+6St8jeGGkL36VAu5AD3Dcjxw vK9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=WpfRZMyF; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 93si2820006edl.231.2018.01.06.06.01.31; Sat, 06 Jan 2018 06:01:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=WpfRZMyF; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 289E8C21EBD; Sat, 6 Jan 2018 14:00:38 +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=RCVD_IN_DNSWL_BLOCKED, 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 6769EC21ED6; Sat, 6 Jan 2018 14:00:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63139C21E2F; Sat, 6 Jan 2018 14:00:00 +0000 (UTC) Received: from conuserg-12.nifty.com (conuserg-12.nifty.com [210.131.2.79]) by lists.denx.de (Postfix) with ESMTPS id 6B467C21E48 for ; Sat, 6 Jan 2018 13:59:59 +0000 (UTC) Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-12.nifty.com with ESMTP id w06DxX3P028034; Sat, 6 Jan 2018 22:59:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com w06DxX3P028034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1515247174; bh=J3jpy0tAiUmCqO8+zcE0xg2GCGcymlaSFSdCOGK/Sgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WpfRZMyFJ6vhW2SztY9/IeZ2rvr/tPaPrxuCgjTCHr5UygjZpUPCgg419sdd/buKC nocQoTmYcRUFMKGGQqp3CuHUONMrpbZLn35d2EsseXf92xG5EfrhWOHOrtKnmeO1OT Htk2gPdEbGq7HjyMjupJRFLK6efkjkOlBWoHQIrdT0viAbgEOK9CEwzRUL6bgCv37f D5BT2/wooogp7akeoPVuVfm7R0qoNxj3guZKoE78fYEQ7nWcy5V7vfHZHT+worTVnz bZfxSalnX1wx9mpkDtI10jmjbrykCr/opiHI61G+K6DUYyNsccz6ypPCRuh43IqEZS gjEpUkmbHgYVA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sat, 6 Jan 2018 22:59:24 +0900 Message-Id: <1515247166-20516-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515247166-20516-1-git-send-email-yamada.masahiro@socionext.com> References: <1515247166-20516-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 1/3] ARM: uniphier: do not use RAM that exceeds 32 bit address range 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" LD20 / PXs3 boards are equipped with a large amount of memory beyond the 32 bit address range. U-Boot relocates itself to the end of the available RAM. This is a problem for DMA engines that only support 32 bit physical address, like the SDMA of SDHCI controllers. In fact, U-Boot does not need to run at the very end of RAM. It is rather troublesome for drivers with DMA engines because U-Boot does not have API like dma_set_mask(), so DMA silently fails, making the driver debugging difficult. Hide the memory region that exceeds the 32 bit address range. It can be done by simply carving out gd->ram_size. It would also possible to override get_effective_memsize() or to define CONFIG_MAX_MEM_MAPPED, but dram_init() is a good enough place to do this job. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/dram_init.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index e9672d2..cb35dab 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -205,6 +205,7 @@ int dram_init(void) return ret; for (i = 0; i < ARRAY_SIZE(dram_map); i++) { + unsigned long max_size; if (!dram_map[i].size) break; @@ -218,6 +219,22 @@ int dram_init(void) dram_map[i].base) break; + /* + * Do not use memory that exceeds 32bit address range. U-Boot + * relocates itself to the end of the effectively available RAM. + * This could be a problem for DMA engines that do not support + * 64bit address (SDMA of SDHCI, UniPhier AV-ether, etc.) + */ + if (dram_map[i].base >= 1ULL << 32) + break; + + max_size = (1ULL << 32) - dram_map[i].base; + + if (dram_map[i].size > max_size) { + gd->ram_size += max_size; + break; + } + gd->ram_size += dram_map[i].size; }