summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchim Ehrlich <aehrlich@taskit.de>2010-03-17 14:50:29 +0100
committertrix <trix@windriver.com>2010-04-03 15:24:27 -0500
commitf936aa0528fe4f5d86168575528e0c52b485c642 (patch)
treeddb43ac50bb72173d8809811e2d33874fcbc84d8
parentc9f72b3da8855c3c9679c821127cccd91e0380ed (diff)
downloadu-boot-imx-f936aa0528fe4f5d86168575528e0c52b485c642.zip
u-boot-imx-f936aa0528fe4f5d86168575528e0c52b485c642.tar.gz
u-boot-imx-f936aa0528fe4f5d86168575528e0c52b485c642.tar.bz2
Convert at91 watchdog driver to new SoC access
This converts the at91 watchdog driver to new c structure type to access registers of the SoC Signed-off-by: Achim Ehrlich <aehrlich@taskit.de>
-rw-r--r--drivers/watchdog/at91sam9_wdt.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 5bb8b77..25afae7 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -42,11 +42,10 @@
static int at91_wdt_settimeout(unsigned int timeout)
{
unsigned int reg;
- unsigned int mr;
+ at91_wdt_t *wd = (at91_wdt_t *) AT91_WDT_BASE;
/* Check if disabled */
- mr = at91_sys_read(AT91_WDT_MR);
- if (mr & AT91_WDT_WDDIS) {
+ if (readl(&wd->mr) & AT91_WDT_MR_WDDIS) {
printf("sorry, watchdog is disabled\n");
return -1;
}
@@ -57,19 +56,21 @@ static int at91_wdt_settimeout(unsigned int timeout)
* Since WDV is a 12-bit counter, the maximum period is
* 4096 / 256 = 16 seconds.
*/
- reg = AT91_WDT_WDRSTEN /* causes watchdog reset */
- /* | AT91_WDT_WDRPROC causes processor reset only */
- | AT91_WDT_WDDBGHLT /* disabled in debug mode */
- | AT91_WDT_WDD /* restart at any time */
- | (timeout & AT91_WDT_WDV); /* timer value */
- at91_sys_write(AT91_WDT_MR, reg);
+
+ reg = AT91_WDT_MR_WDRSTEN /* causes watchdog reset */
+ | AT91_WDT_MR_WDDBGHLT /* disabled in debug mode */
+ | AT91_WDT_MR_WDD(0xfff) /* restart at any time */
+ | AT91_WDT_MR_WDV(timeout); /* timer value */
+
+ writel(reg, &wd->mr);
return 0;
}
void hw_watchdog_reset(void)
{
- at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
+ at91_wdt_t *wd = (at91_wdt_t *) AT91_WDT_BASE;
+ writel(AT91_WDT_CR_WDRSTT | AT91_WDT_CR_KEY, &wd->cr);
}
void hw_watchdog_init(void)