diff mbox series

[1/3] dt-bindings: bus: simple-pm-bus: Make clocks and power-domains optional

Message ID 20211007124858.44011-2-tony@atomide.com (mailing list archive)
State New, archived
Headers show
Series Updates for simple-pm-bus and ti-sysc bindings | expand

Commit Message

Tony Lindgren Oct. 7, 2021, 12:48 p.m. UTC
Clocks and power domains are not required by the simple-pm-bus driver.
There are buses with read-only registers for clocks and power domains
that are always on.

Even without clocks and power domains configured, simple-pm-bus is still
different from simple-bus as simple-pm-bus enables runtime PM for the bus
driver.

Let's update the binding accordingly as this remove the related warnings
for dt_binding_check for omaps.

Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Rob Herring <robh@kernel.org>
Cc: Simon Horman <horms+renesas@verge.net.au>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 .../devicetree/bindings/bus/simple-pm-bus.yaml  | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

Comments

Geert Uytterhoeven Oct. 7, 2021, 1:26 p.m. UTC | #1
Hi Tony,

Thanks for your patch!

On Thu, Oct 7, 2021 at 2:49 PM Tony Lindgren <tony@atomide.com> wrote:
> Clocks and power domains are not required by the simple-pm-bus driver.
> There are buses with read-only registers for clocks and power domains
> that are always on.

The presence of clocks or power-domains properties is the only
distinguishing factor between simple-pm-bus and simple-bus, from a
DT point of view.  So if there has to be a distinguishment, the
properties should be required

If you don't have clocks and power-domains, you should use simple-bus.

> Even without clocks and power domains configured, simple-pm-bus is still
> different from simple-bus as simple-pm-bus enables runtime PM for the bus
> driver.

Which you need to have working Runtime PM for child devices, right? ;-)

This is not specific to DT, but to Linux.
One more reason to let Linux treat simple-pm-bus and simple-bus exactly
the same.  Linux handles the clocks and power-domains (if present)
transparently anyway, through PM Domains

> Let's update the binding accordingly as this remove the related warnings
> for dt_binding_check for omaps.
>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Cc: Rob Herring <robh@kernel.org>
> Cc: Simon Horman <horms+renesas@verge.net.au>
> Cc: Suman Anna <s-anna@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>

> --- a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml
> +++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml
> @@ -13,10 +13,9 @@ description: |
>    A Simple Power-Managed Bus is a transparent bus that doesn't need a real
>    driver, as it's typically initialized by the boot loader.
>
> -  However, its bus controller is part of a PM domain, or under the control
> -  of a functional clock.  Hence, the bus controller's PM domain and/or
> -  clock must be enabled for child devices connected to the bus (either
> -  on-SoC or externally) to function.
> +  However, its bus controller is typically part of a PM domain, or under
> +  the control of a functional clock.  Without PM domain or functional clock,
> +  it still enables runtime PM for the bus driver unlike "simple-bus".
>
>    While "simple-pm-bus" follows the "simple-bus" set of properties, as
>    specified in the Devicetree Specification, it is not an extension of
> @@ -43,10 +42,10 @@ properties:
>
>    clocks: true
>      # Functional clocks
> -    # Required if power-domains is absent, optional otherwise
> +    # Typically used if power-domains is absent
>
>    power-domains:
> -    # Required if clocks is absent, optional otherwise
> +    # Typically used if clocks is absent
>      minItems: 1
>
>  required:
> @@ -55,12 +54,6 @@ required:
>    - '#size-cells'
>    - ranges
>
> -anyOf:
> -  - required:
> -      - clocks
> -  - required:
> -      - power-domains
> -
>  additionalProperties: true
>
>  examples:

Gr{oetje,eeting}s,

                        Geert
Tony Lindgren Oct. 7, 2021, 5:24 p.m. UTC | #2
* Geert Uytterhoeven <geert@linux-m68k.org> [211007 13:27]:
> Hi Tony,
> 
> Thanks for your patch!
> 
> On Thu, Oct 7, 2021 at 2:49 PM Tony Lindgren <tony@atomide.com> wrote:
> > Clocks and power domains are not required by the simple-pm-bus driver.
> > There are buses with read-only registers for clocks and power domains
> > that are always on.
> 
> The presence of clocks or power-domains properties is the only
> distinguishing factor between simple-pm-bus and simple-bus, from a
> DT point of view.  So if there has to be a distinguishment, the
> properties should be required

Heh seems there is no need for distinguishment beyond the compatible
property here though :)

> If you don't have clocks and power-domains, you should use simple-bus.

Except simple-bus is not the same as simple-pm-bus. We do not have
simple-bus do pm_runtime_enable() as you well know having written it :)

