linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] mips: realtek: Add reboot support
@ 2024-09-23 22:57 Chris Packham
  2024-09-23 22:57 ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Chris Packham
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Chris Packham @ 2024-09-23 22:57 UTC (permalink / raw)
  To: lee, robh, krzk+dt, conor+dt, tsbogend
  Cc: devicetree, linux-kernel, linux-mips, Chris Packham

The system reboot on the cameo-rtl9302c (and presumably many other boards based
on the realtek reference design) is connected via the switch reset register
(RST_GLB_CTRL_0).

Because the switch register block encompasses a number of functions that would
normally be separate perhipherals I've represented it as a syscon node. Right
now the only peripheral I've added is the reset (using syscon-reboot). The
binding and syscon node will be expanded in the future to add some additional
functions (e.g. I2C, GPIO, MDIO).

Chris Packham (3):
  dt-bindings: mfd: Add Realtek switch
  mips: dts: realtek: Add syscon-reboot node
  dt-bindings: mfd: Add more RTL9300 variants

 .../bindings/mfd/realtek,rtl9302c-switch.yaml | 53 +++++++++++++++++++
 arch/mips/boot/dts/realtek/rtl930x.dtsi       | 11 ++++
 2 files changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml

-- 
2.46.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch
  2024-09-23 22:57 [PATCH v4 0/3] mips: realtek: Add reboot support Chris Packham
@ 2024-09-23 22:57 ` Chris Packham
  2024-09-24  8:39   ` Krzysztof Kozlowski
  2024-09-23 22:57 ` [PATCH v4 2/3] mips: dts: realtek: Add syscon-reboot node Chris Packham
  2024-09-23 22:57 ` [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants Chris Packham
  2 siblings, 1 reply; 15+ messages in thread
From: Chris Packham @ 2024-09-23 22:57 UTC (permalink / raw)
  To: lee, robh, krzk+dt, conor+dt, tsbogend
  Cc: devicetree, linux-kernel, linux-mips, Chris Packham

Add device tree schema for the Realtek switch. Currently the only
supported feature is the syscon-reboot which is needed to be able to
reboot the board.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

Notes:
    Changes in v3:
    - fix schema id to match filename
    Changes in v2:
    - use filename that matches the compatible
    - put maintainers after title
    - remove unnecessary label in example
    - Rework description to focus on what is implemented rather than what
      may be implemented in the future.

 .../bindings/mfd/realtek,rtl9302c-switch.yaml | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml

diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
new file mode 100644
index 000000000000..2d20dd07a7e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/realtek,rtl9302c-switch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek Switch with Internal CPU
+
+maintainers:
+  - Chris Packham <chris.packham@alliedtelesis.co.nz>
+
+description:
+  The RTL9302 is an Ethernet switch with an integrated CPU. A number of
+  different peripherals are accessed through a common register block,
+  represented here as a syscon node.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - realtek,rtl9302c-switch
+      - const: syscon
+      - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  reboot:
+    $ref: /schemas/power/reset/syscon-reboot.yaml#
+
+required:
+  - compatible
+  - reg
+  - reboot
+
+additionalProperties: false
+
+examples:
+  - |
+    ethernet-switch@1b000000 {
+      compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd";
+      reg = <0x1b000000 0x10000>;
+
+      reboot {
+        compatible = "syscon-reboot";
+        offset = <0x0c>;
+        value = <0x01>;
+      };
+    };
+
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v4 2/3] mips: dts: realtek: Add syscon-reboot node
  2024-09-23 22:57 [PATCH v4 0/3] mips: realtek: Add reboot support Chris Packham
  2024-09-23 22:57 ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Chris Packham
@ 2024-09-23 22:57 ` Chris Packham
  2024-09-24  8:40   ` Krzysztof Kozlowski
  2024-09-23 22:57 ` [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants Chris Packham
  2 siblings, 1 reply; 15+ messages in thread
From: Chris Packham @ 2024-09-23 22:57 UTC (permalink / raw)
  To: lee, robh, krzk+dt, conor+dt, tsbogend
  Cc: devicetree, linux-kernel, linux-mips, Chris Packham

The board level reset on systems using the RTL9302 can be driven via the
switch. Use a syscon-reboot node to represent this.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

Notes:
    Changes in v3:
    - None
    Changes in v2:
    - drop redundant status = "okay"

 arch/mips/boot/dts/realtek/rtl930x.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/mips/boot/dts/realtek/rtl930x.dtsi b/arch/mips/boot/dts/realtek/rtl930x.dtsi
index f271940f82be..cf1b38b6c353 100644
--- a/arch/mips/boot/dts/realtek/rtl930x.dtsi
+++ b/arch/mips/boot/dts/realtek/rtl930x.dtsi
@@ -29,6 +29,17 @@ lx_clk: clock-175mhz {
 		#clock-cells = <0>;
 		clock-frequency  = <175000000>;
 	};
+
+	switch0: switch@1b000000 {
+		compatible = "realtek,rtl9302c-switch", "syscon", "simple-mfd";
+		reg = <0x1b000000 0x10000>;
+
+		reboot {
+			compatible = "syscon-reboot";
+			offset = <0x0c>;
+			value = <0x01>;
+		};
+	};
 };
 
 &soc {
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants
  2024-09-23 22:57 [PATCH v4 0/3] mips: realtek: Add reboot support Chris Packham
  2024-09-23 22:57 ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Chris Packham
  2024-09-23 22:57 ` [PATCH v4 2/3] mips: dts: realtek: Add syscon-reboot node Chris Packham
@ 2024-09-23 22:57 ` Chris Packham
  2024-09-24  8:40   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 15+ messages in thread
From: Chris Packham @ 2024-09-23 22:57 UTC (permalink / raw)
  To: lee, robh, krzk+dt, conor+dt, tsbogend
  Cc: devicetree, linux-kernel, linux-mips, Chris Packham

Add the RTL9301, RTL9300B and RTL9303. These have the same SoC as the
RTL9302C but differ in the Ethernet switch/SERDES arrangement.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

Notes:
    Changes in v4:
    - New

 .../devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml       | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
index 2d20dd07a7e9..a3ba6d9bacaa 100644
--- a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
+++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
@@ -18,7 +18,10 @@ properties:
   compatible:
     items:
       - enum:
+          - realtek,rtl9301-switch
+          - realtek,rtl9302b-switch
           - realtek,rtl9302c-switch
+          - realtek,rtl9303-switch
       - const: syscon
       - const: simple-mfd
 
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch
  2024-09-23 22:57 ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Chris Packham
@ 2024-09-24  8:39   ` Krzysztof Kozlowski
  2024-09-24  8:51     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-24  8:39 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee, robh, krzk+dt, conor+dt, tsbogend, devicetree, linux-kernel,
	linux-mips

On Tue, Sep 24, 2024 at 10:57:17AM +1200, Chris Packham wrote:
> Add device tree schema for the Realtek switch. Currently the only
> supported feature is the syscon-reboot which is needed to be able to
> reboot the board.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants
  2024-09-23 22:57 ` [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants Chris Packham
@ 2024-09-24  8:40   ` Krzysztof Kozlowski
  2024-09-24 20:59     ` Chris Packham
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-24  8:40 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee, robh, krzk+dt, conor+dt, tsbogend, devicetree, linux-kernel,
	linux-mips

On Tue, Sep 24, 2024 at 10:57:19AM +1200, Chris Packham wrote:
> Add the RTL9301, RTL9300B and RTL9303. These have the same SoC as the
> RTL9302C but differ in the Ethernet switch/SERDES arrangement.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> 
> Notes:
>     Changes in v4:
>     - New
> 
>  .../devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml       | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
> index 2d20dd07a7e9..a3ba6d9bacaa 100644
> --- a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
> +++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
> @@ -18,7 +18,10 @@ properties:
>    compatible:
>      items:
>        - enum:
> +          - realtek,rtl9301-switch
> +          - realtek,rtl9302b-switch
>            - realtek,rtl9302c-switch
> +          - realtek,rtl9303-switch

This should be squashed. One logical change is to add a new binding for
entire family, not device-by-device.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 2/3] mips: dts: realtek: Add syscon-reboot node
  2024-09-23 22:57 ` [PATCH v4 2/3] mips: dts: realtek: Add syscon-reboot node Chris Packham
@ 2024-09-24  8:40   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-24  8:40 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee, robh, krzk+dt, conor+dt, tsbogend, devicetree, linux-kernel,
	linux-mips

On Tue, Sep 24, 2024 at 10:57:18AM +1200, Chris Packham wrote:
> The board level reset on systems using the RTL9302 can be driven via the
> switch. Use a syscon-reboot node to represent this.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> 
> Notes:
>     Changes in v3:
>     - None
>     Changes in v2:
>     - drop redundant status = "okay"

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch
  2024-09-24  8:39   ` Krzysztof Kozlowski
@ 2024-09-24  8:51     ` Krzysztof Kozlowski
  2024-09-24 20:56       ` Chris Packham
  0 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-24  8:51 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee, robh, krzk+dt, conor+dt, tsbogend, devicetree, linux-kernel,
	linux-mips

On 24/09/2024 10:39, Krzysztof Kozlowski wrote:
> On Tue, Sep 24, 2024 at 10:57:17AM +1200, Chris Packham wrote:
>> Add device tree schema for the Realtek switch. Currently the only
>> supported feature is the syscon-reboot which is needed to be able to
>> reboot the board.
>>
>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>> ---
> 
> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
> 

Unreviewed - it is incomplete!

No, we said multiple times, you must send complete binding. Sending
pieces for review does not give us full picture and hides parts of the
controversial decisions. If you want to go this way, next time you will
get NAK when adding i2c@0-7 to parent binding.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch
  2024-09-24  8:51     ` Krzysztof Kozlowski
@ 2024-09-24 20:56       ` Chris Packham
  2024-09-24 22:16         ` [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals Chris Packham
  2024-09-25  8:08         ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Krzysztof Kozlowski
  0 siblings, 2 replies; 15+ messages in thread
From: Chris Packham @ 2024-09-24 20:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org

Hi Krzysztof,

On 24/09/24 20:51, Krzysztof Kozlowski wrote:
> On 24/09/2024 10:39, Krzysztof Kozlowski wrote:
>> On Tue, Sep 24, 2024 at 10:57:17AM +1200, Chris Packham wrote:
>>> Add device tree schema for the Realtek switch. Currently the only
>>> supported feature is the syscon-reboot which is needed to be able to
>>> reboot the board.
>>>
>>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>>> ---
>> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
>>
> Unreviewed - it is incomplete!
>
> No, we said multiple times, you must send complete binding. Sending
> pieces for review does not give us full picture and hides parts of the
> controversial decisions. If you want to go this way, next time you will
> get NAK when adding i2c@0-7 to parent binding.
>
Fair enough.

I did already get myself tied in knots trying to juggle two dependent 
series. I thought I was making things easier to review by sending them 
in smaller chunks but obviously I'm holding things back that are 
relevant for context.

So just to be clear, one binding in mfd that covers the reboot and i2c 
for the 4 variants? That's about as much as I can actually test driver wise.

I could add the mdio and switch ports but I'm not at a point where I 
could really test them properly. I know the binding doesn't necessarily 
need code to be able to describe the hardware but it does run the risk 
that I might miss something in the binding that I need when I do get to 
the driver code.

I also did want to say thanks for your patience. It may not seem like it 
but I really do appreciate your feedback and I do try to take it all on 
board.

> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants
  2024-09-24  8:40   ` Krzysztof Kozlowski
@ 2024-09-24 20:59     ` Chris Packham
  2024-09-25  7:20       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 15+ messages in thread
From: Chris Packham @ 2024-09-24 20:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org


On 24/09/24 20:40, Krzysztof Kozlowski wrote:
> On Tue, Sep 24, 2024 at 10:57:19AM +1200, Chris Packham wrote:
>> Add the RTL9301, RTL9300B and RTL9303. These have the same SoC as the
>> RTL9302C but differ in the Ethernet switch/SERDES arrangement.
>>
>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>> ---
>>
>> Notes:
>>      Changes in v4:
>>      - New
>>
>>   .../devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml       | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
>> index 2d20dd07a7e9..a3ba6d9bacaa 100644
>> --- a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
>> +++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
>> @@ -18,7 +18,10 @@ properties:
>>     compatible:
>>       items:
>>         - enum:
>> +          - realtek,rtl9301-switch
>> +          - realtek,rtl9302b-switch
>>             - realtek,rtl9302c-switch
>> +          - realtek,rtl9303-switch
> This should be squashed. One logical change is to add a new binding for
> entire family, not device-by-device.
Yes I did consider that. The main thing that gave me pause for thought 
was the file naming thing. If I squash this should I switch back to the 
realtek,rtl9300-switch filename? I'll probably add the 
realtek,rtl9300-switch fallback as well (and add the chip specific 
compatibles for the i2c).
>
> Best regards,
> Krzysztof
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals
  2024-09-24 20:56       ` Chris Packham
@ 2024-09-24 22:16         ` Chris Packham
  2024-09-24 23:21           ` Rob Herring (Arm)
  2024-09-25  7:25           ` Krzysztof Kozlowski
  2024-09-25  8:08         ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Krzysztof Kozlowski
  1 sibling, 2 replies; 15+ messages in thread
From: Chris Packham @ 2024-09-24 22:16 UTC (permalink / raw)
  To: krzk
  Cc: lee, robh, conor+dt, tsbogend, devicetree, linux-kernel,
	linux-mips, Chris Packham

Add device tree schema for the Realtek RTL9300 switches. The RTL9300
family is made up of the RTL9301, RTL9302B, RTL9302C and RTL9303. These
have the same SoC differ in the Ethernet switch/SERDES arrangement.

Currently the only supported features are the syscon-reboot and i2c
controllers. The syscon-reboot is needed to be able to reboot the board.
The I2C controllers are slightly unusual because they each own an SCL
pin (GPIO 8 for the first controller, GPIO 17 for the second) but have 8
common SDA pins which can be assigned to either controller (but not
both).

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

This is my initial attempt at addressing Krzysztof's comments from my two
series. I expect there may still be a bit of discussion on the binding so I'm
just sending this on it's own rather than the whole series.

 .../bindings/i2c/realtek,rtl9300-i2c.yaml     |  98 ++++++++++++++++
 .../bindings/mfd/realtek,rtl9300-switch.yaml  | 110 ++++++++++++++++++
 2 files changed, 208 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml
 create mode 100644 Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.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..e8cf328b2710
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml
@@ -0,0 +1,99 @@
+# 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:
+    items:
+      - enum:
+          - realtek,rtl9301-i2c
+          - realtek,rtl9302b-i2c
+          - realtek,rtl9302c-i2c
+          - realtek,rtl9303-i2c
+      - const: realtek,rtl9300-i2c
+
+  reg:
+    description: Register offset and size this I2C controller.
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+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
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c@36c {
+      compatible = "realtek,rtl9302c-i2c", "realtek,rtl9300-i2c";
+      reg = <0x36c 0x14>;
+      #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>;
+        };
+      };
+    };
+
+    i2c@388 {
+      compatible = "realtek,rtl9302c-i2c", "realtek,rtl9300-i2c";
+      reg = <0x388 0x14>;
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      i2c@7 {
+        reg = <7>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+      };
+    };
diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.yaml
new file mode 100644
index 000000000000..713cf3211569
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.yaml
@@ -0,0 +1,110 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/realtek,rtl9300-switch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek Switch with Internal CPU
+
+maintainers:
+  - Chris Packham <chris.packham@alliedtelesis.co.nz>
+
+description:
+  The RTL9302 is an Ethernet switch with an integrated CPU. A number of
+  different peripherals are accessed through a common register block,
+  represented here as a syscon node.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - realtek,rtl9301-switch
+          - realtek,rtl9302b-switch
+          - realtek,rtl9302c-switch
+          - realtek,rtl9303-switch
+      - const: realtek,rtl9300-switch
+      - const: syscon
+      - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  reboot:
+    $ref: /schemas/power/reset/syscon-reboot.yaml#
+
+  i2c:
+    $ref: /schemas/i2c/realtek,rtl9300-i2c.yaml#
+
+required:
+  - compatible
+  - reg
+  - reboot
+
+additionalProperties: false
+
+examples:
+  - |
+    ethernet-switch@1b000000 {
+      compatible = "realtek,rtl9302c-switch", "realtek,rtl9300-switch", "syscon", "simple-mfd";
+      reg = <0x1b000000 0x10000>;
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      reboot@c {
+        compatible = "syscon-reboot";
+        reg = <0x0c 0x4>;
+        offset = <0x0c>;
+        value = <0x01>;
+      };
+
+      i2c@36c {
+        compatible = "realtek,rtl9302c-i2c", "realtek,rtl9300-i2c";
+        reg = <0x36c 0x14>;
+        #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>;
+          };
+        };
+      };
+
+      i2c@388 {
+        compatible = "realtek,rtl9302c-i2c", "realtek,rtl9300-i2c";
+        reg = <0x388 0x14>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        i2c@7 {
+          reg = <7>;
+          #address-cells = <1>;
+          #size-cells = <0>;
+          gpio@20 {
+            compatible = "nxp,pca9555";
+            gpio-controller;
+            #gpio-cells = <2>;
+            reg = <0x20>;
+          };
+        };
+      };
+    };
+
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals
  2024-09-24 22:16         ` [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals Chris Packham
@ 2024-09-24 23:21           ` Rob Herring (Arm)
  2024-09-25  7:25           ` Krzysztof Kozlowski
  1 sibling, 0 replies; 15+ messages in thread
From: Rob Herring (Arm) @ 2024-09-24 23:21 UTC (permalink / raw)
  To: Chris Packham
  Cc: devicetree, tsbogend, lee, linux-kernel, krzk, linux-mips,
	conor+dt


On Wed, 25 Sep 2024 10:16:26 +1200, Chris Packham wrote:
> Add device tree schema for the Realtek RTL9300 switches. The RTL9300
> family is made up of the RTL9301, RTL9302B, RTL9302C and RTL9303. These
> have the same SoC differ in the Ethernet switch/SERDES arrangement.
> 
> Currently the only supported features are the syscon-reboot and i2c
> controllers. The syscon-reboot is needed to be able to reboot the board.
> The I2C controllers are slightly unusual because they each own an SCL
> pin (GPIO 8 for the first controller, GPIO 17 for the second) but have 8
> common SDA pins which can be assigned to either controller (but not
> both).
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> 
> This is my initial attempt at addressing Krzysztof's comments from my two
> series. I expect there may still be a bit of discussion on the binding so I'm
> just sending this on it's own rather than the whole series.
> 
>  .../bindings/i2c/realtek,rtl9300-i2c.yaml     |  98 ++++++++++++++++
>  .../bindings/mfd/realtek,rtl9300-switch.yaml  | 110 ++++++++++++++++++
>  2 files changed, 208 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/i2c/realtek,rtl9300-i2c.yaml
>  create mode 100644 Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.example.dtb: ethernet-switch@1b000000: 'reboot' is a required property
	from schema $id: http://devicetree.org/schemas/mfd/realtek,rtl9300-switch.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.example.dtb: ethernet-switch@1b000000: '#address-cells', '#size-cells', 'i2c@36c', 'i2c@388', 'reboot@c' do not match any of the regexes: 'pinctrl-[0-9]+'
	from schema $id: http://devicetree.org/schemas/mfd/realtek,rtl9300-switch.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/realtek,rtl9300-switch.example.dtb: reboot@c: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'
	from schema $id: http://devicetree.org/schemas/power/reset/syscon-reboot.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240924221626.3290531-1-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.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants
  2024-09-24 20:59     ` Chris Packham
@ 2024-09-25  7:20       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-25  7:20 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org

On 24/09/2024 22:59, Chris Packham wrote:
> 
> On 24/09/24 20:40, Krzysztof Kozlowski wrote:
>> On Tue, Sep 24, 2024 at 10:57:19AM +1200, Chris Packham wrote:
>>> Add the RTL9301, RTL9300B and RTL9303. These have the same SoC as the
>>> RTL9302C but differ in the Ethernet switch/SERDES arrangement.
>>>
>>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>>> ---
>>>
>>> Notes:
>>>      Changes in v4:
>>>      - New
>>>
>>>   .../devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml       | 3 +++
>>>   1 file changed, 3 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
>>> index 2d20dd07a7e9..a3ba6d9bacaa 100644
>>> --- a/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
>>> +++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9302c-switch.yaml
>>> @@ -18,7 +18,10 @@ properties:
>>>     compatible:
>>>       items:
>>>         - enum:
>>> +          - realtek,rtl9301-switch
>>> +          - realtek,rtl9302b-switch
>>>             - realtek,rtl9302c-switch
>>> +          - realtek,rtl9303-switch
>> This should be squashed. One logical change is to add a new binding for
>> entire family, not device-by-device.
> Yes I did consider that. The main thing that gave me pause for thought 
> was the file naming thing. If I squash this should I switch back to the 
> realtek,rtl9300-switch filename? I'll probably add the 
> realtek,rtl9300-switch fallback as well (and add the chip specific 
> compatibles for the i2c).

Splitting this per patch did not solve it - following your logic, file
should be renamed.

Choose name matching one compatible, e.g. the fallback. Aren't all these
devices compatible?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals
  2024-09-24 22:16         ` [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals Chris Packham
  2024-09-24 23:21           ` Rob Herring (Arm)
@ 2024-09-25  7:25           ` Krzysztof Kozlowski
  1 sibling, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-25  7:25 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee, robh, conor+dt, tsbogend, devicetree, linux-kernel,
	linux-mips

On Wed, Sep 25, 2024 at 10:16:26AM +1200, Chris Packham wrote:
> Add device tree schema for the Realtek RTL9300 switches. The RTL9300
> family is made up of the RTL9301, RTL9302B, RTL9302C and RTL9303. These
> have the same SoC differ in the Ethernet switch/SERDES arrangement.
> 
> Currently the only supported features are the syscon-reboot and i2c
> controllers. The syscon-reboot is needed to be able to reboot the board.
> The I2C controllers are slightly unusual because they each own an SCL
> pin (GPIO 8 for the first controller, GPIO 17 for the second) but have 8
> common SDA pins which can be assigned to either controller (but not
> both).
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> 
> This is my initial attempt at addressing Krzysztof's comments from my two
> series. I expect there may still be a bit of discussion on the binding so I'm
> just sending this on it's own rather than the whole series.

You need to change the reboot binding first, then you add this one
(either one or two patches).

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch
  2024-09-24 20:56       ` Chris Packham
  2024-09-24 22:16         ` [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals Chris Packham
@ 2024-09-25  8:08         ` Krzysztof Kozlowski
  1 sibling, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-25  8:08 UTC (permalink / raw)
  To: Chris Packham
  Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org

On 24/09/2024 22:56, Chris Packham wrote:
> Hi Krzysztof,
> 
> On 24/09/24 20:51, Krzysztof Kozlowski wrote:
>> On 24/09/2024 10:39, Krzysztof Kozlowski wrote:
>>> On Tue, Sep 24, 2024 at 10:57:17AM +1200, Chris Packham wrote:
>>>> Add device tree schema for the Realtek switch. Currently the only
>>>> supported feature is the syscon-reboot which is needed to be able to
>>>> reboot the board.
>>>>
>>>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>>>> ---
>>> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
>>>
>> Unreviewed - it is incomplete!
>>
>> No, we said multiple times, you must send complete binding. Sending
>> pieces for review does not give us full picture and hides parts of the
>> controversial decisions. If you want to go this way, next time you will
>> get NAK when adding i2c@0-7 to parent binding.
>>
> Fair enough.
> 
> I did already get myself tied in knots trying to juggle two dependent 
> series. I thought I was making things easier to review by sending them 
> in smaller chunks but obviously I'm holding things back that are 
> relevant for context.

Pieces of chunks works fine for drivers, but bindings is an exception
here: if possible, we want to see entire hardware description.

> 
> So just to be clear, one binding in mfd that covers the reboot and i2c 
> for the 4 variants? That's about as much as I can actually test driver wise.

This can be multiple binding files, multiple patches (organized in
bisectable way)... Not sure about what you ask here.

> 
> I could add the mdio and switch ports but I'm not at a point where I 
> could really test them properly. I know the binding doesn't necessarily 
> need code to be able to describe the hardware but it does run the risk 
> that I might miss something in the binding that I need when I do get to 
> the driver code.

OK, MDIO/switch ports can be skipped. Skip anything which you do not
know how it looks or works yet. But in the case of MFD and I2C, you
already had everything available.

> 
> I also did want to say thanks for your patience. It may not seem like it 
> but I really do appreciate your feedback and I do try to take it all on 
> board.

No worries, you are doing a great job, I appreciate it. I probably sound
harsher than intended.


Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-09-25  8:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 22:57 [PATCH v4 0/3] mips: realtek: Add reboot support Chris Packham
2024-09-23 22:57 ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Chris Packham
2024-09-24  8:39   ` Krzysztof Kozlowski
2024-09-24  8:51     ` Krzysztof Kozlowski
2024-09-24 20:56       ` Chris Packham
2024-09-24 22:16         ` [RFC PATCH v4.5] dt-bindings: mfd: Add Realtek RTL9300 switch peripherals Chris Packham
2024-09-24 23:21           ` Rob Herring (Arm)
2024-09-25  7:25           ` Krzysztof Kozlowski
2024-09-25  8:08         ` [PATCH v4 1/3] dt-bindings: mfd: Add Realtek switch Krzysztof Kozlowski
2024-09-23 22:57 ` [PATCH v4 2/3] mips: dts: realtek: Add syscon-reboot node Chris Packham
2024-09-24  8:40   ` Krzysztof Kozlowski
2024-09-23 22:57 ` [PATCH v4 3/3] dt-bindings: mfd: Add more RTL9300 variants Chris Packham
2024-09-24  8:40   ` Krzysztof Kozlowski
2024-09-24 20:59     ` Chris Packham
2024-09-25  7:20       ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).