Skip to content

Instantly share code, notes, and snippets.

@neheb
Created July 8, 2018 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neheb/011cad5943ed43c8cddf43df7388e189 to your computer and use it in GitHub Desktop.
Save neheb/011cad5943ed43c8cddf43df7388e189 to your computer and use it in GitHub Desktop.
From 6647ed17978ba1dde86eaa51651fc5c3d5a6fbef Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 25 May 2018 00:03:29 +0200
Subject: [PATCH] ipq806x: add qca8k support
Signed-off-by: John Crispin <john@phrozen.org>
---
target/linux/ipq806x/Makefile | 2 +-
.../ipq806x/base-files/etc/board.d/02_network | 22 +---
target/linux/ipq806x/config-4.14 | 1 -
.../arch/arm/boot/dts/qcom-ipq8064-ap148.dts | 101 +++++++++++++--
.../arch/arm/boot/dts/qcom-ipq8064-c2600.dts | 98 ++++++++++++--
.../arch/arm/boot/dts/qcom-ipq8064-d7800.dts | 104 +++++++++++++--
.../arch/arm/boot/dts/qcom-ipq8064-db149.dts | 105 +++++++++++----
.../arch/arm/boot/dts/qcom-ipq8064-ea8500.dts | 98 ++++++++++++--
.../arch/arm/boot/dts/qcom-ipq8064-r7500.dts | 98 ++++++++++++--
.../arm/boot/dts/qcom-ipq8064-r7500v2.dts | 98 ++++++++++++--
.../arm/boot/dts/qcom-ipq8064-vr2600v.dts | 98 ++++++++++++--
.../arm/boot/dts/qcom-ipq8065-nbg6817.dts | 116 ++++++++++++-----
.../arch/arm/boot/dts/qcom-ipq8065-r7800.dts | 121 ++++++++++++------
.../0075-dsa-inherit-parent-mac.patch | 42 ++++++
14 files changed, 903 insertions(+), 201 deletions(-)
create mode 100644 target/linux/ipq806x/patches-4.14/0075-dsa-inherit-parent-mac.patch
diff --git a/target/linux/ipq806x/Makefile b/target/linux/ipq806x/Makefile
index 13be76e7ba..53c93de005 100644
--- a/target/linux/ipq806x/Makefile
+++ b/target/linux/ipq806x/Makefile
@@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
ARCH:=arm
BOARD:=ipq806x
BOARDNAME:=Qualcomm Atheros IPQ806X
-FEATURES:=squashfs nand fpu
+FEATURES:=squashfs nand fpu ramdisk
CPU_TYPE:=cortex-a15
CPU_SUBTYPE:=neon-vfpv4
MAINTAINER:=John Crispin <john@phrozen.org>
diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
index 786c6f70e1..dda3b047ef 100755
--- a/target/linux/ipq806x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
@@ -13,13 +13,17 @@ board=$(board_name)
case "$board" in
compex,wpq864 |\
+nec,wg2600hp |\
netgear,d7800 |\
netgear,r7500 |\
netgear,r7500v2 |\
+netgear,r7800 |\
qcom,ipq8064-ap148 |\
+qcom,ipq8064-db149 |\
+tplink,c2600 |\
tplink,vr2600v)
- ucidef_add_switch "switch0" \
- "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
+ ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
+ ucidef_set_interface_wan "wan"
;;
linksys,ea8500)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
@@ -28,20 +32,6 @@ linksys,ea8500)
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
-nec,wg2600hp)
- ucidef_add_switch "switch0" \
- "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
- ;;
-netgear,r7800 |\
-tplink,c2600)
- ucidef_add_switch "switch0" \
- "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@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"
- ;;
zyxel,nbg6817)
hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
ucidef_add_switch "switch0" \
diff --git a/target/linux/ipq806x/config-4.14 b/target/linux/ipq806x/config-4.14
index fda8f52d2c..a832cc04d8 100644
--- a/target/linux/ipq806x/config-4.14
+++ b/target/linux/ipq806x/config-4.14
@@ -2,7 +2,6 @@ CONFIG_ALIGNMENT_TRAP=y
# CONFIG_AMBA_PL08X is not set
# CONFIG_APQ_GCC_8084 is not set
# CONFIG_APQ_MMCC_8084 is not set
-CONFIG_AR8216_PHY=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
index a3df82909e..6f2d8ce2e3 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ap148.dts
@@ -198,24 +198,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan1";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan4";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
@@ -225,7 +297,7 @@
pinctrl-0 = <&rgmii2_pins>;
pinctrl-names = "default";
-
+ mac-address = [ 00 11 22 33 44 55];
fixed-link {
speed = <1000>;
full-duplex;
@@ -236,6 +308,7 @@
status = "ok";
phy-mode = "sgmii";
qcom,id = <2>;
+ mac-address = [ 00 11 22 33 44 56];
fixed-link {
speed = <1000>;
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts
index b683f0275b..00906b1ca6 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-c2600.dts
@@ -361,24 +361,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan1";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan4";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts
index 209d513f1b..73648761d4 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-d7800.dts
@@ -282,36 +282,112 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan4";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan2";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan1";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
status = "ok";
phy-mode = "rgmii";
- phy-handle = <&phy4>;
qcom,id = <1>;
pinctrl-0 = <&rgmii2_pins>;
pinctrl-names = "default";
mtd-mac-address = <&art 6>;
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
};
gmac2: ethernet@37400000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts
index 4c56866077..1209781060 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-db149.dts
@@ -168,41 +168,102 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
- reg = <4>;
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
};
- phy6: ethernet-phy@6 {
- device_type = "ethernet-phy";
- reg = <6>;
+ phy_port4: phy@3 {
+ reg = <3>;
};
- phy7: ethernet-phy@7 {
- device_type = "ethernet-phy";
- reg = <7>;
+ phy_port5: phy@4 {
+ reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan4";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan2";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan1";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac0: ethernet@37000000 {
status = "ok";
phy-mode = "rgmii";
qcom,id = <0>;
- phy-handle = <&phy4>;
pinctrl-0 = <&rgmii0_pins>;
pinctrl-names = "default";
@@ -223,14 +284,12 @@
status = "ok";
phy-mode = "sgmii";
qcom,id = <2>;
- phy-handle = <&phy6>;
};
gmac3: ethernet@37600000 {
status = "ok";
phy-mode = "sgmii";
qcom,id = <3>;
- phy-handle = <&phy7>;
};
};
};
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts
index 1e82a48dbf..4197c5f06c 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-ea8500.dts
@@ -308,24 +308,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan1";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan4";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
index 9ce572bd89..8466f60efd 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
@@ -247,24 +247,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan4";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan2";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan1";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts
index 30bf0abd4b..3c43678240 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts
@@ -283,24 +283,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan4";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan2";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan1";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts
index 0877527332..90caa10801 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts
@@ -274,24 +274,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan4";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan2";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan1";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
index 0b96ba64c6..112f5c2da8 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
@@ -242,42 +242,96 @@
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
+ phy_port1: 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 */
- >;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
+
+ phy_port4: phy@3 {
+ reg = <3>;
+ };
+
+ phy_port5: phy@4 {
reg = <4>;
- qca,ar8327-initvals = <
- 0x000e4 0x6a545 /* MAC_POWER_SEL */
- 0x0000c 0x80 /* PAD6_MODE */
- >;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan1";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan2";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan3";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan4";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
index 29b14df4d2..a5c6fc0f5a 100644
--- a/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
+++ b/target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
@@ -338,48 +338,97 @@
gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH &qcom_pinmux 0 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
+
+ phy_port1: phy@0 {
+ reg = <0>;
+ };
+
+ phy_port2: phy@1 {
+ reg = <1>;
+ };
+ phy_port3: phy@2 {
+ reg = <2>;
+ };
- phy0: ethernet-phy@0 {
- device_type = "ethernet-phy";
- 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 */
- >;
+ phy_port4: phy@3 {
+ reg = <3>;
};
- phy4: ethernet-phy@4 {
- device_type = "ethernet-phy";
+ phy_port5: phy@4 {
reg = <4>;
- qca,ar8327-initvals = <
- 0x000e4 0x6a545 /* MAC_POWER_SEL */
- 0x0000c 0x80 /* PAD6_MODE */
- >;
};
+
+ switch0@16 {
+ compatible = "qca,qca8337";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ reg = <16>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ port@0 {
+ reg = <0>;
+ label = "cpu";
+ ethernet = <&gmac1>;
+ phy-mode = "rgmii";
+
+ fixed-link {
+ speed = <1000>;
+ full-duplex;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ label = "lan4";
+ phy-handle = <&phy_port1>;
+ };
+
+ port@2 {
+ reg = <2>;
+ label = "lan3";
+ phy-handle = <&phy_port2>;
+ };
+
+ port@3 {
+ reg = <3>;
+ label = "lan2";
+ phy-handle = <&phy_port3>;
+ };
+
+ port@4 {
+ reg = <4>;
+ label = "lan1";
+ phy-handle = <&phy_port4>;
+ };
+
+ port@5 {
+ reg = <5>;
+ label = "wan";
+ phy-handle = <&phy_port5>;
+ };
+
+ /*
+ * Disabled until DSA supports multiple CPUs,
+ * otherwise it causes undefined behavior.
+ *
+ * port@6 {
+ * reg = <6>;
+ * label = "cpu";
+ * ethernet = <&gmac2>;
+ * phy-mode = "sgmii";
+ *
+ * fixed-link {
+ * speed = <1000>;
+ * full-duplex;
+ * };
+ * };
+ */
+ };
+ };
};
gmac1: ethernet@37200000 {
diff --git a/target/linux/ipq806x/patches-4.14/0075-dsa-inherit-parent-mac.patch b/target/linux/ipq806x/patches-4.14/0075-dsa-inherit-parent-mac.patch
new file mode 100644
index 0000000000..42b1bd2a67
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.14/0075-dsa-inherit-parent-mac.patch
@@ -0,0 +1,42 @@
+From 171b14b660f35f593748ac62bbdbb43ace2c582d Mon Sep 17 00:00:00 2001
+From: John Crispin <john@phrozen.org>
+Date: Tue, 1 Nov 2016 01:44:15 +0100
+Subject: [PATCH 10/22] net: dsa: make the slave device inheret the MAC of the
+ parent
+
+This patch makes all slave devices inherit the parent devices MAC.
+
+Signed-off-by: John Crispin <john@phrozen.org>
+---
+ net/dsa/slave.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+Index: linux-4.14.43/net/dsa/slave.c
+===================================================================
+--- linux-4.14.43.orig/net/dsa/slave.c
++++ linux-4.14.43/net/dsa/slave.c
+@@ -151,6 +151,16 @@ static int dsa_slave_close(struct net_de
+ return 0;
+ }
+
++static int dsa_slave_init(struct net_device *dev)
++{
++ struct dsa_slave_priv *p = netdev_priv(dev);
++ struct net_device *master = dsa_master_netdev(p);
++ struct sockaddr sa;
++
++ ether_addr_copy(sa.sa_data, master->dev_addr);
++ return eth_mac_addr(dev, &sa);
++}
++
+ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
+ {
+ struct dsa_slave_priv *p = netdev_priv(dev);
+@@ -1032,6 +1042,7 @@ static const struct ethtool_ops dsa_slav
+ static const struct net_device_ops dsa_slave_netdev_ops = {
+ .ndo_open = dsa_slave_open,
+ .ndo_stop = dsa_slave_close,
++ .ndo_init = dsa_slave_init,
+ .ndo_start_xmit = dsa_slave_xmit,
+ .ndo_change_rx_flags = dsa_slave_change_rx_flags,
+ .ndo_set_rx_mode = dsa_slave_set_rx_mode,
--
2.17.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment