mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: core: add driver strength selection when selecting hs400es
@ 2017-09-25  8:56 Chanho Min
  2017-09-25 10:34 ` Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Chanho Min @ 2017-09-25  8:56 UTC (permalink / raw)
  To: Ulf Hansson, Shawn Lin, Linus Walleij, Adrian Hunter, Uri Yanai
  Cc: linux-mmc, linux-kernel, Hankyung Yu, Gunho Lee, Chanho Min

From: "hankyung.yu" <hankyung.yu@lge.com>

The drive strength setting is missed and required when selecting
hs400es. So, It is added here.

Signed-off-by: Hankyung Yu <hankyung.yu@lge.com>
Signed-off-by: Chanho Min <chanho.min@lge.com>
---
 drivers/mmc/core/mmc.c | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 07516f3..bc7586c 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1249,6 +1249,23 @@ out_err:
 	return err;
 }
 
+static void mmc_select_driver_type(struct mmc_card *card)
+{
+	int card_drv_type, drive_strength, drv_type;
+
+	card_drv_type = card->ext_csd.raw_driver_strength |
+			mmc_driver_type_mask(0);
+
+	drive_strength = mmc_select_drive_strength(card,
+						   card->ext_csd.hs200_max_dtr,
+						   card_drv_type, &drv_type);
+
+	card->drive_strength = drive_strength;
+
+	if (drv_type)
+		mmc_set_driver_type(card->host, drv_type);
+}
+
 static int mmc_select_hs400es(struct mmc_card *card)
 {
 	struct mmc_host *host = card->host;
@@ -1300,6 +1317,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
 		goto out_err;
 	}
 
+	mmc_select_driver_type(card);
+
 	/* Switch card to HS400 */
 	val = EXT_CSD_TIMING_HS400 |
 	      card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
@@ -1333,23 +1352,6 @@ out_err:
 	return err;
 }
 
-static void mmc_select_driver_type(struct mmc_card *card)
-{
-	int card_drv_type, drive_strength, drv_type;
-
-	card_drv_type = card->ext_csd.raw_driver_strength |
-			mmc_driver_type_mask(0);
-
-	drive_strength = mmc_select_drive_strength(card,
-						   card->ext_csd.hs200_max_dtr,
-						   card_drv_type, &drv_type);
-
-	card->drive_strength = drive_strength;
-
-	if (drv_type)
-		mmc_set_driver_type(card->host, drv_type);
-}
-
 /*
  * For device supporting HS200 mode, the following sequence
  * should be done before executing the tuning process.
-- 
2.1.4

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

* Re: [PATCH] mmc: core: add driver strength selection when selecting hs400es
  2017-09-25  8:56 [PATCH] mmc: core: add driver strength selection when selecting hs400es Chanho Min
@ 2017-09-25 10:34 ` Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2017-09-25 10:34 UTC (permalink / raw)
  To: Chanho Min, Ulf Hansson, Shawn Lin, Linus Walleij, Uri Yanai
  Cc: linux-mmc, linux-kernel, Hankyung Yu, Gunho Lee

On 25/09/17 11:56, Chanho Min wrote:
> From: "hankyung.yu" <hankyung.yu@lge.com>
> 
> The drive strength setting is missed and required when selecting
> hs400es. So, It is added here.
> 
> Signed-off-by: Hankyung Yu <hankyung.yu@lge.com>
> Signed-off-by: Chanho Min <chanho.min@lge.com>

Looks right.  I guess we should add:

Fixes: 81ac2af65793ecf ("mmc: core: implement enhanced strobe support")
Cc: stable@vger.kernel.org


> ---
>  drivers/mmc/core/mmc.c | 36 +++++++++++++++++++-----------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 07516f3..bc7586c 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1249,6 +1249,23 @@ out_err:
>  	return err;
>  }
>  
> +static void mmc_select_driver_type(struct mmc_card *card)
> +{
> +	int card_drv_type, drive_strength, drv_type;
> +
> +	card_drv_type = card->ext_csd.raw_driver_strength |
> +			mmc_driver_type_mask(0);
> +
> +	drive_strength = mmc_select_drive_strength(card,
> +						   card->ext_csd.hs200_max_dtr,
> +						   card_drv_type, &drv_type);
> +
> +	card->drive_strength = drive_strength;
> +
> +	if (drv_type)
> +		mmc_set_driver_type(card->host, drv_type);
> +}
> +
>  static int mmc_select_hs400es(struct mmc_card *card)
>  {
>  	struct mmc_host *host = card->host;
> @@ -1300,6 +1317,8 @@ static int mmc_select_hs400es(struct mmc_card *card)
>  		goto out_err;
>  	}
>  
> +	mmc_select_driver_type(card);
> +
>  	/* Switch card to HS400 */
>  	val = EXT_CSD_TIMING_HS400 |
>  	      card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
> @@ -1333,23 +1352,6 @@ out_err:
>  	return err;
>  }
>  
> -static void mmc_select_driver_type(struct mmc_card *card)
> -{
> -	int card_drv_type, drive_strength, drv_type;
> -
> -	card_drv_type = card->ext_csd.raw_driver_strength |
> -			mmc_driver_type_mask(0);
> -
> -	drive_strength = mmc_select_drive_strength(card,
> -						   card->ext_csd.hs200_max_dtr,
> -						   card_drv_type, &drv_type);
> -
> -	card->drive_strength = drive_strength;
> -
> -	if (drv_type)
> -		mmc_set_driver_type(card->host, drv_type);
> -}
> -
>  /*
>   * For device supporting HS200 mode, the following sequence
>   * should be done before executing the tuning process.
> 

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

end of thread, other threads:[~2017-09-25 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-25  8:56 [PATCH] mmc: core: add driver strength selection when selecting hs400es Chanho Min
2017-09-25 10:34 ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome