Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E7DEC77B7F for ; Sat, 6 May 2023 17:41:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9A5CA85EE5; Sat, 6 May 2023 19:41:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="pz36gvx3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 73ABF85EAD; Sat, 6 May 2023 19:41:15 +0200 (CEST) Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 196D885B0C for ; Sat, 6 May 2023 19:41:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=tti4Qmzxvxv4f4bSCoTNqk9sxg9Xm5vjt/fKLNY6J5o=; b=pz36gvx36AXxc1fw1rhJRWLq+lvtxmRDtFvkMxvPp9JGdSes9H7wGAYARU6IcDttqkLi cPqJOhg9oGKoWu+ZFA92Rpd4HTdP9zA0CxPZ4OVHhqLlcRlGIv9pLARrohAiN/uils5aG1 03x9mv+NtvjTfWdlRsIPpxwatVXgorSSAXO7YGrgEF8vjhRBm7Z4AJz/LQxrt8dupaQMOa hNhbduoFbW+qcMTd7ou/u13a5ZsGcHs1tcO+NZEjpfJBBXbzk4o9RGueRGapyrWtCtUMka FzqtzGC1vgzL9DToMTt3NayDrVrEgDWkJrm14ztXydKxNeCKlGWN76fk2saDey3A== Received: by filterdrecv-7946957d94-8w8qz with SMTP id filterdrecv-7946957d94-8w8qz-1-64569136-39 2023-05-06 17:41:11.21201038 +0000 UTC m=+966207.669350637 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5 (SG) with ESMTP id NbRyaKTFQmiT0eFX8zi34A Sat, 06 May 2023 17:41:10.743 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 2/5] mmc: rockchip_sdhci: Disable DMA mode using a device tree property Date: Sat, 06 May 2023 17:41:11 +0000 (UTC) Message-Id: <20230506174104.1728148-3-jonas@kwiboo.se> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230506174104.1728148-1-jonas@kwiboo.se> References: <20230506174104.1728148-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0h5G=2FzrGt83ZfTju78?= =?us-ascii?Q?hrl6=2FnG8YZ+A6ofivrm930+Bk54q80Sxu26UjhZ?= =?us-ascii?Q?eNRat=2FDP75G2+sUkirDq28O88fU07Ef9K1hiekl?= =?us-ascii?Q?1ZIIoJFpEws88FPp6n78jKzR4q7m9rEwmEh74Fv?= =?us-ascii?Q?Rh0z+3dWZx=2FK9NJ3R7frhJBD4FfkEQj=2FkNSH6+?= To: Simon Glass , Kever Yang , Philipp Tomsich , Jagan Teki , Eugen Hristev , Peng Fan , Jaehoon Chung , Jonas Karlman Cc: u-boot@lists.denx.de X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Loading part of TF-A into SRAM from eMMC using DMA fails on RK3399 similar to other Rockchip SoCs. Checksum validation fails with: ## Checking hash(es) for Image atf-2 ... sha256 error! Bad hash value for 'hash' hash node in 'atf-2' image node spl_load_simple_fit: can't load image loadables index 1 (ret = -1) mmc_load_image_raw_sector: mmc block read error SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ### Add a device tree property, u-boot,spl-fifo-mode, to control when the rockchip_sdhci driver should disable the use of DMA and fallback on PIO mode. Same device tree property is used by the rockchip_dw_mmc driver. In commit 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") the DMA mode was disabled using a CONFIG option on RK3588. Revert that and instead disable DMA using the device tree property for all RK3588 boards, also apply similar workaround for all RK3399 boards. Fixes: 2cc6cde647e2 ("mmc: rockchip_sdhci: Limit number of blocks read in a single command") Signed-off-by: Jonas Karlman --- arch/arm/dts/rk3399-u-boot.dtsi | 1 + arch/arm/dts/rk3588s-u-boot.dtsi | 1 + configs/rock5b-rk3588_defconfig | 1 - drivers/mmc/rockchip_sdhci.c | 8 ++++++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi index e677ae678dab..3423b882c437 100644 --- a/arch/arm/dts/rk3399-u-boot.dtsi +++ b/arch/arm/dts/rk3399-u-boot.dtsi @@ -120,6 +120,7 @@ &sdhci { max-frequency = <200000000>; bootph-all; + u-boot,spl-fifo-mode; }; &sdmmc { diff --git a/arch/arm/dts/rk3588s-u-boot.dtsi b/arch/arm/dts/rk3588s-u-boot.dtsi index 5201ba246d87..3342de4f0256 100644 --- a/arch/arm/dts/rk3588s-u-boot.dtsi +++ b/arch/arm/dts/rk3588s-u-boot.dtsi @@ -67,6 +67,7 @@ &sdhci { bootph-pre-ram; + u-boot,spl-fifo-mode; }; &uart2 { diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig index d3136ac850fe..3fcc6a26bb51 100644 --- a/configs/rock5b-rk3588_defconfig +++ b/configs/rock5b-rk3588_defconfig @@ -58,7 +58,6 @@ CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_SDMA=y -# CONFIG_SPL_MMC_SDHCI_SDMA is not set CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index 8e4a158049a9..285332d9f4fd 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -589,6 +589,14 @@ static int rockchip_sdhci_probe(struct udevice *dev) if (ret) return ret; + /* + * Disable use of DMA and force use of PIO mode in SPL to fix an issue + * where loading part of TF-A into SRAM using DMA silently fails. + */ + if (IS_ENABLED(CONFIG_SPL_BUILD) && + dev_read_bool(dev, "u-boot,spl-fifo-mode")) + host->flags &= ~USE_DMA; + /* * Reading more than 4 blocks with a single CMD18 command in PIO mode * triggers Data End Bit Error on RK3568 and RK3588. Limit to reading -- 2.40.1