All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk
@ 2023-10-02 17:00 Barnabás Czémán
  2023-10-06 23:50 ` Konrad Dybcio
  0 siblings, 1 reply; 5+ messages in thread
From: Barnabás Czémán @ 2023-10-02 17:00 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Konrad Dybcio, Michael Turquette,
	Stephen Boyd, linux-arm-msm, linux-clk, linux-kernel
  Cc: Barnabás Czémán

According to downstream dwc3-msm source this clock has FSM dependency on
gcc_pcnoc_usb30_clk so enabling it would fail if latter isn't enabled.
This patch add works around this issue by changing parent of
gcc_usb30_master_clk to gcc_pcnoc_usb30_clk. This is acceptable because
both clocks have same parent and are branches/gates.

Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
---
 drivers/clk/qcom/gcc-msm8953.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-msm8953.c b/drivers/clk/qcom/gcc-msm8953.c
index 3e5a8cb14d4d..20639340e8a6 100644
--- a/drivers/clk/qcom/gcc-msm8953.c
+++ b/drivers/clk/qcom/gcc-msm8953.c
@@ -3645,7 +3645,7 @@ static struct clk_branch gcc_usb30_master_clk = {
 		.hw.init = &(struct clk_init_data) {
 			.name = "gcc_usb30_master_clk",
 			.parent_hws = (const struct clk_hw*[]){
-				&usb30_master_clk_src.clkr.hw,
+				&gcc_pcnoc_usb3_axi_clk.clkr.hw,
 			},
 			.num_parents = 1,
 			.ops = &clk_branch2_ops,
-- 
2.42.0


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

* Re: [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk
  2023-10-02 17:00 [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk Barnabás Czémán
@ 2023-10-06 23:50 ` Konrad Dybcio
  2023-10-24  2:59   ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2023-10-06 23:50 UTC (permalink / raw)
  To: Barnabás Czémán, Bjorn Andersson, Andy Gross,
	Michael Turquette, Stephen Boyd, linux-arm-msm, linux-clk,
	linux-kernel

On 2.10.2023 19:00, Barnabás Czémán wrote:
> According to downstream dwc3-msm source this clock has FSM dependency on
> gcc_pcnoc_usb30_clk so enabling it would fail if latter isn't enabled.
> This patch add works around this issue by changing parent of
> gcc_usb30_master_clk to gcc_pcnoc_usb30_clk. This is acceptable because
> both clocks have same parent and are branches/gates.
> 
> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> ---
"meh"

There are multiple cases, especially with qcom, where there are some
magic "dependencies" without parent-child relationship. The common
clock framework doesn't currently have any good way to handle this,
other than some mind gymnastics like you had to do here with matching
them against a common parent/ancestor..

Stephen, what do you say?

Konrad

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

* Re: [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk
  2023-10-06 23:50 ` Konrad Dybcio
@ 2023-10-24  2:59   ` Stephen Boyd
  2023-11-18  0:48     ` Konrad Dybcio
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2023-10-24  2:59 UTC (permalink / raw)
  To: Andy Gross, Barnabás Czémán, Bjorn Andersson,
	Konrad Dybcio, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

Quoting Konrad Dybcio (2023-10-06 16:50:18)
> On 2.10.2023 19:00, Barnabás Czémán wrote:
> > According to downstream dwc3-msm source this clock has FSM dependency on
> > gcc_pcnoc_usb30_clk so enabling it would fail if latter isn't enabled.
> > This patch add works around this issue by changing parent of
> > gcc_usb30_master_clk to gcc_pcnoc_usb30_clk. This is acceptable because
> > both clocks have same parent and are branches/gates.
> > 
> > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > ---
> "meh"
> 
> There are multiple cases, especially with qcom, where there are some
> magic "dependencies" without parent-child relationship. The common
> clock framework doesn't currently have any good way to handle this,
> other than some mind gymnastics like you had to do here with matching
> them against a common parent/ancestor..
> 
> Stephen, what do you say?
> 

You can't change the parent to be not the actual parent. The consumer of
the branch probably wants to call clk_set_rate() on the branch and have
it propagate up to the parent to set the actual rate. Can the axi clk
simply be left enabled all the time? That seems simpler. Otherwise we
probably need to leave the axi clk control to the interconnect driver
and make sure drivers enable interconnects before enabling this branch.

When things start to get this tangled I tend to think that we need to
remove control of the clk from the general drivers and put the logic to
control interconnects and clks into some SoC glue driver and expose a
single interface, like genpd power_on/power_off so that general drivers
can't get the sequence of steps wrong. Instead all they can do is "power
on" their device, and the SoC glue driver can do the proper sequence of
framework calls to power up the device.

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

* Re: [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk
  2023-10-24  2:59   ` Stephen Boyd
@ 2023-11-18  0:48     ` Konrad Dybcio
  2023-11-22  6:09       ` Krishna Kurapati PSSNV
  0 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2023-11-18  0:48 UTC (permalink / raw)
  To: Stephen Boyd, Andy Gross, Barnabás Czémán,
	Bjorn Andersson, Michael Turquette, linux-arm-msm, linux-clk,
	linux-kernel

On 24.10.2023 04:59, Stephen Boyd wrote:
> Quoting Konrad Dybcio (2023-10-06 16:50:18)
>> On 2.10.2023 19:00, Barnabás Czémán wrote:
>>> According to downstream dwc3-msm source this clock has FSM dependency on
>>> gcc_pcnoc_usb30_clk so enabling it would fail if latter isn't enabled.
>>> This patch add works around this issue by changing parent of
>>> gcc_usb30_master_clk to gcc_pcnoc_usb30_clk. This is acceptable because
>>> both clocks have same parent and are branches/gates.
>>>
>>> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
>>> ---
>> "meh"
>>
>> There are multiple cases, especially with qcom, where there are some
>> magic "dependencies" without parent-child relationship. The common
>> clock framework doesn't currently have any good way to handle this,
>> other than some mind gymnastics like you had to do here with matching
>> them against a common parent/ancestor..
>>
>> Stephen, what do you say?
>>
> 
> You can't change the parent to be not the actual parent. The consumer of
> the branch probably wants to call clk_set_rate() on the branch and have
> it propagate up to the parent to set the actual rate. Can the axi clk
> simply be left enabled all the time? That seems simpler. Otherwise we
> probably need to leave the axi clk control to the interconnect driver
> and make sure drivers enable interconnects before enabling this branch.
Yeah I'm almost inclined to think adding even more ifs to the icc driver
will consume more power than just leaving the AXI hanging..

> 
> When things start to get this tangled I tend to think that we need to
> remove control of the clk from the general drivers and put the logic to
> control interconnects and clks into some SoC glue driver and expose a
> single interface, like genpd power_on/power_off so that general drivers
> can't get the sequence of steps wrong. Instead all they can do is "power
> on" their device, and the SoC glue driver can do the proper sequence of
> framework calls to power up the device.
That too, given the structure of qcom SoCs, it should almost look like:

xyznoc-bus {
	compatible = "simple-pm-bus";
	clocks = <&gcc xyznoc_ahb>,
		 <&gcc xyznoc_axi>;
	...

	xyznoc-node@abcd {};
}

etc.

I've actually discussed this with Bjorn, but we came to a conclusion
that it's not trivial to determine which peripheral lives on which NoC
+ many of them seem to sorta overlap more than one..

Konrad

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

* Re: [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk
  2023-11-18  0:48     ` Konrad Dybcio
@ 2023-11-22  6:09       ` Krishna Kurapati PSSNV
  0 siblings, 0 replies; 5+ messages in thread
From: Krishna Kurapati PSSNV @ 2023-11-22  6:09 UTC (permalink / raw)
  To: Konrad Dybcio, Stephen Boyd, Barnabás Czémán,
	Bjorn Andersson
  Cc: linux-arm-msm, linux-clk, linux-kernel, Andy Gross, Michael Turquette



On 11/18/2023 6:18 AM, Konrad Dybcio wrote:
> On 24.10.2023 04:59, Stephen Boyd wrote:
>> Quoting Konrad Dybcio (2023-10-06 16:50:18)
>>> On 2.10.2023 19:00, Barnabás Czémán wrote:
>>>> According to downstream dwc3-msm source this clock has FSM dependency on
>>>> gcc_pcnoc_usb30_clk so enabling it would fail if latter isn't enabled.
>>>> This patch add works around this issue by changing parent of
>>>> gcc_usb30_master_clk to gcc_pcnoc_usb30_clk. This is acceptable because
>>>> both clocks have same parent and are branches/gates.
>>>>
>>>> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
>>>> ---
>>> "meh"
>>>
>>> There are multiple cases, especially with qcom, where there are some
>>> magic "dependencies" without parent-child relationship. The common
>>> clock framework doesn't currently have any good way to handle this,
>>> other than some mind gymnastics like you had to do here with matching
>>> them against a common parent/ancestor..
>>>
>>> Stephen, what do you say?
>>>
>>
>> You can't change the parent to be not the actual parent. The consumer of
>> the branch probably wants to call clk_set_rate() on the branch and have
>> it propagate up to the parent to set the actual rate. Can the axi clk
>> simply be left enabled all the time? That seems simpler. Otherwise we
>> probably need to leave the axi clk control to the interconnect driver
>> and make sure drivers enable interconnects before enabling this branch.
> Yeah I'm almost inclined to think adding even more ifs to the icc driver
> will consume more power than just leaving the AXI hanging..
> 
>>
>> When things start to get this tangled I tend to think that we need to
>> remove control of the clk from the general drivers and put the logic to
>> control interconnects and clks into some SoC glue driver and expose a
>> single interface, like genpd power_on/power_off so that general drivers
>> can't get the sequence of steps wrong. Instead all they can do is "power
>> on" their device, and the SoC glue driver can do the proper sequence of
>> framework calls to power up the device.
> That too, given the structure of qcom SoCs, it should almost look like:
> 
> xyznoc-bus {
> 	compatible = "simple-pm-bus";
> 	clocks = <&gcc xyznoc_ahb>,
> 		 <&gcc xyznoc_axi>;
> 	...
> 
> 	xyznoc-node@abcd {};
> }
> 
> etc.
> 
> I've actually discussed this with Bjorn, but we came to a conclusion
> that it's not trivial to determine which peripheral lives on which NoC
> + many of them seem to sorta overlap more than one..

Are we seeing the clk getting stuck during suspend/resume or during 
clk_prepare_enable in probe ?

Regards,
Krishna,

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

end of thread, other threads:[~2023-11-22  6:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02 17:00 [PATCH] clk: qcom: gcc-msm8953: fix stuck gcc_usb30_master_clk Barnabás Czémán
2023-10-06 23:50 ` Konrad Dybcio
2023-10-24  2:59   ` Stephen Boyd
2023-11-18  0:48     ` Konrad Dybcio
2023-11-22  6:09       ` Krishna Kurapati PSSNV

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.