linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains
@ 2020-10-21 18:31 Sudeep Holla
  2020-10-21 18:31 ` [PATCH v2 2/2] firmware: arm_scmi: Move away from clock devicetree bindings Sudeep Holla
  2020-10-22 18:22 ` [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
  0 siblings, 2 replies; 5+ messages in thread
From: Sudeep Holla @ 2020-10-21 18:31 UTC (permalink / raw)
  To: linux-kernel, devicetree
  Cc: Sudeep Holla, linux-arm-kernel, Rob Herring, Viresh Kumar

Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
-EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
_allocate_opp_table() which is called from dev_pm_opp_add and it
now propagates the error back to the caller.

SCMI performance domain re-used clock bindings to keep it simple. However
with the above mentioned change, if clock property is present in a device
node, opps can't be added until clk_get succeeds. So in order to fix the
issue, we can register dummy clocks which is completely ugly.

Since there are no upstream users for the SCMI performance domain clock
bindings, let us introduce separate performance domain bindings for the
same.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 .../devicetree/bindings/arm/arm,scmi.txt      | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

v1[1]->v2:
	- Changed the generic #perf-domain-cells to more SCMI specific
	  property #arm,scmi-perf-domain-cells

Hi Rob/Viresh,

This is actually a fix for the regression I reported here[2].
I am not adding fixes tag as I am targeting in the same release and
also because it is not directly related.

Regards,
Sudeep

[1] https://lore.kernel.org/r/20201020203710.10100-1-sudeep.holla@arm.com
[2] https://lore.kernel.org/r/20201015180555.gacdzkofpibkdn2e@bogus

P.S.:/me records that this binding needs to be moved to yaml in v5.11
diff --git a/Documentation/devicetree/bindings/arm/arm,scmi.txt b/Documentation/devicetree/bindings/arm/arm,scmi.txt
index 55deb68230eb..7af1be54f6c7 100644
--- a/Documentation/devicetree/bindings/arm/arm,scmi.txt
+++ b/Documentation/devicetree/bindings/arm/arm,scmi.txt
@@ -44,7 +44,7 @@ as described in the following sections. If the platform supports dedicated
 mboxes, mbox-names and shmem shall be present in the sub-node corresponding
 to that protocol.

-Clock/Performance bindings for the clocks/OPPs based on SCMI Message Protocol
+Clock bindings for the clocks based on SCMI Message Protocol
 ------------------------------------------------------------

 This binding uses the common clock binding[1].
@@ -52,6 +52,19 @@ This binding uses the common clock binding[1].
 Required properties:
 - #clock-cells : Should be 1. Contains the Clock ID value used by SCMI commands.

+Performance bindings for the OPPs based on SCMI Message Protocol
+------------------------------------------------------------
+
+Required properties:
+- #arm,scmi-perf-domain-cells: Should be 1. Contains the performance domain ID
+  value used by SCMI commands.
+
+* Property arm,scmi-perf-domain
+
+Devices supporting SCMI performance domain must set their "arm,scmi-perf-domain"
+property with phandle to a SCMI performance domain controller followed by the
+performance domain.
+
 Power domain bindings for the power domains based on SCMI Message Protocol
 ------------------------------------------------------------

@@ -152,7 +165,7 @@ firmware {

 		scmi_dvfs: protocol@13 {
 			reg = <0x13>;
-			#clock-cells = <1>;
+			#arm,scmi-perf-domain-cells = <1>;
 		};

 		scmi_clk: protocol@14 {
@@ -175,7 +188,7 @@ firmware {
 cpu@0 {
 	...
 	reg = <0 0>;
-	clocks = <&scmi_dvfs 0>;
+	arm,scmi-perf-domain = <&scmi_dvfs 0>;
 };

 hdlcd@7ff60000 {
--
2.17.1


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

* [PATCH v2 2/2] firmware: arm_scmi: Move away from clock devicetree bindings
  2020-10-21 18:31 [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
@ 2020-10-21 18:31 ` Sudeep Holla
  2020-10-22 18:22 ` [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
  1 sibling, 0 replies; 5+ messages in thread
From: Sudeep Holla @ 2020-10-21 18:31 UTC (permalink / raw)
  To: linux-kernel, devicetree
  Cc: Sudeep Holla, linux-arm-kernel, Rob Herring, Viresh Kumar

Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
-EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
_allocate_opp_table() which is called from dev_pm_opp_add and it
now propagates the error back to the caller.

This breaks SCMI performance domains as we will never succeed to add any
OPPs. A quick fix would be to register dummy clocks which is completely
ugly and bigger fix which may break with some other change in future.

It is better to add separate binding for the same and use it. A separate
SCMI performance domain binding is introduced and let us use it here.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/perf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 3e1e87012c95..a79c095662a7 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -629,13 +629,13 @@ static void scmi_perf_domain_init_fc(const struct scmi_handle *handle,
 /* Device specific ops */
 static int scmi_dev_domain_id(struct device *dev)
 {
-	struct of_phandle_args clkspec;
+	struct of_phandle_args spec;

-	if (of_parse_phandle_with_args(dev->of_node, "clocks", "#clock-cells",
-				       0, &clkspec))
+	if (of_parse_phandle_with_args(dev->of_node, "arm,scmi-perf-domain",
+				       "#arm,scmi-perf-domain-cells", 0, &spec))
 		return -EINVAL;

-	return clkspec.args[0];
+	return spec.args[0];
 }

 static int scmi_dvfs_device_opps_add(const struct scmi_handle *handle,
--
2.17.1


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

* Re: [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains
  2020-10-21 18:31 [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
  2020-10-21 18:31 ` [PATCH v2 2/2] firmware: arm_scmi: Move away from clock devicetree bindings Sudeep Holla
@ 2020-10-22 18:22 ` Sudeep Holla
  2020-10-23 13:24   ` Rob Herring
  1 sibling, 1 reply; 5+ messages in thread
From: Sudeep Holla @ 2020-10-22 18:22 UTC (permalink / raw)
  To: linux-kernel, devicetree, Rob Herring; +Cc: linux-arm-kernel, Viresh Kumar

On Wed, Oct 21, 2020 at 07:31:03PM +0100, Sudeep Holla wrote:
> Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
> _allocate_opp_table() which is called from dev_pm_opp_add and it
> now propagates the error back to the caller.
> 
> SCMI performance domain re-used clock bindings to keep it simple. However
> with the above mentioned change, if clock property is present in a device
> node, opps can't be added until clk_get succeeds. So in order to fix the
> issue, we can register dummy clocks which is completely ugly.
> 
> Since there are no upstream users for the SCMI performance domain clock
> bindings, let us introduce separate performance domain bindings for the
> same.
> 
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  .../devicetree/bindings/arm/arm,scmi.txt      | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> v1[1]->v2:
> 	- Changed the generic #perf-domain-cells to more SCMI specific
> 	  property #arm,scmi-perf-domain-cells
>

Is more specific #arm,scmi-perf-domain-cells acceptable ?
Sorry for the rush, but this fixes SCMI cpufreq which is broken after
commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
-EPROBE_DEFER")

-- 
Regards,
Sudeep

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

* Re: [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains
  2020-10-22 18:22 ` [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
@ 2020-10-23 13:24   ` Rob Herring
  2020-10-23 13:59     ` Sudeep Holla
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2020-10-23 13:24 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-kernel, devicetree, linux-arm-kernel, Viresh Kumar

On Thu, Oct 22, 2020 at 1:22 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> On Wed, Oct 21, 2020 at 07:31:03PM +0100, Sudeep Holla wrote:
> > Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> > -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
> > _allocate_opp_table() which is called from dev_pm_opp_add and it
> > now propagates the error back to the caller.
> >
> > SCMI performance domain re-used clock bindings to keep it simple. However
> > with the above mentioned change, if clock property is present in a device
> > node, opps can't be added until clk_get succeeds. So in order to fix the
> > issue, we can register dummy clocks which is completely ugly.
> >
> > Since there are no upstream users for the SCMI performance domain clock
> > bindings, let us introduce separate performance domain bindings for the
> > same.
> >
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> >  .../devicetree/bindings/arm/arm,scmi.txt      | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> >
> > v1[1]->v2:
> >       - Changed the generic #perf-domain-cells to more SCMI specific
> >         property #arm,scmi-perf-domain-cells
> >
>
> Is more specific #arm,scmi-perf-domain-cells acceptable ?
> Sorry for the rush, but this fixes SCMI cpufreq which is broken after
> commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> -EPROBE_DEFER")

If you are in a rush, you'd better go the dummy clock route. We should
get this binding right and I think that means something common, not
SCMI specific.

Rob

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

* Re: [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains
  2020-10-23 13:24   ` Rob Herring
@ 2020-10-23 13:59     ` Sudeep Holla
  0 siblings, 0 replies; 5+ messages in thread
From: Sudeep Holla @ 2020-10-23 13:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-kernel, devicetree, Sudeep Holla, linux-arm-kernel, Viresh Kumar

On Fri, Oct 23, 2020 at 08:24:06AM -0500, Rob Herring wrote:
> On Thu, Oct 22, 2020 at 1:22 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
> >
> > On Wed, Oct 21, 2020 at 07:31:03PM +0100, Sudeep Holla wrote:
> > > Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> > > -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
> > > _allocate_opp_table() which is called from dev_pm_opp_add and it
> > > now propagates the error back to the caller.
> > >
> > > SCMI performance domain re-used clock bindings to keep it simple. However
> > > with the above mentioned change, if clock property is present in a device
> > > node, opps can't be added until clk_get succeeds. So in order to fix the
> > > issue, we can register dummy clocks which is completely ugly.
> > >
> > > Since there are no upstream users for the SCMI performance domain clock
> > > bindings, let us introduce separate performance domain bindings for the
> > > same.
> > >
> > > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > > ---
> > >  .../devicetree/bindings/arm/arm,scmi.txt      | 19 ++++++++++++++++---
> > >  1 file changed, 16 insertions(+), 3 deletions(-)
> > >
> > > v1[1]->v2:
> > >       - Changed the generic #perf-domain-cells to more SCMI specific
> > >         property #arm,scmi-perf-domain-cells
> > >
> >
> > Is more specific #arm,scmi-perf-domain-cells acceptable ?
> > Sorry for the rush, but this fixes SCMI cpufreq which is broken after
> > commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> > -EPROBE_DEFER")
> 
> If you are in a rush, you'd better go the dummy clock route. We should
> get this binding right and I think that means something common, not
> SCMI specific.
> 

Ah OK, I assumed you wanted to make it SCMI specific. It makes sense to
have something generic like clocks for OPP domains.

There was discussion on the other thread to use empty OPP list for
firmware discoverable OPP list. Random thought here is to add domain ID
to OPP binding and use that ?

--
Regards,
Sudeep

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

end of thread, other threads:[~2020-10-23 13:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 18:31 [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
2020-10-21 18:31 ` [PATCH v2 2/2] firmware: arm_scmi: Move away from clock devicetree bindings Sudeep Holla
2020-10-22 18:22 ` [PATCH v2 1/2] dt-bindings: arm,scmi: Do not use clocks for SCMI performance domains Sudeep Holla
2020-10-23 13:24   ` Rob Herring
2020-10-23 13:59     ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).