Skip to contentSkip to conversation

ti: wdt: Fixes for am57xx/dra7 Watchdog

PATCH New Lukasz Majewski 3 participants 24 messages Feb 19, 2017 – Apr 10, 2017

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

cover ti: wdt: Fixes for am57xx/dra7 Watchdog

Following patch series comprise various fixes for OMAP Watchdog:

- Disable watchdog during init (as done in recent Linux kernel)

- Enable OMAP watchdog in init_func_watchdog_init

- Extract OMAP WDT (omap_wdt) header file to be resued not only on am335x SoC

- Remove implicit WDT disable code from hwinit-common.c file

- Setup the watchdog timeout via CONFIG_HW_WATCHDOG_TIMEOUT_MS

Tested at am57xx (dra7) SoC

Lukasz Majewski (7):
ti: wdt: common: Make the wdt IP defines common for the TI platform
ti: wdt: omap5: Define WDT_BASE for omap5+ SoC
ti: wdt: omap: Disable watchdog timer before performing initialization
ti: wdt: hwinit-common: Remove legacy watchdog disable code
ti: wdt: omap5: Remove not needed struct watchdog definition
ti: wdt: omap: Use COMMON_HW_WATCHDOG_TIMEOUT_MS to specify watchdog
timeout
ti: wdt: Enable OMAP watchdog in u-boot's board_f.c

 arch/arm/include/asm/arch-am33xx/cpu.h    | 48 +------------------------
 arch/arm/include/asm/arch-omap5/cpu.h     | 17 ++-------
 arch/arm/include/asm/ti-common/omap_wdt.h | 60 +++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/hwinit-common.c       | 27 --------------
 common/board_f.c                          |  2 +-
 drivers/watchdog/omap_wdt.c               | 45 +++++++++++++----------
 6 files changed, 92 insertions(+), 107 deletions(-)
 create mode 100644 arch/arm/include/asm/ti-common/omap_wdt.h
Signature · 1 line
2.1.4
#1 lore raw

cover ti: wdt: Fixes for am57xx/dra7 Watchdog

Following patch series comprise various fixes for OMAP Watchdog:

- Disable watchdog during init (as done in recent Linux kernel)

- Enable OMAP watchdog in init_func_watchdog_init

- Extract OMAP WDT (omap_wdt) header file to be resued not only on am335x SoC

- Remove implicit WDT disable code from hwinit-common.c file

- Setup the watchdog timeout via CONFIG_HW_WATCHDOG_TIMEOUT_MS

Tested at am57xx (dra7) SoC

Lukasz Majewski (7):
ti: wdt: common: Make the wdt IP defines common for the TI platform
ti: wdt: omap5: Define WDT_BASE for omap5+ SoC
ti: wdt: omap: Disable watchdog timer before performing initialization
ti: wdt: hwinit-common: Remove legacy watchdog disable code
ti: wdt: omap5: Remove not needed struct watchdog definition
ti: wdt: omap: Use COMMON_HW_WATCHDOG_TIMEOUT_MS to specify watchdog
timeout
ti: wdt: Enable OMAP watchdog in u-boot's board_f.c

 arch/arm/include/asm/arch-am33xx/cpu.h    | 48 +------------------------
 arch/arm/include/asm/arch-omap5/cpu.h     | 17 ++-------
 arch/arm/include/asm/ti-common/omap_wdt.h | 60 +++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/hwinit-common.c       | 27 --------------
 common/board_f.c                          |  2 +-
 drivers/watchdog/omap_wdt.c               | 45 +++++++++++++----------
 6 files changed, 92 insertions(+), 107 deletions(-)
 create mode 100644 arch/arm/include/asm/ti-common/omap_wdt.h
Signature · 1 line
2.1.4
#2 lore raw

PATCH 1/7 ti: wdt: common: Make the wdt IP defines common for the TI platform

In reply to Lukasz Majewski
---
 arch/arm/include/asm/arch-am33xx/cpu.h    | 48 +------------------------
 arch/arm/include/asm/arch-omap5/cpu.h     |  2 ++
 arch/arm/include/asm/ti-common/omap_wdt.h | 60 +++++++++++++++++++++++++++++++
 3 files changed, 63 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/include/asm/ti-common/omap_wdt.h
arch/arm/include/asm/arch-am33xx/cpu.h +1 -47
index dbed776..54f449f 100644
@@ -66,29 +66,9 @@
 #define PRM_RSTCTRL_RESET		0x01
 #define PRM_RSTST_WARM_RESET_MASK	0x232
 
-/*
- * Watchdog:
- * Using the prescaler, the OMAP watchdog could go for many
- * months before firing.  These limits work without scaling,
- * with the 60 second default assumed by most tools and docs.
- */
-#define TIMER_MARGIN_MAX	(24 * 60 * 60)	/* 1 day */
-#define TIMER_MARGIN_DEFAULT	60	/* 60 secs */
-#define TIMER_MARGIN_MIN	1
-
-#define PTV			0	/* prescale */
-#define GET_WLDR_VAL(secs)	(0xffffffff - ((secs) * (32768/(1<<PTV))) + 1)
-#define WDT_WWPS_PEND_WCLR	BIT(0)
-#define WDT_WWPS_PEND_WLDR	BIT(2)
-#define WDT_WWPS_PEND_WTGR	BIT(3)
-#define WDT_WWPS_PEND_WSPR	BIT(4)
-
-#define WDT_WCLR_PRE		BIT(5)
-#define WDT_WCLR_PTV_OFF	2
-
 #ifndef __KERNEL_STRICT_NAMES
 #ifndef __ASSEMBLY__
-
+#include <asm/ti-common/omap_wdt.h>
 
 #ifndef CONFIG_AM43XX
 /* Encapsulating core pll registers */
@@ -422,32 +402,6 @@ struct cm_rtc {
 	unsigned int clkstctrl;		/* offset 0x4 */
 };
 
