From df28fe4b597c8c8b2b4e031f409c47e33a73e9fe Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj <namiltd@yahoo.com> Date: Tue, 4 Jun 2024 17:59:54 +0200 Subject: [PATCH] kernel: rtl8367b: remove unnecessary cpu_port setting Set the appropriate cpu_port value based on the use of realtek,extif0 to extif2 instead of the additional cpu_port parameter. Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/15033 Signed-off-by: Robert Marko <robimarko@gmail.com> --- target/linux/apm821xx/dts/netgear-wndap6x0.dtsi | 1 - target/linux/generic/files/drivers/net/phy/rtl8367b.c | 11 ++++++++--- .../linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts | 1 - .../linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts | 1 - .../linux/ramips/dts/mt7620a_tplink_ec220-g5-v2.dts | 1 - .../linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts | 1 - 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi index 2921bfedb9..9d98776626 100644 --- a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi +++ b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi @@ -224,7 +224,6 @@ rtl8367b { compatible = "realtek,rtl8367b"; - cpu_port = <5>; realtek,extif0 = <1 2 1 1 1 1 1 1 2>; mii-bus = <&mdio0>; }; diff --git a/target/linux/generic/files/drivers/net/phy/rtl8367b.c b/target/linux/generic/files/drivers/net/phy/rtl8367b.c index cd0d58cbfa..04c790e924 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8367b.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8367b.c @@ -1583,6 +1583,13 @@ static int rtl8367b_detect(struct rtl8366_smi *smi) dev_info(smi->parent, "RTL%s chip found\n", chip_name); + if (of_property_present(smi->parent->of_node, "realtek,extif2")) + smi->cpu_port = RTL8367B_CPU_PORT_NUM + 2; + else if (of_property_present(smi->parent->of_node, "realtek,extif1") && (chip_ver != 0x1010)) /* for the RTL8367R-VB chip, extif1 corresponds to cpu_port 5 */ + smi->cpu_port = RTL8367B_CPU_PORT_NUM + 1; + + dev_info(smi->parent, "CPU port: %u\n", smi->cpu_port); + return 0; } @@ -1621,9 +1628,7 @@ static int rtl8367b_probe(struct platform_device *pdev) smi->cmd_write = 0xb8; smi->ops = &rtl8367b_smi_ops; smi->num_ports = RTL8367B_NUM_PORTS; - if (of_property_read_u32(pdev->dev.of_node, "cpu_port", &smi->cpu_port) - || smi->cpu_port >= smi->num_ports) - smi->cpu_port = RTL8367B_CPU_PORT_NUM; + smi->cpu_port = RTL8367B_CPU_PORT_NUM; smi->num_vlan_mc = RTL8367B_NUM_VLANS; smi->mib_counters = rtl8367b_mib_counters; smi->num_mib_counters = ARRAY_SIZE(rtl8367b_mib_counters); diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts index b134398f44..45cafdbcd1 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts @@ -55,7 +55,6 @@ rtl8367rb { compatible = "realtek,rtl8367b"; - cpu_port = <6>; realtek,extif1 = <1 0 1 1 1 1 1 1 2>; mii-bus = <&mdio0>; }; diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts b/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts index 1ed156e8af..855e06e9f6 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-c5-v4.dts @@ -74,7 +74,6 @@ rtl8367s { compatible = "realtek,rtl8367b"; - cpu_port = <7>; realtek,extif2 = <1 0 1 1 1 1 1 1 2>; mii-bus = <&mdio0>; phy-id = <29>; diff --git a/target/linux/ramips/dts/mt7620a_tplink_ec220-g5-v2.dts b/target/linux/ramips/dts/mt7620a_tplink_ec220-g5-v2.dts index 6ac1a9c5d5..7fc075aedd 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_ec220-g5-v2.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_ec220-g5-v2.dts @@ -82,7 +82,6 @@ rtl8367s { compatible = "realtek,rtl8367b"; - cpu_port = <7>; realtek,extif2 = <1 0 1 1 1 1 1 1 2>; mii-bus = <&mdio0>; phy-id = <29>; diff --git a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts index e96ca9ace6..0630e8a160 100644 --- a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts +++ b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts @@ -85,7 +85,6 @@ rtl8367rb { compatible = "realtek,rtl8367b"; - cpu_port = <7>; realtek,extif2 = <1 0 1 1 1 1 1 1 2>; mii-bus = <&mdio0>; }; -- 2.30.2