[openwrt/openwrt] ipq807x: add initial support for prpl Foundation Haze board

LEDE Commits lede-commits at lists.infradead.org
Tue Jun 13 07:49:58 PDT 2023


ynezz pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/41af35cf6b5eadaf0e380c867be3ee0427202775

commit 41af35cf6b5eadaf0e380c867be3ee0427202775
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Mon Jun 5 12:13:04 2023 +0200

    ipq807x: add initial support for prpl Foundation Haze board
    
    Haze is prpl Foundation's reference board (WNC LVRP).
    
    Board info:
    
     - IPQ8072A SoC
     - 2 GiB RAM
     - 4 GiB eMMC
     - 8MiB SPI NOR (MX25U6435F)
    
     - 3x 1GigE ports (QCA8075)
     - 1x 10GigE port (AQR113C)
     - 1x SFP cage
    
     - WiFi 6GHz 160MHz (QCN9074)
     - WiFi 5GHz 80+80MHz (QCN5054)
     - WiFi 2.4G (QCN5024)
    
     - ARM Standard 20-pin 2.54mm/0.1" JTAG (1V8 !!!)
     - Bluetooth v5.0 + EDR with integrated Class 1 PA (CYW20704)
     - 1x M.2 B-key socket with PCIe 3.0
     - 1x USB 3.0 port
     - UART marked J6 is 4-pin 2.54mm/0.1" connector 3V3(arrow),RX,TX,GND (115200 8N1)
     - Reset and WPS buttons
    
    Flashing instructions:
    
     1. From U-Boot boot OpenWrt using initramfs image:
    
        IPQ807x# tftpboot openwrt-ipq807x-generic-prpl_haze-initramfs-uImage.itb && bootm
    
     2. In OpenWrt running from initramfs execute sysupgrade:
    
        root at OpenWrt:/# sysupgrade -n /tmp/openwrt-ipq807x-generic-prpl_haze-squashfs-sysupgrade.bin
    
    Work in progress/known issues:
    
     * SFP feature not implemented/tested
     * M.2 feature not implemented/tested
     * Bluetooth feature not implemented/tested
     * 6GHz wireless should be working, but not tested
     * MAC address assigments for LAN interfaces
    
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
    (cherry picked from commit 2e910039dd7170fd28641e7686c376dba6f0d8a5)
---
 package/boot/uboot-envtools/files/ipq807x          |   5 +
 .../ipq807x/base-files/etc/board.d/02_network      |   3 +
 .../etc/hotplug.d/firmware/11-ath11k-caldata       |   9 +-
 .../ipq807x/base-files/lib/upgrade/platform.sh     |   1 +
 .../arch/arm64/boot/dts/qcom/ipq8072-haze.dts      | 308 +++++++++++++++++++++
 target/linux/ipq807x/image/generic.mk              |  11 +
 6 files changed, 336 insertions(+), 1 deletion(-)

diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x
index ca331f1032..2064bfc6f2 100644
--- a/package/boot/uboot-envtools/files/ipq807x
+++ b/package/boot/uboot-envtools/files/ipq807x
@@ -35,6 +35,11 @@ xiaomi,ax9000)
 	[ -n "$idx2" ] && \
 		ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000"
 	;;
+prpl,haze)
+	mmcpart="$(find_mmc_part 0:APPSBLENV)"
+	[ -n "$mmcpart" ] && \
+		ubootenv_add_uci_config "$mmcpart" "0x0" "0x40000" "0x400" "0x100"
+	;;
 qnap,301w)
 	idx="$(find_mtd_index 0:appsblenv)"
 	[ -n "$idx" ] && \
diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network
index 1da5c3ae1e..21364337fb 100644
--- a/target/linux/ipq807x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
@@ -25,6 +25,9 @@ ipq807x_setup_interfaces()
 	netgear,wax218)
 		ucidef_set_interface_lan "lan" "dhcp"
 		;;
+	prpl,haze)
+		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
+		;;
 	qnap,301w)
 		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g-2" "10g-1"
 		;;
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
index b3564fe9c6..13cb07477e 100644
--- a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata
@@ -21,10 +21,17 @@ case "$FIRMWARE" in
 	zyxel,nbg7815)
 		caldata_extract "0:art" 0x1000 0x20000
 		;;
+	prpl,haze)
+                caldata_extract_mmc "0:ART" 0x1000 0x20000
+		;;
 	esac
 	;;
-"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin")
+"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin"|\
+"ath11k/QCN9074/hw1.0/cal-pci-0001:01:00.0.bin")
 	case "$board" in
+	prpl,haze)
+                caldata_extract_mmc "0:ART" 0x26800 0x20000
+		;;
 	xiaomi,ax9000)
 		caldata_extract "0:art" 0x26800 0x20000
 		;;
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
index 11717d6324..346cc390f3 100644
--- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
@@ -70,6 +70,7 @@ platform_do_upgrade() {
 	netgear,wax218)
 		nand_do_upgrade "$1"
 		;;
+	prpl,haze|\
 	qnap,301w)
 		kernelname="0:HLOS"
 		rootfsname="rootfs"
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts
new file mode 100644
index 0000000000..8a5200b4eb
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts
@@ -0,0 +1,308 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "ipq8074.dtsi"
+#include "ipq8074-hk-cpu.dtsi"
+#include "ipq8074-ess.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+	model = "prpl Foundation Haze";
+	compatible = "prpl,haze", "qcom,ipq8074";
+
+	aliases {
+		serial0 = &blsp1_uart5;
+		/* Aliases are required by U-Boot to patch MAC addresses */
+		ethernet0 = &dp6_syn;
+		ethernet1 = &dp4;
+		ethernet2 = &dp3;
+		ethernet3 = &dp2;
+		label-mac-device = &dp6_syn;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	keys {
+		compatible = "gpio-keys";
+		pinctrl-0 = <&button_pins>;
+		pinctrl-names = "default";
+
+		wps-button {
+			label = "wps";
+			gpios = <&tlmm 42 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+
+		reset-button {
+			label = "reset";
+			gpios = <&tlmm 44 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+};
+
+&tlmm {
+	mdio_pins: mdio-state {
+		mdc-pins {
+			pins = "gpio68";
+			function = "mdc";
+			drive-strength = <8>;
+			bias-pull-up;
+		};
+
+		mdio-pins {
+			pins = "gpio69";
+			function = "mdio";
+			drive-strength = <8>;
+			bias-pull-up;
+		};
+	};
+
+	button_pins: button-state {
+		wps-pins {
+			pins = "gpio42";
+			function = "gpio";
+			drive-strength = <8>;
+			bias-pull-up;
+		};
+
+		rst-pins {
+			pins = "gpio44";
+			function = "gpio";
+			drive-strength = <8>;
+			bias-pull-up;
+		};
+	};
+};
+
+&blsp1_uart5 {
+	status = "okay";
+};
+
+&prng {
+	status = "okay";
+};
+
+&ssphy_0 {
+	status = "okay";
+};
+
+&qusb_phy_0 {
+	status = "okay";
+};
+
+&ssphy_1 {
+	status = "okay";
+};
+
+&qusb_phy_1 {
+	status = "okay";
+};
+
+&usb_0 {
+	status = "okay";
+};
+
+&usb_1 {
+	status = "okay";
+};
+
+&cryptobam {
+	status = "okay";
+};
+
+&crypto {
+	status = "okay";
+};
+
+&qpic_bam {
+	status = "okay";
+};
+
+&blsp1_spi1 { /* BLSP1 QUP1 */
+	pinctrl-0 = <&spi_0_pins>;
+	pinctrl-names = "default";
+	cs-gpios = <0>;
+	status = "okay";
+
+	flash at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <0>;
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <50000000>;
+
+		partitions {
+			compatible = "qcom,smem-part";
+		};
+	};
+};
+
+&mdio {
+	status = "okay";
+
+	pinctrl-0 = <&mdio_pins>;
+	pinctrl-names = "default";
+	reset-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
+
+	qca8075_1: ethernet-phy at 0 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <0>;
+	};
+
+	qca8075_2: ethernet-phy at 1 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <1>;
+	};
+
+	qca8075_3: ethernet-phy at 2 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <2>;
+	};
+
+	qca8075_4: ethernet-phy at 3 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <3>;
+	};
+
+	aqr113c: ethernet-phy at 5 {
+		compatible ="ethernet-phy-ieee802.3-c45";
+		reg = <8>;
+		reset-gpios = <&tlmm 43 GPIO_ACTIVE_LOW>;
+	};
+};
+
+&sdhc_1 {
+	status = "okay";
+
+	vqmmc-supply = <&l11>;
+};
+
+&switch {
+	status = "okay";
+
+	switch_cpu_bmp = <0x1>;  /* cpu port bitmap */
+	switch_lan_bmp = <0x1e>; /* lan port bitmap */
+	switch_wan_bmp = <0x60>; /* wan port bitmap */
+	switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/
+	switch_mac_mode1 = <0xe>; /* mac mode for uniphy instance1*/
+	switch_mac_mode2 = <0xd>; /* mac mode for uniphy instance2*/
+	bm_tick_mode = <0>; /* bm tick mode */
+	tm_tick_mode = <0>; /* tm tick mode */
+
+	qcom,port_phyinfo {
+		port at 0 {
+			port_id = <1>;
+			phy_address = <0>;
+		};
+		port at 1 {
+			port_id = <2>;
+			phy_address = <1>;
+		};
+		port at 2 {
+			port_id = <3>;
+			phy_address = <2>;
+		};
+		port at 3 {
+			port_id = <4>;
+			phy_address = <3>;
+		};
+		port at 4 {
+			port_id = <6>;
+			phy_address = <8>;
+			compatible = "ethernet-phy-ieee802.3-c45";
+			ethernet-phy-ieee802.3-c45;
+		};
+	};
+};
+
+&edma {
+	status = "okay";
+};
+
+/* Dummy LAN port */
+&dp1 {
+	status = "disabled";
+	phy-handle = <&qca8075_1>;
+	label = "lan4";
+};
+
+&dp2 {
+	status = "okay";
+	phy-handle = <&qca8075_2>;
+	label = "lan3";
+};
+
+&dp3 {
+	status = "okay";
+	phy-handle = <&qca8075_3>;
+	label = "lan2";
+};
+
+&dp4 {
+	status = "okay";
+	phy-handle = <&qca8075_4>;
+	label = "lan1";
+};
+
+&dp6_syn {
+	status = "okay";
+	qcom,mactype = <1>;
+	phy-handle = <&aqr113c>;
+	label = "wan";
+};
+
+&pcie_qmp0 {
+	status = "okay";
+};
+
+&pcie0 {
+	status = "okay";
+
+	perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>;
+
+	bridge at 0,0 {
+		reg = <0x00020000 0 0 0 0>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+		ranges;
+	};
+};
+
+&pcie_qmp1 {
+	status = "okay";
+};
+
+&pcie1 {
+	status = "okay";
+
+	perst-gpio = <&tlmm 61 GPIO_ACTIVE_LOW>;
+
+	bridge at 1,0 {
+		reg = <0x00010000 0 0 0 0>;
+		#address-cells = <3>;
+		#size-cells = <2>;
+		ranges;
+
+		wifi at 1,0 {
+			status = "okay";
+
+			/* ath11k has no DT compatible for PCI cards */
+			compatible = "pci17cb,1104";
+			reg = <0x00010000 0 0 0 0>;
+
+			qcom,ath11k-calibration-variant = "prpl-Haze";
+		};
+	};
+};
+
+&wifi {
+	status = "okay";
+
+	qcom,ath11k-calibration-variant = "prpl-Haze";
+};
diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk
index d57099e5b4..6eca67d11c 100644
--- a/target/linux/ipq807x/image/generic.mk
+++ b/target/linux/ipq807x/image/generic.mk
@@ -95,6 +95,17 @@ define Device/netgear_wax218
 endef
 TARGET_DEVICES += netgear_wax218
 
+define Device/prpl_haze
+	$(call Device/FitImage)
+	$(call Device/EmmcImage)
+	DEVICE_VENDOR := prpl Foundation
+	DEVICE_MODEL := Haze
+	DEVICE_DTS_CONFIG := config at hk09
+	SOC := ipq8072
+	DEVICE_PACKAGES += ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci
+endef
+TARGET_DEVICES += prpl_haze
+
 define Device/qnap_301w
 	$(call Device/FitImage)
 	$(call Device/EmmcImage)




More information about the lede-commits mailing list