From cb19eeaf99214f0477a3ed680b8370a33d560f31 Mon Sep 17 00:00:00 2001 From: Marco von Rosenberg Date: Fri, 29 Mar 2024 20:53:38 +0100 Subject: [PATCH] Improve watchdog-related init in LZMA loader --- .../ath79/image/lzma-loader/src/ar71xx_regs.h | 2 ++ target/linux/ath79/image/lzma-loader/src/board.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h b/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h index 245042fdab74af..e7d768397394be 100644 --- a/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h +++ b/target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h @@ -671,6 +671,8 @@ #define AR934X_GPIO_OUT_GPIO 0x00 +#define QCA955X_GPIO_OUTSEL_CLK_OBS5 0x54 + /* * MII_CTRL block */ diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index e1697fb64b20ee..13926e9b1e6548 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -186,26 +186,22 @@ static inline void mr18_init(void) { } static inline void ap5030dn_init(void) { const unsigned int ap5030dn_watchdog_gpio = 15; - unsigned int gpiobase, spibase, reg; + unsigned int gpiobase, 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)); + 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 + /* Set GPIO15 MUX to output CLK_OBS5 (= CPU_CLK/4) + * to keep the watchdog happy until wdt-gpio takes over + */ reg = READREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3); WRITEREG(gpiobase + AR934X_GPIO_REG_OUT_FUNC3, - reg | (84 << 24)); + reg | (QCA955X_GPIO_OUTSEL_CLK_OBS5 << 24)); } #else static inline void ap5030dn_init(void) { }