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: 856368 X-Patchwork-Delegate: yamada.m@jp.panasonic.com 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="WpfRZMyF"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zDNVk2f2Dz9s8J for ; Sun, 7 Jan 2018 01:01:18 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id E4A4DC21C41; Sat, 6 Jan 2018 14:00:39 +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; } From patchwork Sat Jan 6 13:59:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 856366 X-Patchwork-Delegate: yamada.m@jp.panasonic.com 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="WkkJP5E9"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zDNTS0lDfz9s8J for ; Sun, 7 Jan 2018 01:00:11 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 12807C21EF0; Sat, 6 Jan 2018 14:00:04 +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 A3795C21E2F; Sat, 6 Jan 2018 14:00:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 36552C21E57; 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 3A3D7C21C41 for ; Sat, 6 Jan 2018 13:59:58 +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 w06DxX3Q028034; Sat, 6 Jan 2018 22:59:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com w06DxX3Q028034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1515247175; bh=wOP0xyxfkqZKNZm2xVpwhMG6Lmr5l5JdBU9IAtj5nc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WkkJP5E9UkJyzw/QGxotKtwWhrLgMUhnwr969nx2whfLm9OT7UpxyJ3D1MqanTh/Y kTfcAoaABU9lhw1/7dphxpD0mcQM6FB8bP0iD74/gxYsOkyownyvIs0FUvkxYdGWEt 6nP21Lf7IsKomZpa1fHeXcsWKcYLvhccAJxEYqhhl3AecxZJWAyHm4oydwIk8hsQ2B qmgi3bhXVFI+D7rWbRvtaIBpd+MmJLn80tBrsN0T91BI51tE2IAY8la1wb60yafxrI GI64IsWrHYy66MVpRVXHZSLMPWzIYEOKLuvAISNODuhOlIxpbSfhkR90wcBbG4Xpdj +TrjC15DrALIA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sat, 6 Jan 2018 22:59:25 +0900 Message-Id: <1515247166-20516-3-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 2/3] ARM: uniphier: enable CONFIG_MMC_SDHCI_SDMA for ARMv8 SoCs 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" I did not enable SDMA when I added sdhci-cadence support because LD20 boards are equipped with a large amount memory beyond 32 bit address range, but SDMA does not support the 64bit address. U-Boot relocates itself to the end of effectively available RAM. This would make the MMC enumeration fail because the buffer for EXT_CSD allocated in the stack would go too high, then SDMA would fail to transfer data. Recent SDHCI-compatible controllers support ADMA, but unfortunately U-Boot does not support ADMA. In the previous commit, I hided the DRAM area that exceeds the 32 bit address range. Now, I can enable CONFIG_MMC_SDHCI_SDMA. Signed-off-by: Masahiro Yamada --- configs/uniphier_v8_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/uniphier_v8_defconfig b/configs/uniphier_v8_defconfig index bbcf3b0..2edc3a9 100644 --- a/configs/uniphier_v8_defconfig +++ b/configs/uniphier_v8_defconfig @@ -34,6 +34,7 @@ CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS=10 CONFIG_MMC_UNIPHIER=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_CADENCE=y +CONFIG_MMC_SDHCI_SDMA=y CONFIG_NAND=y CONFIG_NAND_DENALI_DT=y CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=8 From patchwork Sat Jan 6 13:59:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 856367 X-Patchwork-Delegate: yamada.m@jp.panasonic.com 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="0yUj7PEk"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zDNV05plbz9s8J for ; Sun, 7 Jan 2018 01:00:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4D9F3C21EB1; Sat, 6 Jan 2018 14:00:21 +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 8F11AC21EBC; Sat, 6 Jan 2018 14:00:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 46256C21C41; 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 49720C21E2F 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 w06DxX3R028034; Sat, 6 Jan 2018 22:59:35 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com w06DxX3R028034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1515247175; bh=9/vQycBYajU2mhSm+VXdTFBcyPRc6WlLIYegqbxnVr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0yUj7PEkk/WQDkws/tNW+TZvWa7Lp9edHsEvwjI7s1rsOSB7kWKV82dKWiXIz3Y8p HSxfwSlgTd20PIZNKCC7T5F+44+Er7hCba6CmQshrwzVn9IK9TW0ZueU+TzklYUFJg wY4E67TzHn3yV6hsRIBp5PfQdcGFwektqHtmoDWt4g0+qlb7B58sZGukZKuO24aY9z YAsMCrw40JSI3kBUmt6gDWvI5+zKDHTulOtZyqALIeatHWnn58n/y8ME3GPlkj5Emk 9AJYNsXhT8Akb5bOdw48V+6vXLmXhkgtM95snaCrV1tYozafLx2A2fvPbjLXFmKm/B m6pVOCeM+YzMQ== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Sat, 6 Jan 2018 22:59:26 +0900 Message-Id: <1515247166-20516-4-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 3/3] ARM: uniphier: hide memory top by platform hook instead of CONFIG 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" I do not see a good reason to do this by a CONFIG option that affects all SoCs. The ram_size can be adjusted by dram_init() at run-time. Signed-off-by: Masahiro Yamada --- arch/arm/mach-uniphier/dram_init.c | 7 +++++++ include/configs/uniphier.h | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c index cb35dab..f678114 100644 --- a/arch/arm/mach-uniphier/dram_init.c +++ b/arch/arm/mach-uniphier/dram_init.c @@ -238,6 +238,13 @@ int dram_init(void) gd->ram_size += dram_map[i].size; } + /* + * LD20 uses the last 64 byte for each channel for dynamic + * DDR PHY training + */ + if (uniphier_get_soc_id() == UNIPHIER_LD20_ID) + gd->ram_size -= 64; + return 0; } diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h index 12cbe9b..5ab06f6 100644 --- a/include/configs/uniphier.h +++ b/include/configs/uniphier.h @@ -215,8 +215,6 @@ #define CONFIG_SYS_SDRAM_BASE 0x80000000 #define CONFIG_NR_DRAM_BANKS 3 -/* for LD20; the last 64 byte is used for dynamic DDR PHY training */ -#define CONFIG_SYS_MEM_TOP_HIDE 64 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE)