From 9b2f86fdbd59c0b54a958cc5d0097d785bea3bae Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 25 May 2018 00:03:29 +0200 Subject: [PATCH] ipq806x: add qca8k support Signed-off-by: John Crispin --- target/linux/ipq806x/Makefile | 2 +- .../ipq806x/base-files/etc/board.d/02_network | 14 +- 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, 900 insertions(+), 196 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 13be76e7ba9f..53c93de0054a 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 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 9d8af4485552..9e878526d8f9 100755 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -18,9 +18,10 @@ netgear,r7500 |\ netgear,r7500v2 |\ netgear,r7800 |\ qcom,ipq8064-ap148 |\ +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) @@ -29,15 +30,6 @@ linksys,ea8500) ucidef_set_interface_macaddr "lan" "$hw_mac_addr" ucidef_set_interface_macaddr "wan" "$hw_mac_addr" ;; -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,c2600) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@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 8d31e4f77d39..89a53ce7478e 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 a3df82909e26..6f2d8ce2e3ae 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 b683f0275baf..00906b1ca6de 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 514ddb50147a..836edf34c2d0 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 @@ -286,36 +286,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 4c56866077c0..120978106088 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 1e82a48dbfb7..4197c5f06ca3 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 7a209ece12ef..240d2159e712 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 @@ -252,24 +252,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 089445fc3ea1..3ff835219a76 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 @@ -288,24 +288,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 08775273328b..90caa108018e 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 0b96ba64c69a..112f5c2da8b3 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 fbacc039d6c3..c5823f690c25 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 @@ -349,48 +349,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 000000000000..42b1bd2a679b --- /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 +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 +--- + 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.30.2