diff --git a/config/Config-images.in b/config/Config-images.in index df9f64aad2dfaa..c2d7af7a80b105 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -17,7 +17,6 @@ menu "Target Images" default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_lantiq default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_mpc85xx default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ramips - default TARGET_INITRAMFS_COMPRESSION_LZMA if TARGET_ath79_generic_DEVICE_huawei_ap5030dn default TARGET_INITRAMFS_COMPRESSION_ZSTD if TARGET_qualcommax default TARGET_INITRAMFS_COMPRESSION_XZ if USES_SEPARATE_INITRAMFS default TARGET_INITRAMFS_COMPRESSION_NONE diff --git a/target/linux/ath79/files/arch/mips/ap5030dn_initcall.c b/target/linux/ath79/files/arch/mips/ap5030dn_initcall.c deleted file mode 100644 index 45aaf42bcee064..00000000000000 --- a/target/linux/ath79/files/arch/mips/ap5030dn_initcall.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -static void __init ap5030dn_test_toggle_gpio(void) -{ - printk(KERN_INFO "AP5030DN WDT\n"); - asdfasdf -} -early_initcall(ap5030dn_test_toggle_gpio); \ No newline at end of file diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 8328be7667cf8d..4392bdd4519f8a 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -47,6 +47,12 @@ define Build/append-loader-okli-uimage cat "$(KDIR)/loader-$(word 1,$(1)).uImage" >> "$@" endef +define Build/prepend-loader-okli + cat "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" > "$@.new" + cat "$@" >> "$@.new" + mv "$@.new" "$@" +endef + define Build/relocate-kernel rm -rf $@.relocate $(CP) ../../generic/image/relocate $@.relocate diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index b7915a835f7c09..824c66e3a2fda1 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1818,7 +1818,14 @@ define Device/huawei_ap5030dn DEVICE_VENDOR := Huawei DEVICE_MODEL := AP5030DN DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x110040 + IMAGE_SIZE := 7680k ROOTFS_MIN_SIZE := 12240k + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | pad-to 64k | uImage none + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | prepend-loader-okli $(1) + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none IMAGE_SIZE := 30720k IMAGES += kernel.bin squashfs.bin IMAGE/kernel.bin := | append-kernel diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index 7b1e110ee2d902..e1697fb64b20ee 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -182,8 +182,38 @@ static inline void mr18_init(void) static inline void mr18_init(void) { } #endif +#ifdef CONFIG_BOARD_HUAWEI_AP5030DN +static inline void ap5030dn_init(void) +{ + const unsigned int ap5030dn_watchdog_gpio = 15; + unsigned int gpiobase, spibase, reg; + + spibase = KSEG1ADDR(AR71XX_SPI_BASE); + gpiobase = KSEG1ADDR(AR71XX_GPIO_BASE); + + printf("Huawei AP5030DN\n"); + + reg = READREG(gpiobase + AR71XX_GPIO_REG_OE); + WRITEREG(gpiobase + AR71XX_GPIO_REG_OE, + reg & ~(1 << ap5030dn_watchdog_gpio)); + + // Set MUX to output CPU_CLK/4 on GPIO15 + reg = READREG(gpiobase + AR934X_GPIO_REG_FUNC); + WRITEREG(gpiobase + AR934X_GPIO_REG_FUNC, + reg | (1 << 7)); + + // Output stuff on GPIO15 by setting bit 31:24 in gpiobase + AR934X_GPIO_REG_OUT_FUNC3 + reg = READREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3); + WRITEREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3, + reg | (84 << 24)); +} +#else +static inline void ap5030dn_init(void) { } +#endif + void board_init(void) { tlwr1043nd_init(); mr18_init(); + ap5030dn_init(); }