[openwrt/openwrt] ipq807x: Add ZyXEL NBG7815
LEDE Commits
lede-commits at lists.infradead.org
Thu Jan 19 04:26:28 PST 2023
ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/5dee5965012e788f06e4d095e8cfb73200d818cb
commit 5dee5965012e788f06e4d095e8cfb73200d818cb
Author: André Valentin <avalentin at marcant.net>
AuthorDate: Tue Jan 3 19:23:41 2023 +0100
ipq807x: Add ZyXEL NBG7815
ZyXEL NBG7815 is a premium 802.11ax "tri"-band router/AP.
Specifications:
* CPU: Qualcomm IPQ8072A Quad core Cortex-A53 2.2GHz
* RAM: 1 GB 2x Nanya NT5CC256M16ER-EK
* Storage:
* 8MB serial flash Winbond W25Q64DW
* 4GB eMMC flash Kingston EMMC04G-M627
* Ethernet:
* 4x1G RJ45 ports (QCA8074A) with 1x status LED per port
* 1x2.5G RJ45 port (QCA8081) with 1x status LED
* 1x10G RJ45 port (AQR113C) with 1x status LED
* Switch: Qualcomm Atheros QCA8075
* WLAN:
* 2.4GHz: Qualcomm QCN5024 4x4 at 40MHz 802.11b/g/n/ax 1147 Mbps PHY rate
* 2x 5GHz: Qualcomm QCN5054 4x4 802.11a/b/g/n/ac/ax 2402 PHY rate
* Bluetooth CSR8811 using HSUART, currently unsupported
* USB: 1x USB3.0 Type-A port
* LED-s currently not supported:
* White
* Dark Blu
* Amber
* Purple
* Purple and dark blue
* Red
* Buttons:
* 1x Soft reset
* Power: 12V DC Jack
Installation instructions:
* Disconnect WAN
* Reset device to factory defaults by pushing reset button 15 sec,
LEDs should lit orange color.
* After 5-10 minutes, when the LEDs turn constant dark blue,
put your LAN cable and connect at address 192.168.123.1 by telnet on port 23
* Login with
NBG7815 login: root
password: nbg7815 at 2019
* cd /tmp/ApplicationData
* wget -O openwrt-ipq807x-generic-zyxel_nbg7815-squashfs-sysupgrade.bin http://...
* wget https://github.com/itorK/nbg7815_tools/blob/main/flash_to_openwrt.sh
* run flash_to_openwrt.sh
If you can't use wget, you can transfer the files via nc.
See https://openwrt.org/inbox/toh/zyxel/nbg7815_armor_g5 for installation details.
Bluetooth usage:
* you need at least package bluez-utils, recommended bluez-daemon
* run following commands to enable and start
hciattach /dev/ttyMSM1 bcsp
hciconfig hci0 up
Many thanks to itorK for his work on this device:
https://github.com/itorK/openwrt/tree/nbg7815
Reviewed-by: Robert Marko <robimarko at gmail.com>
Signed-off-by: André Valentin <avalentin at marcant.net>
---
package/boot/uboot-envtools/files/ipq807x | 3 +-
package/firmware/ipq-wifi/Makefile | 4 +-
.../firmware/ipq-wifi/board-zyxel_nbg7815.ipq8074 | Bin 0 -> 131176 bytes
.../ipq807x/base-files/etc/board.d/02_network | 3 +
.../etc/hotplug.d/firmware/11-ath11k-caldata | 3 +-
.../ipq807x/base-files/lib/upgrade/platform.sh | 16 +-
.../arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts | 445 +++++++++++++++++++++
target/linux/ipq807x/image/generic.mk | 15 +
8 files changed, 485 insertions(+), 4 deletions(-)
diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x
index 63fd04ec5b..6e4fadbdf5 100644
--- a/package/boot/uboot-envtools/files/ipq807x
+++ b/package/boot/uboot-envtools/files/ipq807x
@@ -13,7 +13,8 @@ dynalink,dl-wrx36)
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2"
;;
-edgecore,eap102)
+edgecore,eap102|\
+zyxel,nbg7815)
idx="$(find_mtd_index 0:appsblenv)"
[ -n "$idx" ] && \
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile
index 32988910c0..861eec13dc 100644
--- a/package/firmware/ipq-wifi/Makefile
+++ b/package/firmware/ipq-wifi/Makefile
@@ -49,7 +49,8 @@ ALLWIFIBOARDS:= \
xiaomi_ax3600 \
xiaomi_ax9000 \
zte_mf18a \
- zte_mf289f
+ zte_mf289f \
+ zyxel_nbg7815
ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD))
@@ -148,5 +149,6 @@ $(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600))
$(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000))
$(eval $(call generate-ipq-wifi-package,zte_mf18a,ZTE MF18A))
$(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F))
+$(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815))
$(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE))))
diff --git a/package/firmware/ipq-wifi/board-zyxel_nbg7815.ipq8074 b/package/firmware/ipq-wifi/board-zyxel_nbg7815.ipq8074
new file mode 100644
index 0000000000..3a1c88b76e
Binary files /dev/null and b/package/firmware/ipq-wifi/board-zyxel_nbg7815.ipq8074 differ
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 e2bd46f095..de237e8541 100644
--- a/target/linux/ipq807x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
@@ -30,6 +30,9 @@ ipq807x_setup_interfaces()
xiaomi,ax9000)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
+ zyxel,nbg7815)
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g" "wan"
+ ;;
*)
echo "Unsupported hardware. Network interfaces not initialized"
;;
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 974e7607aa..304d3a71b8 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
@@ -15,7 +15,8 @@ case "$FIRMWARE" in
qnap,301w|\
redmi,ax6|\
xiaomi,ax3600|\
- xiaomi,ax9000)
+ xiaomi,ax9000|\
+ zyxel,nbg7815)
caldata_extract "0:art" 0x1000 0x20000
;;
esac
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
index 63f546444f..4a6a91b5f5 100644
--- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
@@ -1,7 +1,7 @@
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
-RAMFS_COPY_BIN='fw_printenv fw_setenv'
+RAMFS_COPY_BIN='fw_printenv fw_setenv head'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
xiaomi_initramfs_prepare() {
@@ -66,6 +66,20 @@ platform_do_upgrade() {
rootfsname="rootfs"
mmc_do_upgrade "$1"
;;
+ zyxel,nbg7815)
+ local config_mtdnum="$(find_mtd_index 0:bootconfig)"
+ [ -z "$config_mtdnum" ] && reboot
+ part_num="$(hexdump -e '1/1 "%01x|"' -n 1 -s 168 -C /dev/mtd$config_mtdnum | cut -f 1 -d "|" | head -n1)"
+ if [ "$part_num" -eq "0" ]; then
+ kernelname="0:HLOS"
+ rootfsname="rootfs"
+ mmc_do_upgrade "$1"
+ else
+ kernelname="0:HLOS_1"
+ rootfsname="rootfs_1"
+ mmc_do_upgrade "$1"
+ fi
+ ;;
redmi,ax6|\
xiaomi,ax3600|\
xiaomi,ax9000)
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts
new file mode 100644
index 0000000000..537dd52032
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts
@@ -0,0 +1,445 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Copyright (c) 2022, Karol Przybylski <itor at o2.pl>
+ * Copyright (c) 2023, Andre Valentin <avalentin at marcant.net>
+ */
+
+/dts-v1/;
+
+#include "ipq8074.dtsi"
+#include "ipq8074-hk-cpu.dtsi"
+#include "ipq8074-ess.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+#include <dt-bindings/input/input.h>
+
+
+/ {
+ model = "Zyxel NBG7815";
+ compatible = "zyxel,nbg7815", "qcom,ipq8074";
+
+ aliases {
+ serial0 = &blsp1_uart5;
+ serial1 = &blsp1_uart3;
+ /* Alias as required by u-boot to patch MAC addresses */
+ ethernet0 = &dp1;
+ label-mac-device = &dp1;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
+ };
+ };
+};
+
+&tlmm {
+ mdio_pins: mdio-pins {
+ mdc {
+ pins = "gpio68";
+ function = "mdc";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+
+ mdio {
+ pins = "gpio69";
+ function = "mdio";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ };
+};
+
+
+&blsp1_uart3 {
+ status = "okay";
+};
+
+&blsp1_uart5 {
+ status = "okay";
+};
+
+&prng {
+ status = "okay";
+};
+
+&cryptobam {
+ status = "okay";
+};
+
+&crypto {
+ status = "okay";
+};
+
+&qpic_bam {
+ status = "okay";
+};
+
+
+&blsp1_spi1 {
+ pinctrl-0 = <&spi_0_pins>;
+ pinctrl-names = "default";
+ cs-gpios = <0>;
+ status = "okay";
+
+ /*
+ * Bootloader will find the NAND DT node by the compatible and
+ * then "fixup" it by adding the partitions from the SMEM table
+ * using the legacy bindings thus making it impossible for us
+ * to change the partition table or utilize NVMEM for calibration.
+ * So add a dummy partitions node that bootloader will populate
+ * and set it as disabled so the kernel ignores it instead of
+ * printing warnings due to the broken way bootloader adds the
+ * partitions.
+ */
+ partitions {
+ status = "disabled";
+ };
+
+
+ flash at 0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0>;
+ compatible = "jedec,spi-nor";
+ spi-max-frequency = <50000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "0:sbl1";
+ reg = <0x0 0x50000>;
+ read-only;
+ };
+
+ partition at 50000 {
+ label = "0:mibib";
+ reg = <0x50000 0x10000>;
+ read-only;
+ };
+
+ partition at 60000 {
+ label = "0:bootconfig";
+ reg = <0x60000 0x20000>;
+ read-only;
+ };
+
+ partition at 80000 {
+ label = "0:bootconfig1";
+ reg = <0x80000 0x20000>;
+ read-only;
+ };
+
+ partition at a0000 {
+ label = "0:qsee";
+ reg = <0xa0000 0x180000>;
+ read-only;
+ };
+
+ partition at 220000 {
+ label = "0:qsee_1";
+ reg = <0x220000 0x180000>;
+ read-only;
+ };
+
+ partition at 3a0000 {
+ label = "0:devcfg";
+ reg = <0x3a0000 0x10000>;
+ read-only;
+ };
+
+ partition at 3b0000 {
+ label = "0:devcfg_1";
+ reg = <0x3b0000 0x10000>;
+ read-only;
+ };
+
+ partition at 3c0000 {
+ label = "0:apdp";
+ reg = <0x3c0000 0x10000>;
+ read-only;
+ };
+
+ partition at 3d0000 {
+ label = "0:apdp_1";
+ reg = <0x3d0000 0x10000>;
+ read-only;
+ };
+
+ partition at 3e0000 {
+ label = "0:rpm";
+ reg = <0x3e0000 0x40000>;
+ read-only;
+ };
+
+ partition at 420000 {
+ label = "0:rpm_1";
+ reg = <0x420000 0x40000>;
+ read-only;
+ };
+
+ partition at 460000 {
+ label = "0:cdt";
+ reg = <0x460000 0x10000>;
+ read-only;
+ };
+
+ partition at 470000 {
+ label = "0:cdt_1";
+ reg = <0x470000 0x10000>;
+ read-only;
+ };
+
+ partition at 480000 {
+ label = "0:appsbl";
+ reg = <0x480000 0xc0000>;
+ read-only;
+ };
+
+ partition at 540000 {
+ label = "0:appsbl_1";
+ reg = <0x540000 0xc0000>;
+ read-only;
+ };
+
+ partition at 600000 {
+ compatible = "u-boot,env";
+ label = "0:appsblenv";
+ reg = <0x600000 0x10000>;
+
+ macaddr_lan: ethaddr {
+ };
+ };
+
+ partition at 610000 {
+ label = "0:art";
+ reg = <0x610000 0x40000>;
+ read-only;
+ };
+
+ partition at 650000 {
+ label = "0:ethphyfw";
+ reg = <0x650000 0x80000>;
+ read-only;
+ };
+
+ partition at 6d0000 {
+ label = "0:crt";
+ reg = <0x6d0000 0x10000>;
+ read-only;
+ };
+
+ partition at 6e0000 {
+ label = "dual_flag";
+ reg = <0x6e0000 0x10000>;
+ };
+
+ partition at 6f0000 {
+ label = "reserved";
+ reg = <0x6f0000 0x110000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&mdio {
+ status = "okay";
+ pinctrl-0 = <&mdio_pins>;
+ pinctrl-names = "default";
+ reset-gpios = <&tlmm 37 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>;
+ };
+
+ qca8081: ethernet-phy at 4{
+ compatible = "ethernet-phy-id004d.d101";
+ reg = <28>;
+ reset-gpios = <&tlmm 31 GPIO_ACTIVE_LOW>;
+ };
+
+ aqr113c: ethernet-phy at 5 {
+ compatible = "ethernet-phy-ieee802.3-c45";
+ reg = <8>;
+ reset-gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
+ };
+};
+
+&switch {
+ status = "okay";
+
+ switch_cpu_bmp = <0x1>;
+ switch_lan_bmp = <0x3e>;
+ switch_wan_bmp = <0x40>;
+ switch_mac_mode = <0x0>;
+ switch_mac_mode1 = <0xf>;
+ switch_mac_mode2 = <0xd>;
+ bm_tick_mode = <0>;
+ tm_tick_mode = <0>;
+
+ 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 = <5>;
+ phy_address = <28>;
+ port_mac_sel = "QGMAC_PORT";
+ };
+
+ port at 5 {
+ port_id = <6>;
+ ethernet-phy-ieee802.3-c45;
+ phy_address = <8>;
+ };
+ };
+};
+
+&edma {
+ status = "okay";
+};
+
+&dp1 {
+ status = "okay";
+ phy-handle = <&qca8075_1>;
+ label = "lan1";
+ nvmem-cells = <&macaddr_lan>;
+ nvmem-cell-names = "mac-address-ascii";
+};
+
+&dp2 {
+ status = "okay";
+ phy-handle = <&qca8075_2>;
+ label = "lan2";
+ nvmem-cells = <&macaddr_lan>;
+ nvmem-cell-names = "mac-address-ascii";
+};
+
+&dp3 {
+ status = "okay";
+ phy-handle = <&qca8075_3>;
+ label = "lan3";
+ nvmem-cells = <&macaddr_lan>;
+ nvmem-cell-names = "mac-address-ascii";
+};
+
+&dp4 {
+ status = "okay";
+ phy-handle = <&qca8075_4>;
+ label = "lan4";
+ nvmem-cells = <&macaddr_lan>;
+ nvmem-cell-names = "mac-address-ascii";
+};
+
+&dp5 {
+ status = "okay";
+ phy-handle = <&qca8081>;
+ label = "wan";
+ nvmem-cells = <&macaddr_lan>;
+ nvmem-cell-names = "mac-address-ascii";
+ mac-address-increment = <1>;
+};
+
+&dp6_syn {
+ status = "okay";
+ phy-handle = <&aqr113c>;
+ label = "10g";
+ nvmem-cells = <&macaddr_lan>;
+ nvmem-cell-names = "mac-address-ascii";
+};
+
+&blsp1_i2c2 {
+ pinctrl-0 = <&i2c_0_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ tmp103 at 70 {
+ compatible = "ti,tmp103";
+ reg = <0x70>;
+ };
+};
+
+&sdhc_1 {
+ status = "okay";
+ /* unstable, problem with the hs400 > h200 speed switch */
+ /delete-property/ mmc-hs400-1_8v;
+ mmc-hs200-1_8v;
+ mmc-ddr-1_8v;
+ vqmmc-supply = <&l11>;
+};
+
+&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";
+};
+
+&wifi {
+ status = "okay";
+
+ qcom,ath11k-calibration-variant = "Zyxel-NBG7815";
+};
diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk
index 811a32e942..3145e1b53f 100644
--- a/target/linux/ipq807x/image/generic.mk
+++ b/target/linux/ipq807x/image/generic.mk
@@ -116,3 +116,18 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
endif
endef
TARGET_DEVICES += xiaomi_ax9000
+
+define Device/zyxel_nbg7815
+ $(call Device/FitImage)
+ DEVICE_VENDOR := ZYXEL
+ DEVICE_MODEL := NBG7815
+ DEVICE_DTS_CONFIG := config at nbg7815
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ SOC := ipq8074
+ 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
+ DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci e2fsprogs kmod-fs-ext4 losetup kmod-hwmon-tmp103
+endef
+TARGET_DEVICES += zyxel_nbg7815
More information about the lede-commits
mailing list