Skip to content

Commit 1670d7e

Browse files
committed
Merge tag 'mmc-v6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: - sunxi-mmc: Fix clock refcount imbalance during unbind - sdhci-esdhc-imx: Fix some tuning settings * tag 'mmc-v6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sunxi-mmc: Fix clock refcount imbalance during unbind mmc: sdhci-esdhc-imx: correct the tuning start tap and step setting
2 parents 1ed4638 + 8509419 commit 1670d7e

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
#define ESDHC_TUNING_START_TAP_DEFAULT 0x1
108108
#define ESDHC_TUNING_START_TAP_MASK 0x7f
109109
#define ESDHC_TUNING_CMD_CRC_CHECK_DISABLE (1 << 7)
110+
#define ESDHC_TUNING_STEP_DEFAULT 0x1
110111
#define ESDHC_TUNING_STEP_MASK 0x00070000
111112
#define ESDHC_TUNING_STEP_SHIFT 16
112113

@@ -1368,7 +1369,7 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
13681369
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
13691370
struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
13701371
struct cqhci_host *cq_host = host->mmc->cqe_private;
1371-
int tmp;
1372+
u32 tmp;
13721373

13731374
if (esdhc_is_usdhc(imx_data)) {
13741375
/*
@@ -1423,17 +1424,24 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
14231424

14241425
if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
14251426
tmp = readl(host->ioaddr + ESDHC_TUNING_CTRL);
1426-
tmp |= ESDHC_STD_TUNING_EN |
1427-
ESDHC_TUNING_START_TAP_DEFAULT;
1428-
if (imx_data->boarddata.tuning_start_tap) {
1429-
tmp &= ~ESDHC_TUNING_START_TAP_MASK;
1427+
tmp |= ESDHC_STD_TUNING_EN;
1428+
1429+
/*
1430+
* ROM code or bootloader may config the start tap
1431+
* and step, unmask them first.
1432+
*/
1433+
tmp &= ~(ESDHC_TUNING_START_TAP_MASK | ESDHC_TUNING_STEP_MASK);
1434+
if (imx_data->boarddata.tuning_start_tap)
14301435
tmp |= imx_data->boarddata.tuning_start_tap;
1431-
}
1436+
else
1437+
tmp |= ESDHC_TUNING_START_TAP_DEFAULT;
14321438

14331439
if (imx_data->boarddata.tuning_step) {
1434-
tmp &= ~ESDHC_TUNING_STEP_MASK;
14351440
tmp |= imx_data->boarddata.tuning_step
14361441
<< ESDHC_TUNING_STEP_SHIFT;
1442+
} else {
1443+
tmp |= ESDHC_TUNING_STEP_DEFAULT
1444+
<< ESDHC_TUNING_STEP_SHIFT;
14371445
}
14381446

14391447
/* Disable the CMD CRC check for tuning, if not, need to

drivers/mmc/host/sunxi-mmc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,9 +1492,11 @@ static int sunxi_mmc_remove(struct platform_device *pdev)
14921492
struct sunxi_mmc_host *host = mmc_priv(mmc);
14931493

14941494
mmc_remove_host(mmc);
1495-
pm_runtime_force_suspend(&pdev->dev);
1496-
disable_irq(host->irq);
1497-
sunxi_mmc_disable(host);
1495+
pm_runtime_disable(&pdev->dev);
1496+
if (!pm_runtime_status_suspended(&pdev->dev)) {
1497+
disable_irq(host->irq);
1498+
sunxi_mmc_disable(host);
1499+
}
14981500
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
14991501
mmc_free_host(mmc);
15001502

0 commit comments

Comments
 (0)