Skip to contentSkip to conversation

clk: qcom: gcc-sdm845: Use floor ops for sdcc clks

PATCH Applied Stephen Boyd 3 participants 6 messages Aug 30, 2019 – Sep 9, 2019

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

PATCH 1/1 clk: qcom: gcc-sdm845: Use floor ops for sdcc clks

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")
Cc Taniya Das <[email protected]>

---

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(-)
drivers/clk/qcom/gcc-sdm845.c +2 -2
index 7131dcf9b060..95be125c3bdd 100644
@@ -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,
 	},
 };
 
Signature · 1 line
Sent by a computer through tubes
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 10 lines · Stephen Boyd

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.

Quoted 7 lines
Fixes 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
Cc Taniya Das <[email protected]>

---

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

Seems like a good idea to me.

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

-Doug

#2 lore raw

Hi,

Quoted 14 lines · Doug Anderson

Hi,

Quoted 10 lines · Stephen Boyd

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.

Quoted 4 lines

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.

Quoted 19 lines
Quoted 7 lines
Fixes 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
Cc Taniya Das <[email protected]>

---

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

Seems like a good idea to me.

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

-Doug

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

--
#3 lore raw

Quoting Taniya Das (2019-09-03 08:52:12)

Quoted 17 lines

Hi,

Quoted 14 lines · Doug Anderson

Hi,

Quoted 10 lines · Stephen Boyd

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.

Quoted 7 lines
Quoted 4 lines

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'.

#4 lore raw
Quoted 23 lines · Stephen Boyd

Quoting Taniya Das (2019-09-03 08:52:12)

Quoted 22 lines

Hi,

Quoted 18 lines · Doug Anderson

Hi,

Quoted 10 lines · Stephen Boyd

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.

Quoted 6 lines
Quoted 2 lines

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.

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

--
author Applied
#5 lore raw
In reply to Stephen Boyd

Quoting Stephen Boyd (2019-08-30 12:51:42)

Quoted 10 lines

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.

Quoted 5 lines
Fixes 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845")
Cc Taniya Das <[email protected]>

---

Applied to clk-next