aw_mmc: Regulator improvement
Getting regulator is good, enabling them is better. When the mmc stack decide to change the voltage for IO, don't change the main vcc of the sd/mmc, only the io vcc.
This commit is contained in:
parent
c175fd0fe8
commit
3177f7cda1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330348
@ -267,11 +267,17 @@ aw_mmc_attach(device_t dev)
|
||||
bus_width = 4;
|
||||
|
||||
if (regulator_get_by_ofw_property(dev, 0, "vmmc-supply",
|
||||
&sc->aw_reg_vmmc) == 0 && bootverbose)
|
||||
device_printf(dev, "vmmc-supply regulator found\n");
|
||||
&sc->aw_reg_vmmc) == 0) {
|
||||
if (bootverbose)
|
||||
device_printf(dev, "vmmc-supply regulator found\n");
|
||||
regulator_enable(sc->aw_reg_vmmc);
|
||||
}
|
||||
if (regulator_get_by_ofw_property(dev, 0, "vqmmc-supply",
|
||||
&sc->aw_reg_vqmmc) == 0 && bootverbose)
|
||||
device_printf(dev, "vqmmc-supply regulator found\n");
|
||||
&sc->aw_reg_vqmmc) == 0 && bootverbose) {
|
||||
if (bootverbose)
|
||||
device_printf(dev, "vqmmc-supply regulator found\n");
|
||||
regulator_enable(sc->aw_reg_vqmmc);
|
||||
}
|
||||
|
||||
sc->aw_host.f_min = 400000;
|
||||
sc->aw_host.f_max = 52000000;
|
||||
@ -861,7 +867,7 @@ aw_mmc_set_power(struct aw_mmc_softc *sc, int32_t vdd)
|
||||
|
||||
sc->aw_vdd = vdd;
|
||||
|
||||
if (sc->aw_reg_vmmc == NULL && sc->aw_reg_vqmmc == NULL)
|
||||
if (sc->aw_reg_vqmmc == NULL)
|
||||
return;
|
||||
|
||||
switch (1 << vdd) {
|
||||
@ -878,13 +884,6 @@ aw_mmc_set_power(struct aw_mmc_softc *sc, int32_t vdd)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sc->aw_reg_vmmc)
|
||||
if (regulator_set_voltage(sc->aw_reg_vmmc,
|
||||
min_uvolt, max_uvolt) != 0)
|
||||
device_printf(sc->aw_dev,
|
||||
"Cannot set vmmc to %d<->%d\n",
|
||||
min_uvolt,
|
||||
max_uvolt);
|
||||
if (sc->aw_reg_vqmmc)
|
||||
if (regulator_set_voltage(sc->aw_reg_vqmmc,
|
||||
min_uvolt, max_uvolt) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user