Re: [PATCH] ath79: add Zyxel EMG2926-Q10A

2022-02-20 Thread Alex Henrie
On Sat, Feb 19, 2022 at 12:01 PM Petr Štetiar  wrote:
>
> Alex Henrie  [2022-01-20 22:06:07]:
>
> Hi,
>
> it looks like you need just this two variables:
>
>  DEVICE_MODEL := EMG2926-Q10A
>  RAS_BOARD := AAVK-EMG2926Q10A
>
> so following copy seems a bit much against my DRY taste:
>
> > +define Device/zyxel_emg2926_q10a
> > +  SOC := qca9558
> > +  DEVICE_VENDOR := ZyXEL
> > +  DEVICE_MODEL := EMG2926-Q10A
> > +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \
> > + ath10k-firmware-qca988x-ct
> > +  RAS_BOARD := AAVK-EMG2926Q10A
> > +  RAS_ROOTFS_SIZE := 29696k
> > +  RAS_VERSION := "OpenWrt Linux-$(LINUX_VERSION)"
> > +  KERNEL_SIZE := 4096k
> > +  BLOCKSIZE := 128k
> > +  PAGESIZE := 2048
> > +  LOADER_TYPE := bin
> > +  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none | 
> > \
> > + zyxel-buildkerneljffs | check-size 4096k
> > +  IMAGES := sysupgrade.tar sysupgrade-4M-Kernel.bin factory.bin
> > +  IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to (BLOCKSIZE) 
> > | \
> > + sysupgrade-tar rootfs=@ | append-metadata
> > +  IMAGE/sysupgrade-4M-Kernel.bin/squashfs := append-kernel | \
> > + pad-to (KERNEL_SIZE) | append-ubi | pad-to 263192576 | gzip
> > +  IMAGE/factory.bin := append-kernel | pad-to (KERNEL_SIZE) | 
> > append-ubi | \
> > + zyxel-factory
> > +  UBINIZE_OPTS := -E 5
> > +endef
> > +TARGET_DEVICES += zyxel_emg2926_q10a
>
> so I would simply abstract the common bits into something like this:
>
>  define Device/zyxel_nand_common
> SOC := qca9558
> DEVICE_VENDOR := ZyXEL
> DEVICE_MODEL := EMG2926-Q10A
> DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \
> ath10k-firmware-qca988x-ct
> ...
>  end
>
> and then do:
>
>  define Device/zyxel_nbg6716
>$(Device/zyxel_nand_common)
>DEVICE_MODEL := NBG6716
>RAS_BOARD := NBG6716
>  endef
>
>  define Device/zyxel_emg2926_q10a
>$(Device/zyxel_nand_common)
>DEVICE_MODEL := EMG2926-Q10A
>RAS_BOARD := AAVK-EMG2926Q10A
>  endef

Thanks for showing me! I didn't know that I could do that. How about
we make Device/zyxel_emg2926_q10a inherit from Device/zyxel_nbg6716,
similar to how qca9558_zyxel_emg2926_q10a.dts inherits from
qca9558_zyxel_nbg6716.dts? I'll send a v2 shortly.

-Alex

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [PATCH] ath79: add Zyxel EMG2926-Q10A

2022-02-19 Thread Petr Štetiar
Alex Henrie  [2022-01-20 22:06:07]:

Hi,

it looks like you need just this two variables:

 DEVICE_MODEL := EMG2926-Q10A
 RAS_BOARD := AAVK-EMG2926Q10A

so following copy seems a bit much against my DRY taste:

> +define Device/zyxel_emg2926_q10a
> +  SOC := qca9558
> +  DEVICE_VENDOR := ZyXEL
> +  DEVICE_MODEL := EMG2926-Q10A
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \
> + ath10k-firmware-qca988x-ct
> +  RAS_BOARD := AAVK-EMG2926Q10A
> +  RAS_ROOTFS_SIZE := 29696k
> +  RAS_VERSION := "OpenWrt Linux-$(LINUX_VERSION)"
> +  KERNEL_SIZE := 4096k
> +  BLOCKSIZE := 128k
> +  PAGESIZE := 2048
> +  LOADER_TYPE := bin
> +  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none | \
> + zyxel-buildkerneljffs | check-size 4096k
> +  IMAGES := sysupgrade.tar sysupgrade-4M-Kernel.bin factory.bin
> +  IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to (BLOCKSIZE) | \
> + sysupgrade-tar rootfs=@ | append-metadata
> +  IMAGE/sysupgrade-4M-Kernel.bin/squashfs := append-kernel | \
> + pad-to (KERNEL_SIZE) | append-ubi | pad-to 263192576 | gzip
> +  IMAGE/factory.bin := append-kernel | pad-to (KERNEL_SIZE) | append-ubi 
> | \
> + zyxel-factory
> +  UBINIZE_OPTS := -E 5
> +endef
> +TARGET_DEVICES += zyxel_emg2926_q10a

so I would simply abstract the common bits into something like this:

 define Device/zyxel_nand_common
SOC := qca9558
DEVICE_VENDOR := ZyXEL
DEVICE_MODEL := EMG2926-Q10A
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \
ath10k-firmware-qca988x-ct
...
 end

and then do:

 define Device/zyxel_nbg6716
   $(Device/zyxel_nand_common)
   DEVICE_MODEL := NBG6716
   RAS_BOARD := NBG6716
 endef

 define Device/zyxel_emg2926_q10a
   $(Device/zyxel_nand_common)
   DEVICE_MODEL := EMG2926-Q10A
   RAS_BOARD := AAVK-EMG2926Q10A
 endef

Cheers,

Petr

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] ath79: add Zyxel EMG2926-Q10A

2022-01-20 Thread Alex Henrie
The Zyxel EMG2926-Q10A is 99% the Zyxel NBG6716, but the bootloader
expects a different product name when flashing over TFTP. Also, the
EMG2926-Q10A always has 128 MiB of NAND flash whereas the NBG6716
reportedly can have either 128 MiB or 256 MiB.

Signed-off-by: Alex Henrie 
---
See https://github.com/openwrt/openwrt/pull/4536
---
 .../etc/hotplug.d/ieee80211/00-wifi-migration |  1 +
 .../ath79/dts/qca9558_zyxel_emg2926_q10a.dts  |  8 ++
 target/linux/ath79/image/nand.mk  | 26 +++
 .../nand/base-files/etc/board.d/02_network|  1 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |  1 +
 .../etc/hotplug.d/ieee80211/10-fix-wifi-mac   |  1 +
 .../base-files/lib/preinit/10_fix_eth_mac.sh  |  1 +
 7 files changed, 39 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts

diff --git 
a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration 
b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration
index d2df0533fe..35e7c4452c 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration
+++ b/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/00-wifi-migration
@@ -16,6 +16,7 @@ migrate_wifi_path() {
case "$board" in
tplink,archer-c7-v1|\
tplink,archer-c7-v2|\
+   zyxel,emg2926-q10a|\
zyxel,nbg6716)
path="pci:00/:00:00.0"
WIFI_PATH_CHANGED=1
diff --git a/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts 
b/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts
new file mode 100644
index 00..c00109a5b4
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_zyxel_emg2926_q10a.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca9558_zyxel_nbg6716.dts"
+
+/ {
+   compatible = "zyxel,emg2926-q10a", "zyxel,nbg6716", "qca,qca9558";
+   model = "ZyXEL EMG2926-Q10A";
+};
diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index d31aba1abc..27a63fdf7e 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -289,6 +289,32 @@ define Device/netgear_wndr4500-v3
 endef
 TARGET_DEVICES += netgear_wndr4500-v3
 
+define Device/zyxel_emg2926_q10a
+  SOC := qca9558
+  DEVICE_VENDOR := ZyXEL
+  DEVICE_MODEL := EMG2926-Q10A
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \
+   ath10k-firmware-qca988x-ct
+  RAS_BOARD := AAVK-EMG2926Q10A
+  RAS_ROOTFS_SIZE := 29696k
+  RAS_VERSION := "OpenWrt Linux-$(LINUX_VERSION)"
+  KERNEL_SIZE := 4096k
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  LOADER_TYPE := bin
+  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none | \
+   zyxel-buildkerneljffs | check-size 4096k
+  IMAGES := sysupgrade.tar sysupgrade-4M-Kernel.bin factory.bin
+  IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to (BLOCKSIZE) | \
+   sysupgrade-tar rootfs=@ | append-metadata
+  IMAGE/sysupgrade-4M-Kernel.bin/squashfs := append-kernel | \
+   pad-to (KERNEL_SIZE) | append-ubi | pad-to 263192576 | gzip
+  IMAGE/factory.bin := append-kernel | pad-to (KERNEL_SIZE) | append-ubi | 
\
+   zyxel-factory
+  UBINIZE_OPTS := -E 5
+endef
+TARGET_DEVICES += zyxel_emg2926_q10a
+
 define Device/zyxel_nbg6716
   SOC := qca9558
   DEVICE_VENDOR := ZyXEL
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network 
b/target/linux/ath79/nand/base-files/etc/board.d/02_network
index 76cdab18f8..98aa27f5f2 100644
--- a/target/linux/ath79/nand/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network
@@ -42,6 +42,7 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
;;
+   zyxel,emg2926-q10a|\
zyxel,nbg6716)
ucidef_add_switch "switch0" \
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" 
"6@eth1"
diff --git 
a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 03e225ddde..b9a51c6588 100644
--- 
a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ 
b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -26,6 +26,7 @@ case "$FIRMWARE" in
netgear,r6100)
caldata_extract "caldata" 0x5000 0x844
;;
+   zyxel,emg2926-q10a|\
zyxel,nbg6716)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env 
ethaddr) 1)
diff --git 
a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac