]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/watchdog/at91sam9_wdt.c
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / watchdog / at91sam9_wdt.c
index 5bb8b77afc868713a24d730d7ff6fab98d33465a..ffd49a2befbb24a59747533c5960741a0ae14f05 100644 (file)
@@ -6,10 +6,7 @@
  * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
  * Copyright (C) 2008 Renaud CERRATO r.cerrato@til-technologies.fr
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /*
@@ -21,7 +18,7 @@
 #include <common.h>
 #include <watchdog.h>
 #include <asm/arch/hardware.h>
-#include <asm/arch/io.h>
+#include <asm/io.h>
 #include <asm/arch/at91_wdt.h>
 
 /*
 static int at91_wdt_settimeout(unsigned int timeout)
 {
        unsigned int reg;
-       unsigned int mr;
+       at91_wdt_t *wd = (at91_wdt_t *) ATMEL_BASE_WDT;
 
        /* 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 +53,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 *) ATMEL_BASE_WDT;
+       writel(AT91_WDT_CR_WDRSTT | AT91_WDT_CR_KEY, &wd->cr);
 }
 
 void hw_watchdog_init(void)