Message ID | 20240917232932.3641992-5-chris.packham@alliedtelesis.co.nz (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | i2c: RTL9300 support | expand |
On Wed, 18 Sep 2024 11:29:31 +1200, Chris Packham wrote: > An extension of the RTL9300 SoC is to support multiplexing by selecting > the SDA pins that are being used dynamically. Add a binding that allows > us to describe hardware that makes use of this. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > .../bindings/i2c/realtek,rtl9300-i2c-mux.yaml | 82 +++++++++++++++++++ > MAINTAINERS | 1 + > 2 files changed, 83 insertions(+) > create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: dtschema/dtc warnings/errors: Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.example.dts:22.25-28.13: Warning (unit_address_vs_reg): /example-0/switch@1b000000/i2c@36c: node has a unit name, but no reg or ranges property Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.example.dtb: /example-0/switch@1b000000: failed to match any schema with compatible: ['realtek,rtl9302c-switch', 'syscon', 'simple-mfd'] doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240917232932.3641992-5-chris.packham@alliedtelesis.co.nz The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
On Wed, Sep 18, 2024 at 11:29:31AM +1200, Chris Packham wrote: > An extension of the RTL9300 SoC is to support multiplexing by selecting > the SDA pins that are being used dynamically. Add a binding that allows > us to describe hardware that makes use of this. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > .../bindings/i2c/realtek,rtl9300-i2c-mux.yaml | 82 +++++++++++++++++++ > MAINTAINERS | 1 + > 2 files changed, 83 insertions(+) > create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml > > diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml > new file mode 100644 > index 000000000000..a64879d0fda7 > --- /dev/null > +++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml > @@ -0,0 +1,82 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/i2c/realtek,rtl9300-i2c-mux.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Realtek RTL I2C Multiplexer > + > +maintainers: > + - Chris Packham <chris.packham@alliedtelesis.co.nz> > + > +description: | > + The I2C controllers on the RTL9300 support a level of multiplexing. In the > + simple case the rtl9300-i2c binding can provide a single SDA pin per > + controller. This binding allows a more than one SDA line to be used per > + controller providing a level of multiplexing. > + > +properties: > + compatible: > + const: realtek,rtl9300-i2c-mux > + > + i2c-parent: > + description: phandle of the I2C bus controller that this multiplexer > + operates on. > + $ref: /schemas/types.yaml#/definitions/phandle The mux isn't a separate device, so I think this should just be part of the i2c parent: i2c-mux@36c { i2c@0 { ... }; i2c@1 { ... }; ... }; And then you can get rid of the SDA pin property. If you only use 1 pin, then there is just 1 'i2c' child node with an address matching the SDA pin. Rob
diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml new file mode 100644 index 000000000000..a64879d0fda7 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/realtek,rtl9300-i2c-mux.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek RTL I2C Multiplexer + +maintainers: + - Chris Packham <chris.packham@alliedtelesis.co.nz> + +description: | + The I2C controllers on the RTL9300 support a level of multiplexing. In the + simple case the rtl9300-i2c binding can provide a single SDA pin per + controller. This binding allows a more than one SDA line to be used per + controller providing a level of multiplexing. + +properties: + compatible: + const: realtek,rtl9300-i2c-mux + + i2c-parent: + description: phandle of the I2C bus controller that this multiplexer + operates on. + $ref: /schemas/types.yaml#/definitions/phandle + +allOf: + - $ref: i2c-mux.yaml + +unevaluatedProperties: false + +required: + - compatible + - i2c-parent + +examples: + - | + switch@1b000000 { + compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd"; + reg = <0x1b000000 0x10000>; + + i2c0: i2c@36c { + compatible = "realtek,rtl9300-i2c"; + realtek,control-offset = <0x36c>; + realtek,global-control-offset = <0x384>; + #address-cells = <1>; + #size-cells = <0>; + }; + }; + + base { + i2c-mux { + compatible = "realtek,rtl9300-i2c-mux"; + #address-cells = <1>; + #size-cells = <0>; + i2c-parent = <&i2c0>; + + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + gpio@20 { + compatible = "nxp,pca9555"; + gpio-controller; + #gpio-cells = <2>; + reg = <0x20>; + }; + }; + + i2c@2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + gpio@20 { + compatible = "nxp,pca9555"; + gpio-controller; + #gpio-cells = <2>; + reg = <0x20>; + }; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 9e123e9839a5..178ac8a7e843 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19891,6 +19891,7 @@ RTL9300 I2C DRIVER (rtl9300-i2c) M: Chris Packham <chris.packham@alliedtelesis.co.nz> L: linux-i2c@vger.kernel.org S: Maintained +F: Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml F: Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml F: drivers/i2c/busses/i2c-rtl9300.c
An extension of the RTL9300 SoC is to support multiplexing by selecting the SDA pins that are being used dynamically. Add a binding that allows us to describe hardware that makes use of this. Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> --- .../bindings/i2c/realtek,rtl9300-i2c-mux.yaml | 82 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c-mux.yaml