diff mbox series

dt-bindings: i2c: Rewrite Nomadik I2C bindings in YAML

Message ID 20220526211046.367938-1-linus.walleij@linaro.org
State Accepted
Commit 577584582db59f26c9f27e59e0fd8f0162d2ccdb
Headers show
Series dt-bindings: i2c: Rewrite Nomadik I2C bindings in YAML | expand

Commit Message

Linus Walleij May 26, 2022, 9:10 p.m. UTC
This rewrites the Nomadik I2C bindings in YAML, some extra
tweaks were needed because of the way the original nomadik
names the compatible with two compatibles and the DB8500
with three, and the two main variants use a different clock
name.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 .../devicetree/bindings/i2c/i2c-nomadik.txt   |  23 ----
 .../bindings/i2c/st,nomadik-i2c.yaml          | 113 ++++++++++++++++++
 MAINTAINERS                                   |   2 +-
 3 files changed, 114 insertions(+), 24 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml

Comments

Wolfram Sang June 8, 2022, 7:41 p.m. UTC | #1
On Thu, May 26, 2022 at 11:10:46PM +0200, Linus Walleij wrote:
> This rewrites the Nomadik I2C bindings in YAML, some extra
> tweaks were needed because of the way the original nomadik
> names the compatible with two compatibles and the DB8500
> with three, and the two main variants use a different clock
> name.
> 
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied to for-next, thanks!
Linus Walleij July 1, 2022, 10:54 p.m. UTC | #2
On Fri, Jul 1, 2022 at 11:54 PM Rob Herring <robh@kernel.org> wrote:
> On Sun, Jun 5, 2022 at 8:26 AM Rob Herring <robh@kernel.org> wrote:
> >
> > On Thu, 26 May 2022 23:10:46 +0200, Linus Walleij wrote:
> > > This rewrites the Nomadik I2C bindings in YAML, some extra
> > > tweaks were needed because of the way the original nomadik
> > > names the compatible with two compatibles and the DB8500
> > > with three, and the two main variants use a different clock
> > > name.
> > >
> > > Cc: devicetree@vger.kernel.org
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > ---
> > >  .../devicetree/bindings/i2c/i2c-nomadik.txt   |  23 ----
> > >  .../bindings/i2c/st,nomadik-i2c.yaml          | 113 ++++++++++++++++++
> > >  MAINTAINERS                                   |   2 +-
> > >  3 files changed, 114 insertions(+), 24 deletions(-)
> > >  delete mode 100644 Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
> > >  create mode 100644 Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml
> > >
> >
> > Reviewed-by: Rob Herring <robh@kernel.org>
>
> Due to partially broken 'unevaluatedProperties' implementation, this
> error is going to show up when fixed.
>
> Documentation/devicetree/bindings/i2c/st,nomadik-i2c.example.dtb:
> i2c@80004000: Unevaluated properties are not allowed ('v-i2c-supply',
> 'power-domains' were unexpected)
>         From schema:
> /home/rob/proj/git/linux-dt/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml

Ooops. Sent some fixup patches.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/i2c/i2c-nomadik.txt b/Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
deleted file mode 100644
index 72065b0ff680..000000000000
--- a/Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
+++ /dev/null
@@ -1,23 +0,0 @@ 
-I2C for Nomadik based systems
-
-Required (non-standard) properties:
- - Nil
-
-Recommended (non-standard) properties:
- - clock-frequency : Maximum bus clock frequency for the device
-
-Optional (non-standard) properties:
- - Nil
-
-Example :
-
-i2c@80004000 {
-        compatible = "stericsson,db8500-i2c", "st,nomadik-i2c";
-        reg = <0x80004000 0x1000>;
-        interrupts = <0 21 0x4>;
-        #address-cells = <1>;
-        #size-cells = <0>;
-        v-i2c-supply = <&db8500_vape_reg>;
-
-        clock-frequency = <400000>;
-};
diff --git a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml b/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml
new file mode 100644
index 000000000000..eec502c57047
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml
@@ -0,0 +1,113 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/i2c/st,nomadik-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ST Microelectronics Nomadik I2C Bindings
+
+description: The Nomadik I2C host controller began its life in the ST
+  Microelectronics STn8800 SoC, and was then inherited into STn8810 and
+  STn8815. It was part of the prototype STn8500 which then became ST-Ericsson
+  DB8500 after the merge of these two companies wireless divisions.
+
+maintainers:
+  - Linus Walleij <linus.walleij@linaro.org>
+
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+
+# Need a custom select here or 'arm,primecell' will match on lots of nodes
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - st,nomadik-i2c
+  required:
+    - compatible
+
+properties:
+  compatible:
+    oneOf:
+      # The variant found in STn8815
+      - items:
+          - const: st,nomadik-i2c
+          - const: arm,primecell
+      # The variant found in DB8500
+      - items:
+          - const: stericsson,db8500-i2c
+          - const: st,nomadik-i2c
+          - const: arm,primecell
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    oneOf:
+      # Clock name in STn8815
+      - items:
+          - const: mclk
+          - const: apb_pclk
+      # Clock name in DB8500
+      - items:
+          - const: i2cclk
+          - const: apb_pclk
+
+  resets:
+    maxItems: 1
+
+  clock-frequency:
+    minimum: 1
+    maximum: 400000
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/reset/stericsson,db8500-prcc-reset.h>
+    #include <dt-bindings/arm/ux500_pm_domains.h>
+    i2c@80004000 {
+      compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell";
+      reg = <0x80004000 0x1000>;
+      interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
+
+      #address-cells = <1>;
+      #size-cells = <0>;
+      v-i2c-supply = <&db8500_vape_reg>;
+
+      clock-frequency = <400000>;
+      clocks = <&prcc_kclk 3 3>, <&prcc_pclk 3 3>;
+      clock-names = "i2cclk", "apb_pclk";
+      power-domains = <&pm_domains DOMAIN_VAPE>;
+      resets = <&prcc_reset DB8500_PRCC_3 DB8500_PRCC_3_RESET_I2C0>;
+    };
+
+    i2c@101f8000 {
+      compatible = "st,nomadik-i2c", "arm,primecell";
+      reg = <0x101f8000 0x1000>;
+      interrupt-parent = <&vica>;
+      interrupts = <20>;
+      clock-frequency = <100000>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+      clocks = <&i2c0clk>, <&pclki2c0>;
+      clock-names = "mclk", "apb_pclk";
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index fd768d43e048..0d1816f26ccc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2398,7 +2398,7 @@  T:	git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
 F:	Documentation/devicetree/bindings/arm/ste-*
 F:	Documentation/devicetree/bindings/arm/ux500.yaml
 F:	Documentation/devicetree/bindings/arm/ux500/
-F:	Documentation/devicetree/bindings/i2c/i2c-nomadik.txt
+F:	Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml
 F:	arch/arm/boot/dts/ste-*
 F:	arch/arm/mach-nomadik/
 F:	arch/arm/mach-ux500/