All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2
@ 2018-06-01  7:35 Xiaoliang Yang
  2018-06-01  7:35 ` [U-Boot] [PATCH v2 2/2] watchdog: Kconfig: add config to disable wdog reset Xiaoliang Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Xiaoliang Yang @ 2018-06-01  7:35 UTC (permalink / raw)
  To: u-boot

Support watchdog driver for fsl-lsch2. If you want to use it,
please enable CONFIG_IMX_WATCHDOG, and CONFIG_HW_WATCHDOG.
define CONFIG_WATCHDOG_TIMEOUT_MSECS to set watchdog timeout.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
---
 arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 |   10 ++++++++++
 drivers/watchdog/Kconfig                           |    6 ++++++
 drivers/watchdog/Makefile                          |    2 ++
 drivers/watchdog/imx_watchdog.c                    |   11 +++++++++++
 4 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
index a6ef830..87b91eb 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
+++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
@@ -8,3 +8,13 @@ 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 Layerscape. Use following configs to enable it:
+    #define CONFIG_IMX_WATCHDOG
+    #define CONFIG_HW_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
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 148c6a0..a526afd 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -103,4 +103,10 @@ config WDT_CDNS
 	   Select this to enable Cadence watchdog timer, which can be found on some
 	   Xilinx Microzed Platform.
 
+config IMX_WATCHDOG
+	bool "IMX watchdog timer support"
+	help
+	   Select this to enable IMX watchdog timer, which can be found on
+	   some i.mx and fsl-lsch2 SoCs.
+
 endmenu
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index f405f51..159fc11 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -7,6 +7,8 @@ obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
 obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
 ifneq (,$(filter $(SOC), 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
diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 3f826d1..3ad4e55 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -8,6 +8,13 @@
 #include <asm/io.h>
 #include <watchdog.h>
 #include <asm/arch/imx-regs.h>
+#ifdef CONFIG_FSL_LAYERSCAPE
+#ifdef CONFIG_FSL_LSCH3
+#include <asm/arch/immap_lsch3.h>
+#elif defined(CONFIG_FSL_LSCH2)
+#include <asm/arch/immap_lsch2.h>
+#endif
+#endif
 #include <fsl_wdog.h>
 
 #ifdef CONFIG_IMX_WATCHDOG
@@ -33,8 +40,12 @@ void hw_watchdog_init(void)
 #define CONFIG_WATCHDOG_TIMEOUT_MSECS 128000
 #endif
 	timeout = (CONFIG_WATCHDOG_TIMEOUT_MSECS / 500) - 1;
+#ifdef CONFIG_FSL_LAYERSCAPE
+	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_LAYERSCAPE*/
 	hw_watchdog_reset();
 }
 #endif
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 2/2] watchdog: Kconfig: add config to disable wdog reset
  2018-06-01  7:35 [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
@ 2018-06-01  7:35 ` Xiaoliang Yang
  2018-06-01  7:48 ` [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
  2018-06-01 14:56 ` York Sun
  2 siblings, 0 replies; 6+ messages in thread
From: Xiaoliang Yang @ 2018-06-01  7:35 UTC (permalink / raw)
  To: u-boot

Add Kconfig support for CONFIG_WATCHDOG_RESET_DISABLE, use this config
to disable watchdog reset in imx_watchdog driver, so that the watchdog
will not be fed in u-boot.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
---
 arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 |    3 +++
 drivers/watchdog/Kconfig                           |    6 ++++++
 drivers/watchdog/imx_watchdog.c                    |    2 ++
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
index 87b91eb..c43a99b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
+++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
@@ -18,3 +18,6 @@ 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
+Use following config to disable reset watchdog, so that the watchdog will
+not be fed in u-boot:
+    #define CONFIG_WATCHDOG_RESET_DISABLE
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index a526afd..1958c17 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -109,4 +109,10 @@ config IMX_WATCHDOG
 	   Select this to enable IMX watchdog timer, which can be found on
 	   some i.mx and fsl-lsch2 SoCs.
 
+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.
+
 endmenu
diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 3ad4e55..6691ee9 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -20,10 +20,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)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2
  2018-06-01  7:35 [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
  2018-06-01  7:35 ` [U-Boot] [PATCH v2 2/2] watchdog: Kconfig: add config to disable wdog reset Xiaoliang Yang
@ 2018-06-01  7:48 ` Xiaoliang Yang
  2018-06-01 14:56 ` York Sun
  2 siblings, 0 replies; 6+ messages in thread
From: Xiaoliang Yang @ 2018-06-01  7:48 UTC (permalink / raw)
  To: u-boot

v1 -> v2:
Because of imx_watchdog.c driver not supports all layerscape SoCs, change to build imx_watchdog.o only when enable IMX_WATCHDOG for fsl-lsch2 SoCs.
Add IMX_WATCHDOG in drivers/watchdog/Kconfig.
Changes in v2:
drivers/watchdog/Kconfig                           |    6 ++++++
drivers/watchdog/Makefile                          |    2 ++

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2
  2018-06-01  7:35 [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
  2018-06-01  7:35 ` [U-Boot] [PATCH v2 2/2] watchdog: Kconfig: add config to disable wdog reset Xiaoliang Yang
  2018-06-01  7:48 ` [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
@ 2018-06-01 14:56 ` York Sun
  2 siblings, 0 replies; 6+ messages in thread
From: York Sun @ 2018-06-01 14:56 UTC (permalink / raw)
  To: u-boot

On 06/01/2018 12:37 AM, Xiaoliang Yang wrote:
> Support watchdog driver for fsl-lsch2. If you want to use it,
> please enable CONFIG_IMX_WATCHDOG, and CONFIG_HW_WATCHDOG.
> define CONFIG_WATCHDOG_TIMEOUT_MSECS to set watchdog timeout.
> 
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> ---
>  arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 |   10 ++++++++++
>  drivers/watchdog/Kconfig                           |    6 ++++++
>  drivers/watchdog/Makefile                          |    2 ++
>  drivers/watchdog/imx_watchdog.c                    |   11 +++++++++++
>  4 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
> index a6ef830..87b91eb 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
> @@ -8,3 +8,13 @@ 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 Layerscape. Use following configs to enable it:
> +    #define CONFIG_IMX_WATCHDOG
> +    #define CONFIG_HW_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
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 148c6a0..a526afd 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -103,4 +103,10 @@ config WDT_CDNS
>  	   Select this to enable Cadence watchdog timer, which can be found on some
>  	   Xilinx Microzed Platform.
>  
> +config IMX_WATCHDOG
> +	bool "IMX watchdog timer support"
> +	help
> +	   Select this to enable IMX watchdog timer, which can be found on
> +	   some i.mx and fsl-lsch2 SoCs.
> +
>  endmenu
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index f405f51..159fc11 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -7,6 +7,8 @@ obj-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
>  obj-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
>  ifneq (,$(filter $(SOC), mx31 mx35 mx5 mx6 mx7 vf610))
>  obj-y += imx_watchdog.o
> +else
> +obj-$(CONFIG_IMX_WATCHDOG) += imx_watchdog.o

It is good to see you convert this macro to Kconfig option. But it is
not right to mix these two. You should create a patch before this one to
convert this macro to Kconfig (and remove it from whitelist). It
shouldn't be hard, I only see 7 files defining this macro. Please make
sure you CC maintainers for the Kconfig change.

>  endif
>  obj-$(CONFIG_S5P)               += s5p_wdt.o
>  obj-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
> diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
> index 3f826d1..3ad4e55 100644
> --- a/drivers/watchdog/imx_watchdog.c
> +++ b/drivers/watchdog/imx_watchdog.c
> @@ -8,6 +8,13 @@
>  #include <asm/io.h>
>  #include <watchdog.h>
>  #include <asm/arch/imx-regs.h>
> +#ifdef CONFIG_FSL_LAYERSCAPE
> +#ifdef CONFIG_FSL_LSCH3
> +#include <asm/arch/immap_lsch3.h>

You said LSCH3 doesn't support this watchdog.

York

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2
  2018-10-18 10:27 Xiaoliang Yang
@ 2018-12-08 17:32 ` Stefano Babic
  0 siblings, 0 replies; 6+ messages in thread
From: Stefano Babic @ 2018-12-08 17:32 UTC (permalink / raw)
  To: u-boot



On 18/10/18 12:27, Xiaoliang Yang wrote:
> 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.
> 
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> ---
> 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

-- 
=====================================================================
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
=====================================================================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2
@ 2018-10-18 10:27 Xiaoliang Yang
  2018-12-08 17:32 ` Stefano Babic
  0 siblings, 1 reply; 6+ messages in thread
From: Xiaoliang Yang @ 2018-10-18 10:27 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
---
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(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2 b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
index a6ef830..9176546 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
+++ b/arch/arm/cpu/armv8/fsl-layerscape/doc/README.lsch2
@@ -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
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 08406ca..19c631b 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -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
diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 3f826d1..ddcf474 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -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
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-08 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01  7:35 [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
2018-06-01  7:35 ` [U-Boot] [PATCH v2 2/2] watchdog: Kconfig: add config to disable wdog reset Xiaoliang Yang
2018-06-01  7:48 ` [U-Boot] [PATCH v2 1/2] watchdog: driver support for fsl-lsch2 Xiaoliang Yang
2018-06-01 14:56 ` York Sun
2018-10-18 10:27 Xiaoliang Yang
2018-12-08 17:32 ` Stefano Babic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.