Skip to content

Commit c6303c5

Browse files
wangbaolin719storulf
authored andcommitted
mmc: sdhci-sprd: Fix the incorrect soft reset operation when runtime resuming
The SD host controller specification defines 3 types software reset: software reset for data line, software reset for command line and software reset for all. Software reset for all means this reset affects the entire Host controller except for the card detection circuit. In sdhci_runtime_resume_host() we always do a software "reset for all", which causes the Spreadtrum variant controller to work abnormally after resuming. To fix the problem, let's do a software reset for the data and the command part, rather than "for all". However, as sdhci_runtime_resume() is a common sdhci function and we don't want to change the behaviour for other variants, let's introduce a new in-parameter for it. This enables the caller to decide if a "reset for all" shall be done or not. Signed-off-by: Baolin Wang <[email protected]> Fixes: fb8bd90 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller") Cc: [email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent e21a712 commit c6303c5

File tree

10 files changed

+12
-12
lines changed

10 files changed

+12
-12
lines changed

drivers/mmc/host/sdhci-acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static int sdhci_acpi_runtime_resume(struct device *dev)
883883

884884
sdhci_acpi_byt_setting(&c->pdev->dev);
885885

886-
return sdhci_runtime_resume_host(c->host);
886+
return sdhci_runtime_resume_host(c->host, 0);
887887
}
888888

889889
#endif

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
17051705
esdhc_pltfm_set_clock(host, imx_data->actual_clock);
17061706
}
17071707

1708-
err = sdhci_runtime_resume_host(host);
1708+
err = sdhci_runtime_resume_host(host, 0);
17091709
if (err)
17101710
goto disable_ipg_clk;
17111711

drivers/mmc/host/sdhci-of-at91.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static int sdhci_at91_runtime_resume(struct device *dev)
289289
}
290290

291291
out:
292-
return sdhci_runtime_resume_host(host);
292+
return sdhci_runtime_resume_host(host, 0);
293293
}
294294
#endif /* CONFIG_PM */
295295

drivers/mmc/host/sdhci-pci-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static int sdhci_pci_runtime_suspend_host(struct sdhci_pci_chip *chip)
167167

168168
err_pci_runtime_suspend:
169169
while (--i >= 0)
170-
sdhci_runtime_resume_host(chip->slots[i]->host);
170+
sdhci_runtime_resume_host(chip->slots[i]->host, 0);
171171
return ret;
172172
}
173173

@@ -181,7 +181,7 @@ static int sdhci_pci_runtime_resume_host(struct sdhci_pci_chip *chip)
181181
if (!slot)
182182
continue;
183183

184-
ret = sdhci_runtime_resume_host(slot->host);
184+
ret = sdhci_runtime_resume_host(slot->host, 0);
185185
if (ret)
186186
return ret;
187187
}

drivers/mmc/host/sdhci-pxav3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
554554
if (!IS_ERR(pxa->clk_core))
555555
clk_prepare_enable(pxa->clk_core);
556556

557-
return sdhci_runtime_resume_host(host);
557+
return sdhci_runtime_resume_host(host, 0);
558558
}
559559
#endif
560560

drivers/mmc/host/sdhci-s3c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ static int sdhci_s3c_runtime_resume(struct device *dev)
745745
clk_prepare_enable(busclk);
746746
if (ourhost->cur_clk >= 0)
747747
clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);
748-
ret = sdhci_runtime_resume_host(host);
748+
ret = sdhci_runtime_resume_host(host, 0);
749749
return ret;
750750
}
751751
#endif

drivers/mmc/host/sdhci-sprd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ static int sdhci_sprd_runtime_resume(struct device *dev)
696696
if (ret)
697697
goto clk_disable;
698698

699-
sdhci_runtime_resume_host(host);
699+
sdhci_runtime_resume_host(host, 1);
700700
return 0;
701701

702702
clk_disable:

drivers/mmc/host/sdhci-xenon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static int xenon_runtime_resume(struct device *dev)
638638
priv->restore_needed = false;
639639
}
640640

641-
ret = sdhci_runtime_resume_host(host);
641+
ret = sdhci_runtime_resume_host(host, 0);
642642
if (ret)
643643
goto out;
644644
return 0;

drivers/mmc/host/sdhci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,7 +3320,7 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host)
33203320
}
33213321
EXPORT_SYMBOL_GPL(sdhci_runtime_suspend_host);
33223322

3323-
int sdhci_runtime_resume_host(struct sdhci_host *host)
3323+
int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset)
33243324
{
33253325
struct mmc_host *mmc = host->mmc;
33263326
unsigned long flags;
@@ -3331,7 +3331,7 @@ int sdhci_runtime_resume_host(struct sdhci_host *host)
33313331
host->ops->enable_dma(host);
33323332
}
33333333

3334-
sdhci_init(host, 0);
3334+
sdhci_init(host, soft_reset);
33353335

33363336
if (mmc->ios.power_mode != MMC_POWER_UNDEFINED &&
33373337
mmc->ios.power_mode != MMC_POWER_OFF) {

drivers/mmc/host/sdhci.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ void sdhci_adma_write_desc(struct sdhci_host *host, void **desc,
781781
int sdhci_suspend_host(struct sdhci_host *host);
782782
int sdhci_resume_host(struct sdhci_host *host);
783783
int sdhci_runtime_suspend_host(struct sdhci_host *host);
784-
int sdhci_runtime_resume_host(struct sdhci_host *host);
784+
int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset);
785785
#endif
786786

787787
void sdhci_cqe_enable(struct mmc_host *mmc);

0 commit comments

Comments
 (0)