ipq806x: enable and setup multi-CPU port for qca8k switch
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 20 Jun 2023 07:49:53 +0000 (09:49 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Sat, 30 Sep 2023 11:51:20 +0000 (13:51 +0200)
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 <ansuelsmth@gmail.com>
18 files changed:
target/linux/ipq806x/Makefile
target/linux/ipq806x/base-files/etc/init.d/qca8k_set_port [new file with mode: 0755]
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8062-wg2600hp3.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-ad7200-c2600.dtsi
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-d7800.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-eax500.dtsi
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-g10.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-r7500v2.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-vr2600v.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wg2600hp.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wpq864.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8064-wxr-2533dhp.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nighthawk.dtsi
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-rt4230w-rev6.dts
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-tr4400-v2.dts

index 74a0007a4e01995bd09f5d6f1a3864a3c597f0b4..1bcea1fa80fdd6b840abd7f6ebd5f0d8eb2180ac 100644 (file)
@@ -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 (executable)
index 0000000..bf14907
--- /dev/null
@@ -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
+}
index e3987c6d07dfa625038a95508ecc6e1e89b21e49..5f78d91b9ea95dd091cd1d660c666dd5ef90689a 100644 (file)
                                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 {
index 9d05cf40326ab3bc097539ad59b0a65358ded114..c425c9cd2ed314df72703fcd0c7760945127db25 100644 (file)
                                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 {
index c8e4a1810eb9f5c2dd33c8e8ba5ff0e135d0dfff..7e4e0c829c27230a09a97932c274e359486da723 100644 (file)
                                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 {
index fac43e785fb2eaaad63e3c8829055398cb49b9e7..e5cc2424190e175dce36300b19880c14ce452f56 100644 (file)
                                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 {
index 6795e8fa4fb33f889c709e56a96aa05246011b0d..efcb6ec24110939a13e9a727136ffda28c0a192c 100644 (file)
                                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 {
index d20b55c2c2967689e4f694d7a4c42cfe6756855d..b84c8512ae91af0985a919d51c15487688c804ed 100644 (file)
                                        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 {
index ff464d9d1e8fbf15b2635a96998f1169acd9655a..c58c289d35d9f5eb4387b2e77d1fc3f17fd8eb77 100644 (file)
                                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 {
index 030d4456683f4b901c61457bb7999c8252f38f46..719a423cad3d695ac46475b23038b3b5126d1951 100644 (file)
                                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 {
index 4fddf5e90a42f0f7d0c6c11ffde16d96753e2d63..8104ce18298439145c896fcce2a988f0bcb39bbb 100644 (file)
                                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 {
index 47829a08aa2701ad3a6798479f75cf5d7b300098..87b05b57ba977947f271b439236b8ef41c8f3951 100644 (file)
@@ -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 {
index 37055f110b4968a89797cbf4d37cefdc746562e1..f8b20b0635f2c14f33e1b1e67fb32f32a5d3dd49 100644 (file)
                                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 {
index 97d76e11f0d1471a4747b4e500768afe20496eee..2d761ee3557d2bef9f05827c1e985789deb5d301 100644 (file)
                                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 {
index 96becfb4c1e61d45e0112b93b77e03b62e462b30..693e14c12077519352e538115fcfbad2c22a8c84 100644 (file)
                                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 {
index ecd2c5634a9e66b997a5ef95eccfec444296744a..51ad5ac8eefcbd7931a6f969a0b23e8425ff2d18 100644 (file)
                                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 {
index 87948bb1d6ab2368f896f1af0df92ae069093887..6bf2cfe128ac3d55d6241792c0c5e1b0794a1c11 100644 (file)
                                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 {
index bb00bbe7d3179134bb27c2e931018c9cbc5b36e1..600bcc8421d96f2bf51f177e6606acb01e89f338 100644 (file)
                                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 {