All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] rockchip: mmc: rk3399: work around DMA issue in SPL
Date: Tue, 28 Mar 2017 19:14:34 +0200	[thread overview]
Message-ID: <1490721274-42782-1-git-send-email-philipp.tomsich@theobroma-systems.com> (raw)

The RK3399 hangs during DMA of the Designware MMC controller, when
performing DMA-based transactions in SPL.  To work around this issue,
we disable DMA-based access modes in the SPL stage.

With this fix in place, we can now drop 'fifo-mode' in the DTS for the
RK3399-Q7 (Puma).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

---

Changes in v2:
- Fixes switching to fifo_mode (should have been 1) in SPL. I broke
  this at the 11th hour due to sloppy preparation of the patch.

 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..5b4ed7a 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 on (i.e. disable
+	 * DMA) as the MMC transaction will otherwise hang. This issue
+	 * reproduces only for SPL (i.e. BL2 in the ATF terminology),
+	 * but doesn't occur with the full U-Boot stage.
+	 */
+	priv->fifo_mode = 1;
+#endif
+
 	if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
 				 "clock-freq-min-max", priv->minmax, 2))
 		return -EINVAL;
-- 
1.9.1

             reply	other threads:[~2017-03-28 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 17:14 Philipp Tomsich [this message]
2017-03-29  2:31 ` [U-Boot] [PATCH v2] rockchip: mmc: rk3399: work around DMA issue in SPL Kever Yang
2017-03-29  7:51   ` Dr. Philipp Tomsich
2017-03-29 12:59     ` Dr. Philipp Tomsich
2017-03-30  3:01       ` Kever Yang
2017-03-30  5:04         ` Jaehoon Chung
2017-03-30  6:30           ` Kever Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490721274-42782-1-git-send-email-philipp.tomsich@theobroma-systems.com \
    --to=philipp.tomsich@theobroma-systems.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.