]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dts: convert to upstream switch notation 23599/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 31 May 2026 14:35:35 +0000 (16:35 +0200)
committerMarkus Stockhausen <markus.stockhausen@gmx.de>
Mon, 1 Jun 2026 17:15:51 +0000 (19:15 +0200)
There is currently a difference how upstream and downstream define
the switch in the dts. Downstream holds the switch as a member
node below a root switchcore parent. Upstream uses the switch as
the parent.

Upstream:

  ethernet-switch@1b000000 {
    mdio-controller@ca00 { };
    ethernet { };
    ethernet-ports { };
  }

Downstream:

  switchcore@1b000000 {
    ethernet-switch {
      ethernet-ports { };
    };
    mdio-controller@ca00 { };
    ethernet { };
  }

Align downstream to upstream and merge the ethernet-switch into
the parent node. For this to work adapt the port lookup in the MDIO
and PCS driver.

Remark! With this commit the boot process will give the spurious
error message "rtl838x_eth 1b000000.ethernet-switch:ethernet eth0:
Failed to create a device link to DSA switch 1b000000.ethernet-switch"
This comes from the fact that the switch is the parent of the ethernet
device. Thus a link back from ethernet device to the switch is no
longer possible. Testing shows that the error is just cosmetic.

Link: https://github.com/openwrt/openwrt/pull/23599
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
target/linux/realtek/dts/rtl838x.dtsi
target/linux/realtek/dts/rtl839x.dtsi
target/linux/realtek/dts/rtl930x.dtsi
target/linux/realtek/dts/rtl931x.dtsi
target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c
target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c

index 64e1e26e2976223566053d74ef491b4771b8ded9..1ee9c46212f9463a46127f5991a148e28c3fddc4 100644 (file)
                };
        };
 
-       switchcore@1b000000 {
-               compatible = "syscon", "simple-mfd";
+       switch0: ethernet-switch@1b000000 {
+               compatible = "realtek,rtl8380-switch", "realtek,otto-switch", "syscon", "simple-mfd";
                reg = <0x1b000000 0x10000>;
+               interrupt-parent = <&intc>;
+               interrupts = <20 2>;
                #address-cells = <1>;
                #size-cells = <1>;
 
                        compatible = "realtek,rtl8380-thermal";
                        #thermal-sensor-cells = <0>;
                };
-
-               switch0: ethernet-switch {
-                       compatible = "realtek,rtl8380-switch", "realtek,otto-switch";
-                       status = "okay";
-
-                       interrupt-parent = <&intc>;
-                       interrupts = <20 2>;
-               };
        };
 
        pinmux@1b000144 {
index 4ed1af9d0532e6f9c7f35fe568dc2e9bc5eef2ed..0a31019dbffe1978d60d2fce1d8b8cf08556e11e 100644 (file)
 
        };
 
-       switchcore@1b000000 {
-               compatible = "syscon", "simple-mfd";
+       switch0: ethernet-switch@1b000000 {
+               compatible = "realtek,rtl8392-switch", "realtek,otto-switch", "syscon", "simple-mfd";
                reg = <0x1b000000 0x10000>;
+               interrupt-parent = <&intc>;
+               interrupts = <20 2>;
                #address-cells = <1>;
                #size-cells = <1>;
 
                        compatible = "realtek,rtl8390-thermal";
                        #thermal-sensor-cells = <0>;
                };
-
-               switch0: ethernet-switch {
-                       compatible = "realtek,rtl8392-switch", "realtek,otto-switch";
-                       status = "okay";
-
-                       interrupt-parent = <&intc>;
-                       interrupts = <20 2>;
-               };
        };
 
        pinmux@1b000004 {
index 2e5d9eb65230aa8056cb02e02247c02cdf354969..10507b1d389a92c7ae634ec410b1798fee099b5b 100644 (file)
 
        };
 
