aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/meson-gx-mmc.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 7d14d382cb1c..0d29f1f347eb 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -444,8 +444,8 @@ static void meson_mmc_set_tuning_params(struct mmc_host *mmc)
444static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 444static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
445{ 445{
446 struct meson_host *host = mmc_priv(mmc); 446 struct meson_host *host = mmc_priv(mmc);
447 u32 bus_width; 447 u32 bus_width, val;
448 u32 val, orig; 448 int err;
449 449
450 /* 450 /*
451 * GPIO regulator, only controls switching between 1v8 and 451 * GPIO regulator, only controls switching between 1v8 and
@@ -473,7 +473,7 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
473 int ret = regulator_enable(mmc->supply.vqmmc); 473 int ret = regulator_enable(mmc->supply.vqmmc);
474 474
475 if (ret < 0) 475 if (ret < 0)
476 dev_err(mmc_dev(mmc), 476 dev_err(host->dev,
477 "failed to enable vqmmc regulator\n"); 477 "failed to enable vqmmc regulator\n");
478 else 478 else
479 host->vqmmc_enabled = true; 479 host->vqmmc_enabled = true;
@@ -482,9 +482,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
482 break; 482 break;
483 } 483 }
484 484
485
486 meson_mmc_clk_set(host, ios->clock);
487
488 /* Bus width */ 485 /* Bus width */
489 switch (ios->bus_width) { 486 switch (ios->bus_width) {
490 case MMC_BUS_WIDTH_1: 487 case MMC_BUS_WIDTH_1:
@@ -503,8 +500,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
503 } 500 }
504 501
505 val = readl(host->regs + SD_EMMC_CFG); 502 val = readl(host->regs + SD_EMMC_CFG);
506 orig = val;
507
508 val &= ~CFG_BUS_WIDTH_MASK; 503 val &= ~CFG_BUS_WIDTH_MASK;
509 val |= FIELD_PREP(CFG_BUS_WIDTH_MASK, bus_width); 504 val |= FIELD_PREP(CFG_BUS_WIDTH_MASK, bus_width);
510 505
@@ -518,11 +513,12 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
518 if (ios->timing == MMC_TIMING_MMC_HS400) 513 if (ios->timing == MMC_TIMING_MMC_HS400)
519 val |= CFG_CHK_DS; 514 val |= CFG_CHK_DS;
520 515
521 if (val != orig) { 516 err = meson_mmc_clk_set(host, ios->clock);
522 writel(val, host->regs + SD_EMMC_CFG); 517 if (err)
523 dev_dbg(host->dev, "%s: SD_EMMC_CFG: 0x%08x -> 0x%08x\n", 518 dev_err(host->dev, "Failed to set clock: %d\n,", err);
524 __func__, orig, val); 519
525 } 520 writel(val, host->regs + SD_EMMC_CFG);
521 dev_dbg(host->dev, "SD_EMMC_CFG: 0x%08x\n", val);
526} 522}
527 523
528static void meson_mmc_request_done(struct mmc_host *mmc, 524static void meson_mmc_request_done(struct mmc_host *mmc,