> > Even without clocks and power domains configured, simple-pm-bus is still
> > different from simple-bus as simple-pm-bus enables runtime PM for the bus
> > driver.
> 
> Which you need to have working Runtime PM for child devices, right? ;-)

Right. And based on what I remember we simply cannot do pm_runtime_enable()
for simple-bus without breaking tons of devices.

> This is not specific to DT, but to Linux.
> One more reason to let Linux treat simple-pm-bus and simple-bus exactly
> the same.  Linux handles the clocks and power-domains (if present)
> transparently anyway, through PM Domains

I agree they should be treated the same way with simple-pm-bus just
doing the pm_runtime_enable() being the only difference.

But the clocks and power domain still should be optional. They are
not required by simple-pm-bus.c driver, and may not be required by
the hardware.

Got any better solutions in mind? Adding yet another compatible or
another driver does not seem to get us anywhere either with this :)

Regards,

Tony
Geert Uytterhoeven Oct. 7, 2021, 5:57 p.m. UTC | #3
Hi Tony,

On Thu, Oct 7, 2021 at 7:24 PM Tony Lindgren <tony@atomide.com> wrote:
> * Geert Uytterhoeven <geert@linux-m68k.org> [211007 13:27]:
> > On Thu, Oct 7, 2021 at 2:49 PM Tony Lindgren <tony@atomide.com> wrote:
> > > Even without clocks and power domains configured, simple-pm-bus is still
> > > different from simple-bus as simple-pm-bus enables runtime PM for the bus
> > > driver.
> >
> > Which you need to have working Runtime PM for child devices, right? ;-)
>
> Right. And based on what I remember we simply cannot do pm_runtime_enable()
> for simple-bus without breaking tons of devices.

Why not? Do you have an example of what would break?
The only reason I created simple-pm-bus was because the DT people
objected to adding PM to simple-bus, as they considered it wrong
conceptually.  AFAIK this wouldn't have caused any actual breakage.

Gr{oetje,eeting}s,

                        Geert
Tony Lindgren Oct. 7, 2021, 6:17 p.m. UTC | #4
* Geert Uytterhoeven <geert@linux-m68k.org> [211007 17:57]:
> Hi Tony,
> 
> On Thu, Oct 7, 2021 at 7:24 PM Tony Lindgren <tony@atomide.com> wrote:
> > * Geert Uytterhoeven <geert@linux-m68k.org> [211007 13:27]:
> > > On Thu, Oct 7, 2021 at 2:49 PM Tony Lindgren <tony@atomide.com> wrote:
> > > > Even without clocks and power domains configured, simple-pm-bus is still
> > > > different from simple-bus as simple-pm-bus enables runtime PM for the bus
> > > > driver.
> > >
> > > Which you need to have working Runtime PM for child devices, right? ;-)
> >
> > Right. And based on what I remember we simply cannot do pm_runtime_enable()
> > for simple-bus without breaking tons of devices.
> 
> Why not? Do you have an example of what would break?
> The only reason I created simple-pm-bus was because the DT people
> objected to adding PM to simple-bus, as they considered it wrong
> conceptually.  AFAIK this wouldn't have caused any actual breakage.

Oh OK, then I just remember the reasons wrong for the need for
adding it as a driver.

Regards,

Tony
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml b/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml
--- a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml
+++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml
@@ -13,10 +13,9 @@  description: |
   A Simple Power-Managed Bus is a transparent bus that doesn't need a real
   driver, as it's typically initialized by the boot loader.
 
-  However, its bus controller is part of a PM domain, or under the control
-  of a functional clock.  Hence, the bus controller's PM domain and/or
-  clock must be enabled for child devices connected to the bus (either
-  on-SoC or externally) to function.
+  However, its bus controller is typically part of a PM domain, or under
+  the control of a functional clock.  Without PM domain or functional clock,
+  it still enables runtime PM for the bus driver unlike "simple-bus".
 
   While "simple-pm-bus" follows the "simple-bus" set of properties, as
   specified in the Devicetree Specification, it is not an extension of
@@ -43,10 +42,10 @@  properties:
 
   clocks: true
     # Functional clocks
-    # Required if power-domains is absent, optional otherwise
+    # Typically used if power-domains is absent
 
   power-domains:
-    # Required if clocks is absent, optional otherwise
+    # Typically used if clocks is absent
     minItems: 1
 
 required:
@@ -55,12 +54,6 @@  required:
   - '#size-cells'
   - ranges
 
-anyOf:
-  - required:
-      - clocks
-  - required:
-      - power-domains
-
 additionalProperties: true
 
 examples: