Skip to content

Commit c1590dd

Browse files
jwrdegoedestorulf
authored andcommitted
mmc: sunxi: Add card busy detection
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> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 5d3f6ef commit c1590dd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/mmc/host/sunxi-mmc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,13 @@ static void sunxi_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
873873
spin_unlock_irqrestore(&host->lock, iflags);
874874
}
875875

876+
static int sunxi_mmc_card_busy(struct mmc_host *mmc)
877+
{
878+
struct sunxi_mmc_host *host = mmc_priv(mmc);
879+
880+
return !!(mmc_readl(host, REG_STAS) & SDXC_CARD_DATA_BUSY);
881+
}
882+
876883
static const struct of_device_id sunxi_mmc_of_match[] = {
877884
{ .compatible = "allwinner,sun4i-a10-mmc", },
878885
{ .compatible = "allwinner,sun5i-a13-mmc", },
@@ -888,6 +895,7 @@ static struct mmc_host_ops sunxi_mmc_ops = {
888895
.get_cd = mmc_gpio_get_cd,
889896
.enable_sdio_irq = sunxi_mmc_enable_sdio_irq,
890897
.hw_reset = sunxi_mmc_hw_reset,
898+
.card_busy = sunxi_mmc_card_busy,
891899
};
892900

893901
static const struct sunxi_mmc_clk_delay sunxi_mmc_clk_delays[] = {

0 commit comments

Comments
 (0)