Message ID | 20240920000930.1828086-2-chris.packham@alliedtelesis.co.nz |
---|---|
State | Superseded |
Headers | show |
Series | i2c: RTL9300 support | expand |
On Fri, 20 Sep 2024 12:09:28 +1200, Chris Packham wrote: > Add dtschema for the I2C controller on the RTL9300 SoC. The I2C > controllers on this SoC are part of the "switch" block which is > represented here as a syscon node. The SCL pins are dependent on the I2C > controller (GPIO8 for the first controller, GPIO 17 for the second). The > SDA pins can be assigned to either one of the I2C controllers (but not > both). > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > > Notes: > Changes in v2: > - Use reg property for controller registers > - Remove global-control-offset (will be hard coded in driver) > - Integrated the multiplexing function. Child nodes now represent the > available SDA lines > > .../bindings/i2c/realtek,rtl9300-i2c.yaml | 82 +++++++++++++++++++ > MAINTAINERS | 6 ++ > 2 files changed, 88 insertions(+) > create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.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.example.dtb: /example-0/switch@1b000000: failed to match any schema with compatible: ['realtek,rtl9302c-switch', 'syscon', 'simple-mfd'] /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.example.dtb: i2c@36c: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'clock-frequency' were unexpected) from schema $id: http://devicetree.org/schemas/i2c/realtek,rtl9300-i2c.yaml# doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240920000930.1828086-2-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 Fri, Sep 20, 2024 at 12:09:28PM +1200, Chris Packham wrote: > Add dtschema for the I2C controller on the RTL9300 SoC. The I2C > controllers on this SoC are part of the "switch" block which is > represented here as a syscon node. The SCL pins are dependent on the I2C > controller (GPIO8 for the first controller, GPIO 17 for the second). The > SDA pins can be assigned to either one of the I2C controllers (but not > both). > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > > Notes: > Changes in v2: > - Use reg property for controller registers > - Remove global-control-offset (will be hard coded in driver) > - Integrated the multiplexing function. Child nodes now represent the > available SDA lines > > .../bindings/i2c/realtek,rtl9300-i2c.yaml | 82 +++++++++++++++++++ > MAINTAINERS | 6 ++ > 2 files changed, 88 insertions(+) > create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml > > diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml > new file mode 100644 > index 000000000000..e8c37239b299 > --- /dev/null > +++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.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.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Realtek RTL I2C Controller > + > +maintainers: > + - Chris Packham <chris.packham@alliedtelesis.co.nz> > + > +description: > + The RTL9300 SoC has two I2C controllers. Each of these has an SCL line (which > + if not-used for SCL can be a GPIO). There are 8 common SDA lines that can be > + assigned to either I2C controller. > + > +properties: > + compatible: > + const: realtek,rtl9300-i2c > + > + reg: > + description: Register offset and size this I2C controller. > + > +patternProperties: > + '^i2c@[0-7]$': > + $ref: /schemas/i2c/i2c-controller.yaml > + unevaluatedProperties: false > + > + properties: > + reg: > + description: The SDA pin associated with the I2C bus. > + maxItems: 1 > + > + required: > + - reg > + > +unevaluatedProperties: false This goes after "required:" block. > + > +required: > + - compatible > + - reg > + > +examples: > + - | > + switch@1b000000 { > + compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd"; Drop... or put entire example in the parent device node. > + reg = <0x1b000000 0x10000>; > + #address-cells = <1>; > + #size-cells = <1>; > + > + i2c@36c { > + compatible = "realtek,rtl9300-i2c"; Parent is 9302c, but this is 9300? > + reg = <0x36c 0x14>; > + clock-frequency = <100000>; > + #address-cells = <1>; > + #size-cells = <0>; > + > + i2c@0 { > + reg = <0>; > + #address-cells = <1>; > + #size-cells = <0>; > + gpio@20 { > + compatible = "nxp,pca9555"; Mixed indentation. > + gpio-controller; > + #gpio-cells = <2>; > + reg = <0x20>; > + }; > + }; Best regards, Krzysztof
Hi Krzyzstof, On 23/09/24 08:25, Krzysztof Kozlowski wrote: > On Fri, Sep 20, 2024 at 12:09:28PM +1200, Chris Packham wrote: >> Add dtschema for the I2C controller on the RTL9300 SoC. The I2C >> controllers on this SoC are part of the "switch" block which is >> represented here as a syscon node. The SCL pins are dependent on the I2C >> controller (GPIO8 for the first controller, GPIO 17 for the second). The >> SDA pins can be assigned to either one of the I2C controllers (but not >> both). >> >> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >> --- >> >> Notes: >> Changes in v2: >> - Use reg property for controller registers >> - Remove global-control-offset (will be hard coded in driver) >> - Integrated the multiplexing function. Child nodes now represent the >> available SDA lines >> >> .../bindings/i2c/realtek,rtl9300-i2c.yaml | 82 +++++++++++++++++++ >> MAINTAINERS | 6 ++ >> 2 files changed, 88 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml >> >> diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml >> new file mode 100644 >> index 000000000000..e8c37239b299 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml >> @@ -0,0 +1,82 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://scanmail.trustwave.com/?c=20988&d=2_3w5qdKawcvw7Bv6K3mA_v4JF1rlxddN3AhCekStg&u=http%3a%2f%2fdevicetree%2eorg%2fschemas%2fi2c%2frealtek%2crtl9300-i2c%2eyaml%23 >> +$schema: http://scanmail.trustwave.com/?c=20988&d=2_3w5qdKawcvw7Bv6K3mA_v4JF1rlxddNyJxDbgXsw&u=http%3a%2f%2fdevicetree%2eorg%2fmeta-schemas%2fcore%2eyaml%23 >> + >> +title: Realtek RTL I2C Controller >> + >> +maintainers: >> + - Chris Packham <chris.packham@alliedtelesis.co.nz> >> + >> +description: >> + The RTL9300 SoC has two I2C controllers. Each of these has an SCL line (which >> + if not-used for SCL can be a GPIO). There are 8 common SDA lines that can be >> + assigned to either I2C controller. >> + >> +properties: >> + compatible: >> + const: realtek,rtl9300-i2c >> + >> + reg: >> + description: Register offset and size this I2C controller. >> + >> +patternProperties: >> + '^i2c@[0-7]$': >> + $ref: /schemas/i2c/i2c-controller.yaml >> + unevaluatedProperties: false >> + >> + properties: >> + reg: >> + description: The SDA pin associated with the I2C bus. >> + maxItems: 1 >> + >> + required: >> + - reg >> + >> +unevaluatedProperties: false > This goes after "required:" block. Ack. >> + >> +required: >> + - compatible >> + - reg >> + >> +examples: >> + - | >> + switch@1b000000 { >> + compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd"; > Drop... or put entire example in the parent device node. OK I'll drop it. > >> + reg = <0x1b000000 0x10000>; >> + #address-cells = <1>; >> + #size-cells = <1>; >> + >> + i2c@36c { >> + compatible = "realtek,rtl9300-i2c"; > Parent is 9302c, but this is 9300? The RTL9302C is one of a series of switch chips with integrated CPUs. There is also the RTL9301, RTL9302B and RTL9303 (there my be others but those are the 4 I know about). The differences are all around the switch port/SERDES. The documentation uses "RTL9300" when referring to things common across the family. There's even an app note titled "RTL9300_I2C_Application_Note_V1.1(83)". So I'd really like to use "rtl9300" when talking about the SoC peripherals but use the specific chip compatible when talking about the Ethernet switch or the overall chip. I'm also tempted to add the other variants to my other in-flight patch series. "realtek,rtl9300-i2c" also happens to be what openwrt is using, but I'm not sure that that helps my argument as the binding is now quite different. > >> + reg = <0x36c 0x14>; >> + clock-frequency = <100000>; >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + i2c@0 { >> + reg = <0>; >> + #address-cells = <1>; >> + #size-cells = <0>; >> + gpio@20 { >> + compatible = "nxp,pca9555"; > Mixed indentation. Whoops missed that. Will fix. > >> + gpio-controller; >> + #gpio-cells = <2>; >> + reg = <0x20>; >> + }; >> + }; > Best regards, > Krzysztof >
On 23/09/2024 23:09, Chris Packham wrote: > Hi Krzyzstof, > > On 23/09/24 08:25, Krzysztof Kozlowski wrote: >> On Fri, Sep 20, 2024 at 12:09:28PM +1200, Chris Packham wrote: >>> Add dtschema for the I2C controller on the RTL9300 SoC. The I2C >>> controllers on this SoC are part of the "switch" block which is >>> represented here as a syscon node. The SCL pins are dependent on the I2C >>> controller (GPIO8 for the first controller, GPIO 17 for the second). The >>> SDA pins can be assigned to either one of the I2C controllers (but not >>> both). >>> >>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >>> --- >>> >>> Notes: >>> Changes in v2: >>> - Use reg property for controller registers >>> - Remove global-control-offset (will be hard coded in driver) >>> - Integrated the multiplexing function. Child nodes now represent the >>> available SDA lines >>> >>> .../bindings/i2c/realtek,rtl9300-i2c.yaml | 82 +++++++++++++++++++ >>> MAINTAINERS | 6 ++ >>> 2 files changed, 88 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml >>> new file mode 100644 >>> index 000000000000..e8c37239b299 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml >>> @@ -0,0 +1,82 @@ >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >>> +%YAML 1.2 >>> +--- >>> +$id: http://scanmail.trustwave.com/?c=20988&d=2_3w5qdKawcvw7Bv6K3mA_v4JF1rlxddN3AhCekStg&u=http%3a%2f%2fdevicetree%2eorg%2fschemas%2fi2c%2frealtek%2crtl9300-i2c%2eyaml%23 >>> +$schema: http://scanmail.trustwave.com/?c=20988&d=2_3w5qdKawcvw7Bv6K3mA_v4JF1rlxddNyJxDbgXsw&u=http%3a%2f%2fdevicetree%2eorg%2fmeta-schemas%2fcore%2eyaml%23 >>> + >>> +title: Realtek RTL I2C Controller >>> + >>> +maintainers: >>> + - Chris Packham <chris.packham@alliedtelesis.co.nz> >>> + >>> +description: >>> + The RTL9300 SoC has two I2C controllers. Each of these has an SCL line (which >>> + if not-used for SCL can be a GPIO). There are 8 common SDA lines that can be >>> + assigned to either I2C controller. >>> + >>> +properties: >>> + compatible: >>> + const: realtek,rtl9300-i2c >>> + >>> + reg: >>> + description: Register offset and size this I2C controller. >>> + >>> +patternProperties: >>> + '^i2c@[0-7]$': >>> + $ref: /schemas/i2c/i2c-controller.yaml >>> + unevaluatedProperties: false >>> + >>> + properties: >>> + reg: >>> + description: The SDA pin associated with the I2C bus. >>> + maxItems: 1 >>> + >>> + required: >>> + - reg >>> + >>> +unevaluatedProperties: false >> This goes after "required:" block. > Ack. >>> + >>> +required: >>> + - compatible >>> + - reg >>> + >>> +examples: >>> + - | >>> + switch@1b000000 { >>> + compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd"; >> Drop... or put entire example in the parent device node. > > OK I'll drop it. > >> >>> + reg = <0x1b000000 0x10000>; >>> + #address-cells = <1>; >>> + #size-cells = <1>; >>> + >>> + i2c@36c { >>> + compatible = "realtek,rtl9300-i2c"; >> Parent is 9302c, but this is 9300? > > The RTL9302C is one of a series of switch chips with integrated CPUs. > There is also the RTL9301, RTL9302B and RTL9303 (there my be others but > those are the 4 I know about). The differences are all around the switch > port/SERDES. The documentation uses "RTL9300" when referring to things > common across the family. There's even an app note titled > "RTL9300_I2C_Application_Note_V1.1(83)". So I'd really like to use > "rtl9300" when talking about the SoC peripherals but use the specific > chip compatible when talking about the Ethernet switch or the overall > chip. I'm also tempted to add the other variants to my other in-flight > patch series. Using family variant alone is in general not accepted. You need SoC specific compatible in the front. > > "realtek,rtl9300-i2c" also happens to be what openwrt is using, but I'm > not sure that that helps my argument as the binding is now quite different. Does not matter. They could be using "realtek,we-like-to-use-whatever-we-invented-soc", but that does not mean we should accept it. Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml new file mode 100644 index 000000000000..e8c37239b299 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.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.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek RTL I2C Controller + +maintainers: + - Chris Packham <chris.packham@alliedtelesis.co.nz> + +description: + The RTL9300 SoC has two I2C controllers. Each of these has an SCL line (which + if not-used for SCL can be a GPIO). There are 8 common SDA lines that can be + assigned to either I2C controller. + +properties: + compatible: + const: realtek,rtl9300-i2c + + reg: + description: Register offset and size this I2C controller. + +patternProperties: + '^i2c@[0-7]$': + $ref: /schemas/i2c/i2c-controller.yaml + unevaluatedProperties: false + + properties: + reg: + description: The SDA pin associated with the I2C bus. + maxItems: 1 + + required: + - reg + +unevaluatedProperties: false + +required: + - compatible + - reg + +examples: + - | + switch@1b000000 { + compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd"; + reg = <0x1b000000 0x10000>; + #address-cells = <1>; + #size-cells = <1>; + + i2c@36c { + compatible = "realtek,rtl9300-i2c"; + reg = <0x36c 0x14>; + clock-frequency = <100000>; + #address-cells = <1>; + #size-cells = <0>; + + 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 f328373463b0..ccb1125444f4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19887,6 +19887,12 @@ S: Maintained T: git https://github.com/pkshih/rtw.git F: drivers/net/wireless/realtek/rtl8xxxu/ +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.yaml + RTRS TRANSPORT DRIVERS M: Md. Haris Iqbal <haris.iqbal@ionos.com> M: Jack Wang <jinpu.wang@ionos.com>
Add dtschema for the I2C controller on the RTL9300 SoC. The I2C controllers on this SoC are part of the "switch" block which is represented here as a syscon node. The SCL pins are dependent on the I2C controller (GPIO8 for the first controller, GPIO 17 for the second). The SDA pins can be assigned to either one of the I2C controllers (but not both). Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> --- Notes: Changes in v2: - Use reg property for controller registers - Remove global-control-offset (will be hard coded in driver) - Integrated the multiplexing function. Child nodes now represent the available SDA lines .../bindings/i2c/realtek,rtl9300-i2c.yaml | 82 +++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml