X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fwatchdog%2Fimx_watchdog.c;h=ddcf474996fbd33c1545b69fc0cfe4dd4edaae05;hb=005c1cf888a7ad72bd0f9ceb6f6b2eee7720f7b0;hp=50e602af127b33eef7ab7320a9a552630b8fdc7b;hpb=981481958f98f17089bd3d776f71599756d9b9bd;p=oweals%2Fu-boot.git diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c index 50e602af12..ddcf474996 100644 --- a/drivers/watchdog/imx_watchdog.c +++ b/drivers/watchdog/imx_watchdog.c @@ -8,19 +8,10 @@ #include #include #include - -struct watchdog_regs { - u16 wcr; /* Control */ - u16 wsr; /* Service */ - u16 wrsr; /* Reset Status */ -}; - -#define WCR_WDZST 0x01 -#define WCR_WDBG 0x02 -#define WCR_WDE 0x04 /* WDOG enable */ -#define WCR_WDT 0x08 -#define WCR_WDW 0x80 -#define SET_WCR_WT(x) (x << 8) +#ifdef CONFIG_FSL_LSCH2 +#include +#endif +#include #ifdef CONFIG_IMX_WATCHDOG void hw_watchdog_reset(void) @@ -45,17 +36,22 @@ void hw_watchdog_init(void) #define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000 #endif timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1; - writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT | - WCR_WDW | SET_WCR_WT(timeout), &wdog->wcr); +#ifdef CONFIG_FSL_LSCH2 + writew((WCR_WDA | WCR_SRS | WCR_WDE) << 8 | timeout, &wdog->wcr); +#else + writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT | WCR_SRS | + WCR_WDA | SET_WCR_WT(timeout), &wdog->wcr); +#endif /* CONFIG_FSL_LSCH2*/ hw_watchdog_reset(); } #endif -void reset_cpu(ulong addr) +void __attribute__((weak)) reset_cpu(ulong addr) { struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR; - writew(WCR_WDE, &wdog->wcr); + clrsetbits_le16(&wdog->wcr, WCR_WT_MSK, WCR_WDE); + writew(0x5555, &wdog->wsr); writew(0xaaaa, &wdog->wsr); /* load minimum 1/2 second timeout */ while (1) {