2022-07-05 00:43:27

by 이승희

[permalink] [raw]
Subject: [PATCH] mmc: print clock frequency with recognization

It's easy to figure out how fast frequency it has from the log.
e.g. mmc0: new ultra high speed SDR104 SDXC card
at address aaaa(clk 202000000)

Signed-off-by: Seunghui Lee <[email protected]>
---
drivers/mmc/core/bus.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 58a60afa650b..3623cc27a61c 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -348,7 +348,7 @@ int mmc_add_card(struct mmc_card *card)
mmc_card_ddr52(card) ? "DDR " : "",
type);
} else {
- pr_info("%s: new %s%s%s%s%s%s card at address %04x\n",
+ pr_info("%s: new %s%s%s%s%s%s card at address %04x(clk %u)\n",
mmc_hostname(card->host),
mmc_card_uhs(card) ? "ultra high speed " :
(mmc_card_hs(card) ? "high speed " : ""),
@@ -356,7 +356,8 @@ int mmc_add_card(struct mmc_card *card)
(mmc_card_hs200(card) ? "HS200 " : ""),
mmc_card_hs400es(card) ? "Enhanced strobe " : "",
mmc_card_ddr52(card) ? "DDR " : "",
- uhs_bus_speed_mode, type, card->rca);
+ uhs_bus_speed_mode, type, card->rca,
+ card->host->ios.clock);
}

#ifdef CONFIG_DEBUG_FS
--
2.29.0


2022-07-12 00:43:38

by 이승희

[permalink] [raw]
Subject: RE: [PATCH] mmc: print clock frequency with recognization

> -----Original Message-----
> From: Seunghui Lee <[email protected]>
> Sent: Tuesday, July 5, 2022 9:51 AM
> To: [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Seunghui Lee <[email protected]>
> Subject: [PATCH] mmc: print clock frequency with recognization
>
> It's easy to figure out how fast frequency it has from the log.
> e.g. mmc0: new ultra high speed SDR104 SDXC card at address aaaa(clk
> 202000000)
>
> Signed-off-by: Seunghui Lee <[email protected]>
> ---
> drivers/mmc/core/bus.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index
> 58a60afa650b..3623cc27a61c 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -348,7 +348,7 @@ int mmc_add_card(struct mmc_card *card)
> mmc_card_ddr52(card) ? "DDR " : "",
> type);
> } else {
> - pr_info("%s: new %s%s%s%s%s%s card at address %04x\n",
> + pr_info("%s: new %s%s%s%s%s%s card at
> address %04x(clk %u)\n",
> mmc_hostname(card->host),
> mmc_card_uhs(card) ? "ultra high speed " :
> (mmc_card_hs(card) ? "high speed " : ""), @@ -356,7
> +356,8 @@ int mmc_add_card(struct mmc_card *card)
> (mmc_card_hs200(card) ? "HS200 " : ""),
> mmc_card_hs400es(card) ? "Enhanced strobe " : "",
> mmc_card_ddr52(card) ? "DDR " : "",
> - uhs_bus_speed_mode, type, card->rca);
> + uhs_bus_speed_mode, type, card->rca,
> + card->host->ios.clock);
> }
>
> #ifdef CONFIG_DEBUG_FS
> --
> 2.29.0
Please give me any opinion or suggestion about this commit.
Normally, the SD card's bus speed depends on both host controller and internal PLL.
There are lots of host controller vendor in the market as well.
So, we can guess the exact clock speed from this commit.

2022-07-12 11:24:58

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH] mmc: print clock frequency with recognization

On Tue, 5 Jul 2022 at 02:18, Seunghui Lee <[email protected]> wrote:
>
> It's easy to figure out how fast frequency it has from the log.
> e.g. mmc0: new ultra high speed SDR104 SDXC card
> at address aaaa(clk 202000000)

Well, this information is already available through debugfs and I
think that is sufficient.

Moreover, card->host->ios.clock doesn't necessarily contain that
actual clock rate, but rather the rate that is requested by the core.
To really know the rate the bus is running on,
card->host->ios.actual_clock needs to be checked too. This too is
available through debugfs.

Kind regards
Uffe

>
> Signed-off-by: Seunghui Lee <[email protected]>
> ---
> drivers/mmc/core/bus.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
> index 58a60afa650b..3623cc27a61c 100644
> --- a/drivers/mmc/core/bus.c
> +++ b/drivers/mmc/core/bus.c
> @@ -348,7 +348,7 @@ int mmc_add_card(struct mmc_card *card)
> mmc_card_ddr52(card) ? "DDR " : "",
> type);
> } else {
> - pr_info("%s: new %s%s%s%s%s%s card at address %04x\n",
> + pr_info("%s: new %s%s%s%s%s%s card at address %04x(clk %u)\n",
> mmc_hostname(card->host),
> mmc_card_uhs(card) ? "ultra high speed " :
> (mmc_card_hs(card) ? "high speed " : ""),
> @@ -356,7 +356,8 @@ int mmc_add_card(struct mmc_card *card)
> (mmc_card_hs200(card) ? "HS200 " : ""),
> mmc_card_hs400es(card) ? "Enhanced strobe " : "",
> mmc_card_ddr52(card) ? "DDR " : "",
> - uhs_bus_speed_mode, type, card->rca);
> + uhs_bus_speed_mode, type, card->rca,
> + card->host->ios.clock);
> }
>
> #ifdef CONFIG_DEBUG_FS
> --
> 2.29.0
>