From: Pawel Dembicki Date: Thu, 29 Sep 2022 20:25:24 +0000 (+0200) Subject: mcp85xx: Switch TP-Link TL-WDR4900 v1 to DSA X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=bfa5e4e4eba36757826d0b5d463558f6916d3456;p=openwrt%2Fstaging%2Fjow.git mcp85xx: Switch TP-Link TL-WDR4900 v1 to DSA 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 Tested-by: Nick Hainke # TP Link WDR4900 v1 (5.15) --- diff --git a/target/linux/mpc85xx/base-files/etc/board.d/02_network b/target/linux/mpc85xx/base-files/etc/board.d/02_network index 03153b73d0..7a677ee96f 100644 --- a/target/linux/mpc85xx/base-files/etc/board.d/02_network +++ b/target/linux/mpc85xx/base-files/etc/board.d/02_network @@ -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 index 0000000000..bcc03e9502 --- /dev/null +++ b/target/linux/mpc85xx/base-files/etc/board.d/05_compat-version @@ -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 diff --git a/target/linux/mpc85xx/config-5.10 b/target/linux/mpc85xx/config-5.10 index ab2ca05f9c..909cd53092 100644 --- a/target/linux/mpc85xx/config-5.10 +++ b/target/linux/mpc85xx/config-5.10 @@ -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" diff --git a/target/linux/mpc85xx/config-5.15 b/target/linux/mpc85xx/config-5.15 index 9e143d7b87..5700a247de 100644 --- a/target/linux/mpc85xx/config-5.15 +++ b/target/linux/mpc85xx/config-5.15 @@ -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" diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts index 12281808aa..c54cb53f94 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts @@ -102,20 +102,78 @@ }; 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>; + }; + }; }; }; @@ -128,10 +186,14 @@ }; 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 { diff --git a/target/linux/mpc85xx/image/p1010.mk b/target/linux/mpc85xx/image/p1010.mk index a18cd6d178..92cad3d035 100644 --- a/target/linux/mpc85xx/image/p1010.mk +++ b/target/linux/mpc85xx/image/p1010.mk @@ -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 diff --git a/target/linux/mpc85xx/p1010/config-default b/target/linux/mpc85xx/p1010/config-default index 8a065f7944..5ca65812d7 100644 --- a/target/linux/mpc85xx/p1010/config-default +++ b/target/linux/mpc85xx/p1010/config-default @@ -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 diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index 73176a87dc..65b40e1d7d 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -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