All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
@ 2020-12-10 18:22 Douglas Anderson
  2020-12-10 18:22 ` [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2 Douglas Anderson
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Douglas Anderson @ 2020-12-10 18:22 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Taniya Das, vbadigan, Douglas Anderson, Andy Gross,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

I would repeat the same commit message that was in commit 5e4b7e82d497
("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems
silly to do so when you could just go read that commit.

NOTE: this is actually extra terrible because we're missing the 50 MHz
rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add
50 MHz clock rate for SDC2")).  That means then when you run an older
SD card it'll try to clock it at 100 MHz when it's only specced to run
at 50 MHz max.  As you can probably guess that doesn't work super
well.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
---
Taniya: can you please update whatever process is used to generate
these clock files to use floor for SD card clocks.  I hope you can
also scour through these files looking for similar problems on other
SoCs and submit patches for them.

 drivers/clk/qcom/gcc-sc7180.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c
index 68d8f7aaf64e..b080739ab0c3 100644
--- a/drivers/clk/qcom/gcc-sc7180.c
+++ b/drivers/clk/qcom/gcc-sc7180.c
@@ -642,7 +642,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = {
 		.name = "gcc_sdcc1_ice_core_clk_src",
 		.parent_data = gcc_parent_data_0,
 		.num_parents = 4,
-		.ops = &clk_rcg2_ops,
+		.ops = &clk_rcg2_floor_ops,
 	},
 };
 
@@ -666,7 +666,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = {
 		.name = "gcc_sdcc2_apps_clk_src",
 		.parent_data = gcc_parent_data_5,
 		.num_parents = 5,
-		.ops = &clk_rcg2_ops,
+		.ops = &clk_rcg2_floor_ops,
 	},
 };
 
-- 
2.29.2.576.ga3fc446d84-goog


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

* [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2
  2020-12-10 18:22 [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Douglas Anderson
@ 2020-12-10 18:22 ` Douglas Anderson
  2020-12-10 19:41   ` Bjorn Andersson
  2020-12-10 20:27   ` Stephen Boyd
  2020-12-10 19:39 ` [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Bjorn Andersson
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 9+ messages in thread
From: Douglas Anderson @ 2020-12-10 18:22 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Taniya Das, vbadigan, Douglas Anderson, Andy Gross,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

50 MHz is an incredibly common clock rate for SD cards to run at.
It's "high speed" mode in SD (not very fast these days, but it used to
be) or:
  #define HIGH_SPEED_MAX_DTR	50000000

If we don't support this then older "high speed" cards can only run at
25 MHz or at half their normal speed.  There doesn't seem to be any
reason to skip this clock rate, so add it.

Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/clk/qcom/gcc-sc7180.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c
index b080739ab0c3..d82d725ac231 100644
--- a/drivers/clk/qcom/gcc-sc7180.c
+++ b/drivers/clk/qcom/gcc-sc7180.c
@@ -651,6 +651,7 @@ static const struct freq_tbl ftbl_gcc_sdcc2_apps_clk_src[] = {
 	F(9600000, P_BI_TCXO, 2, 0, 0),
 	F(19200000, P_BI_TCXO, 1, 0, 0),
 	F(25000000, P_GPLL0_OUT_EVEN, 12, 0, 0),
+	F(50000000, P_GPLL0_OUT_EVEN, 6, 0, 0),
 	F(100000000, P_GPLL0_OUT_EVEN, 3, 0, 0),
 	F(202000000, P_GPLL7_OUT_MAIN, 4, 0, 0),
 	{ }
-- 
2.29.2.576.ga3fc446d84-goog


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

* Re: [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
  2020-12-10 18:22 [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Douglas Anderson
  2020-12-10 18:22 ` [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2 Douglas Anderson
@ 2020-12-10 19:39 ` Bjorn Andersson
  2020-12-10 20:27 ` Stephen Boyd
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2020-12-10 19:39 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Stephen Boyd, Taniya Das, vbadigan, Andy Gross,
	Michael Turquette, linux-arm-msm, linux-clk, linux-kernel

On Thu 10 Dec 12:22 CST 2020, Douglas Anderson wrote:

> I would repeat the same commit message that was in commit 5e4b7e82d497
> ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems
> silly to do so when you could just go read that commit.
> 
> NOTE: this is actually extra terrible because we're missing the 50 MHz
> rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add
> 50 MHz clock rate for SDC2")).  That means then when you run an older
> SD card it'll try to clock it at 100 MHz when it's only specced to run
> at 50 MHz max.  As you can probably guess that doesn't work super
> well.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
> ---
> Taniya: can you please update whatever process is used to generate
> these clock files to use floor for SD card clocks.  I hope you can
> also scour through these files looking for similar problems on other
> SoCs and submit patches for them.
> 
>  drivers/clk/qcom/gcc-sc7180.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c
> index 68d8f7aaf64e..b080739ab0c3 100644
> --- a/drivers/clk/qcom/gcc-sc7180.c
> +++ b/drivers/clk/qcom/gcc-sc7180.c
> @@ -642,7 +642,7 @@ static struct clk_rcg2 gcc_sdcc1_ice_core_clk_src = {
>  		.name = "gcc_sdcc1_ice_core_clk_src",
>  		.parent_data = gcc_parent_data_0,
>  		.num_parents = 4,
> -		.ops = &clk_rcg2_ops,
> +		.ops = &clk_rcg2_floor_ops,
>  	},
>  };
>  
> @@ -666,7 +666,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = {
>  		.name = "gcc_sdcc2_apps_clk_src",
>  		.parent_data = gcc_parent_data_5,
>  		.num_parents = 5,
> -		.ops = &clk_rcg2_ops,
> +		.ops = &clk_rcg2_floor_ops,
>  	},
>  };
>  
> -- 
> 2.29.2.576.ga3fc446d84-goog
> 

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

