All of lore.kernel.org
 help / color / mirror / Atom feed
* [v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay
@ 2017-03-21 14:32 ` Piotr Sroka
  0 siblings, 0 replies; 21+ messages in thread
From: Piotr Sroka @ 2017-03-21 14:32 UTC (permalink / raw)
  To: linux-mmc
  Cc: Adrian Hunter, Ulf Hansson, linux-kernel, Masahiro Yamada, Piotr Sroka

Add polling for ACK to be sure that data are written to PHY register.

Signed-off-by: Piotr Sroka <piotrs@cadence.com>
---
Changes for v2:
- fix indent
---
Changes for v3:
- none
---
Changes for v4:
- none
---
Changes for v5:
- use driver version from next branch, with applied enhanced strobe feature support.
---
 drivers/mmc/host/sdhci-cadence.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index 48f6419..83c3b55 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -68,11 +68,12 @@ struct sdhci_cdns_priv {
 	bool enhanced_strobe;
 };
 
-static void sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
-				     u8 addr, u8 data)
+static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
+				    u8 addr, u8 data)
 {
 	void __iomem *reg = priv->hrs_addr + SDHCI_CDNS_HRS04;
 	u32 tmp;
+	int ret;
 
 	tmp = (data << SDHCI_CDNS_HRS04_WDATA_SHIFT) |
 	      (addr << SDHCI_CDNS_HRS04_ADDR_SHIFT);
@@ -81,8 +82,14 @@ static void sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
 	tmp |= SDHCI_CDNS_HRS04_WR;
 	writel(tmp, reg);
 
+	ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10);
+	if (ret)
+		return ret;
+
 	tmp &= ~SDHCI_CDNS_HRS04_WR;
 	writel(tmp, reg);
+
+	return 0;
 }
 
 static void sdhci_cdns_phy_init(struct sdhci_cdns_priv *priv)
-- 
2.2.2

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-03-30 19:32 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 14:32 [v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay Piotr Sroka
2017-03-21 14:32 ` Piotr Sroka
2017-03-21 14:33 ` [v5 2/4] dt-bindings: mmc: add description of PHY delays for sdhci-cadence Piotr Sroka
2017-03-21 14:33   ` Piotr Sroka
2017-03-22  7:30   ` Masahiro Yamada
2017-03-30 11:06     ` Piotr Sroka
2017-03-24 16:26   ` Rob Herring
2017-03-30 19:31   ` Ulf Hansson
2017-03-21 14:33 ` [v5 3/4] mmc: sdhci-cadence: Update PHY delay configuration Piotr Sroka
2017-03-21 14:33   ` Piotr Sroka
2017-03-22  7:31   ` Masahiro Yamada
2017-03-29 13:03   ` Adrian Hunter
2017-03-30 19:30   ` Ulf Hansson
2017-03-21 14:33 ` [v5 4/4] mmc: sdhci-cadence: refactor probe function Piotr Sroka
2017-03-21 14:33   ` Piotr Sroka
2017-03-22  7:31   ` Masahiro Yamada
2017-03-29 13:03   ` Adrian Hunter
2017-03-30 19:30   ` Ulf Hansson
2017-03-22  7:24 ` [v5 1/4] mmc: sdhci-cadence: Fix writing PHY delay Masahiro Yamada
2017-03-29 13:03 ` Adrian Hunter
2017-03-30 19:30 ` Ulf Hansson

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.