[V9,03/23] mmc: core: Announce successful insertion of an SD UHS-II card

Message ID 20230721101349.12387-4-victorshihgli@gmail.com
State New
Headers
Series Add support UHS-II for GL9755 |

Commit Message

Victor Shih July 21, 2023, 10:13 a.m. UTC
  From: Victor Shih <victor.shih@genesyslogic.com.tw>

Update in previous version:
To inform the users about SD UHS-II cards, let's extend the print at card
insertion with a "UHS-II" substring. Within this change, it seems
reasonable to convert from using "ultra high speed" into "UHS-I speed", for
the UHS-I type, as it should makes it more clear.

Note that, the new print for UHS-II cards doesn't include the actual
selected speed mode. Instead, this is going to be added from subsequent
change.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
---

Updates in V7:
 - Drop MMC_TIMING_SD_UHS2 in favor of MMC_TIMING_UHS2_SPEED_A in
   mmc_card_uhs2 function.

Updates in V4:
 - Make mmc_card_uhs2() take struct mmc_host* as in-param.

---

 drivers/mmc/core/bus.c  | 4 +++-
 drivers/mmc/core/host.h | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
  

Comments

Ulf Hansson Aug. 8, 2023, 10:24 a.m. UTC | #1
On Fri, 21 Jul 2023 at 12:14, Victor Shih <victorshihgli@gmail.com> wrote:
>
> From: Victor Shih <victor.shih@genesyslogic.com.tw>

Authorship?

>
> Update in previous version:

Please, drop the above.

> To inform the users about SD UHS-II cards, let's extend the print at card
> insertion with a "UHS-II" substring. Within this change, it seems
> reasonable to convert from using "ultra high speed" into "UHS-I speed", for
> the UHS-I type, as it should makes it more clear.
>
> Note that, the new print for UHS-II cards doesn't include the actual
> selected speed mode. Instead, this is going to be added from subsequent
> change.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
> ---
>
> Updates in V7:
>  - Drop MMC_TIMING_SD_UHS2 in favor of MMC_TIMING_UHS2_SPEED_A in
>    mmc_card_uhs2 function.
>
> Updates in V4:
>  - Make mmc_card_uhs2() take struct mmc_host* as in-param.
>
> ---
>
>  drivers/mmc/core/bus.c  | 4 +++-
>  drivers/mmc/core/host.h | 7 +++++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index cf32cf135781..d9a3b3d38d8b 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -341,7 +341,9 @@ int mmc_add_card(struct mmc_card *card)
>         if (mmc_card_hs(card))
>                 speed_mode = "high speed ";
>         else if (mmc_card_uhs(card))
> -               speed_mode = "ultra high speed ";
> +               speed_mode = "UHS-I speed ";
> +       else if (mmc_card_uhs2(card->host))
> +               speed_mode = "UHS-II speed ";
>         else if (mmc_card_ddr52(card))
>                 speed_mode = "high speed DDR ";
>         else if (mmc_card_hs200(card))
> diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
> index 48c4952512a5..9f6e5e31dfea 100644
> --- a/drivers/mmc/core/host.h
> +++ b/drivers/mmc/core/host.h
> @@ -89,5 +89,12 @@ static inline bool mmc_card_sd_express(struct mmc_host *host)
>                 host->ios.timing == MMC_TIMING_SD_EXP_1_2V;
>  }
>
> +static inline bool mmc_card_uhs2(struct mmc_host *host)
> +{
> +       return host->ios.timing == MMC_TIMING_UHS2_SPEED_A ||
> +              host->ios.timing == MMC_TIMING_UHS2_SPEED_A_HD ||
> +              host->ios.timing == MMC_TIMING_UHS2_SPEED_B ||
> +              host->ios.timing == MMC_TIMING_UHS2_SPEED_B_HD;
> +}
>  #endif
>

Kind regards
Uffe
  

Patch

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index cf32cf135781..d9a3b3d38d8b 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -341,7 +341,9 @@  int mmc_add_card(struct mmc_card *card)
 	if (mmc_card_hs(card))
 		speed_mode = "high speed ";
 	else if (mmc_card_uhs(card))
-		speed_mode = "ultra high speed ";
+		speed_mode = "UHS-I speed ";
+	else if (mmc_card_uhs2(card->host))
+		speed_mode = "UHS-II speed ";
 	else if	(mmc_card_ddr52(card))
 		speed_mode = "high speed DDR ";
 	else if (mmc_card_hs200(card))
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 48c4952512a5..9f6e5e31dfea 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -89,5 +89,12 @@  static inline bool mmc_card_sd_express(struct mmc_host *host)
 		host->ios.timing == MMC_TIMING_SD_EXP_1_2V;
 }
 
+static inline bool mmc_card_uhs2(struct mmc_host *host)
+{
+	return host->ios.timing == MMC_TIMING_UHS2_SPEED_A ||
+	       host->ios.timing == MMC_TIMING_UHS2_SPEED_A_HD ||
+	       host->ios.timing == MMC_TIMING_UHS2_SPEED_B ||
+	       host->ios.timing == MMC_TIMING_UHS2_SPEED_B_HD;
+}
 #endif