* Re: [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2
  2020-12-10 18:22 ` [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2 Douglas Anderson
@ 2020-12-10 19:41   ` Bjorn Andersson
  2020-12-10 20:27   ` Stephen Boyd
  1 sibling, 0 replies; 9+ messages in thread
From: Bjorn Andersson @ 2020-12-10 19:41 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Stephen Boyd, Taniya Das, vbadigan, Andy Gross,
	Michael Turquette, linux-arm-msm, linux-clk, linux-kernel

On Thu 10 Dec 12:22 CST 2020, Douglas Anderson wrote:

> 50 MHz is an incredibly common clock rate for SD cards to run at.
> It's "high speed" mode in SD (not very fast these days, but it used to
> be) or:
>   #define HIGH_SPEED_MAX_DTR	50000000
> 
> If we don't support this then older "high speed" cards can only run at
> 25 MHz or at half their normal speed.  There doesn't seem to be any
> reason to skip this clock rate, so add it.
> 
> Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
> 
>  drivers/clk/qcom/gcc-sc7180.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/qcom/gcc-sc7180.c b/drivers/clk/qcom/gcc-sc7180.c
> index b080739ab0c3..d82d725ac231 100644
> --- a/drivers/clk/qcom/gcc-sc7180.c
> +++ b/drivers/clk/qcom/gcc-sc7180.c
> @@ -651,6 +651,7 @@ static const struct freq_tbl ftbl_gcc_sdcc2_apps_clk_src[] = {
>  	F(9600000, P_BI_TCXO, 2, 0, 0),
>  	F(19200000, P_BI_TCXO, 1, 0, 0),
>  	F(25000000, P_GPLL0_OUT_EVEN, 12, 0, 0),
> +	F(50000000, P_GPLL0_OUT_EVEN, 6, 0, 0),
>  	F(100000000, P_GPLL0_OUT_EVEN, 3, 0, 0),
>  	F(202000000, P_GPLL7_OUT_MAIN, 4, 0, 0),
>  	{ }
> -- 
> 2.29.2.576.ga3fc446d84-goog
> 

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

* Re: [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
  2020-12-10 18:22 [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Douglas Anderson
  2020-12-10 18:22 ` [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2 Douglas Anderson
  2020-12-10 19:39 ` [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Bjorn Andersson
@ 2020-12-10 20:27 ` Stephen Boyd
  2020-12-10 21:00   ` Doug Anderson
  2020-12-10 20:27 ` Stephen Boyd
  2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  4 siblings, 1 reply; 9+ messages in thread
From: Stephen Boyd @ 2020-12-10 20:27 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Taniya Das, vbadigan, Douglas Anderson, Andy Gross,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

Quoting Douglas Anderson (2020-12-10 10:22:38)
> I would repeat the same commit message that was in commit 5e4b7e82d497
> ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems
> silly to do so when you could just go read that commit.
> 
> NOTE: this is actually extra terrible because we're missing the 50 MHz
> rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add
> 50 MHz clock rate for SDC2")).  That means then when you run an older
> SD card it'll try to clock it at 100 MHz when it's only specced to run
> at 50 MHz max.  As you can probably guess that doesn't work super
> well.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
> ---
> Taniya: can you please update whatever process is used to generate
> these clock files to use floor for SD card clocks.  I hope you can
> also scour through these files looking for similar problems on other
> SoCs and submit patches for them.

Any chance the consumer of this clk can call clk_round_rate() and WARN()
if the rate is not anywhere near what it wants it to be? I fear that
this problem will just keep coming up otherwise.

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

* Re: [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
  2020-12-10 18:22 [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Douglas Anderson
                   ` (2 preceding siblings ...)
  2020-12-10 20:27 ` Stephen Boyd
@ 2020-12-10 20:27 ` Stephen Boyd
  2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  4 siblings, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2020-12-10 20:27 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Taniya Das, vbadigan, Douglas Anderson, Andy Gross,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

Quoting Douglas Anderson (2020-12-10 10:22:38)
> I would repeat the same commit message that was in commit 5e4b7e82d497
> ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems
> silly to do so when you could just go read that commit.
> 
> NOTE: this is actually extra terrible because we're missing the 50 MHz
> rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add
> 50 MHz clock rate for SDC2")).  That means then when you run an older
> SD card it'll try to clock it at 100 MHz when it's only specced to run
> at 50 MHz max.  As you can probably guess that doesn't work super
> well.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
> ---

Applied to clk-next

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

* Re: [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2
  2020-12-10 18:22 ` [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2 Douglas Anderson
  2020-12-10 19:41   ` Bjorn Andersson
@ 2020-12-10 20:27   ` Stephen Boyd
  1 sibling, 0 replies; 9+ messages in thread
From: Stephen Boyd @ 2020-12-10 20:27 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Taniya Das, vbadigan, Douglas Anderson, Andy Gross,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

Quoting Douglas Anderson (2020-12-10 10:22:39)
> 50 MHz is an incredibly common clock rate for SD cards to run at.
> It's "high speed" mode in SD (not very fast these days, but it used to
> be) or:
>   #define HIGH_SPEED_MAX_DTR    50000000
> 
> If we don't support this then older "high speed" cards can only run at
> 25 MHz or at half their normal speed.  There doesn't seem to be any
> reason to skip this clock rate, so add it.
> 
> Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---

Applied to clk-next

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

* Re: [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
  2020-12-10 20:27 ` Stephen Boyd
@ 2020-12-10 21:00   ` Doug Anderson
  0 siblings, 0 replies; 9+ messages in thread
From: Doug Anderson @ 2020-12-10 21:00 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Taniya Das, Veerabhadrarao Badiganti, Andy Gross,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	LKML

Hi,

On Thu, Dec 10, 2020 at 12:27 PM Stephen Boyd <sboyd@kernel.org> wrote:
>
> Quoting Douglas Anderson (2020-12-10 10:22:38)
> > I would repeat the same commit message that was in commit 5e4b7e82d497
> > ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems
> > silly to do so when you could just go read that commit.
> >
> > NOTE: this is actually extra terrible because we're missing the 50 MHz
> > rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add
> > 50 MHz clock rate for SDC2")).  That means then when you run an older
> > SD card it'll try to clock it at 100 MHz when it's only specced to run
> > at 50 MHz max.  As you can probably guess that doesn't work super
> > well.
> >
> > Signed-off-by: Douglas Anderson <dianders@chromium.org>
> > Fixes: 17269568f726 ("clk: qcom: Add Global Clock controller (GCC) driver for SC7180")
> > ---
> > Taniya: can you please update whatever process is used to generate
> > these clock files to use floor for SD card clocks.  I hope you can
> > also scour through these files looking for similar problems on other
> > SoCs and submit patches for them.
>
> Any chance the consumer of this clk can call clk_round_rate() and WARN()
> if the rate is not anywhere near what it wants it to be? I fear that
> this problem will just keep coming up otherwise.

Good idea.  Posted ("[PATCH] mmc: sdhci-msm: Warn about overclocking
SD/MMC") [1].

I just checked for the clock being higher, not lower and I did a
normal print rather than a WARN splat.

Interestingly this shows that we were also overclocking the eMMC
during probe (though we end up at a proper rate in the end).  I saw
these transitory errors during boot:

[    6.287870] mmc0: Card appears overclocked; req 52000000 Hz, actual
100000000 Hz
[    6.295811] mmc0: Card appears overclocked; req 52000000 Hz, actual
100000000 Hz
[    6.312573] mmc0: Card appears overclocked; req 104000000 Hz,
actual 192000000 Hz

[1] https://lore.kernel.org/r/20201210125709.1.Iec3430c7d3c2a29262695edef7b82a14aaa567e5@changeid

-Doug

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

* Re: [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
  2020-12-10 18:22 [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Douglas Anderson
                   ` (3 preceding siblings ...)
  2020-12-10 20:27 ` Stephen Boyd
@ 2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
  4 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2020-12-29 20:15 UTC (permalink / raw)
  To: Douglas Anderson; +Cc: linux-arm-msm

Hello:

This series was applied to qcom/linux.git (refs/heads/for-next):

On Thu, 10 Dec 2020 10:22:38 -0800 you wrote:
> I would repeat the same commit message that was in commit 5e4b7e82d497
> ("clk: qcom: gcc-sdm845: Use floor ops for sdcc clks") but it seems
> silly to do so when you could just go read that commit.
> 
> NOTE: this is actually extra terrible because we're missing the 50 MHz
> rate in the table (see the next patch AKA ("clk: qcom: gcc-sc7180: Add
> 50 MHz clock rate for SDC2")).  That means then when you run an older
> SD card it'll try to clock it at 100 MHz when it's only specced to run
> at 50 MHz max.  As you can probably guess that doesn't work super
> well.
> 
> [...]

Here is the summary with links:
  - [1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks
    https://git.kernel.org/qcom/c/6d37a8d19283
  - [2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2
    https://git.kernel.org/qcom/c/043577518f02

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2020-12-29 20:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 18:22 [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Douglas Anderson
2020-12-10 18:22 ` [PATCH 2/2] clk: qcom: gcc-sc7180: Add 50 MHz clock rate for SDC2 Douglas Anderson
2020-12-10 19:41   ` Bjorn Andersson
2020-12-10 20:27   ` Stephen Boyd
2020-12-10 19:39 ` [PATCH 1/2] clk: qcom: gcc-sc7180: Use floor ops for sdcc clks Bjorn Andersson
2020-12-10 20:27 ` Stephen Boyd
2020-12-10 21:00   ` Doug Anderson
2020-12-10 20:27 ` Stephen Boyd
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.