linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helmut Grohne <h.grohne@intenta.de>
To: "Adrian Hunter" <adrian.hunter@intel.com>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Sören Brinkmann" <soren.brinkmann@xilinx.com>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] sdhci-of-arasan: card initialization failure -84
Date: Mon, 4 Jun 2018 08:42:13 +0200	[thread overview]
Message-ID: <20180604064211.q2thyftgpffuaer2@laureti-dev> (raw)

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

             reply	other threads:[~2018-06-04  6:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  6:42 Helmut Grohne [this message]
2018-06-14  7:14 ` [RFC PATCH] sdhci-of-arasan: card initialization failure -84 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

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=20180604064211.q2thyftgpffuaer2@laureti-dev \
    --to=h.grohne@intenta.de \
    --cc=adrian.hunter@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=ulf.hansson@linaro.org \
    /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 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).