Skip to content

Commit c36cf12

Browse files
jbrun3tstorulf
authored andcommitted
mmc: meson-gx: rework set_ios function
Remove conditional write of cfg register. Warn if set_clk fails for some reason. Consistently use host->dev instead of mixing with mmc_dev(mmc) Reviewed-by: Kevin Hilman <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 3c39e2c commit c36cf12

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

drivers/mmc/host/meson-gx-mmc.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ static void meson_mmc_set_tuning_params(struct mmc_host *mmc)
444444
static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
445445
{
446446
struct meson_host *host = mmc_priv(mmc);
447-
u32 bus_width;
448-
u32 val, orig;
447+
u32 bus_width, val;
448+
int err;
449449

450450
/*
451451
* 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)
473473
int ret = regulator_enable(mmc->supply.vqmmc);
474474

475475
if (ret < 0)
476-
dev_err(mmc_dev(mmc),
476+
dev_err(host->dev,
477477
"failed to enable vqmmc regulator\n");
478478
else
479479
host->vqmmc_enabled = true;
@@ -482,9 +482,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
482482
break;
483483
}
484484

485-
486-
meson_mmc_clk_set(host, ios->clock);
487-
488485
/* Bus width */
489486
switch (ios->bus_width) {
490487
case MMC_BUS_WIDTH_1:
@@ -503,8 +500,6 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
503500
}
504501

505502
val = readl(host->regs + SD_EMMC_CFG);
506-
orig = val;
507-
508503
val &= ~CFG_BUS_WIDTH_MASK;
509504
val |= FIELD_PREP(CFG_BUS_WIDTH_MASK, bus_width);
510505

@@ -518,11 +513,12 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
518513
if (ios->timing == MMC_TIMING_MMC_HS400)
519514
val |= CFG_CHK_DS;
520515

521-
if (val != orig) {
522-
writel(val, host->regs + SD_EMMC_CFG);
523-
dev_dbg(host->dev, "%s: SD_EMMC_CFG: 0x%08x -> 0x%08x\n",
524-
__func__, orig, val);
525-
}
516+
err = meson_mmc_clk_set(host, ios->clock);
517+
if (err)
518+
dev_err(host->dev, "Failed to set clock: %d\n,", err);
519+
520+
writel(val, host->regs + SD_EMMC_CFG);
521+
dev_dbg(host->dev, "SD_EMMC_CFG: 0x%08x\n", val);
526522
}
527523

528524
static void meson_mmc_request_done(struct mmc_host *mmc,

0 commit comments

Comments
 (0)