All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mmc: fix the wrong dislabing clock
       [not found] <CGME20180117103659epcas2p2d9c87194f8d2aefe74268fdffe9f246b@epcas2p2.samsung.com>
@ 2018-01-17 10:36 ` Jaehoon Chung
  2018-01-17 10:56   ` Jaehoon Chung
                     ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jaehoon Chung @ 2018-01-17 10:36 UTC (permalink / raw)
  To: u-boot

When power is off, clock is not disabling.
Because it's passed to 1, mmc->clock should be set to f_min value.
Some drivers can't initialize the eMMC/SD card with current status.

This patch is to fix the disabling clock value to 0.

Fixes: 2e7410d76ad1 ("mmc: disable the mmc clock during power off")

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/mmc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 53c819187e..311f51f237 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1501,11 +1501,13 @@ static int mmc_set_ios(struct mmc *mmc)
 
 int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
 {
-	if (clock > mmc->cfg->f_max)
-		clock = mmc->cfg->f_max;
+	if (!disable && clock != 0) {
+		if (clock > mmc->cfg->f_max)
+			clock = mmc->cfg->f_max;
 
-	if (clock < mmc->cfg->f_min)
-		clock = mmc->cfg->f_min;
+		if (clock < mmc->cfg->f_min)
+			clock = mmc->cfg->f_min;
+	}
 
 	mmc->clock = clock;
 	mmc->clk_disable = disable;
@@ -2449,7 +2451,7 @@ static int mmc_power_on(struct mmc *mmc)
 
 static int mmc_power_off(struct mmc *mmc)
 {
-	mmc_set_clock(mmc, 1, true);
+	mmc_set_clock(mmc, 0, true);
 #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (mmc->vmmc_supply) {
 		int ret = regulator_set_enable(mmc->vmmc_supply, false);
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mmc: fix the wrong dislabing clock
  2018-01-17 10:36 ` [U-Boot] [PATCH] mmc: fix the wrong dislabing clock Jaehoon Chung
@ 2018-01-17 10:56   ` Jaehoon Chung
  2018-01-17 14:50     ` Jean-Jacques Hiblot
  2018-01-18  8:55   ` Guillaume Gardet
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2018-01-17 10:56 UTC (permalink / raw)
  To: u-boot

Hi, 

On 01/17/2018 07:36 PM, Jaehoon Chung wrote:
> When power is off, clock is not disabling.
> Because it's passed to 1, mmc->clock should be set to f_min value.
> Some drivers can't initialize the eMMC/SD card with current status.
> 
> This patch is to fix the disabling clock value to 0.

Subject is typo..Will resend. but i want to get the opinion about this patch.

Best Regards,
Jaehoon Chung

> 
> Fixes: 2e7410d76ad1 ("mmc: disable the mmc clock during power off")
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/mmc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 53c819187e..311f51f237 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1501,11 +1501,13 @@ static int mmc_set_ios(struct mmc *mmc)
>  
>  int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
>  {
> -	if (clock > mmc->cfg->f_max)
> -		clock = mmc->cfg->f_max;
> +	if (!disable && clock != 0) {
> +		if (clock > mmc->cfg->f_max)
> +			clock = mmc->cfg->f_max;
>  
> -	if (clock < mmc->cfg->f_min)
> -		clock = mmc->cfg->f_min;
> +		if (clock < mmc->cfg->f_min)
> +			clock = mmc->cfg->f_min;
> +	}
>  
>  	mmc->clock = clock;
>  	mmc->clk_disable = disable;
> @@ -2449,7 +2451,7 @@ static int mmc_power_on(struct mmc *mmc)
>  
>  static int mmc_power_off(struct mmc *mmc)
>  {
> -	mmc_set_clock(mmc, 1, true);
> +	mmc_set_clock(mmc, 0, true);
>  #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
>  	if (mmc->vmmc_supply) {
>  		int ret = regulator_set_enable(mmc->vmmc_supply, false);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mmc: fix the wrong dislabing clock
  2018-01-17 10:56   ` Jaehoon Chung
@ 2018-01-17 14:50     ` Jean-Jacques Hiblot
  0 siblings, 0 replies; 6+ messages in thread
From: Jean-Jacques Hiblot @ 2018-01-17 14:50 UTC (permalink / raw)
  To: u-boot



On 17/01/2018 11:56, Jaehoon Chung wrote:
> Hi,
>
> On 01/17/2018 07:36 PM, Jaehoon Chung wrote:
>> When power is off, clock is not disabling.
>> Because it's passed to 1, mmc->clock should be set to f_min value.
>> Some drivers can't initialize the eMMC/SD card with current status.
>>
>> This patch is to fix the disabling clock value to 0.
> Subject is typo..Will resend. but i want to get the opinion about this patch.

It looks good to me.

Reviewed-by: Jean-Jacques Hiblot <jjhiblot@ti.com>


>
> Best Regards,
> Jaehoon Chung
>
>> Fixes: 2e7410d76ad1 ("mmc: disable the mmc clock during power off")
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> ---
>>   drivers/mmc/mmc.c | 12 +++++++-----
>>   1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>> index 53c819187e..311f51f237 100644
>> --- a/drivers/mmc/mmc.c
>> +++ b/drivers/mmc/mmc.c
>> @@ -1501,11 +1501,13 @@ static int mmc_set_ios(struct mmc *mmc)
>>   
>>   int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
>>   {
>> -	if (clock > mmc->cfg->f_max)
>> -		clock = mmc->cfg->f_max;
>> +	if (!disable && clock != 0) {
>> +		if (clock > mmc->cfg->f_max)
>> +			clock = mmc->cfg->f_max;
>>   
>> -	if (clock < mmc->cfg->f_min)
>> -		clock = mmc->cfg->f_min;
>> +		if (clock < mmc->cfg->f_min)
>> +			clock = mmc->cfg->f_min;
>> +	}
>>   
>>   	mmc->clock = clock;
>>   	mmc->clk_disable = disable;
>> @@ -2449,7 +2451,7 @@ static int mmc_power_on(struct mmc *mmc)
>>   
>>   static int mmc_power_off(struct mmc *mmc)
>>   {
>> -	mmc_set_clock(mmc, 1, true);
>> +	mmc_set_clock(mmc, 0, true);
>>   #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
>>   	if (mmc->vmmc_supply) {
>>   		int ret = regulator_set_enable(mmc->vmmc_supply, false);
>>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mmc: fix the wrong dislabing clock
  2018-01-17 10:36 ` [U-Boot] [PATCH] mmc: fix the wrong dislabing clock Jaehoon Chung
  2018-01-17 10:56   ` Jaehoon Chung
@ 2018-01-18  8:55   ` Guillaume Gardet
  2018-01-18 19:41   ` Anand Moon
  2018-01-22  5:16   ` Jaehoon Chung
  3 siblings, 0 replies; 6+ messages in thread
From: Guillaume Gardet @ 2018-01-18  8:55 UTC (permalink / raw)
  To: u-boot

Hi,


Le 17/01/2018 à 11:36, Jaehoon Chung a écrit :
> When power is off, clock is not disabling.
> Because it's passed to 1, mmc->clock should be set to f_min value.
> Some drivers can't initialize the eMMC/SD card with current status.

This fixes the MMC boot for snow (Chromebook). Thanks a lot!

Tested-by: Guillaume GARDET <guillaume.gardet@free.fr>


Guillaume


>
> This patch is to fix the disabling clock value to 0.
>
> Fixes: 2e7410d76ad1 ("mmc: disable the mmc clock during power off")
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>   drivers/mmc/mmc.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 53c819187e..311f51f237 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1501,11 +1501,13 @@ static int mmc_set_ios(struct mmc *mmc)
>   
>   int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
>   {
> -	if (clock > mmc->cfg->f_max)
> -		clock = mmc->cfg->f_max;
> +	if (!disable && clock != 0) {
> +		if (clock > mmc->cfg->f_max)
> +			clock = mmc->cfg->f_max;
>   
> -	if (clock < mmc->cfg->f_min)
> -		clock = mmc->cfg->f_min;
> +		if (clock < mmc->cfg->f_min)
> +			clock = mmc->cfg->f_min;
> +	}
>   
>   	mmc->clock = clock;
>   	mmc->clk_disable = disable;
> @@ -2449,7 +2451,7 @@ static int mmc_power_on(struct mmc *mmc)
>   
>   static int mmc_power_off(struct mmc *mmc)
>   {
> -	mmc_set_clock(mmc, 1, true);
> +	mmc_set_clock(mmc, 0, true);
>   #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
>   	if (mmc->vmmc_supply) {
>   		int ret = regulator_set_enable(mmc->vmmc_supply, false);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mmc: fix the wrong dislabing clock
  2018-01-17 10:36 ` [U-Boot] [PATCH] mmc: fix the wrong dislabing clock Jaehoon Chung
  2018-01-17 10:56   ` Jaehoon Chung
  2018-01-18  8:55   ` Guillaume Gardet
@ 2018-01-18 19:41   ` Anand Moon
  2018-01-22  5:16   ` Jaehoon Chung
  3 siblings, 0 replies; 6+ messages in thread
From: Anand Moon @ 2018-01-18 19:41 UTC (permalink / raw)
  To: u-boot

Hi JaeHoon,

On 17 January 2018 at 16:06, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> When power is off, clock is not disabling.
> Because it's passed to 1, mmc->clock should be set to f_min value.
> Some drivers can't initialize the eMMC/SD card with current status.
>
> This patch is to fix the disabling clock value to 0.
>
> Fixes: 2e7410d76ad1 ("mmc: disable the mmc clock during power off")
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> ---
>  drivers/mmc/mmc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 53c819187e..311f51f237 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1501,11 +1501,13 @@ static int mmc_set_ios(struct mmc *mmc)
>
>  int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
>  {
> -       if (clock > mmc->cfg->f_max)
> -               clock = mmc->cfg->f_max;
> +       if (!disable && clock != 0) {
> +               if (clock > mmc->cfg->f_max)
> +                       clock = mmc->cfg->f_max;
>
> -       if (clock < mmc->cfg->f_min)
> -               clock = mmc->cfg->f_min;
> +               if (clock < mmc->cfg->f_min)
> +                       clock = mmc->cfg->f_min;
> +       }
>
>         mmc->clock = clock;
>         mmc->clk_disable = disable;
> @@ -2449,7 +2451,7 @@ static int mmc_power_on(struct mmc *mmc)
>
>  static int mmc_power_off(struct mmc *mmc)
>  {
> -       mmc_set_clock(mmc, 1, true);
> +       mmc_set_clock(mmc, 0, true);
>  #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
>         if (mmc->vmmc_supply) {
>                 int ret = regulator_set_enable(mmc->vmmc_supply, false);
> --
> 2.15.1
>

I have tested this patch on Odroid Xu4 on sd_card and eMMC module
and all seem to be working.

Tested-by: Anand Moon <linux.amoon@gmail.com>

Best Regards
-Anand

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mmc: fix the wrong dislabing clock
  2018-01-17 10:36 ` [U-Boot] [PATCH] mmc: fix the wrong dislabing clock Jaehoon Chung
                     ` (2 preceding siblings ...)
  2018-01-18 19:41   ` Anand Moon
@ 2018-01-22  5:16   ` Jaehoon Chung
  3 siblings, 0 replies; 6+ messages in thread
From: Jaehoon Chung @ 2018-01-22  5:16 UTC (permalink / raw)
  To: u-boot

On 01/17/2018 07:36 PM, Jaehoon Chung wrote:
> When power is off, clock is not disabling.
> Because it's passed to 1, mmc->clock should be set to f_min value.
> Some drivers can't initialize the eMMC/SD card with current status.
> 
> This patch is to fix the disabling clock value to 0.
> 
> Fixes: 2e7410d76ad1 ("mmc: disable the mmc clock during power off")
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

Applied to u-boot-mmc. Thanks.

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 53c819187e..311f51f237 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1501,11 +1501,13 @@ static int mmc_set_ios(struct mmc *mmc)
>  
>  int mmc_set_clock(struct mmc *mmc, uint clock, bool disable)
>  {
> -	if (clock > mmc->cfg->f_max)
> -		clock = mmc->cfg->f_max;
> +	if (!disable && clock != 0) {
> +		if (clock > mmc->cfg->f_max)
> +			clock = mmc->cfg->f_max;
>  
> -	if (clock < mmc->cfg->f_min)
> -		clock = mmc->cfg->f_min;
> +		if (clock < mmc->cfg->f_min)
> +			clock = mmc->cfg->f_min;
> +	}
>  
>  	mmc->clock = clock;
>  	mmc->clk_disable = disable;
> @@ -2449,7 +2451,7 @@ static int mmc_power_on(struct mmc *mmc)
>  
>  static int mmc_power_off(struct mmc *mmc)
>  {
> -	mmc_set_clock(mmc, 1, true);
> +	mmc_set_clock(mmc, 0, true);
>  #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
>  	if (mmc->vmmc_supply) {
>  		int ret = regulator_set_enable(mmc->vmmc_supply, false);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-22  5:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180117103659epcas2p2d9c87194f8d2aefe74268fdffe9f246b@epcas2p2.samsung.com>
2018-01-17 10:36 ` [U-Boot] [PATCH] mmc: fix the wrong dislabing clock Jaehoon Chung
2018-01-17 10:56   ` Jaehoon Chung
2018-01-17 14:50     ` Jean-Jacques Hiblot
2018-01-18  8:55   ` Guillaume Gardet
2018-01-18 19:41   ` Anand Moon
2018-01-22  5:16   ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.