Re: [RFC PATCH 08/17] sunxi: introduce NCAT2 generation model

Sam Edwards
2023-06-03T18:04:01Z

Hi again Andre,

On 12/5/22 17:45, Andre Przywara wrote:
> diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
> index b6ffbff883c..3763ec3d2e4 100644
> --- a/arch/arm/mach-sunxi/board.c
> +++ b/arch/arm/mach-sunxi/board.c
> @@ -177,7 +177,7 @@ static int gpio_init(void)
> #error Unsupported console port number. Please fix pin mux settings in board.c
> #endif
>
> -#ifdef CONFIG_SUN50I_GEN_H6
> +#if defined(CONFIG_SUN50I_GEN_H6) || defined(CONFIG_SUNXI_GEN_NCAT2)
> /* Update PIO power bias configuration by copy hardware detected value */
> val = readl(SUNXI_PIO_BASE + SUN50I_H6_GPIO_POW_MOD_VAL);
> writel(val, SUNXI_PIO_BASE + SUN50I_H6_GPIO_POW_MOD_SEL);
> @@ -475,7 +475,7 @@ void reset_cpu(void)
> /* sun5i sometimes gets stuck without this */
> writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
> }
> -#elif defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6)
> +#elif defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) || defined(CONFIG_SUNXI_GEN_NCAT2)
> #if defined(CONFIG_MACH_SUN50I_H6)
> /* WDOG is broken for some H6 rev. use the R_WDOG instead */
> static const struct sunxi_wdog *wdog =

It appears that the R528/T113s updated the watchdog slightly from H6 in
that it now requires a key (0x16AA << 16) OR'd in all writes to
WDOG_SOFT_RST_REG, WDOG_CFG_REG, and WDOG_MODE_REG, or it will ignore
those writes. This reset code busywaits indefinitely unless I add that
key. It looks like sunxi_wdt.c needs to be updated as well, but I don't
know if that's in-scope for this patchset.

Cheers,
Sam