Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mmc/mmc_fdt_helpers.c
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | #ifdef EXT_RESOURCES | ||||
} | } | ||||
if (regulator_get_by_ofw_property(dev, 0, "vqmmc-supply", | if (regulator_get_by_ofw_property(dev, 0, "vqmmc-supply", | ||||
&helper->vqmmc_supply) == 0 && bootverbose) { | &helper->vqmmc_supply) == 0 && bootverbose) { | ||||
if (bootverbose) | if (bootverbose) | ||||
device_printf(dev, "vqmmc-supply regulator found\n"); | device_printf(dev, "vqmmc-supply regulator found\n"); | ||||
} | } | ||||
if (helper->vqmmc_supply != NULL) { | if (helper->vqmmc_supply != NULL) { | ||||
int uvolt; | |||||
if (regulator_get_voltage(helper->vqmmc_supply, &uvolt) == 0) { | |||||
switch (uvolt) { | |||||
case 1200000: | |||||
host->ios.vccq = vccq_120; | |||||
break; | |||||
case 1800000: | |||||
host->ios.vccq = vccq_180; | |||||
break; | |||||
case 3300000: | |||||
host->ios.vccq = vccq_330; | |||||
break; | |||||
} | |||||
manu: Maybe add a default: with a printf under bootverbose if we can't get the current voltage ? | |||||
if (bootverbose) | |||||
device_printf(dev, | |||||
"vqmmc current voltage: %d uV\n", uvolt); | |||||
} | |||||
if (regulator_check_voltage(helper->vqmmc_supply, 1200000) == 0) | if (regulator_check_voltage(helper->vqmmc_supply, 1200000) == 0) | ||||
host->caps |= MMC_CAP_SIGNALING_120; | host->caps |= MMC_CAP_SIGNALING_120; | ||||
else | else | ||||
host->caps &= ~( MMC_CAP_MMC_HS400_120 | | host->caps &= ~( MMC_CAP_MMC_HS400_120 | | ||||
MMC_CAP_MMC_HS200_120 | | MMC_CAP_MMC_HS200_120 | | ||||
MMC_CAP_MMC_DDR52_120); | MMC_CAP_MMC_DDR52_120); | ||||
if (regulator_check_voltage(helper->vqmmc_supply, 1800000) == 0) | if (regulator_check_voltage(helper->vqmmc_supply, 1800000) == 0) | ||||
host->caps |= MMC_CAP_SIGNALING_180; | host->caps |= MMC_CAP_SIGNALING_180; | ||||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |
Maybe add a default: with a printf under bootverbose if we can't get the current voltage ?