Index: sys/arm/broadcom/bcm2835/bcm2835_sdhci.c =================================================================== --- sys/arm/broadcom/bcm2835/bcm2835_sdhci.c +++ sys/arm/broadcom/bcm2835/bcm2835_sdhci.c @@ -48,6 +48,7 @@ #include #include +#include #include @@ -155,6 +156,7 @@ void * sc_intrhand; struct mmc_request * sc_req; struct sdhci_slot sc_slot; + struct mmc_fdt_helper sc_mmc_helper; int sc_dma_ch; bus_dma_tag_t sc_dma_tag; bus_dmamap_t sc_dma_map; @@ -171,6 +173,7 @@ device_t clkman; #endif struct bcm_mmc_conf * conf; + struct mmc_fdt_helper mmc_helper; }; static int bcm_sdhci_probe(device_t); @@ -315,6 +318,7 @@ sc->sc_slot.quirks = sc->conf->quirks; sdhci_init_slot(dev, &sc->sc_slot, 0); + mmc_fdt_parse(dev, 0, &sc->sc_mmc_helper, &sc->sc_slot.host); sc->sc_dma_ch = bcm_dma_allocate(BCM_DMA_CH_ANY); if (sc->sc_dma_ch == BCM_DMA_CH_INVALID) @@ -388,6 +392,37 @@ sdhci_generic_intr(&sc->sc_slot); } +static int +bcm_sdhci_update_ios(device_t bus, device_t child) +{ + struct bcm_sdhci_softc *sc; + struct mmc_ios *ios; + int rv; + + sc = device_get_softc(bus); + ios = &sc->sc_slot.host.ios; + + if (ios->power_mode == power_up) { + if (sc->sc_mmc_helper.vmmc_supply) + regulator_enable(sc->sc_mmc_helper.vmmc_supply); + if (sc->sc_mmc_helper.vqmmc_supply) + regulator_enable(sc->sc_mmc_helper.vqmmc_supply); + } + + rv = sdhci_generic_update_ios(bus, child); + if (rv != 0) + return (rv); + + if (ios->power_mode == power_off) { + if (sc->sc_mmc_helper.vmmc_supply) + regulator_disable(sc->sc_mmc_helper.vmmc_supply); + if (sc->sc_mmc_helper.vqmmc_supply) + regulator_disable(sc->sc_mmc_helper.vqmmc_supply); + } + + return (0); +} + static int bcm_sdhci_get_ro(device_t bus, device_t child) {