public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Chris Ball <chris@printf.net>, Ulf Hansson <ulf.hansson@linaro.org>
Cc: Arend van Spriel <arend@broadcom.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Hans de Goede <hdegoede@redhat.com>,
	Eugene K <sigintmailru@gmail.com>
Subject: [PATCH 3/3] mmc: sunxi: Add card busy detection
Date: Tue, 22 Sep 2015 17:30:26 +0200	[thread overview]
Message-ID: <1442935826-16758-4-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1442935826-16758-1-git-send-email-hdegoede@redhat.com>

Some sdio wifi modules have not been working reliable with the sunxi-mmc
host code. This turns out to be caused by starting new io-rw commands while
the card signals that it is still busy processing a previous command.

This commit adds card-busy detection to the sunxi-mmc driver which together
with recent core changes to check card-busy before starting io-rw commands
fixes the wifi reliability issues on the Cubietruck and other sunxi boards
using sdio wifi.

Reported-by: Eugene K <sigintmailru@gmail.com>
Suggested-by: Eugene K <sigintmailru@gmail.com>
Cc: Eugene K <sigintmailru@gmail.com>
Cc: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Properly accredit Eugene K for coming up with the fix for this
Changes in v3:
-Add card-busy detection and let the core decide when to actually use
 card-busy the added detection
---
 drivers/mmc/host/sunxi-mmc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index a7b7a67..e6226cd 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -868,6 +868,13 @@ static void sunxi_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 	spin_unlock_irqrestore(&host->lock, iflags);
 }
 
+static int sunxi_mmc_card_busy(struct mmc_host *mmc)
+{
+	struct sunxi_mmc_host *host = mmc_priv(mmc);
+
+	return !!(mmc_readl(host, REG_STAS) & SDXC_CARD_DATA_BUSY);
+}
+
 static const struct of_device_id sunxi_mmc_of_match[] = {
 	{ .compatible = "allwinner,sun4i-a10-mmc", },
 	{ .compatible = "allwinner,sun5i-a13-mmc", },
@@ -882,6 +889,7 @@ static struct mmc_host_ops sunxi_mmc_ops = {
 	.get_cd		 = mmc_gpio_get_cd,
 	.enable_sdio_irq = sunxi_mmc_enable_sdio_irq,
 	.hw_reset	 = sunxi_mmc_hw_reset,
+	.card_busy	 = sunxi_mmc_card_busy,
 };
 
 static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
-- 
2.4.3


  parent reply	other threads:[~2015-09-22 15:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 15:30 [PATCH 0/3] mmc: Wait for card_busy before starting sdio requests Hans de Goede
2015-09-22 15:30 ` [PATCH 1/3] mmc: Add mmc_is_io_op helper function Hans de Goede
2015-09-22 15:30 ` [PATCH 2/3] mmc: Wait for card_busy before starting sdio requests Hans de Goede
2015-09-22 15:30 ` Hans de Goede [this message]
2015-09-23 21:43 ` [PATCH 0/3] " Ulf Hansson
2015-09-24  9:19   ` Hans de Goede
2015-09-24 11:18     ` Arend van Spriel
2015-09-24 16:04     ` Doug Anderson
2015-09-25  5:35       ` Jaehoon Chung
2015-09-25  7:53       ` Hans de Goede
2015-09-25  9:37         ` Jaehoon Chung
2015-09-25  9:41           ` Hans de Goede
2015-09-25  9:58             ` Jaehoon Chung
2015-09-25 10:06               ` Hans de Goede
2015-09-25 10:23                 ` Jaehoon Chung
2015-09-25 16:14         ` Doug Anderson
2015-09-29 12:58           ` Hans de Goede
2015-09-29 17:38             ` Doug Anderson

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=1442935826-16758-4-git-send-email-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=arend@broadcom.com \
    --cc=chris@printf.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=sigintmailru@gmail.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