mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-26 06:30:39 +00:00
sunxi: Fix watchdog reset function for R40
The watchdog found on the R40 SoC is the older variant found on the A20. Add the proper "#if defines" to make it work. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
This commit is contained in:
parent
409677ec17
commit
6c7ae2bfc9
3 changed files with 8 additions and 7 deletions
|
@ -67,7 +67,7 @@ struct sunxi_timer_reg {
|
||||||
struct sunxi_timer timer[6]; /* We have 6 timers */
|
struct sunxi_timer timer[6]; /* We have 6 timers */
|
||||||
u8 res2[16];
|
u8 res2[16];
|
||||||
struct sunxi_avs avs;
|
struct sunxi_avs avs;
|
||||||
#ifdef CONFIG_SUNXI_GEN_SUN4I
|
#if defined(CONFIG_SUNXI_GEN_SUN4I) || defined(CONFIG_MACH_SUN8I_R40)
|
||||||
struct sunxi_wdog wdog; /* 0x90 */
|
struct sunxi_wdog wdog; /* 0x90 */
|
||||||
/* XXX the following is not accurate for sun5i/sun7i */
|
/* XXX the following is not accurate for sun5i/sun7i */
|
||||||
struct sunxi_64cnt cnt64; /* 0xa0 */
|
struct sunxi_64cnt cnt64; /* 0xa0 */
|
||||||
|
@ -77,8 +77,7 @@ struct sunxi_timer_reg {
|
||||||
struct sunxi_tgp tgp[4];
|
struct sunxi_tgp tgp[4];
|
||||||
u8 res5[8];
|
u8 res5[8];
|
||||||
u32 cpu_cfg;
|
u32 cpu_cfg;
|
||||||
#endif
|
#elif defined(CONFIG_SUNXI_GEN_SUN6I)
|
||||||
#ifdef CONFIG_SUNXI_GEN_SUN6I
|
|
||||||
u8 res3[16];
|
u8 res3[16];
|
||||||
struct sunxi_wdog wdog[5]; /* We have 5 watchdogs */
|
struct sunxi_wdog wdog[5]; /* We have 5 watchdogs */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,10 @@
|
||||||
#define WDT_CTRL_RESTART (0x1 << 0)
|
#define WDT_CTRL_RESTART (0x1 << 0)
|
||||||
#define WDT_CTRL_KEY (0x0a57 << 1)
|
#define WDT_CTRL_KEY (0x0a57 << 1)
|
||||||
|
|
||||||
#if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I)
|
#if defined(CONFIG_MACH_SUN4I) || \
|
||||||
|
defined(CONFIG_MACH_SUN5I) || \
|
||||||
|
defined(CONFIG_MACH_SUN7I) || \
|
||||||
|
defined(CONFIG_MACH_SUN8I_R40)
|
||||||
|
|
||||||
#define WDT_MODE_EN (0x1 << 0)
|
#define WDT_MODE_EN (0x1 << 0)
|
||||||
#define WDT_MODE_RESET_EN (0x1 << 1)
|
#define WDT_MODE_RESET_EN (0x1 << 1)
|
||||||
|
|
|
@ -270,7 +270,7 @@ void board_init_f(ulong dummy)
|
||||||
|
|
||||||
void reset_cpu(ulong addr)
|
void reset_cpu(ulong addr)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_SUNXI_GEN_SUN4I
|
#if defined(CONFIG_SUNXI_GEN_SUN4I) || defined(CONFIG_MACH_SUN8I_R40)
|
||||||
static const struct sunxi_wdog *wdog =
|
static const struct sunxi_wdog *wdog =
|
||||||
&((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog;
|
&((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog;
|
||||||
|
|
||||||
|
@ -282,8 +282,7 @@ void reset_cpu(ulong addr)
|
||||||
/* sun5i sometimes gets stuck without this */
|
/* sun5i sometimes gets stuck without this */
|
||||||
writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
|
writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(CONFIG_SUNXI_GEN_SUN6I)
|
||||||
#ifdef CONFIG_SUNXI_GEN_SUN6I
|
|
||||||
static const struct sunxi_wdog *wdog =
|
static const struct sunxi_wdog *wdog =
|
||||||
((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog;
|
((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue