[PATCH] mediatek: filogic: add support for GatoNetworks GDSP
Daniel Golle
daniel at makrotopia.org
Mon Nov 4 14:32:27 PST 2024
Hi Enrico,
the patch generally looks very good.
Few things:
- It would be better to use NVMEM in device tree to assign MAC
addresses.
- You could use 'fitblk' in order to have the bootloader validate the
whole image before booting and prevent bootloops in case of corrupted
squashfs (eg. due to loss of power during sysupgrade).
- Maybe split this patch into three, so it becomes easier to read:
1/3 Add device to U-Boot
2/3 Add device to uboot-envtools
3/3 Add device to mediatek target
See comments inline below illustrating the first two points.
On Sun, Nov 03, 2024 at 05:30:34PM +0100, Enrico Mioso wrote:
> [...]
> --- /dev/null
> +++ b/target/linux/mediatek/dts/mt7981b-gatonetworks-gdsp.dts
> @@ -0,0 +1,377 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +
> +/dts-v1/;
> +#include "mt7981.dtsi"
> +
> +/ {
> + model = "GatoNetworks GDSP";
> + compatible = "gatonetworks,gdsp", "mediatek,mt7981";
> +
> + aliases {
> + serial0 = &uart0;
> + label-mac-device = &wifi;
> + led-boot = &sg1;
> + led-failsafe = &sg1;
> + led-running = &sg1;
> + led-upgrade = &sg1;
> + };
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + bootargs = "console=ttyS0,115200n1 earlycon=uart8250,mmio32,0x11002000";
rootdisk = <&firmware>;
> + };
> [...]
> + partition at 180000 {
firmware: partition at 180000 {
> + label = "firmware";
> + reg = <0x180000 0x1E80000>;
> + };
> [...]
> + gatonetworks,gdsp)
> + local factory_dev="/dev/mtd$(find_mtd_index "Factory")"
> + label_mac=$(get_mac_binary $factory_dev 0x4)
Why not use NVMEM and mac-base to read and assign the MAC address?
> [...]
> --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
> +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
> @@ -89,6 +89,11 @@ case "$board" in
> addr=$(mtd_get_mac_binary "Odm" 0x81)
> [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
> ;;
> + gatonetworks,gdsp)
> + addr=$(get_mac_label)
> + [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress
> + [ "$PHYNBR" = "1" ] && macaddr_setbit_la $(macaddr_add $addr 1) > /sys${DEVPATH}/macaddress
Same here, use NVMEM and mac-base if possible.
> --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
> @@ -111,6 +111,7 @@ platform_do_upgrade() {
> ;;
> cudy,re3000-v1|\
> cudy,wr3000-v1|\
> + gatonetworks,gdsp|\
Move the device into group of devices uses fitblk.
> [...]
> +define Device/gatonetworks_gdsp
> + DEVICE_VENDOR := GatoNetworks
> + DEVICE_MODEL := gdsp
> + DEVICE_DTS := mt7981b-gatonetworks-gdsp
> + DEVICE_DTS_DIR := ../dts
> + IMAGES := sysupgrade.bin
> + IMAGE_SIZE := 32768k
> + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \
> + kmod-usb-net-qmi-wwan uqmi kmod-usb3 kmod-usb-serial-option \
> + -kmod-phy-aquantia
Add 'fitblk' package.
Set KERNEL and KERNEL_INITRAMFS like BPi-R3.
More information about the openwrt-devel
mailing list