Index: sys/dev/sdmmc/sdhc.c =================================================================== RCS file: /cvsroot/src/sys/dev/sdmmc/sdhc.c,v retrieving revision 1.103 diff -p -u -r1.103 sdhc.c --- sys/dev/sdmmc/sdhc.c 3 Jul 2019 23:10:08 -0000 1.103 +++ sys/dev/sdmmc/sdhc.c 16 Aug 2019 06:46:12 -0000 @@ -98,6 +98,8 @@ struct sdhc_host { bus_dmamap_t adma_map; bus_dma_segment_t adma_segs[1]; void *adma2; + + uint8_t vdd; /* last vdd setting */ }; #define HDEVNAME(hp) (device_xname((hp)->sc->sc_dev)) @@ -929,6 +931,12 @@ sdhc_bus_power(sdmmc_chipset_handle_t sc goto out; } + /* + * if voltage doesn't change, do nothing + */ + if (vdd == hp->vdd) + goto out; + if (!ISSET(hp->sc->sc_flags, SDHC_FLAG_ENHANCED)) { /* * Enable bus power. Wait at least 1 ms (or 74 clocks) plus @@ -960,6 +968,9 @@ sdhc_bus_power(sdmmc_chipset_handle_t sc } } + /* power successfully changed */ + hp->vdd = vdd; + out: mutex_exit(&hp->intr_lock);