mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-27 14:14:37 +08:00
ti: wdt: omap: Disable watchdog timer before performing initialization
The OMAP WDT IP block requires to be stopped before any write to its registers is performed. This problem has been thoroughly described in Linux kernel: "watchdog: omap: assert the counter being stopped before reprogramming: SHA1: 530c11d432727c697629ad5f9d00ee8e2864d453 Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
737af81927
commit
b633b9c8fe
@ -81,10 +81,32 @@ static int omap_wdt_set_timeout(unsigned int timeout)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void hw_watchdog_disable(void)
|
||||||
|
{
|
||||||
|
struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable watchdog
|
||||||
|
*/
|
||||||
|
writel(0xAAAA, &wdt->wdtwspr);
|
||||||
|
while (readl(&wdt->wdtwwps) != 0x0)
|
||||||
|
;
|
||||||
|
writel(0x5555, &wdt->wdtwspr);
|
||||||
|
while (readl(&wdt->wdtwwps) != 0x0)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
void hw_watchdog_init(void)
|
void hw_watchdog_init(void)
|
||||||
{
|
{
|
||||||
struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
|
struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure the watchdog is disabled. This is unfortunately required
|
||||||
|
* because writing to various registers with the watchdog running has no
|
||||||
|
* effect.
|
||||||
|
*/
|
||||||
|
hw_watchdog_disable();
|
||||||
|
|
||||||
/* initialize prescaler */
|
/* initialize prescaler */
|
||||||
while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
|
while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
|
||||||
;
|
;
|
||||||
@ -104,18 +126,3 @@ void hw_watchdog_init(void)
|
|||||||
while ((readl(&wdt->wdtwwps)) & WDT_WWPS_PEND_WSPR)
|
while ((readl(&wdt->wdtwwps)) & WDT_WWPS_PEND_WSPR)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hw_watchdog_disable(void)
|
|
||||||
{
|
|
||||||
struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable watchdog
|
|
||||||
*/
|
|
||||||
writel(0xAAAA, &wdt->wdtwspr);
|
|
||||||
while (readl(&wdt->wdtwwps) != 0x0)
|
|
||||||
;
|
|
||||||
writel(0x5555, &wdt->wdtwspr);
|
|
||||||
while (readl(&wdt->wdtwwps) != 0x0)
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user