From a95c23c180dc48a7049bdf2a79b6bb5448b85034 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Mon, 15 Apr 2024 23:00:37 +0800 Subject: [PATCH] qualcommax: ipq60xx: add JDCloud AX1800 Pro and AX6600 support --- package/firmware/ipq-wifi/Makefile | 4 + .../arm64/boot/dts/qcom/ipq6000-re-ss-01.dts | 217 ++++++++++++++ .../arm64/boot/dts/qcom/ipq6010-re-cs-02.dts | 270 ++++++++++++++++++ target/linux/qualcommax/image/ipq60xx.mk | 32 ++- .../ipq60xx/base-files/etc/board.d/02_network | 2 + .../etc/hotplug.d/firmware/11-ath11k-caldata | 9 + .../base-files/lib/preinit/81_fix_eeprom | 19 ++ .../base-files/lib/upgrade/platform.sh | 12 +- 8 files changed, 557 insertions(+), 8 deletions(-) create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts create mode 100644 target/linux/qualcommax/ipq60xx/base-files/lib/preinit/81_fix_eeprom diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 8ed43f29e..b79ccf647 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -36,6 +36,8 @@ ALLWIFIBOARDS:= \ edimax_cax1800 \ glinet_gl-ax1800 \ glinet_gl-axt1800 \ + jdcloud_ax1800pro \ + jdcloud_ax6600 \ linksys_mr7350 \ linksys_mx4200 \ linksys_mx5300 \ @@ -143,6 +145,8 @@ $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) $(eval $(call generate-ipq-wifi-package,glinet_gl-ax1800,GL.iNet GL-AX1800)) $(eval $(call generate-ipq-wifi-package,glinet_gl-axt1800,GL.iNet GL-AXT1800)) +$(eval $(call generate-ipq-wifi-package,jdcloud_ax1800pro,JDCloud AX1800 Pro)) +$(eval $(call generate-ipq-wifi-package,jdcloud_ax6600,JDCloud AX6600)) $(eval $(call generate-ipq-wifi-package,linksys_mr7350,Linksys MR7350)) $(eval $(call generate-ipq-wifi-package,linksys_mx4200,Linksys MX4200)) $(eval $(call generate-ipq-wifi-package,linksys_mx5300,Linksys MX5300)) diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts new file mode 100644 index 000000000..dbd6fcd47 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts @@ -0,0 +1,217 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018-512m.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" + +#include +#include + +/ { + model = "JDCloud RE-SS-01"; + compatible = "jdcloud,re-ss-01", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + + ethernet1 = "/soc/dp2"; + ethernet2 = "/soc/dp3"; + ethernet3 = "/soc/dp4"; + ethernet4 = "/soc/dp5"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 8 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: red { + label = "red:status"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: blue { + label = "blue:status"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: green { + label = "green:status"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + button_pins: button_pins { + mux { + pins = "gpio8", "gpio9"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + 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"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&rpm { + status = "disabled"; +}; + +&sdhc { + bus-width = <8>; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + 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>; + + 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>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; +}; + +&switch { + status = "okay"; + + switch_cpu_bmp = <0x1>; /* cpu port bitmap */ + switch_lan_bmp = <0x1e>; /* lan port bitmap */ + switch_wan_bmp = <0x20>; /* wan port bitmap */ + switch_inner_bmp = <0xc0>; /*inner port bitmap*/ + switch_mac_mode = <0x0>; /* mac mode for uniphy 0*/ + switch_mac_mode1 = <0xff>; /* mac mode for uniphy 1*/ + switch_mac_mode2 = <0xff>; /* mac mode for uniphy 2*/ + + qcom,port_phyinfo { + port@2 { + port_id = <2>; + phy_address = <1>; + }; + port@3 { + port_id = <3>; + phy_address = <2>; + }; + port@4 { + port_id = <4>; + phy_address = <3>; + }; + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "wan"; +}; + +&wifi { + status = "okay"; + + qcom,ath11k-fw-memory-mode = <1>; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts new file mode 100644 index 000000000..9d3e398e5 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts @@ -0,0 +1,270 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" + +#include +#include + +/ { + model = "JDCloud RE-CS-02"; + compatible = "jdcloud,re-cs-02", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + serial1 = &blsp1_uart6; + led-boot = &led_status_green; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + + ethernet0 = "/soc/dp1"; + ethernet1 = "/soc/dp2"; + ethernet2 = "/soc/dp3"; + ethernet3 = "/soc/dp4"; + ethernet4 = "/soc/dp5"; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 72 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: red { + label = "red:status"; + gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: blue { + label = "blue:status"; + gpios = <&tlmm 79 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: green { + label = "green:status"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + button_pins: button_pins { + mux { + pins = "gpio56", "gpio72"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + btuart_pins: btuart_pins { + mux { + pins = "gpio48", "gpio49"; + function = "blsp5_uart"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + 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"; +}; + +&blsp1_uart6 { + pinctrl-0 = <&btuart_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + perst-gpio = <&tlmm 53 GPIO_ACTIVE_LOW>; + status = "okay"; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + compatible = "pci17cb,1104"; + reg = <0x00010000 0 0 0 0>; + }; + }; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&rpm { + status = "disabled"; +}; + +&sdhc { + bus-width = <8>; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + non-removable; + 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>; + + qca8075_0: ethernet-phy@24 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <24>; + }; + + qca8075_1: ethernet-phy@25 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <25>; + }; + + qca8075_2: ethernet-phy@26 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <26>; + }; + + qca8075_3: ethernet-phy@27 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <27>; + }; + + qca8081: ethernet-phy@12 { + compatible = "ethernet-phy-id004d.d101"; + reg = <12>; + reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; + }; +}; + +&switch { + status = "okay"; + + switch_cpu_bmp = <0x1>; /* cpu port bitmap */ + switch_lan_bmp = <0x1e>; /* lan port bitmap */ + switch_wan_bmp = <0x20>; /* wan port bitmap */ + switch_inner_bmp = <0xc0>; /*inner port bitmap*/ + switch_mac_mode = <0x0>; /* mac mode for uniphy 0*/ + switch_mac_mode1 = <0xf>; /* mac mode for uniphy 1*/ + switch_mac_mode2 = <0xff>; /* mac mode for uniphy 2*/ + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <24>; + }; + port@2 { + port_id = <2>; + phy_address = <25>; + }; + port@3 { + port_id = <3>; + phy_address = <26>; + }; + port@4 { + port_id = <4>; + phy_address = <27>; + }; + port@5 { + port_id = <5>; + phy_address = <12>; + port_mac_sel = "QGMAC_PORT"; + }; + }; +}; + +&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 = "lan4"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8081>; + label = "wan"; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index 6ef006faf..ef05a150b 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -18,9 +18,9 @@ define Device/UbiFit endef define Device/EmmcImage - IMAGES += factory.bin sysupgrade.bin - IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k - IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata + IMAGES := factory.bin recovery.bin sysupgrade.bin + IMAGE/factory.bin := append-kernel | pad-to 12288k | append-rootfs | append-metadata + IMAGE/recovery.bin := append-kernel | pad-to 6144k | append-rootfs | append-metadata endef define Device/cmiot_ax18 @@ -61,6 +61,32 @@ define Device/glinet_gl-axt1800 endef TARGET_DEVICES += glinet_gl-axt1800 +define Device/jdcloud_re-cs-02 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := AX6600 + SOC := ipq6010 + BLOCKSIZE := 64k + KERNEL_SIZE := 6144k + DEVICE_DTS_CONFIG := config@cp03-c3 + DEVICE_PACKAGES := ipq-wifi-jdcloud_ax6600 kmod-ath11k-pci ath11k-firmware-qcn9074 +endef +TARGET_DEVICES += jdcloud_re-cs-02 + +define Device/jdcloud_re-ss-01 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := AX1800 Pro + SOC := ipq6000 + BLOCKSIZE := 64k + KERNEL_SIZE := 6144k + DEVICE_DTS_CONFIG := config@cp03-c2 + DEVICE_PACKAGES := ipq-wifi-jdcloud_ax1800pro +endef +TARGET_DEVICES += jdcloud_re-ss-01 + define Device/linksys_mr7350 $(call Device/FitImage) DEVICE_VENDOR := Linksys diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network index ead1fb8f0..fc123c9a1 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -12,12 +12,14 @@ ipq60xx_setup_interfaces() case "$board" in cmiot,ax18|\ + jdcloud,re-ss-01|\ qihoo,360v6|\ redmi,ax5-*|\ xiaomi,rm1800) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; glinet,gl-ax1800|\ + jdcloud,re-cs-02|\ linksys,mr7350) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata index a05c55005..b82946cdc 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -16,11 +16,20 @@ case "$FIRMWARE" in xiaomi,rm1800) caldata_extract "0:art" 0x1000 0x10000 ;; + jdcloud,re-cs-02|\ + jdcloud,re-ss-01|\ redmi,ax5-jdcloud) caldata_extract_mmc "0:ART" 0x1000 0x10000 ;; esac ;; +"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin") + case "$board" in + jdcloud,re-cs-02) + caldata_extract_mmc "0:ART" 0x26800 0x20000 + ;; + esac + ;; *) exit 1 ;; diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/81_fix_eeprom b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/81_fix_eeprom new file mode 100644 index 000000000..34b91f4df --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/81_fix_eeprom @@ -0,0 +1,19 @@ +. /lib/functions/caldata.sh + +preinit_fix_eeprom() { + case $(board_name) in + jdcloud,re-cs-02|\ + jdcloud,re-ss-01|\ + redmi,ax5-jdcloud) + mmc_part=$(find_mmc_part 0:ART) + FIRMWARE=""ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin"" + [ ! -e /lib/firmware/"$FIRMWARE" ] && \ + export FIRMWARE="$FIRMWARE" && \ + caldata_extract_mmc "0:ART" 0x1000 0x10000 + ;; + *) + ;; + esac +} + +boot_hook_add preinit_main preinit_fix_eeprom diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh index b04d230c4..e199c33c1 100644 --- a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -17,6 +17,13 @@ platform_do_upgrade() { xiaomi,rm1800) nand_do_upgrade "$1" ;; + jdcloud,re-cs-02|\ + jdcloud,re-ss-01|\ + redmi,ax5-jdcloud) + kernelname="0:HLOS" + rootfsname="rootfs" + mmc_do_upgrade "$1" + ;; linksys,mr7350) boot_part="$(fw_printenv -n boot_part)" if [ "$boot_part" -eq "1" ]; then @@ -31,11 +38,6 @@ platform_do_upgrade() { fw_setenv auto_recovery yes nand_do_upgrade "$1" ;; - redmi,ax5-jdcloud) - kernelname="0:HLOS" - rootfsname="rootfs" - mmc_do_upgrade "$1" - ;; *) default_do_upgrade "$1" ;;