-/* Watchdog timer registers */
-struct wd_timer {
-	unsigned int resv1[4];
-	unsigned int wdtwdsc;	/* offset 0x010 */
-	unsigned int wdtwdst;	/* offset 0x014 */
-	unsigned int wdtwisr;	/* offset 0x018 */
-	unsigned int wdtwier;	/* offset 0x01C */
-	unsigned int wdtwwer;	/* offset 0x020 */
-	unsigned int wdtwclr;	/* offset 0x024 */
-	unsigned int wdtwcrr;	/* offset 0x028 */
-	unsigned int wdtwldr;	/* offset 0x02C */
-	unsigned int wdtwtgr;	/* offset 0x030 */
-	unsigned int wdtwwps;	/* offset 0x034 */
-	unsigned int resv2[3];
-	unsigned int wdtwdly;	/* offset 0x044 */
-	unsigned int wdtwspr;	/* offset 0x048 */
-	unsigned int resv3[1];
-	unsigned int wdtwqeoi;	/* offset 0x050 */
-	unsigned int wdtwqstar;	/* offset 0x054 */
-	unsigned int wdtwqsta;	/* offset 0x058 */
-	unsigned int wdtwqens;	/* offset 0x05C */
-	unsigned int wdtwqenc;	/* offset 0x060 */
-	unsigned int resv4[39];
-	unsigned int wdt_unfr;	/* offset 0x100 */
-};
-
 /* Timer 32 bit registers */
 struct gptimer {
 	unsigned int tidr;		/* offset 0x00 */
arch/arm/include/asm/arch-omap5/cpu.h +2 -0
index 683d905..d7c46605 100644
@@ -18,6 +18,8 @@
 
 #ifndef __KERNEL_STRICT_NAMES
 #ifndef __ASSEMBLY__
+#include <asm/ti-common/omap_wdt.h>
+
 struct gptimer {
 	u32 tidr;		/* 0x00 r */
 	u8 res1[0xc];
arch/arm/include/asm/ti-common/omap_wdt.h new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.1.4
#3 lore raw

PATCH 1/7 ti: wdt: common: Make the wdt IP defines common for the TI platform

Quoted 1 line · Lukasz Majewski
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/eff45fef/attachment.sig>
#4 lore raw

PATCH 1/7 ti: wdt: common: Make the wdt IP defines common for the TI platform

In reply to Lukasz Majewski
Quoted 2 lines · Lukasz Majewski

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/170f9e03/attachment.sig>
#5 lore raw

PATCH 2/7 ti: wdt: omap5: Define WDT_BASE for omap5+ SoC

In reply to Lukasz Majewski
---
 arch/arm/include/asm/arch-omap5/cpu.h | 1 +
 1 file changed, 1 insertion(+)
arch/arm/include/asm/arch-omap5/cpu.h +1 -0
index d7c46605..26e7417 100644
@@ -46,6 +46,7 @@ struct gptimer {
 /* enable sys_clk NO-prescale /1 */
 #define GPT_EN			((0x0 << 2) | (0x1 << 1) | (0x1 << 0))
 
+#define WDT_BASE                (OMAP54XX_L4_WKUP_BASE + 0x14000)
 /* Watchdog */
 #ifndef __KERNEL_STRICT_NAMES
 #ifndef __ASSEMBLY__
Signature · 1 line
2.1.4
#6 lore raw

PATCH 2/7 ti: wdt: omap5: Define WDT_BASE for omap5+ SoC

Quoted 1 line · Lukasz Majewski
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/bd5a44ae/attachment.sig>
#7 lore raw

PATCH 2/7 ti: wdt: omap5: Define WDT_BASE for omap5+ SoC

In reply to Lukasz Majewski
Quoted 2 lines · Lukasz Majewski

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/a969a168/attachment.sig>
#8 lore raw

PATCH 3/7 ti: wdt: omap: Disable watchdog timer before performing initialization

In reply to Lukasz Majewski

The OMAP WDT IP block requires to be stopped before any write to its registers is performed.

This problem has been thoroughly described in Linux kernel:

"watchdog: omap: assert the counter being stopped before reprogramming:
SHA1: 530c11d432727c697629ad5f9d00ee8e2864d453

---
 drivers/watchdog/omap_wdt.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)
drivers/watchdog/omap_wdt.c +22 -15
index 7ea4b60..7b1f429 100644
@@ -81,10 +81,32 @@ static int omap_wdt_set_timeout(unsigned int timeout)
 	return 0;
 }
 
+void hw_watchdog_disable(void)
+{
+	struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
+
+	/*
+	 * Disable watchdog
+	 */
+	writel(0xAAAA, &wdt->wdtwspr);
+	while (readl(&wdt->wdtwwps) != 0x0)
+		;
+	writel(0x5555, &wdt->wdtwspr);
+	while (readl(&wdt->wdtwwps) != 0x0)
+		;
+}
+
 void hw_watchdog_init(void)
 {
 	struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
 
+	/*
+	 * Make sure the watchdog is disabled. This is unfortunately required
+	 * because writing to various registers with the watchdog running has no
+	 * effect.
+	 */
+	hw_watchdog_disable();
+
 	/* initialize prescaler */
 	while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
 		;
@@ -104,18 +126,3 @@ void hw_watchdog_init(void)
 	while ((readl(&wdt->wdtwwps)) & WDT_WWPS_PEND_WSPR)
 		;
 }
-
-void hw_watchdog_disable(void)
-{
-	struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
-
-	/*
-	 * Disable watchdog
-	 */
-	writel(0xAAAA, &wdt->wdtwspr);
-	while (readl(&wdt->wdtwwps) != 0x0)
-		;
-	writel(0x5555, &wdt->wdtwspr);
-	while (readl(&wdt->wdtwwps) != 0x0)
-		;
-}
Signature · 1 line
2.1.4
#9 lore raw

PATCH 3/7 ti: wdt: omap: Disable watchdog timer before performing initialization

Quoted 9 lines · Lukasz Majewski

The OMAP WDT IP block requires to be stopped before any write to its registers is performed.

This problem has been thoroughly described in Linux kernel:

"watchdog: omap: assert the counter being stopped before reprogramming:
SHA1: 530c11d432727c697629ad5f9d00ee8e2864d453

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/aa524682/attachment.sig>
#10 lore raw

PATCH 3/7 ti: wdt: omap: Disable watchdog timer before performing initialization

Hi Tom,

Quoted 5 lines · Lukasz Majewski
Quoted 4 lines

The OMAP WDT IP block requires to be stopped before any write to its registers is performed.

Quoted 9 lines
Quoted 6 lines

This problem has been thoroughly described in Linux kernel:

"watchdog: omap: assert the counter being stopped before
reprogramming: SHA1: 530c11d432727c697629ad5f9d00ee8e2864d453

Could this patch be applied alone? Preparing reset of this patch set is a bit more tricky (since includes verbose testing).

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170407/3c510264/attachment.sig>

#11 lore raw

PATCH 3/7 ti: wdt: omap: Disable watchdog timer before performing initialization

In reply to Lukasz Majewski
Quoted 10 lines · Lukasz Majewski

The OMAP WDT IP block requires to be stopped before any write to its registers is performed.

This problem has been thoroughly described in Linux kernel:

"watchdog: omap: assert the counter being stopped before reprogramming:
SHA1: 530c11d432727c697629ad5f9d00ee8e2864d453

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: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170410/cc718b9e/attachment.sig>
#12 lore raw

PATCH 4/7 ti: wdt: hwinit-common: Remove legacy watchdog disable code

In reply to Lukasz Majewski

This patch removes some legacy code inherited from omap4. It is redundant to the code already available in ./drivers/watchdog/omap_wdt.c

The code dates back to 2010:
"ARMV7: Add basic support for TI OMAP4"
SHA1: d34efc767d26d353e0257042080eec7012e5440f

In contemporary u-boot omap watchdog:
- Can be enabled in SPL:
TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)

- Is explicitly disabled before making any changes of its registers

- Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with other architectures.

This patch removes silent watchdog disable on TI platform, which caused lack of wdt protection in u-boot even when it was explicitly enabled (in SPL) with CONFIG_HW_WATCHDOG.

---
 arch/arm/mach-omap2/hwinit-common.c | 27 ---------------------------
 1 file changed, 27 deletions(-)
arch/arm/mach-omap2/hwinit-common.c +0 -27
index f317293..d6549d3 100644
@@ -150,7 +150,6 @@ void early_system_init(void)
 	if (warm_reset())
 		force_emif_self_refresh();
 #endif
-	watchdog_init();
 	set_mux_conf_regs();
 #ifdef CONFIG_SPL_BUILD
 	srcomp_enable();
@@ -181,32 +180,6 @@ int arch_cpu_init_dm(void)
 }
 
 /*
- * Routine: wait_for_command_complete
- * Description: Wait for posting to finish on watchdog
- */
-void wait_for_command_complete(struct watchdog *wd_base)
-{
-	int pending = 1;
-	do {
-		pending = readl(&wd_base->wwps);
-	} while (pending);
-}
-
-/*
- * Routine: watchdog_init
- * Description: Shut down watch dogs
- */
-void watchdog_init(void)
-{
-	struct watchdog *wd2_base = (struct watchdog *)WDT2_BASE;
-
-	writel(WD_UNLOCK1, &wd2_base->wspr);
-	wait_for_command_complete(wd2_base);
-	writel(WD_UNLOCK2, &wd2_base->wspr);
-}
-
-
-/*
  * This function finds the SDRAM size available in the system
  * based on DMM section configurations
  * This is needed because the size of memory installed may be
Signature · 1 line
2.1.4
#13 lore raw

PATCH 4/7 ti: wdt: hwinit-common: Remove legacy watchdog disable code

Quoted 13 lines · Lukasz Majewski

This patch removes some legacy code inherited from omap4. It is redundant to the code already available in ./drivers/watchdog/omap_wdt.c

The code dates back to 2010:
"ARMV7: Add basic support for TI OMAP4"
SHA1: d34efc767d26d353e0257042080eec7012e5440f

In contemporary u-boot omap watchdog:
- Can be enabled in SPL:
TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)

- Is explicitly disabled before making any changes of its registers

Quoted 8 lines

- Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with other architectures.

This patch removes silent watchdog disable on TI platform, which caused lack of wdt protection in u-boot even when it was explicitly enabled (in SPL) with CONFIG_HW_WATCHDOG.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/f1a280c1/attachment.sig>
#14 lore raw

PATCH 4/7 ti: wdt: hwinit-common: Remove legacy watchdog disable code

In reply to Lukasz Majewski
Quoted 13 lines · Lukasz Majewski

This patch removes some legacy code inherited from omap4. It is redundant to the code already available in ./drivers/watchdog/omap_wdt.c

The code dates back to 2010:
"ARMV7: Add basic support for TI OMAP4"
SHA1: d34efc767d26d353e0257042080eec7012e5440f

In contemporary u-boot omap watchdog:
- Can be enabled in SPL:
TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)

- Is explicitly disabled before making any changes of its registers

Quoted 8 lines

- Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with other architectures.

This patch removes silent watchdog disable on TI platform, which caused lack of wdt protection in u-boot even when it was explicitly enabled (in SPL) with CONFIG_HW_WATCHDOG.

Can you remove similar code from arch/arm/mach-omap2/am33xx/board.c also?

Thanks and regards,
Lokesh

#15 lore raw

PATCH 4/7 ti: wdt: hwinit-common: Remove legacy watchdog disable code

Quoted 21 lines · On Mon, 20 Feb 2017 12:12:05 +0530 Lokesh Vutla <[email protected]> wrote:
Quoted 18 lines · Lukasz Majewski

This patch removes some legacy code inherited from omap4. It is redundant to the code already available
in ./drivers/watchdog/omap_wdt.c

The code dates back to 2010:
"ARMV7: Add basic support for TI OMAP4"
SHA1: d34efc767d26d353e0257042080eec7012e5440f

In contemporary u-boot omap watchdog:
- Can be enabled in SPL:
TI watchdog is initialized in spl_board_init() (call to hw_watchdog_init)

- Is explicitly disabled before making any changes of its registers

- Is re-enabled in init_func_watchdog_init() in ./common/board_f.c with other architectures.

Quoted 8 lines
Quoted 5 lines

This patch removes silent watchdog disable on TI platform, which caused lack of wdt protection in u-boot even when it was explicitly enabled (in SPL) with CONFIG_HW_WATCHDOG.

Can you remove similar code from arch/arm/mach-omap2/am33xx/board.c also?

Ok, I will do it (and test on BBB).

Please test/review other patches :-)

Quoted 4 lines

Thanks and regards,
Lokesh

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#16 lore raw

PATCH 5/7 ti: wdt: omap5: Remove not needed struct watchdog definition

In reply to Lukasz Majewski

After removal of watchdog_init() redundant code from arch/arm/cpu/armv7/omap-common/hwinit-common.c, this structure is not needed anymore.

---
 arch/arm/include/asm/arch-omap5/cpu.h | 14 --------------
 1 file changed, 14 deletions(-)
arch/arm/include/asm/arch-omap5/cpu.h +0 -14
index 26e7417..de6c4e2 100644
@@ -47,20 +47,6 @@ struct gptimer {
 #define GPT_EN			((0x0 << 2) | (0x1 << 1) | (0x1 << 0))
 
 #define WDT_BASE                (OMAP54XX_L4_WKUP_BASE + 0x14000)
-/* Watchdog */
-#ifndef __KERNEL_STRICT_NAMES
-#ifndef __ASSEMBLY__
-struct watchdog {
-	u8 res1[0x34];
-	u32 wwps;		/* 0x34 r */
-	u8 res2[0x10];
-	u32 wspr;		/* 0x48 rw */
-};
-#endif /* __ASSEMBLY__ */
-#endif /* __KERNEL_STRICT_NAMES */
-
-#define WD_UNLOCK1		0xAAAA
-#define WD_UNLOCK2		0x5555
 
 #define TCLR_ST			(0x1 << 0)
 #define TCLR_AR			(0x1 << 1)
Signature · 1 line
2.1.4
#17 lore raw

PATCH 5/7 ti: wdt: omap5: Remove not needed struct watchdog definition

Quoted 5 lines · Lukasz Majewski

After removal of watchdog_init() redundant code from arch/arm/cpu/armv7/omap-common/hwinit-common.c, this structure is not needed anymore.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/1dcaee16/attachment.sig>
#18 lore raw

PATCH 6/7 ti: wdt: omap: Use CONFIG_HW_WATCHDOG_TIMEOUT_MS to specify watchdog timeout

In reply to Lukasz Majewski

Now it is possible to specify in the config file the time after which watchdog will trigger.

The flag itself has been reused from designware watchdog code (./drivers/watchdog/designware_wdt.c).

---
 drivers/watchdog/omap_wdt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/watchdog/omap_wdt.c +5 -3
index 7b1f429..5a2126b 100644
@@ -45,7 +45,9 @@
 #include <asm/arch/cpu.h>
 
 /* Hardware timeout in seconds */
-#define WDT_HW_TIMEOUT 60
+#ifndef CONFIG_HW_WATCHDOG_TIMEOUT_MS
+#define CONFIG_HW_WATCHDOG_TIMEOUT_MS 60000
+#endif
 
 static unsigned int wdt_trgr_pattern = 0x1234;
 
@@ -68,7 +70,7 @@ void hw_watchdog_reset(void)
 static int omap_wdt_set_timeout(unsigned int timeout)
 {
 	struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
-	u32 pre_margin = GET_WLDR_VAL(timeout);
+	u32 pre_margin = GET_WLDR_VAL(timeout / 1000);
 
 	/* just count up at 32 KHz */
 	while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WLDR)
@@ -115,7 +117,7 @@ void hw_watchdog_init(void)
 	while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
 		;
 
-	omap_wdt_set_timeout(WDT_HW_TIMEOUT);
+	omap_wdt_set_timeout(CONFIG_HW_WATCHDOG_TIMEOUT_MS);
 
 	/* Sequence to enable the watchdog */
 	writel(0xBBBB, &wdt->wdtwspr);
Signature · 1 line
2.1.4
#19 lore raw

PATCH 6/7 ti: wdt: omap: Use CONFIG_HW_WATCHDOG_TIMEOUT_MS to specify watchdog timeout

Quoted 16 lines · Lukasz Majewski

Now it is possible to specify in the config file the time after which watchdog will trigger.

The flag itself has been reused from designware watchdog code (./drivers/watchdog/designware_wdt.c).

---
 drivers/watchdog/omap_wdt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/watchdog/omap_wdt.c +0 -0
index 7b1f429..5a2126b 100644

drivers/watchdog/omap_wdt.c line 50

Quoted 7 lines
drivers/watchdog/omap_wdt.c +3 -1
@@ -45,7 +45,9 @@
 #include <asm/arch/cpu.h>
 
 /* Hardware timeout in seconds */
-#define WDT_HW_TIMEOUT 60
+#ifndef CONFIG_HW_WATCHDOG_TIMEOUT_MS
+#define CONFIG_HW_WATCHDOG_TIMEOUT_MS 60000
+#endif

Please migrate CONFIG_HW_WATCHDOG_TIMEOUT_MS to Kconfig, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/9c0f61dc/attachment.sig>
#20 lore raw

PATCH 7/7 ti: wdt: Enable OMAP watchdog in u-boot's board_f.c

In reply to Lukasz Majewski

The init_func_watchdog_init called in u-boot's board_f.c's init_sequence is responsible for enabling WDT in u-boot and notify user about it.

Several other architectures have adopted it for this purpose. This code does the same with OMAP watchdog.

---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
index ae6cd85..5dd56a4 100644
@@ -120,7 +120,7 @@ static int init_func_watchdog_init(void)
 	defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
 	defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
 	defined(CONFIG_DESIGNWARE_WATCHDOG) || \
-	defined(CONFIG_IMX_WATCHDOG))
+	defined(CONFIG_IMX_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG))
 	hw_watchdog_init();
 	puts("       Watchdog enabled\n");
 # endif
Signature · 1 line
2.1.4
#21 lore raw

PATCH 7/7 ti: wdt: Enable OMAP watchdog in u-boot's board_f.c

Quoted 16 lines · Lukasz Majewski

The init_func_watchdog_init called in u-boot's board_f.c's init_sequence is responsible for enabling WDT in u-boot and notify user about it.

Several other architectures have adopted it for this purpose. This code does the same with OMAP watchdog.

---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +0 -0
index ae6cd85..5dd56a4 100644

common/board_f.c static int init_func_watchdog_init(void) · line 123

Quoted 5 lines
common/board_f.c +1 -1
@@ -120,7 +120,7 @@ static int init_func_watchdog_init(void)
 	defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
 	defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
 	defined(CONFIG_DESIGNWARE_WATCHDOG) || \
-	defined(CONFIG_IMX_WATCHDOG))
+	defined(CONFIG_IMX_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG))

Please introduce a new symbol here with a reasonable name and select it on the various platforms, then make OMAP also select it. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170219/710d27ad/attachment-0001.sig>
#22 lore raw

PATCH 7/7 ti: wdt: Enable OMAP watchdog in u-boot's board_f.c

Hi Tom,

Quoted 13 lines · Lukasz Majewski
Quoted 12 lines

The init_func_watchdog_init called in u-boot's board_f.c's init_sequence is responsible for enabling WDT in u-boot and notify user about it.

Several other architectures have adopted it for this purpose. This code does the same with OMAP watchdog.

---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

common/board_f.c static int init_func_watchdog_init(void) · line 124

Quoted 11 lines
common/board_f.c +1 -1
index ae6cd85..5dd56a4 100644
@@ -120,7 +120,7 @@ static int init_func_watchdog_init(void)
 	defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
 	defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) ||
 \ defined(CONFIG_DESIGNWARE_WATCHDOG) || \
-	defined(CONFIG_IMX_WATCHDOG))
+	defined(CONFIG_IMX_WATCHDOG) ||
 defined(CONFIG_OMAP_WATCHDOG))

Please introduce a new symbol here with a reasonable name and select it on the various platforms, then make OMAP also select it. Thanks!

Something similar to CONFIG_SPL_HW_WATCHDOG bu for u-boot?

That would be something like CONFIG_HW_WATCHDOG_INIT ...

Quoted 1 line

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170220/223e3747/attachment.sig>

#23 lore raw

PATCH 7/7 ti: wdt: Enable OMAP watchdog in u-boot's board_f.c

Quoted 30 lines · Lukasz Majewski

Hi Tom,

Quoted 13 lines · Lukasz Majewski
Quoted 12 lines

The init_func_watchdog_init called in u-boot's board_f.c's init_sequence is responsible for enabling WDT in u-boot and notify user about it.

Several other architectures have adopted it for this purpose. This code does the same with OMAP watchdog.

---
 common/board_f.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

common/board_f.c static int init_func_watchdog_init(void) · line 124

Quoted 11 lines
common/board_f.c +1 -1
index ae6cd85..5dd56a4 100644
@@ -120,7 +120,7 @@ static int init_func_watchdog_init(void)
 	defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
 	defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) ||
 \ defined(CONFIG_DESIGNWARE_WATCHDOG) || \
-	defined(CONFIG_IMX_WATCHDOG))
+	defined(CONFIG_IMX_WATCHDOG) ||
 defined(CONFIG_OMAP_WATCHDOG))

Please introduce a new symbol here with a reasonable name and select it on the various platforms, then make OMAP also select it. Thanks!

Quoted 3 lines

Something similar to CONFIG_SPL_HW_WATCHDOG bu for u-boot?

That would be something like CONFIG_HW_WATCHDOG_INIT ...

CONFIG_HW_WATCHDOG_INIT sounds good, thanks!

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