Merge tag 'mmc-v6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Apr 2024 20:17:33 +0000 (13:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Apr 2024 20:17:33 +0000 (13:17 -0700)
Pull MMC host fixes from Ulf Hansson:

 - moxart: Fix regression for sg_miter for PIO mode

 - sdhci-msm: Avoid hang by preventing access to suspended controller

 - sdhci-of-dwcmshc: Fix SD card tuning error for th1520

* tag 'mmc-v6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: moxart: fix handling of sgm->consumed, otherwise WARN_ON triggers
  mmc: sdhci-of-dwcmshc: th1520: Increase tuning loop count to 128
  mmc: sdhci-msm: pervent access to suspended controller

drivers/mmc/host/moxart-mmc.c
drivers/mmc/host/sdhci-msm.c
drivers/mmc/host/sdhci-of-dwcmshc.c

index b88d6dec209f5722df79c3d269070939aa2d72da..9a5f75163acaeef8226ee122dde79c60fd9b7d8c 100644 (file)
@@ -300,6 +300,7 @@ static void moxart_transfer_pio(struct moxart_host *host)
        remain = sgm->length;
        if (remain > host->data_len)
                remain = host->data_len;
+       sgm->consumed = 0;
 
        if (data->flags & MMC_DATA_WRITE) {
                while (remain > 0) {
index 668e0aceeebac9caecb84af355eb08d51c71de0b..e113b99a3eab592dfdd24bbd6c371c2756c2b6c9 100644 (file)
@@ -2694,6 +2694,11 @@ static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
        struct sdhci_host *host = dev_get_drvdata(dev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+       unsigned long flags;
+
+       spin_lock_irqsave(&host->lock, flags);
+       host->runtime_suspended = true;
+       spin_unlock_irqrestore(&host->lock, flags);
 
        /* Drop the performance vote */
        dev_pm_opp_set_rate(dev, 0);
@@ -2708,6 +2713,7 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev)
        struct sdhci_host *host = dev_get_drvdata(dev);
        struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
        struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
+       unsigned long flags;
        int ret;
 
        ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
@@ -2726,7 +2732,15 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev)
 
        dev_pm_opp_set_rate(dev, msm_host->clk_rate);
 
-       return sdhci_msm_ice_resume(msm_host);
+       ret = sdhci_msm_ice_resume(msm_host);
+       if (ret)
+               return ret;
+
+       spin_lock_irqsave(&host->lock, flags);
+       host->runtime_suspended = false;
+       spin_unlock_irqrestore(&host->lock, flags);
+
+       return ret;
 }
 
 static const struct dev_pm_ops sdhci_msm_pm_ops = {
index 1d8f5a76096aeb3c836722b3f97226d7dd2c5201..f2e4a93ed1d61a22d4601fefe2a120caf2b19333 100644 (file)
@@ -626,6 +626,7 @@ static int th1520_execute_tuning(struct sdhci_host *host, u32 opcode)
 
        /* perform tuning */
        sdhci_start_tuning(host);
+       host->tuning_loop_count = 128;
        host->tuning_err = __sdhci_execute_tuning(host, opcode);
        if (host->tuning_err) {
                /* disable auto-tuning upon tuning error */