]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
watchdog: at91sam9_wdt: Remove now superfluous wdt start and reset
authorStefan Roese <sr@denx.de>
Thu, 11 Apr 2019 13:58:47 +0000 (15:58 +0200)
committerStefan Roese <sr@denx.de>
Fri, 26 Apr 2019 07:16:32 +0000 (09:16 +0200)
With the new generic function, the scattered other functions are now
removed to be replaced by the generic one. The new version also enables
the configuration of the watchdog timeout via the DT "timeout-sec"
property (if enabled via CONFIG_OF_CONTROL).

The watchdog servicing is enabled via CONFIG_WATCHDOG.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Heiko Schocher <hs@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
arch/arm/mach-at91/clock.c
arch/arm/mach-at91/include/mach/at91_wdt.h
configs/gardena-smart-gateway-at91sam_defconfig
drivers/watchdog/at91sam9_wdt.c

index 1d3df2c09de0dcd3345fc3f8faf651a0b094aa81..8344daeb39a24eebd181e8991c40b1d1d30dbfc7 100644 (file)
@@ -14,8 +14,6 @@
 
 #define EN_UPLL_TIMEOUT                500
 
-static struct udevice *watchdog_dev __attribute__((section(".data"))) = NULL;
-
 void at91_periph_clk_enable(int id)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
@@ -123,46 +121,3 @@ void at91_pllicpr_init(u32 icpr)
 
        writel(icpr, &pmc->pllicpr);
 }
-
-/* Called by macro WATCHDOG_RESET */
-void watchdog_reset(void)
-{
-       static ulong next_reset;
-       ulong now;
-
-       if (!watchdog_dev)
-               return;
-
-       now = get_timer(0);
-
-       /* Do not reset the watchdog too often */
-       if (now > next_reset) {
-               next_reset = now + 1000;        /* reset every 1000ms */
-               wdt_reset(watchdog_dev);
-       }
-}
-
-int arch_early_init_r(void)
-{
-       struct at91_wdt_priv *priv;
-
-       /* Init watchdog */
-       if (uclass_get_device_by_seq(UCLASS_WDT, 0, &watchdog_dev)) {
-               debug("Watchdog: Not found by seq!\n");
-               if (uclass_get_device(UCLASS_WDT, 0, &watchdog_dev)) {
-                       puts("Watchdog: Not found!\n");
-                       return 0;
-               }
-       }
-
-       priv = dev_get_priv(watchdog_dev);
-       if (!priv) {
-               printf("Watchdog: priv not available!\n");
-               return 0;
-       }
-
-       wdt_start(watchdog_dev, priv->timeout * 1000, 0);
-       printf("Watchdog: Started\n");
-
-       return 0;
-}
index a8fc73b3d1ea94de3bd6e7e21cd3342b811d4fde..8ef8e007d7767308a5b46be46b02c51073723a41 100644 (file)
@@ -28,7 +28,6 @@ typedef struct at91_wdt {
 struct at91_wdt_priv {
        void __iomem *regs;
        u32 regval;
-       u32 timeout;
 };
 
 #endif
@@ -51,6 +50,5 @@ struct at91_wdt_priv {
 
 /* Hardware timeout in seconds */
 #define WDT_MAX_TIMEOUT                16
-#define WDT_DEFAULT_TIMEOUT    2
 
 #endif
index b395a5a175da488b4ad14c1d586bc2fc77580c31..956897dc7f7c7cfef8aaf1721e4be6727aa03b4e 100644 (file)
@@ -23,7 +23,6 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=6 root=ubi0:rootfs rw"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
-CONFIG_ARCH_EARLY_INIT_R=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SEPARATE_BSS=y
 # CONFIG_TPL_BANNER_PRINT is not set
@@ -76,7 +75,6 @@ CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
 CONFIG_ATMEL_PIT_TIMER=y
 # CONFIG_SYS_WHITE_ON_BLACK is not set
-CONFIG_WATCHDOG=y
 CONFIG_WDT=y
 CONFIG_WDT_AT91=y
 # CONFIG_UBIFS_SILENCE_MSG is not set
index 000769d46deb280fa55cf208719a845abccf2f82..48433cc1589a62680b1fb866fd7c5d03ccb0b185 100644 (file)
@@ -107,14 +107,6 @@ static int at91_wdt_probe(struct udevice *dev)
        if (!priv->regs)
                return -EINVAL;
 
-#if CONFIG_IS_ENABLED(OF_CONTROL)
-       priv->timeout = dev_read_u32_default(dev, "timeout-sec",
-                                            WDT_DEFAULT_TIMEOUT);
-       debug("%s: timeout %d", __func__, priv->timeout);
-#else
-       priv->timeout = WDT_DEFAULT_TIMEOUT;
-#endif
-
        debug("%s: Probing wdt%u\n", __func__, dev->seq);
 
        return 0;