Skip to content

Commit 317c7bc

Browse files
committed
Merge tag 'mmc-v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Fix regression for the mmc ioctl MMC host: - sdhci-of-dwcmshc: Fixup PM support in ->remove_new() - sdhci-omap: Re-tune when device became runtime suspended" * tag 'mmc-v6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: sdhci-of-dwcmshc: disable PM runtime in dwcmshc_remove() mmc: sdhci-omap: re-tuning is needed after a pm transition to support emmc HS200 mode mmc: core: Avoid negative index with array access mmc: core: Initialize mmc_blk_ioc_data
2 parents 529b10c + 0374930 commit 317c7bc

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

drivers/mmc/core/block.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static struct mmc_blk_ioc_data *mmc_blk_ioctl_copy_from_user(
413413
struct mmc_blk_ioc_data *idata;
414414
int err;
415415

416-
idata = kmalloc(sizeof(*idata), GFP_KERNEL);
416+
idata = kzalloc(sizeof(*idata), GFP_KERNEL);
417417
if (!idata) {
418418
err = -ENOMEM;
419419
goto out;
@@ -488,7 +488,7 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
488488
if (idata->flags & MMC_BLK_IOC_DROP)
489489
return 0;
490490

491-
if (idata->flags & MMC_BLK_IOC_SBC)
491+
if (idata->flags & MMC_BLK_IOC_SBC && i > 0)
492492
prev_idata = idatas[i - 1];
493493

494494
/*

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

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -999,15 +999,32 @@ static int dwcmshc_probe(struct platform_device *pdev)
999999
return err;
10001000
}
10011001

1002+
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
1003+
{
1004+
u16 ctrl;
1005+
1006+
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
1007+
if (ctrl & SDHCI_CLOCK_CARD_EN) {
1008+
ctrl &= ~SDHCI_CLOCK_CARD_EN;
1009+
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
1010+
}
1011+
}
1012+
10021013
static void dwcmshc_remove(struct platform_device *pdev)
10031014
{
10041015
struct sdhci_host *host = platform_get_drvdata(pdev);
10051016
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
10061017
struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host);
10071018
struct rk35xx_priv *rk_priv = priv->priv;
10081019

1020+
pm_runtime_get_sync(&pdev->dev);
1021+
pm_runtime_disable(&pdev->dev);
1022+
pm_runtime_put_noidle(&pdev->dev);
1023+
10091024
sdhci_remove_host(host, 0);
10101025

1026+
dwcmshc_disable_card_clk(host);
1027+
10111028
clk_disable_unprepare(pltfm_host->clk);
10121029
clk_disable_unprepare(priv->bus_clk);
10131030
if (rk_priv)
@@ -1099,17 +1116,6 @@ static void dwcmshc_enable_card_clk(struct sdhci_host *host)
10991116
}
11001117
}
11011118

1102-
static void dwcmshc_disable_card_clk(struct sdhci_host *host)
1103-
{
1104-
u16 ctrl;
1105-
1106-
ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
1107-
if (ctrl & SDHCI_CLOCK_CARD_EN) {
1108-
ctrl &= ~SDHCI_CLOCK_CARD_EN;
1109-
sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL);
1110-
}
1111-
}
1112-
11131119
static int dwcmshc_runtime_suspend(struct device *dev)
11141120
{
11151121
struct sdhci_host *host = dev_get_drvdata(dev);

drivers/mmc/host/sdhci-omap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,9 @@ static int __maybe_unused sdhci_omap_runtime_suspend(struct device *dev)
14391439
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
14401440
struct sdhci_omap_host *omap_host = sdhci_pltfm_priv(pltfm_host);
14411441

1442+
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
1443+
mmc_retune_needed(host->mmc);
1444+
14421445
if (omap_host->con != -EINVAL)
14431446
sdhci_runtime_suspend_host(host);
14441447

0 commit comments

Comments
 (0)