Page MenuHomeFreeBSD

D30294.id89615.diff
No OneTemporary

D30294.id89615.diff

diff --git a/sys/arm/allwinner/aw_mmc.c b/sys/arm/allwinner/aw_mmc.c
--- a/sys/arm/allwinner/aw_mmc.c
+++ b/sys/arm/allwinner/aw_mmc.c
@@ -1285,6 +1285,8 @@
struct mmc_ios *ios;
unsigned int clock;
uint32_t reg, div = 1;
+ int reg_status;
+ int rv;
sc = device_get_softc(bus);
@@ -1310,10 +1312,16 @@
if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD))
device_printf(sc->aw_dev, "Powering down sd/mmc\n");
- if (sc->mmc_helper.vmmc_supply)
- regulator_disable(sc->mmc_helper.vmmc_supply);
- if (sc->mmc_helper.vqmmc_supply)
- regulator_disable(sc->mmc_helper.vqmmc_supply);
+ if (sc->mmc_helper.vmmc_supply) {
+ rv = regulator_status(sc->mmc_helper.vmmc_supply, &reg_status);
+ if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED)
+ regulator_disable(sc->mmc_helper.vmmc_supply);
+ }
+ if (sc->mmc_helper.vqmmc_supply) {
+ rv = regulator_status(sc->mmc_helper.vqmmc_supply, &reg_status);
+ if (rv == 0 && reg_status == REGULATOR_STATUS_ENABLED)
+ regulator_disable(sc->mmc_helper.vqmmc_supply);
+ }
aw_mmc_reset(sc);
break;
@@ -1321,10 +1329,16 @@
if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD))
device_printf(sc->aw_dev, "Powering up sd/mmc\n");
- if (sc->mmc_helper.vmmc_supply)
- regulator_enable(sc->mmc_helper.vmmc_supply);
- if (sc->mmc_helper.vqmmc_supply)
- regulator_enable(sc->mmc_helper.vqmmc_supply);
+ if (sc->mmc_helper.vmmc_supply) {
+ rv = regulator_status(sc->mmc_helper.vmmc_supply, &reg_status);
+ if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED)
+ regulator_enable(sc->mmc_helper.vmmc_supply);
+ }
+ if (sc->mmc_helper.vqmmc_supply) {
+ rv = regulator_status(sc->mmc_helper.vqmmc_supply, &reg_status);
+ if (rv == 0 && reg_status != REGULATOR_STATUS_ENABLED)
+ regulator_enable(sc->mmc_helper.vqmmc_supply);
+ }
aw_mmc_init(sc);
break;
};

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 28, 10:52 PM (19 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26306869
Default Alt Text
D30294.id89615.diff (1 KB)

Event Timeline