浏览代码

ipq806x: convert each device to DSA implementation

Convert each ipq806x device to DSA implementation using the qca8k
driver. Rework 02_network to follow the new naming scheme.
Update 01_leds to use netdev trigger with correct DSA port and drop
now unused switch trigger.

Currently secondary CPU is disabled and will be reneabled later.

Signed-off-by: Christian Marangi <[email protected]>
Christian Marangi 4 年之前
父节点
当前提交
337e36e0ef
共有 29 个文件被更改,包括 2025 次插入396 次删除
  1. 1 1
      target/linux/ipq806x/Makefile
  2. 11 11
      target/linux/ipq806x/base-files/etc/board.d/01_leds
  3. 39 71
      target/linux/ipq806x/base-files/etc/board.d/02_network
  4. 45 0
      target/linux/ipq806x/base-files/etc/board.d/05_compat-version
  5. 0 1
      target/linux/ipq806x/config-6.1
  6. 97 15
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts
  7. 99 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi
  8. 26 0
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200.dts
  9. 99 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
  10. 99 17
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ap161.dts
  11. 99 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts
  12. 99 15
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-db149.dts
  13. 26 0
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ea7500-v1.dts
  14. 0 6
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts
  15. 100 12
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi
  16. 100 11
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts
  17. 67 15
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi
  18. 97 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
  19. 99 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts
  20. 99 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts
  21. 98 13
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts
  22. 99 14
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts
  23. 99 18
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts
  24. 98 32
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
  25. 99 36
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi
  26. 100 13
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts
  27. 89 11
      target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts
  28. 7 0
      target/linux/ipq806x/image/chromium.mk
  29. 34 0
      target/linux/ipq806x/image/generic.mk

+ 1 - 1
target/linux/ipq806x/Makefile

@@ -16,7 +16,7 @@ KERNELNAME:=zImage Image dtbs
 
 include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
-	kmod-leds-gpio kmod-gpio-button-hotplug swconfig \
+	kmod-leds-gpio kmod-gpio-button-hotplug \
 	kmod-ata-ahci kmod-ata-ahci-platform \
 	kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
 	kmod-phy-qcom-ipq806x-usb kmod-usb3 kmod-usb-dwc3-qcom \

+ 11 - 11
target/linux/ipq806x/base-files/etc/board.d/01_leds

@@ -11,7 +11,7 @@ board=$(board_name)
 case "$board" in
 buffalo,wxr-2533dhp)
 	ucidef_set_led_wlan "wlan" "WLAN" "white:wireless" "phy0tpt"
-	ucidef_set_led_switch "wan" "WAN" "white:internet" "switch0" "0x20"
+	ucidef_set_led_netdev "wan" "WAN" "white:internet" "wan"
 	;;
 compex,wpq864)
 	ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
@@ -28,10 +28,10 @@ meraki,mr52)
 nec,wg2600hp)
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy1tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy0tpt"
-	ucidef_set_led_switch "wan" "WAN" "green:active" "switch0" "0x2"
+	ucidef_set_led_netdev "wan" "WAN" "green:active" "wan"
 	;;
 nec,wg2600hp3)
-	ucidef_set_led_switch "wan" "WAN" "green:active" "switch0" "0x2"
+	ucidef_set_led_netdev "wan" "WAN" "green:active" "wan"
 	;;
 netgear,d7800 |\
 netgear,r7500 |\
@@ -41,7 +41,7 @@ netgear,xr450 |\
 netgear,xr500)
 	ucidef_set_led_usbport "usb1" "USB 1" "white:usb1" "usb1-port1" "usb2-port1"
 	ucidef_set_led_usbport "usb2" "USB 2" "white:usb2" "usb3-port1" "usb4-port1"
-	ucidef_set_led_switch "wan" "WAN" "white:wan" "switch0" "0x20"
+	ucidef_set_led_netdev "wan" "WAN" "white:wan" "wan"
 	ucidef_set_led_ide "esata" "eSATA" "white:esata"
 	;;
 nokia,ac400i)
@@ -55,8 +55,8 @@ nokia,ac400i)
 tplink,ad7200)
 	ucidef_set_led_usbport "usb1" "USB 1" "blue:usb1" "usb1-port1" "usb2-port1"
 	ucidef_set_led_usbport "usb2" "USB 2" "blue:usb3" "usb3-port1" "usb4-port1"
