mcp85xx: Switch TP-Link TL-WDR4900 v1 to DSA
authorPawel Dembicki <paweldembicki@gmail.com>
Thu, 29 Sep 2022 20:25:24 +0000 (22:25 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 20 Feb 2023 11:04:44 +0000 (12:04 +0100)
This patch introduces DSA support for TP-Link TL-WDR4900 v1 switch.
Swconfig driver for QCA8327 switch is removed because this router is
only one device which use Qualcom swconfig switch.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Tested-by: Nick Hainke <vincent@systemli.org> # TP Link WDR4900 v1 (5.15)
target/linux/mpc85xx/base-files/etc/board.d/02_network
target/linux/mpc85xx/base-files/etc/board.d/05_compat-version [new file with mode: 0644]
target/linux/mpc85xx/config-5.10
target/linux/mpc85xx/config-5.15
target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
target/linux/mpc85xx/image/p1010.mk
target/linux/mpc85xx/p1010/config-default
target/linux/mpc85xx/p1020/config-default

index 03153b73d0b00dbf7b15f684e7255fecc746bbf3..7a677ee96f6318de3712a8ce25926369089f2741 100644 (file)
@@ -18,8 +18,7 @@ ocedo,panda)
                "0:lan" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "6:lan" "7:lan" "8u@eth0"
        ;;
 tplink,tl-wdr4900-v1)
-       ucidef_add_switch "switch0" \
-               "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
+       ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
        ucidef_set_interface_macaddr "wan" "$(macaddr_add $(mtd_get_mac_binary u-boot 0x4fc00) 1)"
        ;;
 *)
diff --git a/target/linux/mpc85xx/base-files/etc/board.d/05_compat-version b/target/linux/mpc85xx/base-files/etc/board.d/05_compat-version
new file mode 100644 (file)
index 0000000..bcc03e9
--- /dev/null
@@ -0,0 +1,15 @@
+
+. /lib/functions.sh
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+       tplink,tl-wdr4900-v1)
+               ucidef_set_compat_version "1.1"
+               ;;
+esac
+
+board_config_flush
+
+exit 0
index ab2ca05f9c86459412d5be0fa0eb33336406ec58..909cd53092e233d55cdc00f2297fbc9b255faa4a 100644 (file)
@@ -1,8 +1,6 @@
 # CONFIG_40x is not set
 # CONFIG_44x is not set
 # CONFIG_ADVANCED_OPTIONS is not set
-CONFIG_AR8216_PHY=y
-CONFIG_AR8216_PHY_LEDS=y
 CONFIG_ARCH_32BIT_OFF_T=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_KEEP_MEMBLOCK=y
@@ -65,7 +63,6 @@ CONFIG_EDAC_LEGACY_SYSFS=y
 CONFIG_EDAC_MPC85XX=y
 CONFIG_EDAC_SUPPORT=y
 CONFIG_ENABLE_MUST_CHECK=y
-CONFIG_ETHERNET_PACKET_MANGLE=y
 CONFIG_FIXED_PHY=y
 CONFIG_FSL_BOOKE=y
 CONFIG_FSL_EMB_PERFMON=y
@@ -240,7 +237,6 @@ CONFIG_SPI_MEM=y
 CONFIG_SRCU=y
 # CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_STX_GP3 is not set
-CONFIG_SWCONFIG=y
 CONFIG_SWPHY=y
 CONFIG_SYSCTL_EXCEPTION_TRACE=y
 CONFIG_TARGET_CPU="8540"
index 9e143d7b875abfda15a06cc837a8a6955884cd67..5700a247de6ab2e867185c79919954aebb6ef79f 100644 (file)
@@ -1,8 +1,6 @@
 # CONFIG_40x is not set
 # CONFIG_44x is not set
 # CONFIG_ADVANCED_OPTIONS is not set
-CONFIG_AR8216_PHY=y
-CONFIG_AR8216_PHY_LEDS=y
 CONFIG_ARCH_32BIT_OFF_T=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_KEEP_MEMBLOCK=y
@@ -60,7 +58,6 @@ CONFIG_EDAC_ATOMIC_SCRUB=y
 CONFIG_EDAC_LEGACY_SYSFS=y
 CONFIG_EDAC_MPC85XX=y
 CONFIG_EDAC_SUPPORT=y
-CONFIG_ETHERNET_PACKET_MANGLE=y
 CONFIG_FIXED_PHY=y
 CONFIG_FSL_BOOKE=y
 # CONFIG_FSL_DPAA2_SWITCH is not set
@@ -238,7 +235,6 @@ CONFIG_SPI_MEM=y
 CONFIG_SRCU=y
 # CONFIG_STRIP_ASM_SYMS is not set
 # CONFIG_STX_GP3 is not set
-CONFIG_SWCONFIG=y
 CONFIG_SWPHY=y
 CONFIG_SYSCTL_EXCEPTION_TRACE=y
 CONFIG_TARGET_CPU="8540"