-       switchcore@1b000000 {
-               compatible = "syscon", "simple-mfd";
+       switch0: ethernet-switch@1b000000 {
+               compatible = "realtek,rtl9301-switch", "realtek,otto-switch", "syscon", "simple-mfd";
                reg = <0x1b000000 0x10000>;
+               interrupt-parent = <&intc>;
+               interrupts = <23 2>;
                #address-cells = <1>;
                #size-cells = <1>;
 
                        compatible = "realtek,rtl9300-thermal";
                        #thermal-sensor-cells = <0>;
                };
-
-               switch0: ethernet-switch {
-                       compatible = "realtek,rtl9301-switch", "realtek,otto-switch";
-                       status = "okay";
-
-                       interrupt-parent = <&intc>;
-                       interrupts = <23 2>;
-               };
        };
 
        pinmux@1b000200 {
index 95448ae6fef4658135efea89dd08012fe797b170..a26bfc6d5546f1637931a73013dfa9715285093d 100644 (file)
                };
        };
 
-       switchcore@1b000000 {
-               compatible = "syscon", "simple-mfd";
+       switch0: ethernet-switch@1b000000 {
+               compatible = "realtek,rtl9311-switch", "realtek,otto-switch", "syscon", "simple-mfd";
                reg = <0x1b000000 0x10000>;
+               interrupt-parent = <&gic>;
+               interrupts = <GIC_SHARED 15 IRQ_TYPE_LEVEL_HIGH>;
+               #interrupt-cells = <3>;
                #address-cells = <1>;
                #size-cells = <1>;
 
                                #pcs-cells = <1>;
                        };
                };
-
-               switch0: ethernet-switch {
-                       compatible = "realtek,rtl9311-switch", "realtek,otto-switch";
-                       status = "okay";
-
-                       interrupt-parent = <&gic>;
-                       #interrupt-cells = <3>;
-                       interrupts = <GIC_SHARED 15 IRQ_TYPE_LEVEL_HIGH>;
-               };
        };
 
        pinmux@1b00103c {
index 6888f86eba19eeef982921fe1a1c9b7663abc2c1..c4d425b78475003d7c38dd16fd495a75d92d5136 100644 (file)
@@ -976,14 +976,9 @@ static int rtmd_map_ports(struct device *dev)
        struct rtmd_ctrl *ctrl = dev_get_drvdata(dev);
        int smi_bus, smi_addr, pn;
 
-       struct fwnode_handle *fw_parent __free(fwnode_handle) = fwnode_get_parent(fw_dev);
-       if (!fw_parent)
-               return -ENODEV;
-
-       struct fwnode_handle *fw_switch __free(fwnode_handle) =
-               fwnode_get_named_child_node(fw_parent, "ethernet-switch");
+       struct fwnode_handle *fw_switch __free(fwnode_handle) = fwnode_get_parent(fw_dev);
        if (!fw_switch)
-               return dev_err_probe(dev, -ENODEV, "%pfwP missing ethernet-switch\n", fw_parent);
+               return -ENODEV;
 
        struct fwnode_handle *fw_ports __free(fwnode_handle) =
                fwnode_get_named_child_node(fw_switch, "ethernet-ports");
index ea1c445289f592461474feb4000fdfc76a47c9a3..b48d790090161444444e73b82d35cdeea59be175 100644 (file)
@@ -4247,14 +4247,9 @@ static struct rtpcs_serdes *rtpcs_find_serdes(struct rtpcs_ctrl *ctrl,
 static int rtpcs_map_links(struct device *dev, struct rtpcs_ctrl *ctrl)
 {
        struct fwnode_handle *fw_dev = dev_fwnode(dev);
-       struct fwnode_handle *fw_parent __free(fwnode_handle) = fwnode_get_parent(fw_dev);
-       if (!fw_parent)
-               return -ENODEV;
-
-       struct fwnode_handle *fw_switch __free(fwnode_handle) =
-               fwnode_get_named_child_node(fw_parent, "ethernet-switch");
+       struct fwnode_handle *fw_switch __free(fwnode_handle) = fwnode_get_parent(fw_dev);
        if (!fw_switch)
-               return dev_err_probe(dev, -ENODEV, "%pfwP missing ethernet-switch\n", fw_parent);
+               return -ENODEV;
 
        struct fwnode_handle *fw_ports __free(fwnode_handle) =
                fwnode_get_named_child_node(fw_switch, "ethernet-ports");