-	ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x02"
-	ucidef_set_led_switch "lan" "lan" "blue:lan" "switch0" "0x3c"
+	ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan"
+	ucidef_set_led_netdev "lan" "lan" "blue:lan" "br-lan"
 	ucidef_set_led_wlan "wlan2g" "wlan2g" "blue:wlan2g" "phy2tpt"
 	ucidef_set_led_wlan "wlan5g" "wlan5g" "blue:wlan5g" "phy1tpt"
 	ucidef_set_led_netdev "wlan60g" "wlan60g" "blue:wlan60g" "wlan0"
@@ -64,18 +64,18 @@ tplink,ad7200)
 tplink,c2600)
 	ucidef_set_led_usbport "usb1" "USB 1" "white:usb_2" "usb1-port1" "usb2-port1"
 	ucidef_set_led_usbport "usb2" "USB 2" "white:usb_4" "usb3-port1" "usb4-port1"
-	ucidef_set_led_switch "wan" "wan" "white:wan" "switch0" "0x20"
-	ucidef_set_led_switch "lan" "lan" "white:lan" "switch0" "0x1e"
+	ucidef_set_led_netdev "wan" "wan" "white:wan" "wan"
+	ucidef_set_led_netdev "lan" "lan" "white:lan" "br-lan"
 	;;
 tplink,vr2600v)
 	ucidef_set_led_usbport "usb" "USB" "white:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1"
-	ucidef_set_led_switch "lan" "lan" "white:lan" "switch0" "0x1e"
+	ucidef_set_led_netdev "lan" "lan" "white:lan" "br-lan"
 	ucidef_set_led_wlan "wlan2g" "WLAN2G" "white:wlan2g" "phy0tpt"
 	ucidef_set_led_wlan "wlan5g" "WLAN5G" "white:wlan5g" "phy1tpt"
-	ucidef_set_led_switch "wan" "wan" "white:wan" "switch0" "0x20"
+	ucidef_set_led_netdev "wan" "WAN" "white:wan" "wan"
 	;;
 zyxel,nbg6817)
-	ucidef_set_led_netdev "wan" "WAN" "white:internet" "eth1"
+	ucidef_set_led_netdev "wan" "WAN" "white:internet" "wan"
 	;;
 esac
 

+ 39 - 71
target/linux/ipq806x/base-files/etc/board.d/02_network

@@ -12,81 +12,50 @@ ipq806x_setup_interfaces()
 
 	case "$board" in
 	arris,tr4400-v2)
-		ucidef_set_interfaces_lan_wan "eth1" "eth2"
-		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "0u@eth0"
+		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth2"
 		;;
 	askey,rt4230w-rev6 |\
 	asrock,g10 |\
-	nec,wg2600hp)
-		ucidef_add_switch "switch0" \
-			"2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
-		;;
+	nec,wg2600hp |\
 	buffalo,wxr-2533dhp |\
 	compex,wpq864 |\
 	netgear,d7800 |\
 	netgear,r7500 |\
 	netgear,r7500v2 |\
-	qcom,ipq8064-ap148)
-		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
-		;;
-	edgecore,ecw5410)
-		ucidef_set_interfaces_lan_wan "eth1" "eth0"
-		;;
-	linksys,ea7500-v1)
-		ucidef_add_switch "switch0" \
-			"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
-	;;
-	linksys,ea8500)
-		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
-		;;
-	meraki,mr42)
-		ucidef_set_interface_lan "eth0"
-		;;
-	meraki,mr52)
-		ucidef_set_interfaces_lan_wan "eth0" "eth1"
-		;;
-	nec,wg2600hp3)
-		ucidef_add_switch "switch0" \
-			"2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
-		;;
+	qcom,ipq8064-ap148 |\
+	linksys,ea7500-v1 |\
+	linksys,ea8500 |\
+	nec,wg2600hp3 |\
 	netgear,r7800 |\
-	netgear,xr450 |\
 	netgear,xr500 |\
+	netgear,xr450 |\
 	tplink,c2600 |\
-	tplink,vr2600v)
-		ucidef_add_switch "switch0" \
-			"1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
-		;;
-	qcom,ipq8064-ap161)
-		ucidef_set_interface_lan "eth1 eth2"
-		ucidef_add_switch "switch0" \
-			"0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
-		;;
-	qcom,ipq8064-db149)
-		ucidef_set_interface_lan "eth1 eth2 eth3"
-		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
-		;;
-	tplink,ad7200)
-		ucidef_add_switch "switch0" \
-			"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
+	tplink,vr2600v |\
+	tplink,ad7200 |\
+	zyxel,nbg6817)
+		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
 		;;
 	asus,onhub |\
 	tplink,onhub)
