Re: [PATCH net-next v7 5/7] ARM64: dts: marvell: Fix some common switch mistakes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 25, 2023 at 9:48 PM Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:

> We  *COULD* add a second over-specified compatible to the switch
> node. Such as:
>
>       switch0@10 {
>                 compatible = "marvell,turris-mox-mv88e6190-switch",
> "marvell,mv88e6190";
>
> (and the same for the 6085 version)
>
> And use that to relax the requirement for that variant with an - if:
> statemement.
>
> This should work fine since U-Boot is only looking for nodenames, not
> compatible strings. I think I will try this approach.

This works. Compatibles added like such to the turris-mox nodes:

        switch0@10 {
-               compatible = "marvell,mv88e6190";
+               compatible = "marvell,turris-mox-mv88e6190",
"marvell,mv88e6190";

The mv88e6xxx schema will look like so:

 properties:
   compatible:
+    oneOf:
+      - enum:
+          - marvell,mv88e6085
+          - marvell,mv88e6190
+          - marvell,mv88e6250
(...)
+      - items:
+          - const: marvell,turris-mox-mv88e6085
+          - const: marvell,mv88e6085
+      - items:
+          - const: marvell,turris-mox-mv88e6190
+          - const: marvell,mv88e6190

Then ethernet-switch.yaml gets this:

-properties:
-  $nodename:
-    pattern: "^(ethernet-)?switch(@.*)?$"
+allOf:
+  # This condition is here to satisfy the case where certain device
+  # nodes have to preserve non-standard names because of
+  # backward-compatibility with boot loaders inspecting certain
+  # node names.
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - marvell,turris-mox-mv88e6085
+              - marvell,turris-mox-mv88e6190
+    then:
+      properties:
+        $nodename:
+          pattern: "switch[0-3]@[0-3]+$"
+    else:
+      properties:
+        $nodename:
+          pattern: "^(ethernet-)?switch(@.*)?$"

This latter thing is maybe not so nice for everyone to process.

The alternative is however to copy all of dsa.yaml, dsa-port.yaml and
ethernet-port.yaml (maybe more) into the Marvell binding. Which I can do,
of course. (qca8k is already deviant).

Unless there is a better way.

Yours,
Linus Walleij





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux