diff --git a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq50xx b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq50xx index 7d49a65528c..b5dc49d9e0e 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq50xx +++ b/package/boot/uboot-tools/uboot-envtools/files/qualcommax_ipq50xx @@ -34,6 +34,9 @@ linksys,mx6200|\ linksys,spnmx56) ubootenv_add_mtd "u_env" "0x0" "0x40000" "0x20000" ;; +ubnt,unifi-6-pro) + ubootenv_add_mtd "u-boot-env" "0x0" "0x10000" "0x1000" + ;; wallys,dr5018s|\ yuncore,ax830|\ yuncore,ax850) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index c027bca505d..68fbd928f65 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -116,6 +116,7 @@ ALLWIFIBOARDS:= \ tplink_eap660hd-v1 \ tplink_re700x \ tplink_tl-wa1201-v2 \ + ubnt_unifi-6-pro \ ubnt_utr \ wallys_dr40x9 \ wallys_dr5018s \ @@ -335,6 +336,7 @@ $(eval $(call generate-ipq-wifi-package,tplink_eap650-outdoor-v1,TP-Link EAP650- $(eval $(call generate-ipq-wifi-package,tplink_eap660hd-v1,TP-Link EAP660 HD v1)) $(eval $(call generate-ipq-wifi-package,tplink_re700x,TP-Link RE700X)) $(eval $(call generate-ipq-wifi-package,tplink_tl-wa1201-v2,TP-Link TL-WA1201 V2)) +$(eval $(call generate-ipq-wifi-package,ubnt_unifi-6-pro,Ubiquiti UniFi 6 Pro)) $(eval $(call generate-ipq-wifi-package,ubnt_utr,Ubiquiti UniFi Travel Router)) $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9)) $(eval $(call generate-ipq-wifi-package,wallys_dr5018s,Wallys DR5018S)) diff --git a/target/linux/qualcommax/dts/ipq5018-unifi-6-pro.dts b/target/linux/qualcommax/dts/ipq5018-unifi-6-pro.dts new file mode 100644 index 00000000000..06a202c9e0b --- /dev/null +++ b/target/linux/qualcommax/dts/ipq5018-unifi-6-pro.dts @@ -0,0 +1,320 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "ipq5018.dtsi" +#include "ipq5018-ess.dtsi" + +#include +#include +#include + +/ { + model = "Ubiquiti UniFi 6 Pro"; + compatible = "ubnt,unifi-6-pro", "qcom,ipq5018"; + + aliases { + label-mac-device = &gmac0; + serial0 = &blsp1_uart1; + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_blue; + }; + + chosen { + /* kernel in slot 1 (0:HLOS_1), rootfs in the "log" + * partition; U-Boot passes no root= + */ + bootargs-append = " root=/dev/mmcblk0p5 rootwait coherent_pool=2M"; + stdout-path = "serial0:115200n8"; + }; + + /* DDR is 1 GiB but U-Boot clamps the memory reg to 512 MiB + * (same U-Boot v1.0.25.152 in BZ.6.6.65 and BZ.6.8.2); + * linux,usable-memory is read before reg and overrides it. + */ + memory@40000000 { + linux,usable-memory = <0x0 0x40000000 0x0 0x3ff00000>; + }; + + keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset-button { + label = "reset"; + gpios = <&tlmm 24 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + led_white: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>; + }; + + led_blue: led-1 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&sleep_clk { + clock-frequency = <32000>; +}; + +&xo_board_clk { + clock-div = <4>; + clock-mult = <1>; +}; + +&blsp1_uart1 { + status = "okay"; + + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; +}; + +&prng { + status = "okay"; +}; + +&qfprom { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + pinctrl-0 = <&spi_pins>; + pinctrl-names = "default"; + + /* Macronix MX25U6435F, 8 MiB */ + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "SBL1"; + reg = <0x000000 0x030000>; + read-only; + }; + + partition@30000 { + label = "MIBIB"; + reg = <0x030000 0x010000>; + read-only; + }; + + partition@40000 { + label = "BOOTCONFIG"; + reg = <0x040000 0x010000>; + read-only; + }; + + partition@50000 { + label = "QSEE"; + reg = <0x050000 0x0a0000>; + read-only; + }; + + partition@f0000 { + label = "DEVCFG"; + reg = <0x0f0000 0x010000>; + read-only; + }; + + partition@100000 { + label = "CDT"; + reg = <0x100000 0x010000>; + read-only; + }; + + partition@110000 { + label = "u-boot-env"; + reg = <0x110000 0x010000>; + }; + + partition@120000 { + label = "u-boot"; + reg = <0x120000 0x0a0000>; + read-only; + }; + + partition@1c0000 { + label = "ART"; + reg = <0x1c0000 0x070000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + caldata_ipq5018: calibration@1000 { + reg = <0x1000 0x20000>; + }; + + caldata_qcn9074: calibration@26800 { + reg = <0x26800 0x20000>; + }; + }; + }; + + partition@230000 { + label = "EEPROM"; + reg = <0x230000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + compatible = "mac-base"; + reg = <0x0 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; +}; + +&sdhc_1 { + status = "okay"; + + pinctrl-0 = <&sdc_default_state>; + pinctrl-names = "default"; + mmc-ddr-1_8v; + mmc-hs200-1_8v; + max-frequency = <192000000>; + bus-width = <4>; +}; + +&mdio0 { + status = "okay"; +}; + +/* single RJ45 port with PoE input, IPQ5018 MAC0 -> internal GE PHY */ +&gmac0 { + status = "okay"; + + label = "lan"; + + nvmem-cells = <&macaddr_eeprom_0 0>; + nvmem-cell-names = "mac-address"; +}; + +&tlmm { + button_pins: button-state { + pins = "gpio24"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + + sdc_default_state: sdc-default-state { + clk-pins { + pins = "gpio9"; + function = "sdc1_clk"; + drive-strength = <8>; + bias-disable; + }; + + cmd-pins { + pins = "gpio8"; + function = "sdc1_cmd"; + drive-strength = <8>; + bias-pull-up; + }; + + data-pins { + pins = "gpio4", "gpio5", "gpio6", "gpio7"; + function = "sdc1_data"; + drive-strength = <8>; + bias-disable; + }; + }; + + led_pins: led-state { + pins = "gpio2", "gpio3"; + function = "gpio"; + drive-strength = <8>; + bias-disable; + }; + + serial_0_pins: uart0-state { + pins = "gpio20", "gpio21"; + function = "blsp0_uart0"; + bias-disable; + }; + + spi_pins: spi-state { + pins = "gpio10", "gpio11", "gpio12", "gpio13"; + function = "blsp0_spi"; + drive-strength = <8>; + bias-disable; + }; +}; + +/* QCN9074, 5 GHz 4x4 */ +&pcie0_phy { + status = "okay"; +}; + +&pcie0 { + status = "okay"; + + perst-gpios = <&tlmm 15 GPIO_ACTIVE_LOW>; + + pcie@0 { + wifi@0,0 { + status = "okay"; + + /* QCN9074: ath11k lacks DT compatible for PCI cards */ + compatible = "pci17cb,1104"; + reg = <0x00010000 0 0 0 0>; + + qcom,calibration-variant = "Ubiquiti-U6-Pro"; + + nvmem-cells = <&caldata_qcn9074>, <&macaddr_eeprom_0 2>; + nvmem-cell-names = "calibration", "mac-address"; + }; + }; +}; + +/* IPQ5018 internal radio, 2.4 GHz 2x2 */ +&q6v5_wcss { + firmware-name = "ath11k/IPQ5018/hw1.0/q6_fw.mdt", + "ath11k/IPQ5018/hw1.0/m3_fw.mdt"; +}; + +&wifi { + status = "okay"; + + qcom,rproc = <&q6v5_wcss>; + qcom,calibration-variant = "Ubiquiti-U6-Pro"; + qcom,ath11k-fw-memory-mode = <1>; + + nvmem-cells = <&caldata_ipq5018>, <&macaddr_eeprom_0 1>; + nvmem-cell-names = "calibration", "mac-address"; +}; diff --git a/target/linux/qualcommax/image/ipq50xx.mk b/target/linux/qualcommax/image/ipq50xx.mk index 3848efadb77..6e76e1cc624 100644 --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -397,6 +397,23 @@ define Device/tplink_re700x endef TARGET_DEVICES += tplink_re700x +define Device/ubnt_unifi-6-pro + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 Pro + DEVICE_ALT0_VENDOR := Ubiquiti + DEVICE_ALT0_MODEL := U6-Pro + SOC := ipq5018 + DEVICE_DTS_CONFIG := config@a650 + DEVICE_PACKAGES := ath11k-firmware-ipq5018 \ + kmod-ath11k-pci \ + ath11k-firmware-qcn9074 \ + ipq-wifi-ubnt_unifi-6-pro \ + kmod-fs-f2fs f2fs-tools +endef +TARGET_DEVICES += ubnt_unifi-6-pro + define Device/wallys_dr5018s $(call Device/FitImage) $(call Device/UbiFit) diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network index 11b7d2d2a92..97b5295674f 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network @@ -50,7 +50,8 @@ ipq50xx_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; tplink,eap650-outdoor-v1|\ - tplink,re700x) + tplink,re700x|\ + ubnt,unifi-6-pro) ucidef_set_interface_lan "lan" "dhcp" ;; zte,t5400) diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh index b6fe794af96..8cae1e36efc 100644 --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -311,6 +311,13 @@ platform_do_upgrade() { remove_oem_ubi_volume tp_data nand_do_upgrade "$1" ;; + ubnt,unifi-6-pro) + # OpenWrt boots from slot 1, slot 0 (0:HLOS) keeps the + # signed stock image + CI_KERNPART="0:HLOS_1" + CI_ROOTPART="log" + emmc_do_upgrade "$1" + ;; wallys,dr5018s) CI_UBIPART="rootfs" remove_oem_ubi_volume debug @@ -357,3 +364,11 @@ platform_do_upgrade() { ;; esac } + +platform_copy_config() { + case "$(board_name)" in + ubnt,unifi-6-pro) + emmc_copy_config + ;; + esac +}