+		ucidef_set_interfaces_lan_wan "lan1" "wan"
+		;;
+	edgecore,ecw5410)
 		ucidef_set_interfaces_lan_wan "eth1" "eth0"
-		ucidef_add_switch "switch0" \
-			"1:lan" "6@eth1" "2:wan" "0@eth0"
 		;;
-	nokia,ac400i |\
+	qcom,ipq8064-ap161)
+		ucidef_set_interface_lan "eth1 eth2 lan1 lan2 lan3 lan4" "wan"
+		;;
+	qcom,ipq8064-db149)
+		ucidef_set_interface_lan "eth1 eth2 eth3 lan1 lan2 lan3 lan4" "wan"
+		;;
 	ubnt,unifi-ac-hd)
 		ucidef_set_interface_lan "eth0 eth1"
 		;;
-	zyxel,nbg6817)
-		ucidef_add_switch "switch0" \
-			"1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
+	meraki,mr42)
+		ucidef_set_interface_lan "eth0"
+		;;
+	meraki,mr52)
+		ucidef_set_interfaces_lan_wan "eth0" "eth1"
 		;;
 	*)
 		echo "Unsupported hardware. Network interfaces not intialized"
@@ -94,34 +63,33 @@ ipq806x_setup_interfaces()
 	esac
 }
 
-ipq806x_setup_mac_address()
+ipq806x_setup_macs()
 {
 	local board="$1"
 
 	case "$board" in
-	linksys,ea7500-v1)
-		hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
-		ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
-		ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
+		linksys,ea7500-v1)
+			hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
+			ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
+			ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
 		;;
-	linksys,ea8500)
-		hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
-		ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
-		ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
+		linksys,ea8500)
+			hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
+			ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
+			ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
 		;;
-	zyxel,nbg6817)
-		hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
-		ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
-		ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
+		zyxel,nbg6817)
+			hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
+			ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
+			ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
 		;;
 	esac
 }
 
 board_config_update
-
 board=$(board_name)
 
-ipq806x_setup_mac_address $board
+ipq806x_setup_macs $board
 ipq806x_setup_interfaces $board
 
 board_config_flush

+ 45 - 0
target/linux/ipq806x/base-files/etc/board.d/05_compat-version

@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# Copyright (C) 2020 OpenWrt.org
+#
+
+. /lib/functions.sh
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+	arris,tr4400-v2 |\
+	askey,rt4230w-rev6 |\
+	asrock,g10 |\
+	buffalo,wxr-2533dhp |\
+	compex,wpq864 |\
+	nec,wg2600hp |\
+	nec,wg2600hp3 |\
+	netgear,d7800 |\
+	netgear,r7500 |\
+	netgear,r7500v2 |\
+	netgear,r7800 |\
+	netgear,xr450 |\
+	netgear,xr500 |\
+	nokia,ac400i |\
+	qcom,ipq8064-ap148 |\
+	qcom,ipq8064-ap161 |\
+	qcom,ipq8064-db149 |\
+	tplink,ad7200 |\
+	tplink,c2600 |\
+	tplink,vr2600v |\
+	zyxel,nbg6817 |\
+	asus,onhub |\
+	tplink,onhub)
+		ucidef_set_compat_version "1.1"
+		;;
+	linksys,ea7500-v1 |\
+	linksys,ea8500)
+		ucidef_set_compat_version "2.1"
+		;;
+esac
+
+board_config_flush
+
+exit 0

+ 0 - 1
target/linux/ipq806x/config-6.1

@@ -1,7 +1,6 @@
 CONFIG_ALIGNMENT_TRAP=y
 # CONFIG_APQ_GCC_8084 is not set
 # CONFIG_APQ_MMCC_8084 is not set
-CONFIG_AR8216_PHY=y
 CONFIG_ARCH_32BIT_OFF_T=y
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 # CONFIG_ARCH_IPQ40XX is not set

+ 97 - 15
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts

@@ -413,21 +413,103 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x04 0x80080080  /* PAD0_MODE */
-			0x0c 0x06000000  /* PAD6_MODE */
-			0x10 0x002613a0  /* PWS_REG */
-			0x50 0xcc36cc36  /* LED_CTRL0 */
-			0x54 0xca36ca36  /* LED_CTRL1 */
-			0x58 0xc936c936  /* LED_CTRL2 */
-			0x5c 0x03ffff00  /* LED_CTRL3 */
-			0x7c 0x0000004e  /* PORT0_STATUS */
-			0x94 0x0000004e  /* PORT6_STATUS */
-			0xe0 0xc74164de  /* SGMII_CTRL */
-			0xe4 0x0006a545  /* MAC_PWR_SEL */
-			>;
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <6>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "sgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 99 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi

@@ -337,21 +337,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 26 - 0
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200.dts

@@ -129,6 +129,32 @@
 	};
 };
 
+&mdio0 {
+	switch@10 {
+		ports {
+			port@1 {
+				label = "wan";
+			};
+
+			port@2 {
+				label = "lan1";
+			};
+
+			port@3 {
+				label = "lan2";
+			};
+
+			port@4 {
+				label = "lan3";
+			};
+
+			port@5 {
+				label = "lan4";
+			};
+		};
+	};
+};
+
 &pcie2 {
 	status = "okay";
 	max-link-speed = <1>;

+ 99 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ap148.dts

@@ -90,21 +90,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			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>;
+			};
+		};
 	};
 };
 

+ 99 - 17
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ap161.dts

@@ -102,24 +102,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x20080     /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac0>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
-		qca,phy-rgmii-en;
-		qca,txclk-delay-en;
-		qca,rxclk-delay-en;
+			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>;
+			};
+		};
 	};
 
 	phy3: ethernet-phy@3 {

+ 99 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts

@@ -340,21 +340,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 99 - 15
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-db149.dts

@@ -117,21 +117,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-		>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac0>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			phy_port1: phy@0 {
+				reg = <0>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			phy_port2: phy@1 {
+				reg = <1>;
+			};
+
+			phy_port3: phy@2 {
+				reg = <2>;
+			};
+
+			phy_port4: phy@3 {
+				reg = <3>;
+			};
+
+			phy_port5: phy@4 {
+				reg = <4>;
+			};
+		};
 	};
 
 	phy6: ethernet-phy@6 {
@@ -147,7 +232,6 @@
 	status = "okay";
 	phy-mode = "rgmii";
 	qcom,id = <0>;
-	phy-handle = <&phy4>;
 
 	pinctrl-0 = <&rgmii0_pins>;
 	pinctrl-names = "default";

+ 26 - 0
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ea7500-v1.dts

@@ -89,3 +89,29 @@
 		reg = <0x6080000 0x1f80000>;
 	};
 };
+
+&mdio0 {
+	switch@10 {
+		ports {
+			port@1 {
+				label = "wan";
+			};
+
+			port@2 {
+				label = "lan1";
+			};
+
+			port@3 {
+				label = "lan2";
+			};
+
+			port@4 {
+				label = "lan3";
+			};
+
+			port@5 {
+				label = "lan4";
+			};
+		};
+	};
+};

+ 0 - 6
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts

@@ -106,12 +106,6 @@
 	};
 };
 
-&mdio0 {
-	phy4: ethernet-phy@4 {
-		reg = <4>;
-	};
-};
-
 &gmac1 {
 	qcom,phy_mdio_addr = <4>;
 	qcom,poll_required = <1>;

+ 100 - 12
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi

@@ -185,18 +185,106 @@
 	reset-gpios = <&qcom_pinmux 63 GPIO_ACTIVE_HIGH>;
 	reset-post-delay-us = <12000>;
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x00010 0x2613a0    /* PWS_REG */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 100 - 11
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts

@@ -158,17 +158,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 67 - 15
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi

@@ -62,21 +62,73 @@
 		pinctrl-0 = <&mdio_pins>;
 		pinctrl-names = "default";
 
-		phy0: ethernet-phy@0 {
-			reg = <0>;
-			qca,ar8327-initvals = <
-				0x00004 0x7600000   /* PAD0_MODE */
-				0x00008 0x1000000   /* PAD5_MODE */
-				0x0000c 0x80        /* PAD6_MODE */
-				0x000e4 0xaa545     /* MAC_POWER_SEL */
-				0x000e0 0xc74164de  /* SGMII_CTRL */
-				0x0007c 0x4e        /* PORT0_STATUS */
-				0x00094 0x4e        /* PORT6_STATUS */
-				>;
-		};
-
-		phy1: ethernet-phy@1 {
-			reg = <1>;
+		switch@10 {
+			compatible = "qca,qca8337";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x10>;
+
+			ports {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				port@0 {
+					reg = <0>;
+					label = "cpu";
+					ethernet = <&gmac0>;
+					phy-mode = "rgmii";
+					tx-internal-delay-ps = <1000>;
+					rx-internal-delay-ps = <1000>;
+
+					fixed-link {
+						speed = <1000>;
+						full-duplex;
+					};
+				};
+
+				port@1 {
+					reg = <1>;
+					label = "lan1";
+					phy-mode = "internal";
+					phy-handle = <&phy_port1>;
+				};
+
+				port@2 {
+					reg = <2>;
+					label = "wan";
+					phy-mode = "internal";
+					phy-handle = <&phy_port2>;
+				};
+
+				/*
+				port@6 {
+					reg = <0>;
+					label = "cpu";
+					ethernet = <&gmac2>;
+					phy-mode = "rgmii";
+
+					fixed-link {
+						speed = <1000>;
+						full-duplex;
+						pause;
+						asym-pause;
+					};
+				};
+				*/
+			};
+
+			mdio {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				phy_port1: phy@0 {
+					reg = <0>;
+				};
+
+				phy_port2: phy@1 {
+					reg = <1>;
+				};
+			};
 		};
 	};
 

+ 97 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts

@@ -254,21 +254,104 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 99 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts

@@ -337,21 +337,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0xaa545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 99 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts

@@ -369,21 +369,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 98 - 13
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts

@@ -141,20 +141,105 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x06000000  /* PAD0_MODE */
-			0x0000c 0x00080080  /* PAD6_MODE */
-			0x000e4 0x0006a545  /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x0000004e  /* PORT0_STATUS */
-			0x00094 0x0000004e  /* PORT6_STATUS */
-			>;
-	};
+switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			phy_port1: phy@0 {
+				reg = <0>;
+			};
+
+			phy_port2: phy@1 {
+				reg = <1>;
+			};
+
+			phy_port3: phy@2 {
+				reg = <2>;
+			};
 
-	ethernet-phy@4 {
-		reg = <4>;
+			phy_port4: phy@3 {
+				reg = <3>;
+			};
+
+			phy_port5: phy@4 {
+				reg = <4>;
+			};
+		};
 	};
 };
 

+ 99 - 14
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts

@@ -270,21 +270,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 99 - 18
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts

@@ -195,25 +195,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x07600000  /* PAD0_MODE */
-			0x00008 0x01000000  /* PAD5_MODE */
-			0x0000c 0x00000080  /* PAD6_MODE */
-			0x00050 0xcc35cc35  /* LED_CTRL0 */
-			0x00054 0xca35ca35  /* LED_CTRL1 */
-			0x00058 0xc935c935  /* LED_CTRL2 */
-			0x0005c 0x03ffff00  /* LED_CTRL3 */
-			0x000e4 0x0006a545  /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x0000007e  /* PORT0_STATUS */
-			0x00094 0x0000007e  /* PORT6_STATUS */
-			>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	ethernet-phy@4 {
-		reg = <4>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 98 - 32
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts

@@ -245,40 +245,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0xaa545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			0x00970 0x1e864443  /* QM_PORT0_CTRL0 */
-			0x00974 0x000001c6  /* QM_PORT0_CTRL1 */
-			0x00978 0x19008643  /* QM_PORT1_CTRL0 */
-			0x0097c 0x000001c6  /* QM_PORT1_CTRL1 */
-			0x00980 0x19008643  /* QM_PORT2_CTRL0 */
-			0x00984 0x000001c6  /* QM_PORT2_CTRL1 */
-			0x00988 0x19008643  /* QM_PORT3_CTRL0 */
-			0x0098c 0x000001c6  /* QM_PORT3_CTRL1 */
-			0x00990 0x19008643  /* QM_PORT4_CTRL0 */
-			0x00994 0x000001c6  /* QM_PORT4_CTRL1 */
-			0x00998 0x1e864443  /* QM_PORT5_CTRL0 */
-			0x0099c 0x000001c6  /* QM_PORT5_CTRL1 */
-			0x009a0 0x1e864443  /* QM_PORT6_CTRL0 */
-			0x009a4 0x000001c6  /* QM_PORT6_CTRL1 */
-			>;
-	};
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			phy_port1: phy@0 {
+				reg = <0>;
+			};
+
+			phy_port2: phy@1 {
+				reg = <1>;
+			};
+
+			phy_port3: phy@2 {
+				reg = <2>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
-		qca,ar8327-initvals = <
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x0000c 0x80        /* PAD6_MODE */
-			>;
+			phy_port4: phy@3 {
+				reg = <3>;
+			};
+
+			phy_port5: phy@4 {
+				reg = <4>;
+			};
+		};
 	};
 };
 

