diff mbox

sdhci: Add regulator support for vccq (voltage regualor)

Message ID 87txwexfwi.fsf@octavius.laptop.org (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Chris Ball Aug. 8, 2012, 2:43 a.m. UTC
Hi Philip,

On Mon, Jul 23 2012, philipspatches@gmail.com wrote:
> From: Philip Rakity <prakity@marvell.com>
>
> On some systems the host controller does not support vccq
> signaling.  This is supplied by a dedicated regulator (vqmmc).
>
> Add support for this regulator.
>
> Signed-off-by: Philip Rakity <prakity@marvell.com>

I've folded in this trivial cleanup patch, let me know if there's anything
in there you disagree with:

Comments

Philip Rakity Aug. 8, 2012, 4:31 a.m. UTC | #1
Hi Chris,

Looks good.

Philip

On Aug 7, 2012, at 7:43 PM, Chris Ball <cjb@laptop.org> wrote:

> Hi Philip,
> 
> On Mon, Jul 23 2012, philipspatches@gmail.com wrote:
>> From: Philip Rakity <prakity@marvell.com>
>> 
>> On some systems the host controller does not support vccq
>> signaling.  This is supplied by a dedicated regulator (vqmmc).
>> 
>> Add support for this regulator.
>> 
>> Signed-off-by: Philip Rakity <prakity@marvell.com>
> 
> I've folded in this trivial cleanup patch, let me know if there's anything
> in there you disagree with:
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index ac50d35..828ac6c 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1607,11 +1607,10 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
> 	sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
> 
> 	if (host->vqmmc) {
> -		ret = regulator_set_voltage(host->vqmmc,
> -			3300000, 3300000);
> +		ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000);
> 		if (ret) {
> -			pr_info(DRIVER_NAME ": Switching to 3.3V "
> -				"signalling voltage failed\n");
> +			pr_warning("%s: Switching to 3.3V signalling voltage "
> +				   " failed\n", mmc_hostname(host->mmc));
> 			return -EIO;
> 		}
> 	}
> @@ -1623,7 +1622,9 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
> 	if (!(ctrl & SDHCI_CTRL_VDD_180))
> 		return 0;
> 
> -	pr_info(DRIVER_NAME ": Switching to 3.3V signalling voltage failed\n");
> +	pr_warning("%s: 3.3V regulator output did not became stable\n",
> +		   mmc_hostname(host->mmc));
> +
> 	return -EIO;
> }
> 
> @@ -1700,8 +1701,9 @@ static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host,
> 	if (host->vmmc)
> 		regulator_enable(host->vmmc);
> 
> -	pr_info(DRIVER_NAME ": Switching to 1.8V signalling "
> -		"voltage failed, retrying with S18R set to 0\n");
> +	pr_warning("%s: Switching to 1.8V signalling voltage failed, "
> +		   "retrying with S18R set to 0\n", mmc_hostname(host->mmc));
> +
> 	return -EAGAIN;
> }
> 
> @@ -2834,15 +2836,13 @@ int sdhci_add_host(struct sdhci_host *host)
> 	    !(host->mmc->caps & MMC_CAP_NONREMOVABLE))
> 		mmc->caps |= MMC_CAP_NEEDS_POLL;
> 
> -	/* if vqmmc regulator and no 1.8V signaling no UHS */
> -
> +	/* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
> 	host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc");
> 	if (IS_ERR(host->vqmmc)) {
> -		pr_info("%s: no vqmmc regulator found\n",
> -			mmc_hostname(mmc));
> +		pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
> 		host->vqmmc = NULL;
> -	} else if (regulator_is_supported_voltage(host->vqmmc,
> -			1800000, 1800000))
> +	}
> +	else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
> 		regulator_enable(host->vqmmc);
> 	else
> 		caps[1] &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
> 
> -- 
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ac50d35..828ac6c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1607,11 +1607,10 @@  static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
 	sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
 
 	if (host->vqmmc) {
-		ret = regulator_set_voltage(host->vqmmc,
-			3300000, 3300000);
+		ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000);
 		if (ret) {
-			pr_info(DRIVER_NAME ": Switching to 3.3V "
-				"signalling voltage failed\n");
+			pr_warning("%s: Switching to 3.3V signalling voltage "
+				   " failed\n", mmc_hostname(host->mmc));
 			return -EIO;
 		}
 	}
@@ -1623,7 +1622,9 @@  static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
 	if (!(ctrl & SDHCI_CTRL_VDD_180))
 		return 0;
 
-	pr_info(DRIVER_NAME ": Switching to 3.3V signalling voltage failed\n");
+	pr_warning("%s: 3.3V regulator output did not became stable\n",
+		   mmc_hostname(host->mmc));
+
 	return -EIO;
 }
 
@@ -1700,8 +1701,9 @@  static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host,
 	if (host->vmmc)
 		regulator_enable(host->vmmc);
 
-	pr_info(DRIVER_NAME ": Switching to 1.8V signalling "
-		"voltage failed, retrying with S18R set to 0\n");
+	pr_warning("%s: Switching to 1.8V signalling voltage failed, "
+		   "retrying with S18R set to 0\n", mmc_hostname(host->mmc));
+
 	return -EAGAIN;
 }
 
@@ -2834,15 +2836,13 @@  int sdhci_add_host(struct sdhci_host *host)
 	    !(host->mmc->caps & MMC_CAP_NONREMOVABLE))
 		mmc->caps |= MMC_CAP_NEEDS_POLL;
 
-	/* if vqmmc regulator and no 1.8V signaling no UHS */
-
+	/* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
 	host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc");
 	if (IS_ERR(host->vqmmc)) {
-		pr_info("%s: no vqmmc regulator found\n",
-			mmc_hostname(mmc));
+		pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
 		host->vqmmc = NULL;
-	} else if (regulator_is_supported_voltage(host->vqmmc,
-			1800000, 1800000))
+	}
+	else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
 		regulator_enable(host->vqmmc);
 	else
 		caps[1] &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |