Skip to contentSkip to conversation

watchdog: driver support for fsl-lsch2

PATCH New Xiaoliang Yang 2 participants 4 messages Oct 18, 2018 – Dec 8, 2018

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

PATCH v2 1/2 watchdog: driver support for fsl-lsch2

Support watchdog driver for fsl-lsch2. It's disabled in default. If you want to use it, please enable CONFIG_IMX_WATCHDOG. Define CONFIG_WATCHDOG_TIMEOUT_MSECS to set watchdog timeout.

---
v1->v2: Remove LSCH3 config from imx-watchdog.c, because it only
support LSCH2 platforms.
Use Kconfig option IMX_WATCHDOG to introduce how to use watchdog driver in README.lsch2.

---
 arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 |    9 +++++++++
 drivers/watchdog/Makefile                          |    2 ++
 drivers/watchdog/imx_watchdog.c                    |    7 +++++++
 3 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 +9 -0
index a6ef830..9176546 100644
@@ -8,3 +8,12 @@ Freescale LayerScape with Chassis Generation 2
 
 This architecture supports Freescale ARMv8 SoCs with Chassis generation 2,
 for example LS1043A.
+
+Watchdog support Overview
+-------------------
+Support watchdog driver for LSCH2. The driver is disabled in default.
+You can enable it by setting CONFIG_IMX_WATCHDOG.
+Use following config to set watchdog timeout, if this config is not defined,
+the default timeout value is 128s which is the maximum. Set 10 seconds for
+example:
+    #define CONFIG_WATCHDOG_TIMEOUT_MSECS 10000
drivers/watchdog/Makefile +2 -0
index 08406ca..19c631b 100644
@@ -7,6 +7,8 @@ obj-$(CONFIG_AT91SAM9_WATCHDOG) += 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
+else
+obj-$(CONFIG_IMX_WATCHDOG) += imx_watchdog.o
 endif
 obj-$(CONFIG_S5P)               += s5p_wdt.o
 obj-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
drivers/watchdog/imx_watchdog.c +7 -0
index 3f826d1..ddcf474 100644
@@ -8,6 +8,9 @@
 #include <asm/io.h>
 #include <watchdog.h>
 #include <asm/arch/imx-regs.h>
+#ifdef CONFIG_FSL_LSCH2
+#include <asm/arch/immap_lsch2.h>
+#endif
 #include <fsl_wdog.h>
 
 #ifdef CONFIG_IMX_WATCHDOG
@@ -33,8 +36,12 @@ void hw_watchdog_init(void)
 #define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000
 #endif
 	timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1;
+#ifdef CONFIG_FSL_LSCH2
+	writew((WCR_WDA | WCR_SRS | WCR_WDE) << 8 | timeout, &wdog->wcr);
+#else
 	writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT | WCR_SRS |
 		WCR_WDA | SET_WCR_WT(timeout), &wdog->wcr);
+#endif /* CONFIG_FSL_LSCH2*/
 	hw_watchdog_reset();
 }
 #endif
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 2/2 watchdog: imx: add config to disable wdog reset

Add Kconfig option WATCHDOG_RESET_DISABLE to disable watchdog reset in imx_watchdog driver, so that the watchdog will not be fed in u-boot if CONFIG_WATCHDOG_RESET_DISABLE is enabled.

---
 arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 |    2 ++
 drivers/watchdog/Kconfig                           |    6 ++++++
 drivers/watchdog/imx_watchdog.c                    |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 +2 -0
index 9176546..9583bf7 100644
@@ -17,3 +17,5 @@ Use following config to set watchdog timeout, if this config is not defined,
 the default timeout value is 128s which is the maximum. Set 10 seconds for
 example:
     #define CONFIG_WATCHDOG_TIMEOUT_MSECS 10000
+Set CONFIG_WATCHDOG_RESET_DISABLE to disable reset watchdog, so that the
+watchdog will not be fed in u-boot.
drivers/watchdog/Kconfig +6 -0
index d545b3e..d5dbc80 100644
@@ -11,6 +11,12 @@ config WATCHDOG
 config HW_WATCHDOG
 	bool
 
+config WATCHDOG_RESET_DISABLE
+	bool "Disable reset watchdog"
+	help
+	   Disable reset watchdog, which can let WATCHDOG_RESET invalid, so
+	   that the watchdog will not be fed in u-boot.
+
 config BCM2835_WDT
 	bool "Enable BCM2835/2836 watchdog driver"
 	select HW_WATCHDOG
drivers/watchdog/imx_watchdog.c +2 -0
index ddcf474..14cc618 100644
@@ -16,10 +16,12 @@
 #ifdef CONFIG_IMX_WATCHDOG
 void hw_watchdog_reset(void)
 {
+#ifndef CONFIG_WATCHDOG_RESET_DISABLE
 	struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
 
 	writew(0x5555, &wdog->wsr);
 	writew(0xaaaa, &wdog->wsr);
+#endif /* CONFIG_WATCHDOG_RESET_DISABLE*/
 }
 
 void hw_watchdog_init(void)
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/2 watchdog: imx: add config to disable wdog reset

Quoted 13 lines · Xiaoliang Yang

Add Kconfig option WATCHDOG_RESET_DISABLE to disable watchdog reset in imx_watchdog driver, so that the watchdog will not be fed in u-boot if CONFIG_WATCHDOG_RESET_DISABLE is enabled.

---
 arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 |    2 ++
 drivers/watchdog/Kconfig                           |    6 ++++++
 drivers/watchdog/imx_watchdog.c                    |    2 ++
 3 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 +0 -0
index 9176546..9583bf7 100644

arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2

Quoted 1 line
arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 +0 -1
--- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH v2 1/2 watchdog: driver support for fsl-lsch2

In reply to Xiaoliang Yang
Quoted 11 lines · Xiaoliang Yang

Support watchdog driver for fsl-lsch2. It's disabled in default. If you want to use it, please enable CONFIG_IMX_WATCHDOG. Define CONFIG_WATCHDOG_TIMEOUT_MSECS to set watchdog timeout.

---
v1->v2: Remove LSCH3 config from imx-watchdog.c, because it only
support LSCH2 platforms.
Use Kconfig option IMX_WATCHDOG to introduce how to use watchdog driver in README.lsch2.
---

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================