ipq40xx: add HFCL ION4 support

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-08-26 17:35:25 +02:00
parent e97526a324
commit a0c32b4915
2 changed files with 415 additions and 0 deletions

View File

@@ -0,0 +1,399 @@
From e3a96108c0773915b53a08d04a98192338c5aeb9 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 26 Aug 2021 17:34:47 +0200
Subject: [PATCH] ipq40xx: add HFCL ION4 support
Signed-off-by: John Crispin <john@phrozen.org>
---
package/boot/uboot-envtools/files/ipq40xx | 4 +
package/firmware/ipq-wifi/Makefile | 4 +-
.../ipq40xx/base-files/etc/board.d/01_leds | 4 +
.../ipq40xx/base-files/etc/board.d/02_network | 1 +
.../etc/hotplug.d/firmware/11-ath10k-caldata | 6 +
.../base-files/lib/upgrade/platform.sh | 1 +
.../arm/boot/dts/qcom-ipq4019-hfcl-ion4.dts | 226 ++++++++++++++++++
target/linux/ipq40xx/image/generic.mk | 19 ++
.../ipq40xx/patches-5.4/999-hfcl_ion.patch | 12 +
9 files changed, 276 insertions(+), 1 deletion(-)
create mode 100644 target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hfcl-ion4.dts
create mode 100644 target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx
index ac66a7f2bd..9d39350544 100644
--- a/package/boot/uboot-envtools/files/ipq40xx
+++ b/package/boot/uboot-envtools/files/ipq40xx
@@ -63,6 +63,10 @@ linksys,mr8300)
zyxel,nbg6617)
ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000"
;;
+hfcl,ion4)
+ env=$(ubootenv_mtdinfo)
+ ubootenv_add_uci_config $env
+ ;;
esac
config_load ubootenv
diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile
index 23fc4caa2e..e887e5ad1c 100644
--- a/package/firmware/ipq-wifi/Makefile
+++ b/package/firmware/ipq-wifi/Makefile
@@ -51,7 +51,8 @@ ALLWIFIBOARDS:= \
qxwlan_e2600ac \
cig_wf610d \
wallys_dr40x9 \
- tp-link_ec420-g1
+ tp-link_ec420-g1 \
+ hfcl_ion4
ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD))
@@ -139,5 +140,6 @@ $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC))
$(eval $(call generate-ipq-wifi-package,cig_wf610d,CIG WF_610D))
$(eval $(call generate-ipq-wifi-package,tp-link_ec420-g1,tp-link EC420-G1))
$(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9))
+$(eval $(call generate-ipq-wifi-package,hfcl_ion4,HFCL ION4))
$(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE))))
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
index efd5d002db..57d3664423 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
@@ -70,6 +70,10 @@ zyxel,wre6606)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wlan2g" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wlan5g" "phy1tpt"
;;
+hfcl,ion4)
+ ucidef_set_led_wlan "wlan2g" "WLAN2G" "yellow:wlan2g" "phy0tpt"
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "red:wlan5g" "phy1tpt"
+ ;;
esac
board_config_flush
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index cfcf518907..84596dcf88 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -33,6 +33,7 @@ ipq40xx_setup_interfaces()
netgear,ex6100v2|\
netgear,ex6150v2|\
tp-link,ec420-g1|\
+ hfcl,ion4|\
zyxel,wre6606)
ucidef_set_interface_wan "eth0"
;;
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 561c8289e7..d38decf77b 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -162,6 +162,9 @@ case "$FIRMWARE" in
tp-link,ec420-g1)
caldata_extract "0:ART" 0x1000 0x2f20
;;
+ hfcl,ion4)
+ caldata_extract "0:ART" 4096 12064
+ ;;
esac
;;
"ath10k/pre-cal-ahb-a800000.wifi.bin")
@@ -272,6 +275,9 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
;;
+ hfcl,ion4)
+ caldata_extract "0:ART" 20480 12064
+ ;;
esac
;;
*)
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index 7ebe0396f6..c404f32f41 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -74,6 +74,7 @@ platform_do_upgrade() {
mobipromo,cm520-79f |\
qxwlan,e2600ac-c2 |\
wallys,dr40x9 |\
+ hfcl,ion4 |\
tp-link,ec420-g1)
nand_do_upgrade "$1"
;;
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hfcl-ion4.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hfcl-ion4.dts
new file mode 100644
index 0000000000..662eb7dff0
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hfcl-ion4.dts
@@ -0,0 +1,226 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qcom-ipq4019.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+ model = "HFCL Ltd, ION4";
+ compatible = "hfcl,ion4";
+
+ aliases {
+/* led-boot = &power_green;
+ led-failsafe = &power_red;
+ led-running = &power_green;
+ led-upgrade = &power_red;
+ label-mac-device = &wifi0;
+ */
+ };
+
+ soc {
+ rng@22000 {
+ status = "okay";
+ };
+
+ mdio@90000 {
+ status = "okay";
+ pinctrl-0 = <&mdio_pins>;
+ pinctrl-names = "default";
+
+ /delete-node/ ethernet-phy@1;
+ /delete-node/ ethernet-phy@2;
+ /delete-node/ ethernet-phy@3;
+ /delete-node/ ethernet-phy@4;
+ /delete-node/ psgmii-phy@5;
+ };
+
+ tcsr@1949000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1949000 0x100>;
+ qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+ };
+
+ ess_tcsr@1953000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1953000 0x1000>;
+ qcom,ess-interface-select = <TCSR_ESS_PSGMII_RGMII5>;
+ };
+
+ tcsr@1957000 {
+ compatible = "qcom,tcsr";
+ reg = <0x1957000 0x100>;
+ qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+ };
+
+ crypto@8e3a000 {
+ status = "okay";
+ };
+
+ watchdog@b017000 {
+ status = "okay";
+ };
+
+ ess-switch@c000000 {
+ switch_mac_mode = <0x3>; /* mac mode for RGMII RMII */
+ switch_lan_bmp = <0x0>; /* lan port bitmap */
+ switch_wan_bmp = <0x10>; /* wan port bitmap */
+ };
+
+ edma@c080000 {
+ status = "okay";
+ phy-mode = "rgmii-id";
+ qcom,num_gmac = <1>;
+ qcom,single-phy;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ power_red: power_red {
+ label = "yellow:wlan2g";
+ gpios = <&tlmm 45 GPIO_ACTIVE_LOW>;
+ };
+
+ power_green: power_green {
+ label = "red:wlan5g";
+ gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>;
+ };
+ };
+};
+
+&tlmm {
+ serial_0_pins: serial_pinmux {
+ mux {
+ pins = "gpio16", "gpio17";
+ function = "blsp_uart0";
+ bias-disable;
+ };
+ };
+
+ nand_pins: nand_pins {
+ pullups {
+ pins = "gpio53", "gpio58", "gpio59";
+ function = "qpic";
+ bias-pull-up;
+ };
+
+ pulldowns {
+ pins = "gpio54", "gpio55", "gpio56",
+ "gpio57", "gpio60", "gpio61",
+ "gpio62", "gpio63", "gpio64",
+ "gpio65", "gpio66", "gpio67",
+ "gpio68", "gpio69";
+ function = "qpic";
+ bias-pull-down;
+ };
+ };
+
+ mdio_pins: mdio_pinmux {
+ mux_1 {
+ pins = "gpio6";
+ function = "mdio";
+ bias-pull-up;
+ };
+ mux_2 {
+ pins = "gpio7";
+ function = "mdc";
+ bias-pull-up;
+ };
+ };
+};
+
+&nand {
+ pinctrl-0 = <&nand_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ nand@0 {
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition0@0 {
+ label = "0:SBL1";
+ reg = <0x00000000 0x00100000>;
+ read-only;
+ };
+ partition1@100000 {
+ label = "0:MIBIB";
+ reg = <0x00100000 0x00100000>;
+ read-only;
+ };
+ partition2@200000 {
+ label = "0:BOOTCONFIG";
+ reg = <0x00200000 0x00100000>;
+ read-only;
+ };
+ partition3@300000 {
+ label = "0:QSEE";
+ reg = <0x00300000 0x00200000>;
+ read-only;
+ };
+ partition4@500000 {
+ label = "0:CDT";
+ reg = <0x00500000 0x00180000>;
+ read-only;
+ };
+ partition5@680000 {
+ label = "0:APPSBLENV";
+ reg = <0x00680000 0x00080000>;
+ };
+ partition6@700000 {
+ label = "0:APPSBL";
+ reg = <0x00700000 0x00400000>;
+ read-only;
+ };
+ partition7@b00000 {
+ label = "0:ART";
+ reg = <0x00b00000 0x00080000>;
+ read-only;
+ };
+ partition8@b80000 {
+ label = "kernel";
+ reg = <0x00b80000 0x1000000>;
+ };
+ partition8@180000 {
+ label = "ubi";
+ reg = <0x02b80000 0x5480000>;
+ };
+ };
+ };
+};
+
+&cryptobam {
+ status = "okay";
+};
+
+&blsp_dma {
+ status = "okay";
+};
+
+&blsp1_uart1 {
+ pinctrl-0 = <&serial_0_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&qpic_bam {
+ status = "okay";
+};
+
+&wifi0 {
+ status = "okay";
+};
+
+&wifi1 {
+ status = "okay";
+};
+
+&gmac0 {
+ qcom,phy_mdio_addr = <0>;
+ qcom,poll_required = <1>;
+ vlan_tag = <0 0x20>;
+};
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index 7cbfecb233..896f2a657c 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -861,3 +861,22 @@ define Device/tp-link_ec420_g1
DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-tp-link_ec420-g1
endef
TARGET_DEVICES += tp-link_ec420_g1
+
+define Device/hfcl_ion4
+ $(call Device/FitImage)
+ $(call Device/UbiFit)
+ DEVICE_VENDOR := HFCL
+ DEVICE_MODEL := ION4
+ SOC := qcom-ipq4019
+ DEVICE_DTS := qcom-ipq4019-hfcl-ion4
+ KERNEL_INSTALL := 1
+ KERNEL_SIZE := 4048k
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ BOARD_NAME := hfcl-ion4
+ IMAGES := nand-sysupgrade.bin
+ IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata
+ DEVICE_PACKAGES := uboot-envtools
+ _DEVICE_PACKAGES := ipq-wifi-hfcl_ion4 uboot-envtools
+endef
+TARGET_DEVICES += hfcl_ion4
diff --git a/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch b/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
new file mode 100644
index 0000000000..2b45b47521
--- /dev/null
+++ b/target/linux/ipq40xx/patches-5.4/999-hfcl_ion.patch
@@ -0,0 +1,12 @@
+Index: linux-5.4.111/arch/arm/boot/dts/Makefile
+===================================================================
+--- linux-5.4.111.orig/arch/arm/boot/dts/Makefile
++++ linux-5.4.111/arch/arm/boot/dts/Makefile
+@@ -885,6 +885,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+ qcom-ipq4019-wpj419.dtb \
+ qcom-ipq4019-wtr-m2133hp.dtb \
+ qcom-ipq4019-tp-link-ec420-g1.dtb \
++ qcom-ipq4019-hfcl-ion4.dtb \
+ qcom-ipq4028-wpj428.dtb \
+ qcom-ipq4029-ap-303.dtb \
+ qcom-ipq4029-ap-303h.dtb \
--
2.25.1

16
profiles/hfcl_ion4.yml Normal file
View File

@@ -0,0 +1,16 @@
---
profile: hfcl_ion4
target: ipq40xx
subtarget: generic
description: Build image for the HFCL ION4
image: bin/targets/ipq40xx/generic/openwrt-ipq40xx-generic-hfcl_ion4-squashfs-nand-sysupgrade.bin
include:
- ucentral-ap
packages:
- ath10k-firmware-qca4019-ct-htt
- ath10k-firmware-qca9888-ct-htt
- ath10k-firmware-qca9984-ct-htt
diffconfig: |
# CONFIG_PACKAGE_ath10k-firmware-qca4019-ct is not set
# CONFIG_PACKAGE_ath10k-firmware-qca9888-ct is not set
# CONFIG_PACKAGE_ath10k-firmware-qca9984-ct is not set