aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/sp805_wdt.c
diff options
context:
space:
mode:
authorNick Bowler <nbowler@elliptictech.com>2011-07-15 11:04:02 -0400
committerWim Van Sebroeck <wim@iguana.be>2011-07-26 17:19:56 -0400
commit081d83a3393f65adc94fc4240b9926be3054f9dc (patch)
tree8d39c1fc1c3921f42afa009a8828180f1589931b /drivers/watchdog/sp805_wdt.c
parentda3e515024ba32aaf0d524518ce39a8fb77332cd (diff)
watchdog: sp805: Flush posted writes in enable/disable.
There are no reads in these functions, so if MMIO writes are posted, the writes in enable/disable may not have completed by the time these functions return. If the functions run from different CPUs, it's in theory possible for the writes to be interleaved, which would be disastrous for this driver. At the very least, we need an mmiowb() before releasing the lock, but since it seems desirable for the watchdog timer to be actually stopped or reset when these functions return, read the lock register to force the writes out. Signed-off-by: Nick Bowler <nbowler@elliptictech.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/sp805_wdt.c')
-rw-r--r--drivers/watchdog/sp805_wdt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index c1e099aa57f3..cc2cfbe33b30 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -134,6 +134,8 @@ static void wdt_enable(void)
134 writel(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL); 134 writel(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL);
135 writel(LOCK, wdt->base + WDTLOCK); 135 writel(LOCK, wdt->base + WDTLOCK);
136 136
137 /* Flush posted writes. */
138 readl(wdt->base + WDTLOCK);
137 spin_unlock(&wdt->lock); 139 spin_unlock(&wdt->lock);
138} 140}
139 141
@@ -146,6 +148,8 @@ static void wdt_disable(void)
146 writel(0, wdt->base + WDTCONTROL); 148 writel(0, wdt->base + WDTCONTROL);
147 writel(LOCK, wdt->base + WDTLOCK); 149 writel(LOCK, wdt->base + WDTLOCK);
148 150
151 /* Flush posted writes. */
152 readl(wdt->base + WDTLOCK);
149 spin_unlock(&wdt->lock); 153 spin_unlock(&wdt->lock);
150} 154}
151 155