+ 99 - 36
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi

@@ -302,43 +302,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0xaa545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			0x00970 0x1e864443  /* QM_PORT0_CTRL0 */
-			0x00974 0x000001c6  /* QM_PORT0_CTRL1 */
-			0x00978 0x19008643  /* QM_PORT1_CTRL0 */
-			0x0097c 0x000001c6  /* QM_PORT1_CTRL1 */
-			0x00980 0x19008643  /* QM_PORT2_CTRL0 */
-			0x00984 0x000001c6  /* QM_PORT2_CTRL1 */
-			0x00988 0x19008643  /* QM_PORT3_CTRL0 */
-			0x0098c 0x000001c6  /* QM_PORT3_CTRL1 */
-			0x00990 0x19008643  /* QM_PORT4_CTRL0 */
-			0x00994 0x000001c6  /* QM_PORT4_CTRL1 */
-			0x00998 0x1e864443  /* QM_PORT5_CTRL0 */
-			0x0099c 0x000001c6  /* QM_PORT5_CTRL1 */
-			0x009a0 0x1e864443  /* QM_PORT6_CTRL0 */
-			0x009a4 0x000001c6  /* QM_PORT6_CTRL1 */
-			>;
-		qca,ar8327-vlans = <
-			0x1	0x5e	    /* VLAN1 Ports 1/2/3/4/6 */
-			0x2	0x21	    /* VLAN2 Ports 0/5 */
-		>;
-	};
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
 
-	phy4: ethernet-phy@4 {
-		reg = <4>;
-		qca,ar8327-initvals = <
-			0x000e4 0x6a545     /* MAC_POWER_SEL */
-			0x0000c 0x80        /* PAD6_MODE */
-			>;
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 100 - 13
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts

@@ -297,19 +297,106 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	phy0: ethernet-phy@0 {
-		reg = <0x0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0xaa545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			0x00050 0xcf02cf02  /* LED_CTRL_0 */
-			0x00054 0xc832c832  /* LED_CTRL_1 */
-			>;
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac0>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "wan";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			port@5 {
+				reg = <5>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port5>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac2>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			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>;
+			};
+		};
 	};
 };
 

+ 89 - 11
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts

@@ -311,17 +311,95 @@
 	pinctrl-0 = <&mdio0_pins>;
 	pinctrl-names = "default";
 
