Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Mar 2018 18:30:31 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r330348 - head/sys/arm/allwinner
Message-ID:  <201803031830.w23IUV5K072057@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sat Mar  3 18:30:31 2018
New Revision: 330348
URL: https://svnweb.freebsd.org/changeset/base/330348

Log:
  aw_mmc: Regulator improvement
  
  Getting regulator is good, enabling them is better.
  When the mmc stack decide to change the voltage for IO, don't
  change the main vcc of the sd/mmc, only the io vcc.

Modified:
  head/sys/arm/allwinner/aw_mmc.c

Modified: head/sys/arm/allwinner/aw_mmc.c
==============================================================================
--- head/sys/arm/allwinner/aw_mmc.c	Sat Mar  3 18:28:19 2018	(r330347)
+++ head/sys/arm/allwinner/aw_mmc.c	Sat Mar  3 18:30:31 2018	(r330348)
@@ -267,11 +267,17 @@ aw_mmc_attach(device_t dev)
 		bus_width = 4;
 
 	if (regulator_get_by_ofw_property(dev, 0, "vmmc-supply",
-	    &sc->aw_reg_vmmc) == 0 && bootverbose)
-		device_printf(dev, "vmmc-supply regulator found\n");
+	    &sc->aw_reg_vmmc) == 0) {
+		if (bootverbose)
+			device_printf(dev, "vmmc-supply regulator found\n");
+		regulator_enable(sc->aw_reg_vmmc);
+	}
 	if (regulator_get_by_ofw_property(dev, 0, "vqmmc-supply",
-	    &sc->aw_reg_vqmmc) == 0 && bootverbose)
-		device_printf(dev, "vqmmc-supply regulator found\n");
+	    &sc->aw_reg_vqmmc) == 0 && bootverbose) {
+		if (bootverbose)
+			device_printf(dev, "vqmmc-supply regulator found\n");
+		regulator_enable(sc->aw_reg_vqmmc);
+	}
 
 	sc->aw_host.f_min = 400000;
 	sc->aw_host.f_max = 52000000;
@@ -861,7 +867,7 @@ aw_mmc_set_power(struct aw_mmc_softc *sc, int32_t vdd)
 
 	sc->aw_vdd = vdd;
 
-	if (sc->aw_reg_vmmc == NULL && sc->aw_reg_vqmmc == NULL)
+	if (sc->aw_reg_vqmmc == NULL)
 		return;
 
 	switch (1 << vdd) {
@@ -878,13 +884,6 @@ aw_mmc_set_power(struct aw_mmc_softc *sc, int32_t vdd)
 		break;
 	}
 
-	if (sc->aw_reg_vmmc)
-		if (regulator_set_voltage(sc->aw_reg_vmmc,
-		    min_uvolt, max_uvolt) != 0)
-			device_printf(sc->aw_dev,
-			    "Cannot set vmmc to %d<->%d\n",
-			    min_uvolt,
-			    max_uvolt);
 	if (sc->aw_reg_vqmmc)
 		if (regulator_set_voltage(sc->aw_reg_vqmmc,
 		    min_uvolt, max_uvolt) != 0)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803031830.w23IUV5K072057>