From patchwork Tue Mar 28 16:49:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Tomsich X-Patchwork-Id: 744430 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3vsxlN5w4yz9s2Q for ; Wed, 29 Mar 2017 03:52:32 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 84AB6C21C85; Tue, 28 Mar 2017 16:50:59 +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=none 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 044FCC21C60; Tue, 28 Mar 2017 16:49:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BC7E1C21C60; Tue, 28 Mar 2017 16:49:25 +0000 (UTC) Received: from mail.theobroma-systems.com (vegas.theobroma-systems.com [144.76.126.164]) by lists.denx.de (Postfix) with ESMTPS id F237AC21BE6 for ; Tue, 28 Mar 2017 16:49:19 +0000 (UTC) Received: from [86.59.122.178] (port=33502 helo=android.lan) by mail.theobroma-systems.com with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1csuJ3-0000cj-B9; Tue, 28 Mar 2017 18:49:17 +0200 From: Philipp Tomsich To: u-boot@lists.denx.de Date: Tue, 28 Mar 2017 18:49:13 +0200 Message-Id: <1490719753-33318-1-git-send-email-philipp.tomsich@theobroma-systems.com> X-Mailer: git-send-email 1.9.1 Cc: Lin huang , Klaus Goger , Philipp Tomsich , MengDongyang Subject: [U-Boot] [PATCH] rockchip: mmc: rk3399: work around DMA issue in SPL 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" The RK3399 hangs during DMA of the Designware MMC controller, when performing DMA-based transctions in SPL. To work around this issue, we disable DMA-based access modes in the SPL stage. Note that this affects full OF_CONTROL (i.e. OF_PLATDATA not being defined) only and aligns the behaviour with what happens when OF_PLATDATA is defined, as fifo_mode gets overwritten to 0 in that case. With this fix in place, we can reenable 'fifo-mode' in the DTS for the RK3399-Q7 (Puma). Signed-off-by: Philipp Tomsich --- arch/arm/dts/rk3399-puma.dts | 1 - drivers/mmc/rockchip_dw_mmc.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/dts/rk3399-puma.dts b/arch/arm/dts/rk3399-puma.dts index 917df1e..71eb72d 100644 --- a/arch/arm/dts/rk3399-puma.dts +++ b/arch/arm/dts/rk3399-puma.dts @@ -91,7 +91,6 @@ &sdmmc { u-boot,dm-pre-reloc; bus-width = <4>; - fifo-mode; /* until we fix DMA in SPL */ status = "okay"; }; diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index c36eda0..6bf4823 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -76,6 +76,17 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) return -EINVAL; priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), "fifo-mode"); + +#if defined(CONFIG_ROCKCHIP_RK3399) && defined(CONFIG_SPL_BUILD) + /* + * For a RK3399 SPL build, force fifo_mode to off as the MMC + * transaction will otherwise hang. This issue reproduces + * only SPL (i.e. BL2 in ATF terminology), but doesn't occur + * with the full U-Boot stage. + */ + priv->fifo_mode = 0; +#endif + if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "clock-freq-min-max", priv->minmax, 2)) return -EINVAL;