-	ethernet-phy@0 {
-		reg = <0x0>;
-		qca,ar8327-initvals = <
-			0x00004 0x7600000   /* PAD0_MODE */
-			0x00008 0x1000000   /* PAD5_MODE */
-			0x0000c 0x80        /* PAD6_MODE */
-			0x000e4 0xaa545     /* MAC_POWER_SEL */
-			0x000e0 0xc74164de  /* SGMII_CTRL */
-			0x0007c 0x4e        /* PORT0_STATUS */
-			0x00094 0x4e        /* PORT6_STATUS */
-			>;
+	switch@10 {
+		compatible = "qca,qca8337";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac0>;
+				phy-mode = "rgmii";
+				tx-internal-delay-ps = <1000>;
+				rx-internal-delay-ps = <1000>;
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			port@1 {
+				reg = <1>;
+				label = "lan1";
+				phy-mode = "internal";
+				phy-handle = <&phy_port1>;
+			};
+
+			port@2 {
+				reg = <2>;
+				label = "lan2";
+				phy-mode = "internal";
+				phy-handle = <&phy_port2>;
+			};
+
+			port@3 {
+				reg = <3>;
+				label = "lan3";
+				phy-mode = "internal";
+				phy-handle = <&phy_port3>;
+			};
+
+			port@4 {
+				reg = <4>;
+				label = "lan4";
+				phy-mode = "internal";
+				phy-handle = <&phy_port4>;
+			};
+
+			/*
+			port@6 {
+				reg = <0>;
+				label = "cpu";
+				ethernet = <&gmac1>;
+				phy-mode = "rgmii";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					pause;
+					asym-pause;
+				};
+			};
+			*/
+		};
+
+		mdio {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			phy_port1: phy@0 {
+				reg = <0>;
+			};
+
+			phy_port2: phy@1 {
+				reg = <1>;
+			};
+
+			phy_port3: phy@2 {
+				reg = <2>;
+			};
+
+			phy_port4: phy@3 {
+				reg = <3>;
+			};
+		};
 	};
 
 	phy7: ethernet-phy@7 {

+ 7 - 0
target/linux/ipq806x/image/chromium.mk

@@ -1,3 +1,8 @@
+define Device/dsa-migration
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
+endef
+
 define Build/cros-gpt
 	cp $@ [email protected] 2>/dev/null || true
 	ptgen -o [email protected] -g \
@@ -47,6 +52,7 @@ endef
 
 define Device/asus_onhub
 	$(call Device/OnhubImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := ASUS
 	DEVICE_MODEL := OnHub SRT-AC1900
 	DEVICE_DTS := $$(SOC)-asus-onhub
@@ -56,6 +62,7 @@ TARGET_DEVICES += asus_onhub
 
 define Device/tplink_onhub
 	$(call Device/OnhubImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := TP-Link
 	DEVICE_MODEL := OnHub AC1900 Cloud Router
 	DEVICE_DTS := $$(SOC)-tplink-onhub

+ 34 - 0
target/linux/ipq806x/image/generic.mk

@@ -8,6 +8,16 @@ define Device/kernel-size-migration
 	use the force flag when image check fails. Settings will be lost. ***
 endef
 
+define Device/dsa-migration
+  DEVICE_COMPAT_VERSION := 1.1
+  DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
+endef
+
+define Device/dsa-migration-from-2_0
+  DEVICE_COMPAT_VERSION := 2.1
+  DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
+endef
+
 define Build/buffalo-rootfs-cksum
 	( \
 		echo -ne "\x$$(od -A n -t u1 $@ | tr -s ' ' '\n' | \
@@ -67,6 +77,7 @@ endef
 
 define Device/arris_tr4400-v2
 	$(call Device/LegacyImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Arris
 	DEVICE_MODEL := TR4400
 	DEVICE_VARIANT := v2
@@ -80,6 +91,7 @@ TARGET_DEVICES += arris_tr4400-v2
 
 define Device/askey_rt4230w-rev6
 	$(call Device/LegacyImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Askey
 	DEVICE_MODEL := RT4230W
 	DEVICE_VARIANT := REV6
@@ -94,6 +106,7 @@ TARGET_DEVICES += askey_rt4230w-rev6
 define Device/asrock_g10
 	$(call Device/FitImage)
 	$(call Device/UbiFit)
+	$(Device/dsa-migration)
 	SOC := qcom-ipq8064
 	DEVICE_VENDOR := ASRock
 	DEVICE_MODEL := G10
@@ -107,6 +120,7 @@ TARGET_DEVICES += asrock_g10
 
 define Device/buffalo_wxr-2533dhp
 	$(call Device/LegacyImage)
+	$(Device/dsa-migration)
 	SOC := qcom-ipq8064
 	DEVICE_VENDOR := Buffalo
 	DEVICE_MODEL := WXR-2533DHP
@@ -123,6 +137,7 @@ TARGET_DEVICES += buffalo_wxr-2533dhp
 define Device/compex_wpq864
 	$(call Device/FitImage)
 	$(call Device/UbiFit)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Compex
 	DEVICE_MODEL := WPQ864
 	BLOCKSIZE := 128k
@@ -148,6 +163,7 @@ TARGET_DEVICES += edgecore_ecw5410
 define Device/linksys_ea7500-v1
 	$(call Device/LegacyImage)
 	$(Device/kernel-size-migration)
+	$(Device/dsa-migration-from-2_0)
 	DEVICE_VENDOR := Linksys
 	DEVICE_MODEL := EA7500
 	DEVICE_VARIANT := v1
@@ -168,6 +184,7 @@ TARGET_DEVICES += linksys_ea7500-v1
 define Device/linksys_ea8500
 	$(call Device/LegacyImage)
 	$(Device/kernel-size-migration)
+	$(Device/dsa-migration-from-2_0)
 	DEVICE_VENDOR := Linksys
 	DEVICE_MODEL := EA8500
 	SOC := qcom-ipq8064
@@ -223,6 +240,7 @@ TARGET_DEVICES += meraki_mr52
 
 define Device/nec_wg2600hp
 	$(call Device/LegacyImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NEC
 	DEVICE_MODEL := Aterm WG2600HP
 	SOC := qcom-ipq8064
@@ -236,6 +254,7 @@ TARGET_DEVICES += nec_wg2600hp
 
 define Device/nec_wg2600hp3
 	$(call Device/LegacyImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NEC Platforms
 	DEVICE_MODEL := Aterm WG2600HP3
 	SOC := qcom-ipq8062
@@ -252,6 +271,7 @@ TARGET_DEVICES += nec_wg2600hp3
 
 define Device/netgear_d7800
 	$(call Device/DniImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NETGEAR
 	DEVICE_MODEL := Nighthawk X4 D7800
 	SOC := qcom-ipq8064
@@ -271,6 +291,7 @@ TARGET_DEVICES += netgear_d7800
 
 define Device/netgear_r7500
 	$(call Device/DniImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NETGEAR
 	DEVICE_MODEL := Nighthawk X4 R7500
 	DEVICE_VARIANT := v1
@@ -288,6 +309,7 @@ TARGET_DEVICES += netgear_r7500
 
 define Device/netgear_r7500v2
 	$(call Device/DniImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NETGEAR
 	DEVICE_MODEL := Nighthawk X4 R7500
 	DEVICE_VARIANT := v2
@@ -306,6 +328,7 @@ TARGET_DEVICES += netgear_r7500v2
 
 define Device/netgear_r7800
 	$(call Device/DniImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NETGEAR
 	DEVICE_MODEL := Nighthawk X4S R7800
 	SOC := qcom-ipq8065
@@ -322,6 +345,7 @@ TARGET_DEVICES += netgear_r7800
 
 define Device/netgear_xr450
 	$(call Device/DniImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NETGEAR
 	DEVICE_MODEL := Nighthawk XR450
 	SOC := qcom-ipq8065
@@ -336,6 +360,7 @@ TARGET_DEVICES += netgear_xr450
 
 define Device/netgear_xr500
 	$(call Device/DniImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := NETGEAR
 	DEVICE_MODEL := Nighthawk XR500
 	SOC := qcom-ipq8065
@@ -351,6 +376,7 @@ TARGET_DEVICES += netgear_xr500
 define Device/nokia_ac400i
 	$(call Device/FitImage)
 	$(call Device/UbiFit)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Nokia
 	DEVICE_MODEL := AC400i
 	SOC := qcom-ipq8065
@@ -365,6 +391,7 @@ TARGET_DEVICES += nokia_ac400i
 define Device/qcom_ipq8064-ap148
 	$(call Device/FitImage)
 	$(call Device/UbiFit)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Qualcomm
 	DEVICE_MODEL := AP148
 	DEVICE_VARIANT := standard
@@ -382,6 +409,7 @@ TARGET_DEVICES += qcom_ipq8064-ap148
 define Device/qcom_ipq8064-ap148-legacy
 	$(call Device/LegacyImage)
 	$(call Device/UbiFit)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Qualcomm
 	DEVICE_MODEL := AP148
 	DEVICE_VARIANT := legacy
@@ -398,6 +426,7 @@ TARGET_DEVICES += qcom_ipq8064-ap148-legacy
 define Device/qcom_ipq8064-ap161
 	$(call Device/FitImage)
 	$(call Device/UbiFit)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Qualcomm
 	DEVICE_MODEL := AP161
 	SOC := qcom-ipq8064
@@ -412,6 +441,7 @@ TARGET_DEVICES += qcom_ipq8064-ap161
 
 define Device/qcom_ipq8064-db149
 	$(call Device/FitImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := Qualcomm
 	DEVICE_MODEL := DB149
 	SOC := qcom-ipq8064
@@ -424,6 +454,7 @@ TARGET_DEVICES += qcom_ipq8064-db149
 
 define Device/tplink_ad7200
 	$(call Device/TpSafeImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := TP-Link
 	DEVICE_MODEL := AD7200
 	DEVICE_VARIANT := v1/v2
@@ -440,6 +471,7 @@ TARGET_DEVICES += tplink_ad7200
 
 define Device/tplink_c2600
 	$(call Device/TpSafeImage)
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := TP-Link
 	DEVICE_MODEL := Archer C2600
 	DEVICE_VARIANT := v1
@@ -454,6 +486,7 @@ endef
 TARGET_DEVICES += tplink_c2600
 
 define Device/tplink_vr2600v
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := TP-Link
 	DEVICE_MODEL := Archer VR2600v
 	DEVICE_VARIANT := v1
@@ -486,6 +519,7 @@ endef
 TARGET_DEVICES += ubnt_unifi-ac-hd
 
 define Device/zyxel_nbg6817
+	$(Device/dsa-migration)
 	DEVICE_VENDOR := ZyXEL
 	DEVICE_MODEL := NBG6817
 	SOC := qcom-ipq8065