index 12281808aa5b6007813ed0a83e108677299326a2..c54cb53f9452ea2c03a3c251e6b6e303ee7effb9 100644 (file)
                };
 
                mdio@24000 {
-                       phy0: ethernet-phy@0 {
-                               reg = <0x0>;
-                               qca,ar8327-initvals = <
-                                       0x00004 0x07600000 /* PAD0_MODE */
-                                       0x00008 0x00000000 /* PAD5_MODE */
-                                       0x0000c 0x01000000 /* PAD6_MODE */
-                                       0x00010 0x40000000 /* POWER_ON_STRAP */
-                                       0x00050 0xcf35cf35 /* LED_CTRL0 */
-                                       0x00054 0xcf35cf35 /* LED_CTRL1 */
-                                       0x00058 0xcf35cf35 /* LED_CTRL2 */
-                                       0x0005c 0x03ffff00 /* LED_CTRL3 */
-                                       0x0007c 0x0000007e /* PORT0_STATUS */
-                                       0x00094 0x00000200 /* PORT6_STATUS */
-                               >;
+
+                       phy_port1: phy@0 {
+                               reg = <0>;
+                       };
+
+                       phy_port2: phy@1 {
+                               reg = <1>;
+                       };
+
+                       phy_port3: phy@2 {
+                               reg = <2>;
+                       };
+
+                       phy_port4: phy@3 {
+                               reg = <3>;
+                       };
+
+                       phy_port5: phy@4 {
+                               reg = <4>;
+                       };
+
+                       switch@0 {
+                               compatible = "qca,qca8327";
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+                               reg = <0x10>;
+
+                               ports {
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       port@0 {
+                                               reg = <0>;
+                                               ethernet = <&enet0>;
+                                               phy-mode = "rgmii-id";
+
+                                               fixed-link {
+                                                       speed = <1000>;
+                                                       full-duplex;
+                                               };
+                                       };
+
+                                       port@1 {
+                                               reg = <1>;
+                                               label = "wan";
+                                               phy-handle = <&phy_port1>;
+                                       };
+
+                                       port@2 {
+                                               reg = <2>;
+                                               label = "lan1";
+                                               phy-handle = <&phy_port2>;
+                                       };
+
+                                       port@3 {
+                                               reg = <3>;
+                                               label = "lan2";
+                                               phy-handle = <&phy_port3>;
+                                       };
+
+                                       port@4 {
+                                               reg = <4>;
+                                               label = "lan3";
+                                               phy-handle = <&phy_port4>;
+                                       };
+
+                                       port@5 {
+                                               reg = <5>;
+                                               label = "lan4";
+                                               phy-handle = <&phy_port5>;
+                                       };
+                               };
                        };
                };
 
                };
 
                enet0: ethernet@b0000 {
-                       phy-handle = <&phy0>;
                        phy-connection-type = "rgmii-id";
                        nvmem-cells = <&macaddr_uboot_4fc00>;
                        nvmem-cell-names = "mac-address";
+
+                       fixed-link {
+                               speed = <1000>;
+                               full-duplex;
+                       };
                };
 
                enet1: ethernet@b1000 {
index a18cd6d17888ae3f0297c320290d39de4130b3a8..92cad3d03586a07de41150078d74cf279393883f 100644 (file)
@@ -18,6 +18,8 @@ define Device/tplink_tl-wdr4900-v1
   DEVICE_VENDOR := TP-Link
   DEVICE_MODEL := TL-WDR4900
   DEVICE_VARIANT := v1
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
   TPLINK_HEADER_VERSION := 1
   TPLINK_HWID := 0x49000001
   TPLINK_HWREV := 1
index 8a065f7944161c297bf7bc332d3fdaf4a7c6b88e..5ca65812d709d541203ec9f8c903fea05646f082 100644 (file)
@@ -1,3 +1,4 @@
+CONFIG_AT803X_PHY=y
 # CONFIG_FSL_CORENET_CF is not set
 CONFIG_MTD_NAND_FSL_IFC=y
 CONFIG_MTD_SPLIT_FIRMWARE=y
@@ -6,7 +7,15 @@ CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BEB_LIMIT=20
 CONFIG_MTD_UBI_BLOCK=y
 CONFIG_MTD_UBI_WL_THRESHOLD=4096
+CONFIG_NET_DEVLINK=y
+CONFIG_NET_DSA=y
+CONFIG_NET_DSA_QCA8K=y
+CONFIG_NET_DSA_TAG_QCA=y
+CONFIG_NET_SWITCHDEV=y
+CONFIG_PHYLINK=y
 CONFIG_REALTEK_PHY=y
 CONFIG_RED_15W_REV1=y
+CONFIG_REGMAP=y
+CONFIG_REGULATOR=y
 CONFIG_TL_WDR4900_V1=y
 CONFIG_UBIFS_FS=y
index 73176a87dc793a66edf55b4325782e554e6ae7e8..65b40e1d7d87424517f5725cfae330d442e5de1b 100644 (file)
@@ -43,6 +43,7 @@ CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
 CONFIG_SMP=y
 CONFIG_SPI_GPIO=y
+CONFIG_SWCONFIG=y
 CONFIG_SWCONFIG_B53=y
 # CONFIG_SWCONFIG_B53_MMAP_DRIVER is not set
 CONFIG_SWCONFIG_B53_PHY_DRIVER=y