Skip to contentSkip to conversation

arm: at91: wdt: Convert watchdog driver to dm/dt

PATCH New Prasanthi Chellakumar 2 participants 2 messages Oct 9, 2018 – Nov 17, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 arm: at91: wdt: Convert watchdog driver to dm/dt

Convert the Watchdog driver for AT91SAM9x processors to support the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG" to new "CONFIG_WDT_AT91" Kconfig option.

---
 arch/arm/dts/at91sam9260-smartweb.dts      |   1 +
 arch/arm/dts/at91sam9g20-taurus.dts        |   1 +
 arch/arm/mach-at91/include/mach/at91_wdt.h |   6 +-
 arch/arm/mach-at91/spl.c                   |   2 +-
 arch/arm/mach-at91/spl_at91.c              |   2 +-
 arch/arm/mach-at91/spl_atmel.c             |   2 +-
 common/board_f.c                           |   2 +-
 configs/picosam9g45_defconfig              |   4 ++
 configs/smartweb_defconfig                 |   3 +
 configs/taurus_defconfig                   |   3 +
 doc/README.at91                            |   2 +-
 doc/README.watchdog                        |   2 +-
 drivers/watchdog/Kconfig                   |  10 +++
 drivers/watchdog/Makefile                  |   2 +-
 drivers/watchdog/at91sam9_wdt.c            | 104 ++++++++++++++++++++++-------
 include/configs/picosam9g45.h              |   4 --
 include/configs/smartweb.h                 |   7 --
 include/configs/taurus.h                   |   7 --
 scripts/config_whitelist.txt               |   1 -
 19 files changed, 114 insertions(+), 51 deletions(-)
arch/arm/dts/at91sam9260-smartweb.dts +1 -0
index e59781b..a22de2d 100644
@@ -89,6 +89,7 @@
 			};
 
 			watchdog at fffffd40 {
+				timeout-sec = <15>;
 				status = "okay";
 			};
 
arch/arm/dts/at91sam9g20-taurus.dts +1 -0
index 7931c0a..cee228b 100644
@@ -98,6 +98,7 @@
 			};
 
 			watchdog at fffffd40 {
+				timeout-sec = <15>;
 				status = "okay";
 			};
 
arch/arm/mach-at91/include/mach/at91_wdt.h +5 -1
index 99b0cc8..cd22723 100644
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
  * Copyright (C) 2007 Andrew Victor
- * Copyright (C) 2007 Atmel Corporation.
+ * Copyright (C) 2018 Microchip Technology Inc.
  *
  * Watchdog Timer (WDT) - System peripherals regsters.
  * Based on AT91SAM9261 datasheet revision D.
@@ -27,9 +27,13 @@ typedef struct at91_wdt {
 
 #endif
 
+/* Watchdog Control Register */
+#define AT91_WDT_CR			0x00
 #define AT91_WDT_CR_WDRSTT		1
 #define AT91_WDT_CR_KEY			0xa5000000	/* KEY Password */
 
+/* Watchdog Mode Register*/
+#define AT91_WDT_MR			0X04
 #define AT91_WDT_MR_WDV(x)		(x & 0xfff)
 #define AT91_WDT_MR_WDFIEN		0x00001000
 #define AT91_WDT_MR_WDRSTEN		0x00002000
arch/arm/mach-at91/spl.c +1 -1
index 8bfb2a4..6da6d41 100644
@@ -11,7 +11,7 @@
 #include <asm/arch/clk.h>
 #include <spl.h>
 
-#if !defined(CONFIG_AT91SAM9_WATCHDOG)
+#if !defined(CONFIG_WDT_AT91)
 void at91_disable_wdt(void)
 {
 	struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT;
arch/arm/mach-at91/spl_at91.c +1 -1
index 8c36804..23ebaa9 100644
@@ -76,7 +76,7 @@ void __weak spl_board_init(void)
 void board_init_f(ulong dummy)
 {
 	lowlevel_clock_init();
-#if !defined(CONFIG_AT91SAM9_WATCHDOG)
+#if !defined(CONFIG_WDT_AT91)
 	at91_disable_wdt();
 #endif
 
arch/arm/mach-at91/spl_atmel.c +1 -1
index 597ff8c..ef745c9 100644
@@ -98,7 +98,7 @@ void board_init_f(ulong dummy)
 	configure_2nd_sram_as_l2_cache();
 #endif
 
-#if !defined(CONFIG_AT91SAM9_WATCHDOG)
+#if !defined(CONFIG_WDT_AT91)
 	/* disable watchdog */
 	at91_disable_wdt();
 #endif
common/board_f.c +1 -1
index 213d044..02223db 100644
@@ -91,7 +91,7 @@ static int init_func_watchdog_init(void)
 {
 # if defined(CONFIG_HW_WATCHDOG) && \
 	(defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
-	defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
+	defined(CONFIG_SH) || \
 	defined(CONFIG_DESIGNWARE_WATCHDOG) || \
 	defined(CONFIG_IMX_WATCHDOG))
 	hw_watchdog_init();
configs/picosam9g45_defconfig +4 -0
index 0b6234f..be9cb5c 100644
@@ -39,3 +39,7 @@ CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
 CONFIG_OF_LIBFDT=y
+CONFIG_DM=y
+CONFIG_SPL_DM=y
+CONFIG_WDT=y
+CONFIG_WDT_AT91=y
configs/smartweb_defconfig +3 -0
index b0bb18a..3204211 100644
@@ -60,3 +60,6 @@ CONFIG_USB_ETHER_ASIX=y
 CONFIG_USB_ETHER_MCS7830=y
 CONFIG_SPL_TINY_MEMSET=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_WDT=y
+CONFIG_WDT_AT91=y
+CONFIG_AT91_HW_WDT_TIMEOUT=y
configs/taurus_defconfig +3 -0
index bafd8ab..8925d85 100644
@@ -62,3 +62,6 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0908
 CONFIG_USB_GADGET_PRODUCT_NUM=0x02d2
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_WDT=y
+CONFIG_WDT_AT91=y
+CONFIG_AT91_HW_WDT_TIMEOUT=y
doc/README.at91 +1 -1
index 6741213..39dd563 100644
@@ -171,4 +171,4 @@ III. Watchdog support
 	your code (make sure not to disable it in AT91Bootstrap for instance).
 
 	In the U-Boot configuration, the AT91 watchdog support is enabled using
-	the CONFIG_AT91SAM9_WATCHDOG and CONFIG_HW_WATCHDOG options.
+	the CONFIG_WDT and CONFIG_WDT_AT91 options.
doc/README.watchdog +1 -1
index 7097c87..f23c923 100644
@@ -14,7 +14,7 @@ CONFIG_WATCHDOG_TIMEOUT_MSECS
 	If not given, will default to maximum timeout. This would
 	be 128000 msec for i.mx31/35/5x/6x.
 
-CONFIG_AT91SAM9_WATCHDOG
+CONFIG_WDT_AT91
 	Available for AT91SAM9 to service the watchdog.
 
 CONFIG_FTWDT010_WATCHDOG
drivers/watchdog/Kconfig +10 -0
index d545b3e..276d6c4 100644
@@ -111,4 +111,14 @@ config XILINX_TB_WATCHDOG
 	   Select this to enable Xilinx Axi watchdog timer, which can be found on some
 	   Xilinx Microblaze Platforms.
 
+config WDT_AT91
+	bool "AT91 watchdog timer support"
+	depends on WDT
+	help
+	   Select this to enable Microchip watchdog timer, which can be found on
+	   some AT91 devices.
+
+config AT91_HW_WDT_TIMEOUT
+	bool "AT91 watchdog timeout specified"
+	depends on WDT_AT91
 endmenu
drivers/watchdog/Makefile +1 -1
index 08406ca..a5c27b0 100644
@@ -3,7 +3,7 @@
 # (C) Copyright 2008
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
+obj-$(CONFIG_WDT_AT91) += at91sam9_wdt.o
 obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
 ifneq (,$(filter $(SOC), mx25 mx31 mx35 mx5 mx6 mx7 vf610))
 obj-y += imx_watchdog.o
drivers/watchdog/at91sam9_wdt.c +80 -24

149 lines not on this page · raw message

include/configs/picosam9g45.h +0 -4
index 0b240e7..c2882e6 100644
@@ -57,10 +57,6 @@
  */
 #define CONFIG_BOOTP_BOOTFILESIZE
 
-/* Enable the watchdog */
-#define CONFIG_AT91SAM9_WATCHDOG
-#define CONFIG_HW_WATCHDOG
-
 /*
  * Command line configuration.
  */
include/configs/smartweb.h +0 -7
index 114b87e..28af575 100644
@@ -112,13 +112,6 @@
 	"root=/dev/nfs ip=dhcp nfsroot=${serverip}:/srv/nfs/rootfs; "	\
 	"dhcp"
 
-/* Enable the watchdog */
-#define CONFIG_AT91SAM9_WATCHDOG
-#if !defined(CONFIG_SPL_BUILD)
-#define CONFIG_HW_WATCHDOG
-#endif
-#define CONFIG_AT91_HW_WDT_TIMEOUT	15
-
 #if !defined(CONFIG_SPL_BUILD)
 /* USB configuration */
 #define CONFIG_USB_ATMEL
include/configs/taurus.h +0 -7
index 4fdb0dd..f283ab7 100644
@@ -85,13 +85,6 @@
 #define CONFIG_RMII
 #define CONFIG_AT91_WANTS_COMMON_PHY
 
-#define CONFIG_AT91SAM9_WATCHDOG
-#define CONFIG_AT91_HW_WDT_TIMEOUT	15
-#if !defined(CONFIG_SPL_BUILD)
-/* Enable the watchdog */
-#define CONFIG_HW_WATCHDOG
-#endif
-
 /* USB */
 #if defined(CONFIG_BOARD_TAURUS)
 #define CONFIG_USB_ATMEL
scripts/config_whitelist.txt +0 -1
index e805b1e..72f3d29 100644
@@ -82,7 +82,6 @@ CONFIG_AT91SAM9G20EK_2MMC
 CONFIG_AT91SAM9G45EKES
 CONFIG_AT91SAM9G45_LCD_BASE
 CONFIG_AT91SAM9M10G45EK
-CONFIG_AT91SAM9_WATCHDOG
 CONFIG_AT91_CAN
 CONFIG_AT91_EFLASH
 CONFIG_AT91_GPIO_PULLUP
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/1 arm: at91: wdt: Convert watchdog driver to dm/dt

Quoted 5 lines · Prasanthi Chellakumar

Convert the Watchdog driver for AT91SAM9x processors to support the driver model and device tree. Changes "CONFIG_AT91SAM9_WATCHDOG" to new "CONFIG_WDT_AT91" Kconfig option.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181117/50d112cc/attachment.sig>