linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] sdhci-of-arasan: card initialization failure -84
@ 2018-06-04  6:42 Helmut Grohne
  2018-06-14  7:14 ` Adrian Hunter
  2018-06-14  7:19 ` Adrian Hunter
  0 siblings, 2 replies; 11+ messages in thread
From: Helmut Grohne @ 2018-06-04  6:42 UTC (permalink / raw)
  To: Adrian Hunter, Michal Simek, Sören Brinkmann, Ulf Hansson,
	linux-mmc
  Cc: linux-arm-kernel

Work around repeated:

    mmc0: error -84 whilst initialising SD card
---
 drivers/mmc/host/sdhci.c | 1 +
 1 file changed, 1 insertion(+)

I'm seeing the above error -84 with a series of Kingston cards of 4GB capacity
when used with an arasan host controller. Using the cards with other hosts or
using other cards with the host is not problematic. The host controller has the
following device tree:

	ps7-sdio@e0100000 {
		compatible = "arasan,sdhci-8.9a";
		reg = <0xe0100000 0x1000>;
		clock-names = "clk_xin", "clk_ahb";
		clock-frequency = <50000000>;
		clocks = <&clkc 21>, <&clkc 32>;
		interrupt-parent = <&ps7_scugic_0>;
		interrupts = <0 24 4>;
	};

When enabling sufficient debugging (and thus slowing the kernel down), the
problem goes away. Without debug features, the insertion of this delay suffices
for my particular instance. Inserting the same delay before the
SDHCI_CLOCK_CARD_EN write also makes the error go away.

While instrumenting the code I found that the loop waiting for the
SDHCI_CLOCK_INT_STABLE would always terminate immediately (regardless of the
card being used). Only when the card is removed, the loop would spin once. This
hints that potentially the stable checking is broken for this host controller.

During my testing I checked 7 Kingston cards, 2 Transcend Cards, 1 Apacer card,
3 arasn hosts, 3 non-arasan hosts and had consistent reports for a similar
number of devices from others.

If my hypothesis is reasonable, I can turn this patch into a new quirk that
replaces the stable polling with msleep(20), which is the poll timeout. Is
there anything else I should investigate before doing so?

Helmut

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 90cc1977b792..5d2809aeb4eb 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1430,6 +1430,7 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk)
 
 	clk |= SDHCI_CLOCK_CARD_EN;
 	sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
+	udelay(80);
 }
 EXPORT_SYMBOL_GPL(sdhci_enable_clk);
 
-- 
2.11.0

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

end of thread, other threads:[~2018-07-02 13:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-04  6:42 [RFC PATCH] sdhci-of-arasan: card initialization failure -84 Helmut Grohne
2018-06-14  7:14 ` Adrian Hunter
2018-06-14  7:19 ` Adrian Hunter
2018-06-15  8:18   ` [PATCH v2] mmc: sdhci-of-arasan: Add quirk for unstable clocks Helmut Grohne
2018-06-18  8:59     ` Ulf Hansson
2018-06-19  9:09     ` Adrian Hunter
2018-06-20 11:32     ` [PATCH v3 0/2] mmc: sdhci-of-arasan: workaround for broken clocks Helmut Grohne
2018-06-20 11:32       ` [PATCH v3 1/2] dt-bindings: mmc: broken clock stable indicator on arasan controllers Helmut Grohne
2018-06-20 19:08         ` Rob Herring
2018-06-20 11:33       ` [PATCH v3 2/2] mmc: sdhci-of-arasan: Add quirk for unstable clocks Helmut Grohne
2018-07-02 13:17       ` [PATCH v3 0/2] mmc: sdhci-of-arasan: workaround for broken clocks Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).