diff mbox series

[dt-schema,3/3] schemas: i2c: add generic interrupt name for I2C controllers

Message ID 20240815120935.5871-4-wsa+renesas@sang-engineering.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series schemas: i2c: fix "smbus_alert" handling | expand

Commit Message

Wolfram Sang Aug. 15, 2024, 12:09 p.m. UTC
"smbus_alert" is a generic interrupt name for controllers, so document
it. Introduce also "irq" for the primary interrupt.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 dtschema/schemas/i2c/i2c-controller.yaml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Rob Herring (Arm) Aug. 15, 2024, 2:54 p.m. UTC | #1
On Thu, Aug 15, 2024 at 6:09 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> "smbus_alert" is a generic interrupt name for controllers, so document
> it. Introduce also "irq" for the primary interrupt.

I wouldn't add "irq". It's kind of odd in that we have it for I2C
devices in the first place and we don't try to do that anywhere else.

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  dtschema/schemas/i2c/i2c-controller.yaml | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/dtschema/schemas/i2c/i2c-controller.yaml b/dtschema/schemas/i2c/i2c-controller.yaml
> index 7eb6b0f..da277a2 100644
> --- a/dtschema/schemas/i2c/i2c-controller.yaml
> +++ b/dtschema/schemas/i2c/i2c-controller.yaml
> @@ -90,6 +90,22 @@ properties:
>        low-pass analog filter). Typical value should be above the normal i2c bus
>        clock frequency (clock-frequency). Specified in Hz.
>
> +  interrupts:
> +    description:
> +      If not using interrupt-names, the first interrupt will be treated as the
> +      primary interrupt for the controller.
> +
> +  interrupt-names:
> +    anyOf:
> +      - {} # Any name is allowed.
> +      - items:
> +          enum:
> +            - irq
> +            - smbus_alert

It doesn't really matter with the {}, but the 2nd entry is only true
if interrupt-names only contains these 2 names. I'd use 'contains'
rather than 'items' here.

> +        description:
> +          Generic names are "irq" for a primary interrupt and "smbus_alert" for
> +          the SMBusAlert signal. Other names are left to individual bindings.
> +
>    mctp-controller:
>      type: boolean
>      description:
> --
> 2.43.0
>
>
Wolfram Sang Aug. 15, 2024, 6:42 p.m. UTC | #2
Hi Rob,

thanks for the super-fast review!

> > "smbus_alert" is a generic interrupt name for controllers, so document
> > it. Introduce also "irq" for the primary interrupt.
> 
> I wouldn't add "irq". It's kind of odd in that we have it for I2C
> devices in the first place and we don't try to do that anywhere else.

Yes, I am actually happy to remove "irq". I only added it for
consistency.

> > +  interrupt-names:
> > +    anyOf:
> > +      - {} # Any name is allowed.
> > +      - items:
> > +          enum:
> > +            - irq
> > +            - smbus_alert
> 
> It doesn't really matter with the {}, but the 2nd entry is only true
> if interrupt-names only contains these 2 names. I'd use 'contains'
> rather than 'items' here.

So, just replace "items:" with "contains:", right? Should I also change
this for I2C targets and add this chunk to patch 2?

All the best,

   Wolfram
Rob Herring (Arm) Aug. 15, 2024, 8:39 p.m. UTC | #3
On Thu, Aug 15, 2024 at 12:43 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Rob,
>
> thanks for the super-fast review!
>
> > > "smbus_alert" is a generic interrupt name for controllers, so document
> > > it. Introduce also "irq" for the primary interrupt.
> >
> > I wouldn't add "irq". It's kind of odd in that we have it for I2C
> > devices in the first place and we don't try to do that anywhere else.
>
> Yes, I am actually happy to remove "irq". I only added it for
> consistency.
>
> > > +  interrupt-names:
> > > +    anyOf:
> > > +      - {} # Any name is allowed.
> > > +      - items:
> > > +          enum:
> > > +            - irq
> > > +            - smbus_alert
> >
> > It doesn't really matter with the {}, but the 2nd entry is only true
> > if interrupt-names only contains these 2 names. I'd use 'contains'
> > rather than 'items' here.
>
> So, just replace "items:" with "contains:", right? Should I also change
> this for I2C targets and add this chunk to patch 2?

Oh, I missed that you just copied that, but yes, if you can update
that one too, it would be good.

Rob
diff mbox series

Patch

diff --git a/dtschema/schemas/i2c/i2c-controller.yaml b/dtschema/schemas/i2c/i2c-controller.yaml
index 7eb6b0f..da277a2 100644
--- a/dtschema/schemas/i2c/i2c-controller.yaml
+++ b/dtschema/schemas/i2c/i2c-controller.yaml
@@ -90,6 +90,22 @@  properties:
       low-pass analog filter). Typical value should be above the normal i2c bus
       clock frequency (clock-frequency). Specified in Hz.
 
+  interrupts:
+    description:
+      If not using interrupt-names, the first interrupt will be treated as the
+      primary interrupt for the controller.
+
+  interrupt-names:
+    anyOf:
+      - {} # Any name is allowed.
+      - items:
+          enum:
+            - irq
+            - smbus_alert
+        description:
+          Generic names are "irq" for a primary interrupt and "smbus_alert" for
+          the SMBusAlert signal. Other names are left to individual bindings.
+
   mctp-controller:
     type: boolean
     description: