diff mbox series

[net-next,v6,1/6] dt-bindings: mfd: Add switch to RTL9300

Message ID 20250204030249.1965444-2-chris.packham@alliedtelesis.co.nz (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series RTL9300 MDIO driver | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply fail Patch does not apply to net-next-0

Commit Message

Chris Packham Feb. 4, 2025, 3:02 a.m. UTC
Add bindings for the ethernet-switch portion of the RTL9300.

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

Notes:
    Changes in v6:
    - New
    - I'd like to enforce the property being "ethernet-ports" but I see the
      generic binding allows "ports" as well. Can I just add ethernet-ports:
      type: object here or does by driver need to handle both "ports" and
      "ethernet-ports" (I see some do and some don't).

 .../bindings/mfd/realtek,rtl9301-switch.yaml     | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Krzysztof Kozlowski Feb. 4, 2025, 8:09 a.m. UTC | #1
On Tue, Feb 04, 2025 at 04:02:44PM +1300, Chris Packham wrote:
> Add bindings for the ethernet-switch portion of the RTL9300.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> 
> Notes:
>     Changes in v6:
>     - New
>     - I'd like to enforce the property being "ethernet-ports" but I see the
>       generic binding allows "ports" as well. Can I just add ethernet-ports:
>       type: object here or does by driver need to handle both "ports" and
>       "ethernet-ports" (I see some do and some don't).
> 
>  .../bindings/mfd/realtek,rtl9301-switch.yaml     | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
> index f053303ab1e6..cb54abda5e6a 100644
> --- a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
> +++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
> @@ -14,6 +14,8 @@ description:
>    number of different peripherals are accessed through a common register block,
>    represented here as a syscon node.
>  
> +$ref: /schemas/net/ethernet-switch.yaml#
> +
>  properties:
>    compatible:
>      items:
> @@ -45,7 +47,7 @@ required:
>    - compatible
>    - reg
>  

I don't get why this device receives now children without addresses.
Either your children have 'reg' or they do not. Mixing is a sign of a
mess, like this was never actually simple-mfd.

You would get this comment if you posted complete schema the first time.

Best regards,
Krzysztof
Rob Herring (Arm) Feb. 4, 2025, 4:02 p.m. UTC | #2
On Tue, Feb 04, 2025 at 04:02:44PM +1300, Chris Packham wrote:
> Add bindings for the ethernet-switch portion of the RTL9300.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
> 
> Notes:
>     Changes in v6:
>     - New
>     - I'd like to enforce the property being "ethernet-ports" but I see the
>       generic binding allows "ports" as well. Can I just add ethernet-ports:
>       type: object here

Yes. And keep 'additionalProperties'.

>  or does by driver need to handle both "ports" and
>       "ethernet-ports" (I see some do and some don't).

No, it doesn't.

> 
>  .../bindings/mfd/realtek,rtl9301-switch.yaml     | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
> index f053303ab1e6..cb54abda5e6a 100644
> --- a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
> +++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
> @@ -14,6 +14,8 @@ description:
>    number of different peripherals are accessed through a common register block,
>    represented here as a syscon node.
>  
> +$ref: /schemas/net/ethernet-switch.yaml#

If you don't have any device specific per port properties, then this 
needs to be: ethernet-switch.yaml#/$defs/ethernet-ports

> +
>  properties:
>    compatible:
>      items:
> @@ -45,7 +47,7 @@ required:
>    - compatible
>    - reg
>  
> -additionalProperties: false
> +unevaluatedProperties: false
>  
>  examples:
>    - |
> @@ -110,5 +112,17 @@ examples:
>            };
>          };
>        };
> +
> +      ethernet-ports {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        port@0 {
> +          reg = <0>;
> +        };
> +        port@1 {
> +          reg = <1>;
> +        };
> +      };
>      };
>  
> -- 
> 2.48.1
>
Chris Packham Feb. 4, 2025, 8:14 p.m. UTC | #3
Hi Krzysztof,

On 04/02/2025 21:09, Krzysztof Kozlowski wrote:
> On Tue, Feb 04, 2025 at 04:02:44PM +1300, Chris Packham wrote:
>> Add bindings for the ethernet-switch portion of the RTL9300.
>>
>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>> ---
>>
>> Notes:
>>      Changes in v6:
>>      - New
>>      - I'd like to enforce the property being "ethernet-ports" but I see the
>>        generic binding allows "ports" as well. Can I just add ethernet-ports:
>>        type: object here or does by driver need to handle both "ports" and
>>        "ethernet-ports" (I see some do and some don't).
>>
>>   .../bindings/mfd/realtek,rtl9301-switch.yaml     | 16 +++++++++++++++-
>>   1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
>> index f053303ab1e6..cb54abda5e6a 100644
>> --- a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
>> +++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
>> @@ -14,6 +14,8 @@ description:
>>     number of different peripherals are accessed through a common register block,
>>     represented here as a syscon node.
>>   
>> +$ref: /schemas/net/ethernet-switch.yaml#
>> +
>>   properties:
>>     compatible:
>>       items:
>> @@ -45,7 +47,7 @@ required:
>>     - compatible
>>     - reg
>>   
> I don't get why this device receives now children without addresses.
> Either your children have 'reg' or they do not. Mixing is a sign of a
> mess, like this was never actually simple-mfd.
>
> You would get this comment if you posted complete schema the first time.

Yes fair enough. I think I erred too far on the side of trying to send 
small chunks (and also not wanting to commit to a binding before I had 
working drivers).

So how do we move forward? There's one more patch I haven't sent yet 
that adds interrupts for the switch block. But other than that I think 
what I have now covers all of the major components in this chip.

There's only one in-tree board that uses this and I'm the maintainer of 
it so withdrawing the mfd binding and replacing it with something else 
is not out of the question. There may be some complaints from make 
dtbs_check while we get this sorted but hopefully we can get that done soon.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
index f053303ab1e6..cb54abda5e6a 100644
--- a/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
+++ b/Documentation/devicetree/bindings/mfd/realtek,rtl9301-switch.yaml
@@ -14,6 +14,8 @@  description:
   number of different peripherals are accessed through a common register block,
   represented here as a syscon node.
 
+$ref: /schemas/net/ethernet-switch.yaml#
+
 properties:
   compatible:
     items:
@@ -45,7 +47,7 @@  required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
@@ -110,5 +112,17 @@  examples:
           };
         };
       };
+
+      ethernet-ports {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        port@0 {
+          reg = <0>;
+        };
+        port@1 {
+          reg = <1>;
+        };
+      };
     };