Skip to content

Commit

Permalink
Improve watchdog-related init in LZMA loader
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingMarco committed Mar 29, 2024
1 parent e1734c3 commit cb19eea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 2 additions & 0 deletions target/linux/ath79/image/lzma-loader/src/ar71xx_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@

#define AR934X_GPIO_OUT_GPIO 0x00

#define QCA955X_GPIO_OUTSEL_CLK_OBS5 0x54

/*
* MII_CTRL block
*/
Expand Down
16 changes: 6 additions & 10 deletions target/linux/ath79/image/lzma-loader/src/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) { }
Expand Down

0 comments on commit cb19eea

Please sign in to comment.