arm: allwinner: aw_mmc: Check if the regulator support the voltage

Don't blindy say that we support both 3.3V and 1.8V.
If we have a regulator for the data lines, check that the voltage is
supported before adding the signaling caps.
If we don't have a regulator, just assume that the data lines are 3.3V
This unbreak eMMC on some allwinner boards.

Reported by:	ganbold
MFC after:	1 month
X-MFC-With:	r354396
This commit is contained in:
Emmanuel Vadot 2019-11-06 14:58:25 +00:00
parent 9c3a56d076
commit 94d3675ea0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354397

View File

@ -511,7 +511,13 @@ aw_mmc_attach(device_t dev)
MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 |
MMC_CAP_UHS_DDR50 | MMC_CAP_MMC_DDR52;
sc->aw_host.caps |= MMC_CAP_SIGNALING_330 | MMC_CAP_SIGNALING_180;
if (sc->aw_reg_vqmmc != NULL) {
if (regulator_check_voltage(sc->aw_reg_vqmmc, 1800000) == 0)
sc->aw_host.caps |= MMC_CAP_SIGNALING_180;
if (regulator_check_voltage(sc->aw_reg_vqmmc, 3300000) == 0)
sc->aw_host.caps |= MMC_CAP_SIGNALING_330;
} else
sc->aw_host.caps |= MMC_CAP_SIGNALING_330;
if (bus_width >= 4)
sc->aw_host.caps |= MMC_CAP_4_BIT_DATA;