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>
};
};
- 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 {
};
- 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 {
};
- 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 {
};
};
- 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 {
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");
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");