Skip to contentSkip to conversation

mmc: meson-gx: fix setting f_min

PATCH Superseded Heiner Kallweit 3 participants 4 messages Jan 31, 2017 – Feb 3, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 mmc: meson-gx: fix setting f_min

Currently f_min is set to 4 MHz whilst the comment states 400 MHz. I think the itention is to set f_min to 400 kHz.
Change value and comment accordingly.

---
 drivers/mmc/host/meson-gx-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/meson-gx-mmc.c +1 -1
index 5eca88bc..da3cce31 100644
@@ -268,7 +268,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
 	if (f_min != UINT_MAX)
 		f_min = DIV_ROUND_UP(CLK_SRC_XTAL_RATE, CLK_DIV_MAX);
 	else
-		f_min = 4000000;  /* default min: 400 MHz */
+		f_min = 400000;  /* default min: 400 kHz */
 	host->mmc->f_min = f_min;
 
 	/* create the mux */
Signature · 1 line
2.11.0
#1 lore raw
Quoted 14 lines · Heiner Kallweit

Currently f_min is set to 4 MHz whilst the comment states 400 MHz. I think the itention is to set f_min to 400 kHz.
Change value and comment accordingly.

---
 drivers/mmc/host/meson-gx-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/meson-gx-mmc.c +0 -0
index 5eca88bc..da3cce31 100644

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_init(struct meson_host *host) · line 271

Quoted 5 lines
drivers/mmc/host/meson-gx-mmc.c +1 -1
@@ -268,7 +268,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
 	if (f_min != UINT_MAX)
 		f_min = DIV_ROUND_UP(CLK_SRC_XTAL_RATE, CLK_DIV_MAX);
 	else
-		f_min = 4000000;  /* default min: 400 MHz */
+		f_min = 400000;  /* default min: 400 kHz */

I'm not sure but f_min can be 100KHz by default, not 400KHz. Because mmc-core should be try to find frequency from 400KHz to "f_min" value.

Best Regards,
Jaehoon Chung

Quoted 4 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
 	host->mmc->f_min = f_min;
 
 	/* create the mux */
#2 lore raw

Am 01.02.2017 um 12:49 schrieb Jaehoon Chung:

Quoted 10 lines · Heiner Kallweit
Quoted 9 lines

Currently f_min is set to 4 MHz whilst the comment states 400 MHz. I think the itention is to set f_min to 400 kHz.
Change value and comment accordingly.

---
 drivers/mmc/host/meson-gx-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_init(struct meson_host *host) · line 271

Quoted 10 lines
drivers/mmc/host/meson-gx-mmc.c +1 -1
index 5eca88bc..da3cce31 100644
@@ -268,7 +268,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
 	if (f_min != UINT_MAX)
 		f_min = DIV_ROUND_UP(CLK_SRC_XTAL_RATE, CLK_DIV_MAX);
 	else
-		f_min = 4000000;  /* default min: 400 MHz */
+		f_min = 400000;  /* default min: 400 kHz */

I'm not sure but f_min can be 100KHz by default, not 400KHz. Because mmc-core should be try to find frequency from 400KHz to "f_min" value.

Actually I wonder how we can ever reach this part of the if clause. If at least one parent clock is defined and we can get its clock rate then f_min != UINT_MAX.
Can we think of a case where no parent clock is defined? And would it make sense at all to proceed in this case?

Quoted 9 lines

Best Regards,
Jaehoon Chung

Quoted 4 lines
drivers/mmc/host/meson-gx-mmc.c +0 -0
 	host->mmc->f_min = f_min;
 
 	/* create the mux */
maintainer
#3 lore raw
Quoted 25 lines · Heiner Kallweit

Am 01.02.2017 um 12:49 schrieb Jaehoon Chung:

Quoted 10 lines · Heiner Kallweit
Quoted 9 lines

Currently f_min is set to 4 MHz whilst the comment states 400 MHz. I think the itention is to set f_min to 400 kHz.
Change value and comment accordingly.

---
 drivers/mmc/host/meson-gx-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_clk_init(struct meson_host *host) · line 271

Quoted 10 lines
drivers/mmc/host/meson-gx-mmc.c +1 -1
index 5eca88bc..da3cce31 100644
@@ -268,7 +268,7 @@ static int meson_mmc_clk_init(struct meson_host *host)
 	if (f_min != UINT_MAX)
 		f_min = DIV_ROUND_UP(CLK_SRC_XTAL_RATE, CLK_DIV_MAX);
 	else
-		f_min = 4000000;  /* default min: 400 MHz */
+		f_min = 400000;  /* default min: 400 kHz */

I'm not sure but f_min can be 100KHz by default, not 400KHz. Because mmc-core should be try to find frequency from 400KHz to "f_min" value.

Quoted 5 lines

Actually I wonder how we can ever reach this part of the if clause. If at least one parent clock is defined and we can get its clock rate then f_min != UINT_MAX.
Can we think of a case where no parent clock is defined? And would it make sense at all to proceed in this case?

This is actually common while adding a new board or SoC and is a useful fallback/safeguard.

Kevin