From: Christian Marangi Date: Tue, 20 Jun 2023 07:49:53 +0000 (+0200) Subject: ipq806x: enable and setup multi-CPU port for qca8k switch X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=8eab5b2526703a3183012852c75e8512d50d3f7e;p=openwrt%2Fstaging%2Fnbd.git ipq806x: enable and setup multi-CPU port for qca8k switch Enable and setup multi-cpu for qca8k switch for ipq806x based devices. Rework each DTS to enable the secondary CPU port on QCA8K switch and apply the required values originally set by the OEM in the old swconfig node. In original firmware the first CPU port was always assigned to the WAN port and the secondary CPU port was assigned to the rest of the LAN port. Follow this original implementation using an init.d script. To setup the CPU port ip tools is required. Add additional default package ip-tiny to correctly setup the CPU port. Signed-off-by: Christian Marangi --- diff --git a/target/linux/ipq806x/Makefile b/target/linux/ipq806x/Makefile index 74a0007a4e..1bcea1fa80 100644 --- a/target/linux/ipq806x/Makefile +++ b/target/linux/ipq806x/Makefile @@ -21,6 +21,6 @@ DEFAULT_PACKAGES += \ kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \ kmod-phy-qcom-ipq806x-usb kmod-usb3 kmod-usb-dwc3-qcom \ kmod-ath10k-ct wpad-basic-mbedtls \ - uboot-envtools + uboot-envtools ip-tiny $(eval $(call BuildTarget)) diff --git a/target/linux/ipq806x/base-files/etc/init.d/qca8k_set_port b/target/linux/ipq806x/base-files/etc/init.d/qca8k_set_port new file mode 100755 index 0000000000..bf14907b8f --- /dev/null +++ b/target/linux/ipq806x/base-files/etc/init.d/qca8k_set_port @@ -0,0 +1,45 @@ +#!/bin/sh /etc/rc.common + +START=15 + +set_qca8k_port() { + local port=$1 + local master=$2 + + ip link set $port type dsa conduit $master +} + +boot() { + # Restore original implementation where the eth1 (port 6) was used + # for the lan port and the eth0 (port 0) was used for the wan port + case $(board_name) in + 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 |\ + tplink,ad7200 |\ + tplink,c2600 |\ + tplink,vr2600v |\ + zyxel,nbg6817) + set_qca8k_port lan1 eth1 + set_qca8k_port lan2 eth1 + set_qca8k_port lan3 eth1 + set_qca8k_port lan4 eth1 + set_qca8k_port wan eth0 + ;; + asus,onhub |\ + tplink,onhub) + set_qca8k_port lan1 eth1 + set_qca8k_port wan eth0 + ;; + esac +} diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts index e3987c6d07..5f78d91b9e 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts @@ -471,19 +471,19 @@ phy-handle = <&phy_port5>; }; - /* port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac2>; phy-mode = "sgmii"; + qca,sgmii-enable-pll; + qca,sgmii-rxclk-falling-edge; fixed-link { speed = <1000>; full-duplex; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi index 9d05cf4032..c425c9cd2e 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi @@ -396,21 +396,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts index c8e4a1810e..7e4e0c829c 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts @@ -399,21 +399,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi index fac43e785f..e5cc242419 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi @@ -244,21 +244,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts index 6795e8fa4f..efcb6ec241 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts @@ -217,21 +217,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi index d20b55c2c2..b84c8512ae 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi @@ -100,21 +100,18 @@ phy-handle = <&phy_port2>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts index ff464d9d1e..c58c289d35 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts @@ -313,19 +313,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts index 030d445668..719a423cad 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts @@ -396,21 +396,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts index 4fddf5e90a..8104ce1829 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts @@ -428,21 +428,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts index 47829a08aa..87b05b57ba 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts @@ -199,21 +199,19 @@ switch@10 { phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; + qca,sgmii-rxclk-falling-edge; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts index 37055f110b..f8b20b0635 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts @@ -329,21 +329,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts index 97d76e11f0..2d761ee355 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts @@ -254,21 +254,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts index 96becfb4c1..693e14c120 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts @@ -304,21 +304,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi index ecd2c5634a..51ad5ac8ee 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi @@ -361,21 +361,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac2>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts index 87948bb1d6..6bf2cfe128 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts @@ -356,21 +356,18 @@ phy-handle = <&phy_port5>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; - ethernet = <&gmac2>; - phy-mode = "rgmii"; + ethernet = <&gmac1>; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio { diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts index bb00bbe7d3..600bcc8421 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts @@ -363,21 +363,18 @@ phy-handle = <&phy_port4>; }; - /* port@6 { - reg = <0>; + reg = <6>; label = "cpu"; ethernet = <&gmac1>; - phy-mode = "rgmii"; + phy-mode = "sgmii"; + qca,sgmii-enable-pll; fixed-link { speed = <1000>; full-duplex; - pause; - asym-pause; }; }; - */ }; mdio {