diff mbox

[v2,02/10] mmc: omap_hsmmc: make vcc and vcc_aux independent

Message ID 1370546059-24181-3-git-send-email-balajitk@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Balaji T K June 6, 2013, 7:14 p.m. UTC
handle vcc and vcc_aux independently

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Comments

Tony Lindgren June 12, 2013, 2:25 p.m. UTC | #1
* Balaji T K <balajitk@ti.com> [130606 12:20]:
> handle vcc and vcc_aux independently
> 
> Signed-off-by: Balaji T K <balajitk@ti.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index 1865321..bda1a42 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>  	 * If we don't see a Vcc regulator, assume it's a fixed
>  	 * voltage always-on regulator.
>  	 */
> -	if (!host->vcc)
> +	if (!host->vcc && !host->vcc_aux)
>  		return 0;
>  	/*
>  	 * With DT, never turn OFF the regulator for MMC1. This is because

Doesn't the above change break MMC for most boards that only pass
one regulator and no aux regulator?

Regards,

Tony

> @@ -280,11 +280,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>  	 * chips/cards need an interface voltage rail too.
>  	 */
>  	if (power_on) {
> -		ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
> +		if (host->vcc)
> +			ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
>  		/* Enable interface voltage rail, if needed */
>  		if (ret == 0 && host->vcc_aux) {
>  			ret = regulator_enable(host->vcc_aux);
> -			if (ret < 0)
> +			if (ret < 0 && host->vcc)
>  				ret = mmc_regulator_set_ocr(host->mmc,
>  							host->vcc, 0);
>  		}
> @@ -292,7 +293,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>  		/* Shut down the rail */
>  		if (host->vcc_aux)
>  			ret = regulator_disable(host->vcc_aux);
> -		if (!ret) {
> +		if (host->vcc) {
>  			/* Then proceed to shut down the local regulator */
>  			ret = mmc_regulator_set_ocr(host->mmc,
>  						host->vcc, 0);
> -- 
> 1.7.5.4
> 
--
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
Balaji T K June 12, 2013, 2:33 p.m. UTC | #2
On Wednesday 12 June 2013 07:55 PM, Tony Lindgren wrote:
> * Balaji T K <balajitk@ti.com> [130606 12:20]:
>> handle vcc and vcc_aux independently
>>
>> Signed-off-by: Balaji T K <balajitk@ti.com>
>> ---
>>   drivers/mmc/host/omap_hsmmc.c |    9 +++++----
>>   1 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
>> index 1865321..bda1a42 100644
>> --- a/drivers/mmc/host/omap_hsmmc.c
>> +++ b/drivers/mmc/host/omap_hsmmc.c
>> @@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>>   	 * If we don't see a Vcc regulator, assume it's a fixed
>>   	 * voltage always-on regulator.
>>   	 */
>> -	if (!host->vcc)
>> +	if (!host->vcc && !host->vcc_aux)
>>   		return 0;
>>   	/*
>>   	 * With DT, never turn OFF the regulator for MMC1. This is because
>
> Doesn't the above change break MMC for most boards that only pass
> one regulator and no aux regulator?
>

No, I want to skip regulator operation in set_power function iff both
regulator are not present.

Earlier vcc was assumed/mandatory if vcc_aux is present.
Now, regulator operation will be handled if either one of vcc/vcc_aux is present,

> Regards,
>
> Tony
>
>> @@ -280,11 +280,12 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>>   	 * chips/cards need an interface voltage rail too.
>>   	 */
>>   	if (power_on) {
>> -		ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
>> +		if (host->vcc)
>> +			ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
>>   		/* Enable interface voltage rail, if needed */
>>   		if (ret == 0 && host->vcc_aux) {
>>   			ret = regulator_enable(host->vcc_aux);
>> -			if (ret < 0)
>> +			if (ret < 0 && host->vcc)
>>   				ret = mmc_regulator_set_ocr(host->mmc,
>>   							host->vcc, 0);
>>   		}
>> @@ -292,7 +293,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
>>   		/* Shut down the rail */
>>   		if (host->vcc_aux)
>>   			ret = regulator_disable(host->vcc_aux);
>> -		if (!ret) {
>> +		if (host->vcc) {
>>   			/* Then proceed to shut down the local regulator */
>>   			ret = mmc_regulator_set_ocr(host->mmc,
>>   						host->vcc, 0);
>> --
>> 1.7.5.4
>>

--
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
Tony Lindgren June 12, 2013, 2:38 p.m. UTC | #3
* Balaji T K <balajitk@ti.com> [130612 07:39]:
> On Wednesday 12 June 2013 07:55 PM, Tony Lindgren wrote:
> >* Balaji T K <balajitk@ti.com> [130606 12:20]:
> >>handle vcc and vcc_aux independently
> >>
> >>Signed-off-by: Balaji T K <balajitk@ti.com>
> >>---
> >>  drivers/mmc/host/omap_hsmmc.c |    9 +++++----
> >>  1 files changed, 5 insertions(+), 4 deletions(-)
> >>
> >>diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> >>index 1865321..bda1a42 100644
> >>--- a/drivers/mmc/host/omap_hsmmc.c
> >>+++ b/drivers/mmc/host/omap_hsmmc.c
> >>@@ -253,7 +253,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
> >>  	 * If we don't see a Vcc regulator, assume it's a fixed
> >>  	 * voltage always-on regulator.
> >>  	 */
> >>-	if (!host->vcc)
> >>+	if (!host->vcc && !host->vcc_aux)
> >>  		return 0;
> >>  	/*
> >>  	 * With DT, never turn OFF the regulator for MMC1. This is because
> >
> >Doesn't the above change break MMC for most boards that only pass
> >one regulator and no aux regulator?
> >
> 
> No, I want to skip regulator operation in set_power function iff both
> regulator are not present.
> 
> Earlier vcc was assumed/mandatory if vcc_aux is present.
> Now, regulator operation will be handled if either one of vcc/vcc_aux is present,

Ah OK yes sorry I misread your patch.

Regards,

Tony
--
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/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1865321..bda1a42 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -253,7 +253,7 @@  static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
 	 * If we don't see a Vcc regulator, assume it's a fixed
 	 * voltage always-on regulator.
 	 */
-	if (!host->vcc)
+	if (!host->vcc && !host->vcc_aux)
 		return 0;
 	/*
 	 * With DT, never turn OFF the regulator for MMC1. This is because
@@ -280,11 +280,12 @@  static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
 	 * chips/cards need an interface voltage rail too.
 	 */
 	if (power_on) {
-		ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
+		if (host->vcc)
+			ret = mmc_regulator_set_ocr(host->mmc, host->vcc, vdd);
 		/* Enable interface voltage rail, if needed */
 		if (ret == 0 && host->vcc_aux) {
 			ret = regulator_enable(host->vcc_aux);
-			if (ret < 0)
+			if (ret < 0 && host->vcc)
 				ret = mmc_regulator_set_ocr(host->mmc,
 							host->vcc, 0);
 		}
@@ -292,7 +293,7 @@  static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
 		/* Shut down the rail */
 		if (host->vcc_aux)
 			ret = regulator_disable(host->vcc_aux);
-		if (!ret) {
+		if (host->vcc) {
 			/* Then proceed to shut down the local regulator */
 			ret = mmc_regulator_set_ocr(host->mmc,
 						host->vcc, 0);