qualcommax: ipq60xx: add Qihoo 360V6 support
authorChukun Pan <amadeus@jmu.edu.cn>
Fri, 21 Jun 2024 15:18:21 +0000 (23:18 +0800)
committerRobert Marko <robimarko@gmail.com>
Fri, 6 Dec 2024 09:59:38 +0000 (10:59 +0100)
Specifications:
  SoC:     Qualcomm IPQ6000 1.5GHz
  RAM:     NTCC256M16ER-EK 512MiB
  Flash:   W29N01HZSINA 128MiB
  ETH:     QCA8075 (3x LAN, 1x WAN)
  WLAN1:   2.4GHz 802.11b/g/n/ax 2x2
  WLAN2:   5GHz 802.11a/n/ac/ax 2x2
  Power:   DC 12V 1.5A
  Button:  Reset, Wps
  USB:     1x 2.0

Flash instructions:
  1. Download the initramfs image, rename it to
     initramfs.itb, host it with the tftp server.
  2. Interrupt U-Boot and run these commands:
     tftpboot initramfs.itb
     bootm
  3. After openwrt boots up, use scp or luci web
     to upload sysupgrade.bin to upgrade.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
Link: https://github.com/openwrt/openwrt/pull/15940
Signed-off-by: Robert Marko <robimarko@gmail.com>
package/firmware/ipq-wifi/Makefile
target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts [new file with mode: 0644]
target/linux/qualcommax/image/ipq60xx.mk
target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network
target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata
target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh

index af2a62b1588615886e33858b5efbf2ae64fe2e1a..b80665efdb050db868a5f575854ad0cabcc60b6d 100644 (file)
@@ -49,6 +49,7 @@ ALLWIFIBOARDS:= \
        netgear_wax620 \
        netgear_wax630 \
        prpl_haze \
+       qihoo_360v6 \
        qnap_301w \
        redmi_ax6 \
        skspruce_wia3300-20 \
@@ -175,6 +176,7 @@ $(eval $(call generate-ipq-wifi-package,netgear_wax214,Netgear WAX214))
 $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218))
 $(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620))
 $(eval $(call generate-ipq-wifi-package,netgear_wax630,Netgear WAX630))
+$(eval $(call generate-ipq-wifi-package,qihoo_360v6,Qihoo 360V6))
 $(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))
 $(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze))
 $(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts
new file mode 100644 (file)
index 0000000..07aabe0
--- /dev/null
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "ipq6018-512m.dtsi"
+#include "ipq6018-ess.dtsi"
+#include "ipq6018-cp-cpu.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       model = "Qihoo 360V6";
+       compatible = "qihoo,360v6", "qcom,ipq6018";
+
+       aliases {
+               serial0 = &blsp1_uart3;
+               led-boot = &led_status_red;
+               led-failsafe = &led_status_red;
+               led-running = &led_status_green;
+               led-upgrade = &led_status_orange;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-append = " root=/dev/ubiblock0_1";
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               wps {
+                       label = "wps";
+                       linux,code = <KEY_WPS_BUTTON>;
+                       gpios = <&tlmm 19 GPIO_ACTIVE_LOW>;
+               };
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&tlmm 68 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_status_red: red {
+                       color = <LED_COLOR_ID_RED>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&tlmm 71 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_orange: orange {
+                       color = <LED_COLOR_ID_ORANGE>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&tlmm 72 GPIO_ACTIVE_HIGH>;
+               };
+
+               led_status_green: green {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_STATUS;
+                       gpios = <&tlmm 73 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&tlmm {
+       mdio_pins: mdio-pins {
+               mdc {
+                       pins = "gpio64";
+                       function = "mdc";
+                       drive-strength = <8>;
+                       bias-pull-up;
+               };
+
+               mdio {
+                       pins = "gpio65";
+                       function = "mdio";
+                       drive-strength = <8>;
+                       bias-pull-up;
+               };
+       };
+};
+
+&blsp1_uart3 {
+       pinctrl-0 = <&serial_3_pins>;
+       pinctrl-names = "default";
+       status = "okay";
+};
+
+&qpic_bam {
+       status = "okay";
+};
+
+&qpic_nand {
+       status = "okay";
+
+       nand@0 {
+               reg = <0>;
+               nand-ecc-strength = <4>;
+               nand-ecc-step-size = <512>;
+               nand-bus-width = <8>;
+
+               partitions {
+                       compatible = "qcom,smem-part";
+               };
+       };
+};
+
+&qusb_phy_0 {
+       status = "okay";
+};
+
+&ssphy_0 {
+       status = "okay";
+};
+
+&usb3 {
+       status = "okay";
+};
+
+&mdio {
+       status = "okay";
+
+       pinctrl-0 = <&mdio_pins>;
+       pinctrl-names = "default";
+       reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>;
+
+       ethernet-phy-package@0 {
+               compatible = "qcom,qca8075-package";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <0>;
+
+               qca8075_0: ethernet-phy@0 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <0>;
+               };
+
+               qca8075_1: ethernet-phy@1 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <1>;
+               };
+
+               qca8075_2: ethernet-phy@2 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <2>;
+               };
+
+               qca8075_3: ethernet-phy@3 {
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       reg = <3>;
+               };
+       };
+};
+
+&switch {
+       status = "okay";
+
+       switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3)>;
+       switch_wan_bmp = <ESS_PORT4>;
+       switch_mac_mode = <MAC_MODE_PSGMII>;
+
+       qcom,port_phyinfo {
+               port@1 {
+                       port_id = <1>;
+                       phy_address = <0>;
+               };
+               port@2 {
+                       port_id = <2>;
+                       phy_address = <1>;
+               };
+               port@3 {
+                       port_id = <3>;
+                       phy_address = <2>;
+               };
+               port@4 {
+                       port_id = <4>;
+                       phy_address = <3>;
+               };
+       };
+};
+
+&edma {
+       status = "okay";
+};
+
+&dp1 {
+       status = "okay";
+       phy-handle = <&qca8075_0>;
+       label = "lan1";
+};
+
+&dp2 {
+       status = "okay";
+       phy-handle = <&qca8075_1>;
+       label = "lan2";
+};
+
+&dp3 {
+       status = "okay";
+       phy-handle = <&qca8075_2>;
+       label = "lan3";
+};
+
+&dp4 {
+       status = "okay";
+       phy-handle = <&qca8075_3>;
+       label = "wan";
+};
+
+&wifi {
+       status = "okay";
+
+       qcom,ath11k-fw-memory-mode = <1>;
+       qcom,ath11k-calibration-variant = "Qihoo-360V6";
+};
index 75a69d3c6b31c6948270e80663515066025140e5..d861f82d1c693d3d4a768fac6d80defb24828dd2 100644 (file)
@@ -37,6 +37,19 @@ define Device/netgear_wax214
 endef
 TARGET_DEVICES += netgear_wax214
 
+define Device/qihoo_360v6
+       $(call Device/FitImage)
+       $(call Device/UbiFit)
+       DEVICE_VENDOR := Qihoo
+       DEVICE_MODEL := 360V6
+       BLOCKSIZE := 128k
+       PAGESIZE := 2048
+       SOC := ipq6000
+       DEVICE_DTS_CONFIG := config@cp03-c1
+       DEVICE_PACKAGES := ipq-wifi-qihoo_360v6
+endef
+TARGET_DEVICES += qihoo_360v6
+
 define Device/yuncore_fap650
        $(call Device/FitImage)
        $(call Device/UbiFit)
index 86d55de7b8dd17542b4e566d7e8071ee3dc1978a..86ed04f34bbfc6ff823432617d8b2771b28a7e38 100644 (file)
@@ -20,6 +20,9 @@ ipq60xx_setup_interfaces()
        netgear,wax214)
                ucidef_set_interfaces_lan_wan "lan"
                ;;
+       qihoo,360v6)
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
+               ;;
        yuncore,fap650)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
                ;;
@@ -29,9 +32,30 @@ ipq60xx_setup_interfaces()
        esac
 }
 
+ipq60xx_setup_macs()
+{
+       local board="$1"
+       local lan_mac=""
+       local wan_mac=""
+       local label_mac=""
+
+       case "$board" in
+       qihoo,360v6)
+               lan_mac=$(mtd_get_mac_ascii factory lanMac)
+               wan_mac=$(macaddr_add "$lan_mac" 1)
+               label_mac=$lan_mac
+               ;;
+       esac
+
+       [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+       [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+       [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+}
+
 board_config_update
 board=$(board_name)
 ipq60xx_setup_interfaces $board
+ipq60xx_setup_macs $board
 board_config_flush
 
 exit 0
index cc2de7514e88798ce6202f1ff20e91773afdcf45..e35413e1e039b1d1a634324cfedc13514f2a7718 100644 (file)
@@ -18,6 +18,13 @@ case "$FIRMWARE" in
        netgear,wax214)
                caldata_extract "0:art" 0x1000 0x10000
                ;;
+       qihoo,360v6)
+               caldata_extract "0:art" 0x1000 0x10000
+               label_mac=$(mtd_get_mac_ascii factory lanMac)
+               ath11k_patch_mac $(macaddr_add $label_mac 3) 0
+               ath11k_patch_mac $(macaddr_add $label_mac 2) 1
+               ath11k_set_macflag
+               ;;
        yuncore,fap650)
                caldata_extract "0:art" 0x1000 0x20000
                ;;
index cbc6292978bf2d119303ea168e651f0369904d05..c545746b31ff792f5974f090e4aad69f7a1cf70b 100644 (file)
@@ -37,7 +37,8 @@ platform_do_upgrade() {
                fw_setenv bootcount 0
                nand_do_upgrade "$1"
                ;;
-       netgear,wax214)
+       netgear,wax214|\
+       qihoo,360v6)
                nand_do_upgrade "$1"
                ;;
        yuncore,fap650)