Skip to contentSkip to conversation

mmc: sdhci-of-esdhc: limit the SDHC clock frequency

PATCH In review [email protected] 2 participants 3 messages Nov 24, 2022 – Nov 29, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci-of-esdhc: limit the SDHC clock frequency

From: Yuantian Tang <[email protected]>

The highest clock frequency for eMMC HS200 mode on ls1043a is 116.7Mhz according to its specification.
So add the limit to gate the frequency.

---
 drivers/mmc/host/sdhci-of-esdhc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +7 -0
index 00542dd74c07..1fd4ae10862d 100644
@@ -43,6 +43,12 @@ static const struct esdhc_clk_fixup ls1021a_esdhc_clk = {
 	.max_clk[MMC_TIMING_SD_HS] = 46500000,
 };
 
+static const struct esdhc_clk_fixup ls1043a_esdhc_clk = {
+	.sd_dflt_max_clk = 25000000,
+	.max_clk[MMC_TIMING_UHS_SDR104] = 116700000,
+	.max_clk[MMC_TIMING_MMC_HS200] = 116700000,
+};
+
 static const struct esdhc_clk_fixup ls1046a_esdhc_clk = {
 	.sd_dflt_max_clk = 25000000,
 	.max_clk[MMC_TIMING_UHS_SDR104] = 167000000,
@@ -64,6 +70,7 @@ static const struct esdhc_clk_fixup p1010_esdhc_clk = {
 
 static const struct of_device_id sdhci_esdhc_of_match[] = {
 	{ .compatible = "fsl,ls1021a-esdhc", .data = &ls1021a_esdhc_clk},
+	{ .compatible = "fsl,ls1043a-esdhc", .data = &ls1043a_esdhc_clk},
 	{ .compatible = "fsl,ls1046a-esdhc", .data = &ls1046a_esdhc_clk},
 	{ .compatible = "fsl,ls1012a-esdhc", .data = &ls1012a_esdhc_clk},
 	{ .compatible = "fsl,p1010-esdhc",   .data = &p1010_esdhc_clk},
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 7 lines · On 24/11/22 08:46, [email protected] wrote:

From: Yuantian Tang <[email protected]>

The highest clock frequency for eMMC HS200 mode on ls1043a is 116.7Mhz according to its specification.
So add the limit to gate the frequency.

It is probably nicer to use a consistent email name. checkpatch gives this warning:

WARNING: From:/Signed-off-by: email name mismatch: 'From: Yuantian Tang <[email protected]>' != 'Signed-off-by: Andy Tang <[email protected]>'

Quoted 9 lines
---
 drivers/mmc/host/sdhci-of-esdhc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +0 -0
index 00542dd74c07..1fd4ae10862d 100644

drivers/mmc/host/sdhci-of-esdhc.c static const struct esdhc_clk_fixup ls1021a_esdhc_clk = { · line 50

Quoted 8 lines
drivers/mmc/host/sdhci-of-esdhc.c +5 -0
@@ -43,6 +43,12 @@ static const struct esdhc_clk_fixup ls1021a_esdhc_clk = {
 	.max_clk[MMC_TIMING_SD_HS] = 46500000,
 };
 
+static const struct esdhc_clk_fixup ls1043a_esdhc_clk = {
+	.sd_dflt_max_clk = 25000000,
+	.max_clk[MMC_TIMING_UHS_SDR104] = 116700000,
+	.max_clk[MMC_TIMING_MMC_HS200] = 116700000,
+};

ls1043a_esdhc_clk seems the same as ls1046a_esdhc_clk Should they be shared? e.g. called ls104xx_esdhc_clk

Quoted 12 lines
drivers/mmc/host/sdhci-of-esdhc.c +2 -0
+
 static const struct esdhc_clk_fixup ls1046a_esdhc_clk = {
 	.sd_dflt_max_clk = 25000000,
 	.max_clk[MMC_TIMING_UHS_SDR104] = 167000000,
@@ -64,6 +70,7 @@ static const struct esdhc_clk_fixup p1010_esdhc_clk = {
 
 static const struct of_device_id sdhci_esdhc_of_match[] = {
 	{ .compatible = "fsl,ls1021a-esdhc", .data = &ls1021a_esdhc_clk},
+	{ .compatible = "fsl,ls1043a-esdhc", .data = &ls1043a_esdhc_clk},
 	{ .compatible = "fsl,ls1046a-esdhc", .data = &ls1046a_esdhc_clk},
 	{ .compatible = "fsl,ls1012a-esdhc", .data = &ls1012a_esdhc_clk},
 	{ .compatible = "fsl,p1010-esdhc",   .data = &p1010_esdhc_clk},
author
#2 lore raw

Hi Adrian,

Thanks for your review. Please see my reply inline.

Quoted 17 lines

-----Original Message-----
From: Adrian Hunter <[email protected]>
Sent: 2022年11月29日 16:05
To: Andy Tang <[email protected]>; [email protected]
Cc: [email protected]; [email protected]
Subject: [EXT] Re: [PATCH] mmc: sdhci-of-esdhc: limit the SDHC clock frequency

Caution: EXT Email

Quoted 6 lines · On 24/11/22 08:46, [email protected] wrote:

From: Yuantian Tang <[email protected]>

The highest clock frequency for eMMC HS200 mode on ls1043a is 116.7Mhz according to its specification.
So add the limit to gate the frequency.

Quoted 7 lines
Quoted 1 line

It is probably nicer to use a consistent email name. checkpatch gives this warning:

WARNING: From:/Signed-off-by: email name mismatch: 'From: Yuantian Tang <[email protected]>' != 'Signed-off-by: Andy Tang <[email protected]>'

OK, will keep it consistent.

Quoted 14 lines

drivers/mmc/host/sdhci-of-esdhc.c static const struct esdhc_clk_fixup

Quoted 11 lines
---
 drivers/mmc/host/sdhci-of-esdhc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mmc/host/sdhci-of-esdhc.c +0 -0
index 00542dd74c07..1fd4ae10862d 100644
@@ -43,6 +43,12 @@ static const struct esdhc_clk_fixup

ls1021a_esdhc_clk = {

Quoted 2 lines
drivers/mmc/host/sdhci-of-esdhc.c +0 -0
      .max_clk[MMC_TIMING_SD_HS] = 46500000,  };
 
Quoted 7 lines

drivers/mmc/host/sdhci-of-esdhc.c static const struct esdhc_clk_fixup ls1021a_esdhc_clk = {

Quoted 4 lines
drivers/mmc/host/sdhci-of-esdhc.c +4 -0
+static const struct esdhc_clk_fixup ls1043a_esdhc_clk = {
+     .sd_dflt_max_clk = 25000000,
+     .max_clk[MMC_TIMING_UHS_SDR104] = 116700000,
+     .max_clk[MMC_TIMING_MMC_HS200] = 116700000, };

ls1043a_esdhc_clk seems the same as ls1046a_esdhc_clk Should they be shared? e.g. called ls104xx_esdhc_clk

The values are different. One is the 116700Khz, the other is 167000Khz. Even they are the same, it is better to have its own clk struct for future compatibility.

Thanks,
Andy

Quoted 16 lines

drivers/mmc/host/sdhci-of-esdhc.c static const struct esdhc_clk_fixup ls1021a_esdhc_clk = {

Quoted 5 lines
drivers/mmc/host/sdhci-of-esdhc.c +1 -0
+
 static const struct esdhc_clk_fixup ls1046a_esdhc_clk = {
      .sd_dflt_max_clk = 25000000,
      .max_clk[MMC_TIMING_UHS_SDR104] = 167000000, @@ -64,6

+70,7 @@

Quoted 10 lines
drivers/mmc/host/sdhci-of-esdhc.c +0 -0
 static const struct esdhc_clk_fixup p1010_esdhc_clk = {
 
 static const struct of_device_id sdhci_esdhc_of_match[] = {
      { .compatible = "fsl,ls1021a-esdhc", .data =

&ls1021a_esdhc_clk},
+ { .compatible = "fsl,ls1043a-esdhc", .data =
+ &ls1043a_esdhc_clk},

      { .compatible = "fsl,ls1046a-esdhc", .data = &ls1046a_esdhc_clk},
      { .compatible = "fsl,ls1012a-esdhc", .data = &ls1012a_esdhc_clk},
      { .compatible = "fsl,p1010-esdhc",   .data = &p1010_esdhc_clk},