Skip to content

Commit b1231b2

Browse files
jbrun3tstorulf
authored andcommitted
mmc: meson-gx: implement voltage switch callback
Implement voltage switch callback (shamelessly copied from sunxi mmc driver). This allow, with the appropriate tuning function, to use SD ultra high speed modes. Reviewed-by: Kevin Hilman <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent 033d716 commit b1231b2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,27 @@ static int meson_mmc_card_busy(struct mmc_host *mmc)
10491049
return !(FIELD_GET(STATUS_DATI, regval) & 0xf);
10501050
}
10511051

1052+
static int meson_mmc_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
1053+
{
1054+
/* vqmmc regulator is available */
1055+
if (!IS_ERR(mmc->supply.vqmmc)) {
1056+
/*
1057+
* The usual amlogic setup uses a GPIO to switch from one
1058+
* regulator to the other. While the voltage ramp up is
1059+
* pretty fast, care must be taken when switching from 3.3v
1060+
* to 1.8v. Please make sure the regulator framework is aware
1061+
* of your own regulator constraints
1062+
*/
1063+
return mmc_regulator_set_vqmmc(mmc, ios);
1064+
}
1065+
1066+
/* no vqmmc regulator, assume fixed regulator at 3/3.3V */
1067+
if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
1068+
return 0;
1069+
1070+
return -EINVAL;
1071+
}
1072+
10521073
static const struct mmc_host_ops meson_mmc_ops = {
10531074
.request = meson_mmc_request,
10541075
.set_ios = meson_mmc_set_ios,
@@ -1057,6 +1078,7 @@ static const struct mmc_host_ops meson_mmc_ops = {
10571078
.post_req = meson_mmc_post_req,
10581079
.execute_tuning = meson_mmc_execute_tuning,
10591080
.card_busy = meson_mmc_card_busy,
1081+
.start_signal_voltage_switch = meson_mmc_voltage_switch,
10601082
};
10611083

10621084
static int meson_mmc_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)