uboot-mediatek: support GL.iNet GL-X3000 and GL-XE3000

Add u-boot support based on the kernel dts introduced in d1016446 and
the GL-MT6000 u-boot support in fe10f974.

The pcie-mediatek-gen3 kernel driver doesn't like hotplug, so to work in
PCIe mode, the 5G modem on this device needs to be switched on by u-boot
before starting the kernel. Include an init_modem step in the boot_system
action to set the relevant gpios. (The factory bootloader does the same,
using Mediatek SDK-specific gpio_power_clr and gpio_pull_up.)

Ideally the modem would be started using gpio-hog in the device tree, but
this will need to wait until mediatek gpio-hog support is fixed upstream:

  https://lore.kernel.org/u-boot/6ef2583e85eea60560d7776377d662779e7c44e5.1722419839.git.chris@arachsys.com/

The bootloader can be replaced using the built-in web interface of the
factory bootloader. Hold the reset button for five seconds while powering
on the device and it will boot into a recovery http server.

http://192.168.1.1/uboot.html and http://192.168.1.1/bl2.html can then
be used to upload openwrt-mediatek-filogic-glinet_gl-x3000-bl31-uboot.fip
and openwrt-mediatek-filogic-glinet_gl-x3000-preloader.bin respectively.

Alternatively, from a root shell on the running system, unlock the boot
partition with

  echo 0 >/sys/block/mmcblk0boot0/force_ro

then write openwrt-mediatek-filogic-glinet_gl-x3000-bl31-uboot.fip to
/dev/mmcblk0p4 and openwrt-mediatek-filogic-glinet_gl-x3000-preloader.bin
to /dev/mmcblk0boot0.

Signed-off-by: Chris Webb <chris@arachsys.com>
Link: https://github.com/openwrt/openwrt/pull/15645
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Chris Webb
2024-06-10 09:54:23 +01:00
committed by Hauke Mehrtens
parent 105a5790b7
commit 7eda44f536
4 changed files with 322 additions and 0 deletions

View File

@@ -692,7 +692,11 @@ define Device/glinet_gl-x3000-xe3000-common
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware mkf2fs \
kmod-fs-f2fs kmod-hwmon-pwmfan kmod-usb3 kmod-usb-serial-option \
kmod-usb-storage kmod-usb-net-qmi-wwan uqmi
IMAGES += factory.bin
IMAGE/factory.bin := append-kernel | pad-to 32M | append-rootfs
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
ARTIFACTS := preloader.bin bl31-uboot.fip
ARTIFACT/preloader.bin := mt7981-bl2 emmc-ddr4
endef
define Device/glinet_gl-x3000
@@ -700,6 +704,7 @@ define Device/glinet_gl-x3000
DEVICE_DTS := mt7981a-glinet-gl-x3000
SUPPORTED_DEVICES := glinet,gl-x3000
$(call Device/glinet_gl-x3000-xe3000-common)
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot glinet_gl-x3000
endef
TARGET_DEVICES += glinet_gl-x3000
@@ -708,6 +713,7 @@ define Device/glinet_gl-xe3000
DEVICE_DTS := mt7981a-glinet-gl-xe3000
SUPPORTED_DEVICES := glinet,gl-xe3000
$(call Device/glinet_gl-x3000-xe3000-common)
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot glinet_gl-xe3000
endef
TARGET_DEVICES += glinet_gl-xe3000