Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks
@ 2019-08-30 19:51 Stephen Boyd
  2019-08-30 21:34 ` Doug Anderson
  2019-09-09 10:25 ` Stephen Boyd
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Boyd @ 2019-08-30 19:51 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, linux-arm-msm, Douglas Anderson, Taniya Das

Some MMC cards fail to enumerate properly when inserted into an MMC slot
on sdm845 devices. This is because the clk ops for qcom clks round the
frequency up to the nearest rate instead of down to the nearest rate.
For example, the MMC driver requests a frequency of 52MHz from
clk_set_rate() but the qcom implementation for these clks rounds 52MHz
up to the next supported frequency of 100MHz. The MMC driver could be
modified to request clk rate ranges but for now we can fix this in the
clk driver by changing the rounding policy for this clk to be round down
instead of round up.

Fixes: 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
Reported-by: Douglas Anderson <dianders@chromium.org>
Cc: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---

I suppose we need to do this for all the sdc clks in qcom driver?

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

diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c
index 7131dcf9b060..95be125c3bdd 100644
--- a/drivers/clk/qcom/gcc-sdm845.c
+++ b/drivers/clk/qcom/gcc-sdm845.c
@@ -685,7 +685,7 @@ static struct clk_rcg2 gcc_sdcc2_apps_clk_src = {
 		.name = "gcc_sdcc2_apps_clk_src",
 		.parent_names = gcc_parent_names_10,
 		.num_parents = 5,
-		.ops = &clk_rcg2_ops,
+		.ops = &clk_rcg2_floor_ops,
 	},
 };
 
@@ -709,7 +709,7 @@ static struct clk_rcg2 gcc_sdcc4_apps_clk_src = {
 		.name = "gcc_sdcc4_apps_clk_src",
 		.parent_names = gcc_parent_names_0,
 		.num_parents = 4,
-		.ops = &clk_rcg2_ops,
+		.ops = &clk_rcg2_floor_ops,
 	},
 };
 
-- 
Sent by a computer through tubes


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

* Re: [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks
  2019-08-30 19:51 [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks Stephen Boyd
@ 2019-08-30 21:34 ` Doug Anderson
  2019-09-03 15:52   ` Taniya Das
  2019-09-09 10:25 ` Stephen Boyd
  1 sibling, 1 reply; 6+ messages in thread
From: Doug Anderson @ 2019-08-30 21:34 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Stephen Boyd, LKML, linux-clk, linux-arm-msm,
	Taniya Das

Hi,

On Fri, Aug 30, 2019 at 12:51 PM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Some MMC cards fail to enumerate properly when inserted into an MMC slot
> on sdm845 devices. This is because the clk ops for qcom clks round the
> frequency up to the nearest rate instead of down to the nearest rate.
> For example, the MMC driver requests a frequency of 52MHz from
> clk_set_rate() but the qcom implementation for these clks rounds 52MHz
> up to the next supported frequency of 100MHz. The MMC driver could be
> modified to request clk rate ranges but for now we can fix this in the
> clk driver by changing the rounding policy for this clk to be round down
> instead of round up.

Since all the MMC rates are expressed as "maximum" clock rates doing
it like you are doing it now seems sane.


> Fixes: 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Cc: Taniya Das <tdas@codeaurora.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>
> I suppose we need to do this for all the sdc clks in qcom driver?

Seems like a good idea to me.


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

Reviewed-by: Douglas Anderson <dianders@chromium.org>


-Doug

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

* Re: [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks
  2019-08-30 21:34 ` Doug Anderson
@ 2019-09-03 15:52   ` Taniya Das
  2019-09-03 22:47     ` Stephen Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Taniya Das @ 2019-09-03 15:52 UTC (permalink / raw)
  To: Doug Anderson, Stephen Boyd
  Cc: Michael Turquette, Stephen Boyd, LKML, linux-clk, linux-arm-msm

Hi,

On 8/31/2019 3:04 AM, Doug Anderson wrote:
> Hi,
> 
> On Fri, Aug 30, 2019 at 12:51 PM Stephen Boyd <swboyd@chromium.org> wrote:
>>
>> Some MMC cards fail to enumerate properly when inserted into an MMC slot
>> on sdm845 devices. This is because the clk ops for qcom clks round the
>> frequency up to the nearest rate instead of down to the nearest rate.
>> For example, the MMC driver requests a frequency of 52MHz from
>> clk_set_rate() but the qcom implementation for these clks rounds 52MHz
>> up to the next supported frequency of 100MHz. The MMC driver could be
>> modified to request clk rate ranges but for now we can fix this in the
>> clk driver by changing the rounding policy for this clk to be round down
>> instead of round up.
> 
> Since all the MMC rates are expressed as "maximum" clock rates doing
> it like you are doing it now seems sane.
> 
> 

Looks like we need to update/track it for all SDCC clocks for all targets.


>> Fixes: 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
>> Reported-by: Douglas Anderson <dianders@chromium.org>
>> Cc: Taniya Das <tdas@codeaurora.org>
>> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
>> ---
>>
>> I suppose we need to do this for all the sdc clks in qcom driver?
> 
> Seems like a good idea to me.
> 
> 
>>   drivers/clk/qcom/gcc-sdm845.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> 
> 
> -Doug
> 

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation.

--

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

* Re: [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks
  2019-09-03 15:52   ` Taniya Das
@ 2019-09-03 22:47     ` Stephen Boyd
  2019-09-05  9:22       ` Taniya Das
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2019-09-03 22:47 UTC (permalink / raw)
  To: Doug Anderson, Taniya Das
  Cc: Michael Turquette, Stephen Boyd, LKML, linux-clk, linux-arm-msm

Quoting Taniya Das (2019-09-03 08:52:12)
> Hi,
> 
> On 8/31/2019 3:04 AM, Doug Anderson wrote:
> > Hi,
> > 
> > On Fri, Aug 30, 2019 at 12:51 PM Stephen Boyd <swboyd@chromium.org> wrote:
> >>
> >> Some MMC cards fail to enumerate properly when inserted into an MMC slot
> >> on sdm845 devices. This is because the clk ops for qcom clks round the
> >> frequency up to the nearest rate instead of down to the nearest rate.
> >> For example, the MMC driver requests a frequency of 52MHz from
> >> clk_set_rate() but the qcom implementation for these clks rounds 52MHz
> >> up to the next supported frequency of 100MHz. The MMC driver could be
> >> modified to request clk rate ranges but for now we can fix this in the
> >> clk driver by changing the rounding policy for this clk to be round down
> >> instead of round up.
> > 
> > Since all the MMC rates are expressed as "maximum" clock rates doing
> > it like you are doing it now seems sane.
> > 
> > 
> 
> Looks like we need to update/track it for all SDCC clocks for all targets.
> 

Yeah. It would be great if you can send the patches. Otherwise I'll
throw it on my todo list named 'forever'.


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

* Re: [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks
  2019-09-03 22:47     ` Stephen Boyd
@ 2019-09-05  9:22       ` Taniya Das
  0 siblings, 0 replies; 6+ messages in thread
From: Taniya Das @ 2019-09-05  9:22 UTC (permalink / raw)
  To: Stephen Boyd, Doug Anderson
  Cc: Michael Turquette, Stephen Boyd, LKML, linux-clk, linux-arm-msm



On 9/4/2019 4:17 AM, Stephen Boyd wrote:
> Quoting Taniya Das (2019-09-03 08:52:12)
>> Hi,
>>
>> On 8/31/2019 3:04 AM, Doug Anderson wrote:
>>> Hi,
>>>
>>> On Fri, Aug 30, 2019 at 12:51 PM Stephen Boyd <swboyd@chromium.org> wrote:
>>>>
>>>> Some MMC cards fail to enumerate properly when inserted into an MMC slot
>>>> on sdm845 devices. This is because the clk ops for qcom clks round the
>>>> frequency up to the nearest rate instead of down to the nearest rate.
>>>> For example, the MMC driver requests a frequency of 52MHz from
>>>> clk_set_rate() but the qcom implementation for these clks rounds 52MHz
>>>> up to the next supported frequency of 100MHz. The MMC driver could be
>>>> modified to request clk rate ranges but for now we can fix this in the
>>>> clk driver by changing the rounding policy for this clk to be round down
>>>> instead of round up.
>>>
>>> Since all the MMC rates are expressed as "maximum" clock rates doing
>>> it like you are doing it now seems sane.
>>>
>>>
>>
>> Looks like we need to update/track it for all SDCC clocks for all targets.
>>
> 
> Yeah. It would be great if you can send the patches. Otherwise I'll
> throw it on my todo list named 'forever'.
> 

Sure Stephen,  would send out the patches fixing them.

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation.

--

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

* Re: [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks
  2019-08-30 19:51 [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks Stephen Boyd
  2019-08-30 21:34 ` Doug Anderson
@ 2019-09-09 10:25 ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2019-09-09 10:25 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, linux-arm-msm, Douglas Anderson, Taniya Das

Quoting Stephen Boyd (2019-08-30 12:51:42)
> Some MMC cards fail to enumerate properly when inserted into an MMC slot
> on sdm845 devices. This is because the clk ops for qcom clks round the
> frequency up to the nearest rate instead of down to the nearest rate.
> For example, the MMC driver requests a frequency of 52MHz from
> clk_set_rate() but the qcom implementation for these clks rounds 52MHz
> up to the next supported frequency of 100MHz. The MMC driver could be
> modified to request clk rate ranges but for now we can fix this in the
> clk driver by changing the rounding policy for this clk to be round down
> instead of round up.
> 
> Fixes: 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
> Reported-by: Douglas Anderson <dianders@chromium.org>
> Cc: Taniya Das <tdas@codeaurora.org>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---

Applied to clk-next


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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30 19:51 [PATCH] clk: qcom: gcc-sdm845: Use floor ops for sdcc clks Stephen Boyd
2019-08-30 21:34 ` Doug Anderson
2019-09-03 15:52   ` Taniya Das
2019-09-03 22:47     ` Stephen Boyd
2019-09-05  9:22       ` Taniya Das
2019-09-09 10:25 ` Stephen Boyd

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org linux-arm-msm@archiver.kernel.org
	public-inbox-index linux-arm-msm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox