Skip to content

Commit

Permalink
Initial draft for fixing LZMA & watchdog problems using lzma-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingMarco committed Mar 29, 2024
1 parent c9d551f commit e1734c3
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 9 deletions.
1 change: 0 additions & 1 deletion config/Config-images.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions target/linux/ath79/files/arch/mips/ap5030dn_initcall.c

This file was deleted.

6 changes: 6 additions & 0 deletions target/linux/ath79/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions target/linux/ath79/image/generic.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions target/linux/ath79/image/lzma-loader/src/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit e1734c3

Please sign in to comment.