linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] watchdog: s3c2410: Fixes and improvements
@ 2017-02-24 15:11 Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines Krzysztof Kozlowski
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

Hi,

Minor cleanup and some fixes for the watchdog used on all
Samsung SoCs.

The patches are independent of each other - DTS will go through
separate (my) tree.


Best regards,
Krzysztof

Krzysztof Kozlowski (8):
  watchdog: s3c2410: Remove confusing CONFIG prefix from local defines
  watchdog: s3c2410: Fix infinite interrupt in soft mode
  ARM: dts: exynos: Fix watchdog reset on Exynos4412
  ARM: dts: s3c64xx: Enable watchdog on all S3C64xx boards
  ARM: dts: exynos: Enable watchdog on all Exynos4 boards
  ARM: dts: exynos: Fix infinite interrupt in soft mode on Exynos5440
  ARM: dts: s3c64xx: Fix infinite interrupt in soft mode
  ARM: dts: s5pv210: Fix infinite interrupt in soft mode

 .../devicetree/bindings/watchdog/samsung-wdt.txt   |  9 +++---
 arch/arm/boot/dts/exynos4.dtsi                     |  9 ------
 arch/arm/boot/dts/exynos4210-origen.dts            |  4 ---
 arch/arm/boot/dts/exynos4210.dtsi                  |  8 +++++
 arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi    |  4 ---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi    |  4 ---
 arch/arm/boot/dts/exynos4412-origen.dts            |  4 ---
 arch/arm/boot/dts/exynos4412.dtsi                  |  9 ++++++
 arch/arm/boot/dts/exynos5440.dtsi                  |  2 +-
 arch/arm/boot/dts/s3c64xx.dtsi                     |  3 +-
 arch/arm/boot/dts/s5pv210.dtsi                     |  2 +-
 drivers/watchdog/s3c2410_wdt.c                     | 37 +++++++++++++++-------
 12 files changed, 51 insertions(+), 44 deletions(-)

-- 
2.9.3

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

* [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:32   ` Guenter Roeck
  2017-02-24 15:11 ` [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

The CONFIG prefix from defines in the s3c2410_wdt.c might suggest that
these constants come from Kconfig.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/watchdog/s3c2410_wdt.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 59e95762a6de..3e216f54cb6f 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -64,8 +64,8 @@
 #define S3C2410_WTCON_PRESCALE_MASK	(0xff << 8)
 #define S3C2410_WTCON_PRESCALE_MAX	0xff
 
-#define CONFIG_S3C2410_WATCHDOG_ATBOOT		(0)
-#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME	(15)
+#define S3C2410_WATCHDOG_ATBOOT		(0)
+#define S3C2410_WATCHDOG_DEFAULT_TIME	(15)
 
 #define EXYNOS5_RST_STAT_REG_OFFSET		0x0404
 #define EXYNOS5_WDT_DISABLE_REG_OFFSET		0x0408
@@ -79,7 +79,7 @@
 
 static bool nowayout	= WATCHDOG_NOWAYOUT;
 static int tmr_margin;
-static int tmr_atboot	= CONFIG_S3C2410_WATCHDOG_ATBOOT;
+static int tmr_atboot	= S3C2410_WATCHDOG_ATBOOT;
 static int soft_noboot;
 static int debug;
 
@@ -90,10 +90,10 @@ module_param(soft_noboot, int, 0);
 module_param(debug,	  int, 0);
 
 MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. (default="
-		__MODULE_STRING(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME) ")");
+		__MODULE_STRING(S3C2410_WATCHDOG_DEFAULT_TIME) ")");
 MODULE_PARM_DESC(tmr_atboot,
 		"Watchdog is started at boot time if set to 1, default="
-			__MODULE_STRING(CONFIG_S3C2410_WATCHDOG_ATBOOT));
+			__MODULE_STRING(S3C2410_WATCHDOG_ATBOOT));
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
 			__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
@@ -406,7 +406,7 @@ static struct watchdog_ops s3c2410wdt_ops = {
 static struct watchdog_device s3c2410_wdd = {
 	.info = &s3c2410_wdt_ident,
 	.ops = &s3c2410wdt_ops,
-	.timeout = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME,
+	.timeout = S3C2410_WATCHDOG_DEFAULT_TIME,
 };
 
 /* interrupt handler code */
@@ -600,12 +600,12 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
 					wdt->wdt_device.timeout);
 	if (ret) {
 		started = s3c2410wdt_set_heartbeat(&wdt->wdt_device,
-					CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
+					S3C2410_WATCHDOG_DEFAULT_TIME);
 
 		if (started == 0)
 			dev_info(dev,
 			   "tmr_margin value out of range, default %d used\n",
-			       CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
+			       S3C2410_WATCHDOG_DEFAULT_TIME);
 		else
 			dev_info(dev, "default timer value is out of range, "
 							"cannot start\n");
-- 
2.9.3

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

* [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:37   ` Guenter Roeck
  2017-02-28  1:12   ` Rob Herring
  2017-02-24 15:11 ` [PATCH 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412 Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
of an interrupt.  However the interrupt itself was not cleared thus on
first hit, the system enters infinite interrupt handling loop.

On Odroid U3 (Exynos4412), when booted with s3c2410_wdt.soft_noboot=1
argument the console is flooded:
	# killall -9 watchdog
	[   60.523760] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
	[   60.536744] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)

Fix this by writing something to the WTCLRINT register to clear the
interrupt.  The register WTCLRINT however appeared in S3C6410 so a new
watchdog quirk and flavor are needed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

I was thinking about CC-ing stable, especially when I thought about
adding unconditional WTCLRINT clear.  However it appears that S3C2410
does not have the WTCLRINT register, this a new chip flavor has to be
added.  This makes the fix spread over driver and DTS changes.

Worth adding:
	Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
?
---
 .../devicetree/bindings/watchdog/samsung-wdt.txt    |  9 +++++----
 drivers/watchdog/s3c2410_wdt.c                      | 21 ++++++++++++++++++---
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
index 8f3d96af81d7..1f6e101e299a 100644
--- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
@@ -6,10 +6,11 @@ occurred.
 
 Required properties:
 - compatible : should be one among the following
-	(a) "samsung,s3c2410-wdt" for Exynos4 and previous SoCs
-	(b) "samsung,exynos5250-wdt" for Exynos5250
-	(c) "samsung,exynos5420-wdt" for Exynos5420
-	(c) "samsung,exynos7-wdt" for Exynos7
+	- "samsung,s3c2410-wdt" for S3C2410
+	- "samsung,s3c6410-wdt" for S3C6410, S5PV210 and Exynos4
+	- "samsung,exynos5250-wdt" for Exynos5250
+	- "samsung,exynos5420-wdt" for Exynos5420
+	- "samsung,exynos7-wdt" for Exynos7
 
 - reg : base physical address of the controller and length of memory mapped
 	region.
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 3e216f54cb6f..7db7847a005c 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -46,6 +46,7 @@
 #define S3C2410_WTCON		0x00
 #define S3C2410_WTDAT		0x04
 #define S3C2410_WTCNT		0x08
+#define S3C2410_WTCLRINT	0x0c
 
 #define S3C2410_WTCNT_MAXCNT	0xffff
 
@@ -72,6 +73,7 @@
 #define EXYNOS5_WDT_MASK_RESET_REG_OFFSET	0x040c
 #define QUIRK_HAS_PMU_CONFIG			(1 << 0)
 #define QUIRK_HAS_RST_STAT			(1 << 1)
+#define QUIRK_HAS_WTCLRINT_REG			(1 << 2)
 
 /* These quirks require that we have a PMU register map */
 #define QUIRKS_HAVE_PMUREG			(QUIRK_HAS_PMU_CONFIG | \
@@ -143,13 +145,18 @@ static const struct s3c2410_wdt_variant drv_data_s3c2410 = {
 };
 
 #ifdef CONFIG_OF
+static const struct s3c2410_wdt_variant drv_data_s3c6410 = {
+	.quirks = QUIRK_HAS_WTCLRINT_REG,
+};
+
 static const struct s3c2410_wdt_variant drv_data_exynos5250  = {
 	.disable_reg = EXYNOS5_WDT_DISABLE_REG_OFFSET,
 	.mask_reset_reg = EXYNOS5_WDT_MASK_RESET_REG_OFFSET,
 	.mask_bit = 20,
 	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
 	.rst_stat_bit = 20,
-	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT,
+	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT \
+		  | QUIRK_HAS_WTCLRINT_REG,
 };
 
 static const struct s3c2410_wdt_variant drv_data_exynos5420 = {
@@ -158,7 +165,8 @@ static const struct s3c2410_wdt_variant drv_data_exynos5420 = {
 	.mask_bit = 0,
 	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
 	.rst_stat_bit = 9,
-	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT,
+	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT \
+		  | QUIRK_HAS_WTCLRINT_REG,
 };
 
 static const struct s3c2410_wdt_variant drv_data_exynos7 = {
@@ -167,12 +175,15 @@ static const struct s3c2410_wdt_variant drv_data_exynos7 = {
 	.mask_bit = 23,
 	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
 	.rst_stat_bit = 23,	/* A57 WDTRESET */
-	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT,
+	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT \
+		  | QUIRK_HAS_WTCLRINT_REG,
 };
 
 static const struct of_device_id s3c2410_wdt_match[] = {
 	{ .compatible = "samsung,s3c2410-wdt",
 	  .data = &drv_data_s3c2410 },
+	{ .compatible = "samsung,s3c6410-wdt",
+	  .data = &drv_data_s3c6410 },
 	{ .compatible = "samsung,exynos5250-wdt",
 	  .data = &drv_data_exynos5250 },
 	{ .compatible = "samsung,exynos5420-wdt",
@@ -418,6 +429,10 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param)
 	dev_info(wdt->dev, "watchdog timer expired (irq)\n");
 
 	s3c2410wdt_keepalive(&wdt->wdt_device);
+
+	if (wdt->drv_data->quirks & QUIRK_HAS_WTCLRINT_REG)
+		writel(0x1, wdt->reg_base + S3C2410_WTCLRINT);
+
 	return IRQ_HANDLED;
 }
 
-- 
2.9.3

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

* [PATCH 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:25   ` Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 4/8] ARM: dts: s3c64xx: Enable watchdog on all S3C64xx boards Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

The Exynos4412 has the same watchdog as newer SoCs (e.g. Exynos5250).
Just like the others, for working it requires additional steps in Power
Management Unit: unmasking the reset request and enabling the system
reset.  Without these additional steps in PMU, the watchdog will not be
able to reset the system on expiration event.

Change the compatible of Exynos4412 watchdog device node to
samsung,exynos5250-wdt which includes the additional PMU steps.

This will also fix infinite watchdog interrupt in soft mode (lack of
interrupt clear) because it is also included in samsung,exynos5250-wdt.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/arm/boot/dts/exynos4.dtsi    |  9 ---------
 arch/arm/boot/dts/exynos4210.dtsi |  9 +++++++++
 arch/arm/boot/dts/exynos4412.dtsi | 10 ++++++++++
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index 18def1c774d5..71e2cdae6068 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -283,15 +283,6 @@
 		};
 	};
 
-	watchdog: watchdog@10060000 {
-		compatible = "samsung,s3c2410-wdt";
-		reg = <0x10060000 0x100>;
-		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&clock CLK_WDT>;
-		clock-names = "watchdog";
-		status = "disabled";
-	};
-
 	rtc: rtc@10070000 {
 		compatible = "samsung,s3c6410-rtc";
 		reg = <0x10070000 0x100>;
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index f9408188f97f..e126357aba9a 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -119,6 +119,15 @@
 		};
 	};
 
+	watchdog: watchdog@10060000 {
+		compatible = "samsung,s3c6410-wdt";
+		reg = <0x10060000 0x100>;
+		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&clock CLK_WDT>;
+		clock-names = "watchdog";
+		status = "disabled";
+	};
+
 	clock: clock-controller@10030000 {
 		compatible = "samsung,exynos4210-clock";
 		reg = <0x10030000 0x20000>;
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index 235bbb69ad7c..6f47988a1ab5 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -215,6 +215,16 @@
 		};
 	};
 
+	watchdog: watchdog@10060000 {
+		compatible = "samsung,exynos5250-wdt";
+		reg = <0x10060000 0x100>;
+		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&clock CLK_WDT>;
+		clock-names = "watchdog";
+		samsung,syscon-phandle = <&pmu_system_controller>;
+		status = "disabled";
+	};
+
 	adc: adc@126C0000 {
 		compatible = "samsung,exynos-adc-v1";
 		reg = <0x126C0000 0x100>;
-- 
2.9.3

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

* [PATCH 4/8] ARM: dts: s3c64xx: Enable watchdog on all S3C64xx boards
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2017-02-24 15:11 ` [PATCH 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412 Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 5/8] ARM: dts: exynos: Enable watchdog on all Exynos4 boards Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

Watchdog module does not have external dependencies so it can be safely
enabled in s3c64xx.dtsi thus making it available for all S3C64xx-based
boards.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/arm/boot/dts/s3c64xx.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi
index 0ccb414cd268..6caec5f27d38 100644
--- a/arch/arm/boot/dts/s3c64xx.dtsi
+++ b/arch/arm/boot/dts/s3c64xx.dtsi
@@ -100,7 +100,6 @@
 			interrupts = <26>;
 			clock-names = "watchdog";
 			clocks = <&clocks PCLK_WDT>;
-			status = "disabled";
 		};
 
 		i2c0: i2c@7f004000 {
-- 
2.9.3

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

* [PATCH 5/8] ARM: dts: exynos: Enable watchdog on all Exynos4 boards
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2017-02-24 15:11 ` [PATCH 4/8] ARM: dts: s3c64xx: Enable watchdog on all S3C64xx boards Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 6/8] ARM: dts: exynos: Fix infinite interrupt in soft mode on Exynos5440 Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

Watchdog module does not have external dependencies so it can be safely
enabled in exynos4.dtsi thus making it available for all Exynos4-based
boards.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/arm/boot/dts/exynos4210-origen.dts         | 4 ----
 arch/arm/boot/dts/exynos4210.dtsi               | 1 -
 arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi | 4 ----
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 4 ----
 arch/arm/boot/dts/exynos4412-origen.dts         | 4 ----
 arch/arm/boot/dts/exynos4412.dtsi               | 1 -
 6 files changed, 18 deletions(-)

diff --git a/arch/arm/boot/dts/exynos4210-origen.dts b/arch/arm/boot/dts/exynos4210-origen.dts
index a2c6a13fe67b..312650e2450f 100644
--- a/arch/arm/boot/dts/exynos4210-origen.dts
+++ b/arch/arm/boot/dts/exynos4210-origen.dts
@@ -328,7 +328,3 @@
 &tmu {
 	status = "okay";
 };
-
-&watchdog {
-	status = "okay";
-};
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index e126357aba9a..e6e62103a71f 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -125,7 +125,6 @@
 		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&clock CLK_WDT>;
 		clock-names = "watchdog";
-		status = "disabled";
 	};
 
 	clock: clock-controller@10030000 {
diff --git a/arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi b/arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi
index a36cd36a26b8..4cd62487bb16 100644
--- a/arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi
+++ b/arch/arm/boot/dts/exynos4412-itop-scp-core.dtsi
@@ -495,7 +495,3 @@
 	vtmu-supply = <&ldo16_reg>;
 	status = "okay";
 };
-
-&watchdog {
-	status = "okay";
-};
diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index 78f118cb73d4..0f1ff792fe44 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -555,7 +555,3 @@
 	vtmu-supply = <&ldo10_reg>;
 	status = "okay";
 };
-
-&watchdog {
-	status = "okay";
-};
diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts
index a1ab6f94bb64..7a83e2df18a6 100644
--- a/arch/arm/boot/dts/exynos4412-origen.dts
+++ b/arch/arm/boot/dts/exynos4412-origen.dts
@@ -541,7 +541,3 @@
 &serial_3 {
 	status = "okay";
 };
-
-&watchdog {
-	status = "okay";
-};
diff --git a/arch/arm/boot/dts/exynos4412.dtsi b/arch/arm/boot/dts/exynos4412.dtsi
index 6f47988a1ab5..cc69466f17c0 100644
--- a/arch/arm/boot/dts/exynos4412.dtsi
+++ b/arch/arm/boot/dts/exynos4412.dtsi
@@ -222,7 +222,6 @@
 		clocks = <&clock CLK_WDT>;
 		clock-names = "watchdog";
 		samsung,syscon-phandle = <&pmu_system_controller>;
-		status = "disabled";
 	};
 
 	adc: adc@126C0000 {
-- 
2.9.3

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

* [PATCH 6/8] ARM: dts: exynos: Fix infinite interrupt in soft mode on Exynos5440
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2017-02-24 15:11 ` [PATCH 5/8] ARM: dts: exynos: Enable watchdog on all Exynos4 boards Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 7/8] ARM: dts: s3c64xx: Fix infinite interrupt in soft mode Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 8/8] ARM: dts: s5pv210: " Krzysztof Kozlowski
  7 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
of an interrupt.  The interrupt has to be cleared, because otherwise
system enters infinite interrupt handling loop.

Use a samsung,s3c6410-wdt compatible to select appropriate quirk for
clearing the watchdog interrupt.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/arm/boot/dts/exynos5440.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos5440.dtsi b/arch/arm/boot/dts/exynos5440.dtsi
index 77d35bb92950..abfe054b2187 100644
--- a/arch/arm/boot/dts/exynos5440.dtsi
+++ b/arch/arm/boot/dts/exynos5440.dtsi
@@ -189,7 +189,7 @@
 	};
 
 	watchdog@110000 {
-		compatible = "samsung,s3c2410-wdt";
+		compatible = "samsung,s3c6410-wdt";
 		reg = <0x110000 0x1000>;
 		interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&clock CLK_B_125>;
-- 
2.9.3

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

* [PATCH 7/8] ARM: dts: s3c64xx: Fix infinite interrupt in soft mode
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2017-02-24 15:11 ` [PATCH 6/8] ARM: dts: exynos: Fix infinite interrupt in soft mode on Exynos5440 Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  2017-02-24 15:11 ` [PATCH 8/8] ARM: dts: s5pv210: " Krzysztof Kozlowski
  7 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
of an interrupt.  The interrupt has to be cleared, because otherwise
system enters infinite interrupt handling loop.

Use a samsung,s3c6410-wdt compatible to select appropriate quirk for
clearing the watchdog interrupt.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/arm/boot/dts/s3c64xx.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/s3c64xx.dtsi b/arch/arm/boot/dts/s3c64xx.dtsi
index 6caec5f27d38..c55cbb3af2c0 100644
--- a/arch/arm/boot/dts/s3c64xx.dtsi
+++ b/arch/arm/boot/dts/s3c64xx.dtsi
@@ -94,7 +94,7 @@
 		};
 
 		watchdog: watchdog@7e004000 {
-			compatible = "samsung,s3c2410-wdt";
+			compatible = "samsung,s3c6410-wdt";
 			reg = <0x7e004000 0x1000>;
 			interrupt-parent = <&vic0>;
 			interrupts = <26>;
-- 
2.9.3

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

* [PATCH 8/8] ARM: dts: s5pv210: Fix infinite interrupt in soft mode
  2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2017-02-24 15:11 ` [PATCH 7/8] ARM: dts: s3c64xx: Fix infinite interrupt in soft mode Krzysztof Kozlowski
@ 2017-02-24 15:11 ` Krzysztof Kozlowski
  7 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:11 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
of an interrupt.  The interrupt has to be cleared, because otherwise
system enters infinite interrupt handling loop.

Use a samsung,s3c6410-wdt compatible to select appropriate quirk for
clearing the watchdog interrupt.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 arch/arm/boot/dts/s5pv210.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
index a853918be43f..726c5d0dbd5b 100644
--- a/arch/arm/boot/dts/s5pv210.dtsi
+++ b/arch/arm/boot/dts/s5pv210.dtsi
@@ -310,7 +310,7 @@
 		};
 
 		watchdog: watchdog@e2700000 {
-			compatible = "samsung,s3c2410-wdt";
+			compatible = "samsung,s3c6410-wdt";
 			reg = <0xe2700000 0x1000>;
 			interrupt-parent = <&vic0>;
 			interrupts = <26>;
-- 
2.9.3

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

* Re: [PATCH 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412
  2017-02-24 15:11 ` [PATCH 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412 Krzysztof Kozlowski
@ 2017-02-24 15:25   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 15:25 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

On Fri, Feb 24, 2017 at 05:11:17PM +0200, Krzysztof Kozlowski wrote:
> The Exynos4412 has the same watchdog as newer SoCs (e.g. Exynos5250).
> Just like the others, for working it requires additional steps in Power
> Management Unit: unmasking the reset request and enabling the system
> reset.  Without these additional steps in PMU, the watchdog will not be
> able to reset the system on expiration event.
> 
> Change the compatible of Exynos4412 watchdog device node to
> samsung,exynos5250-wdt which includes the additional PMU steps.
> 
> This will also fix infinite watchdog interrupt in soft mode (lack of
> interrupt clear) because it is also included in samsung,exynos5250-wdt.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  arch/arm/boot/dts/exynos4.dtsi    |  9 ---------
>  arch/arm/boot/dts/exynos4210.dtsi |  9 +++++++++
>  arch/arm/boot/dts/exynos4412.dtsi | 10 ++++++++++
>  3 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
> index 18def1c774d5..71e2cdae6068 100644
> --- a/arch/arm/boot/dts/exynos4.dtsi
> +++ b/arch/arm/boot/dts/exynos4.dtsi
> @@ -283,15 +283,6 @@
>  		};
>  	};
>  
> -	watchdog: watchdog@10060000 {
> -		compatible = "samsung,s3c2410-wdt";
> -		reg = <0x10060000 0x100>;
> -		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
> -		clocks = <&clock CLK_WDT>;
> -		clock-names = "watchdog";
> -		status = "disabled";
> -	};
> -
>  	rtc: rtc@10070000 {
>  		compatible = "samsung,s3c6410-rtc";
>  		reg = <0x10070000 0x100>;
> diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
> index f9408188f97f..e126357aba9a 100644
> --- a/arch/arm/boot/dts/exynos4210.dtsi
> +++ b/arch/arm/boot/dts/exynos4210.dtsi
> @@ -119,6 +119,15 @@
>  		};
>  	};
>  
> +	watchdog: watchdog@10060000 {
> +		compatible = "samsung,s3c6410-wdt";

My mistake - here it should still remain at samsung,s3c2410-wdt because
I am just copying existing nodes to Exynso4210. The compatible should be
changed in patch 6/8.


Best regards,
Krzysztof

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

* Re: [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines
  2017-02-24 15:11 ` [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines Krzysztof Kozlowski
@ 2017-02-24 15:32   ` Guenter Roeck
  0 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 15:32 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

On 02/24/2017 07:11 AM, Krzysztof Kozlowski wrote:
> The CONFIG prefix from defines in the s3c2410_wdt.c might suggest that
> these constants come from Kconfig.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/s3c2410_wdt.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 59e95762a6de..3e216f54cb6f 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -64,8 +64,8 @@
>  #define S3C2410_WTCON_PRESCALE_MASK	(0xff << 8)
>  #define S3C2410_WTCON_PRESCALE_MAX	0xff
>
> -#define CONFIG_S3C2410_WATCHDOG_ATBOOT		(0)
> -#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME	(15)
> +#define S3C2410_WATCHDOG_ATBOOT		(0)
> +#define S3C2410_WATCHDOG_DEFAULT_TIME	(15)
>
>  #define EXYNOS5_RST_STAT_REG_OFFSET		0x0404
>  #define EXYNOS5_WDT_DISABLE_REG_OFFSET		0x0408
> @@ -79,7 +79,7 @@
>
>  static bool nowayout	= WATCHDOG_NOWAYOUT;
>  static int tmr_margin;
> -static int tmr_atboot	= CONFIG_S3C2410_WATCHDOG_ATBOOT;
> +static int tmr_atboot	= S3C2410_WATCHDOG_ATBOOT;
>  static int soft_noboot;
>  static int debug;
>
> @@ -90,10 +90,10 @@ module_param(soft_noboot, int, 0);
>  module_param(debug,	  int, 0);
>
>  MODULE_PARM_DESC(tmr_margin, "Watchdog tmr_margin in seconds. (default="
> -		__MODULE_STRING(CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME) ")");
> +		__MODULE_STRING(S3C2410_WATCHDOG_DEFAULT_TIME) ")");
>  MODULE_PARM_DESC(tmr_atboot,
>  		"Watchdog is started at boot time if set to 1, default="
> -			__MODULE_STRING(CONFIG_S3C2410_WATCHDOG_ATBOOT));
> +			__MODULE_STRING(S3C2410_WATCHDOG_ATBOOT));
>  MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
>  			__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>  MODULE_PARM_DESC(soft_noboot, "Watchdog action, set to 1 to ignore reboots, "
> @@ -406,7 +406,7 @@ static struct watchdog_ops s3c2410wdt_ops = {
>  static struct watchdog_device s3c2410_wdd = {
>  	.info = &s3c2410_wdt_ident,
>  	.ops = &s3c2410wdt_ops,
> -	.timeout = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME,
> +	.timeout = S3C2410_WATCHDOG_DEFAULT_TIME,
>  };
>
>  /* interrupt handler code */
> @@ -600,12 +600,12 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>  					wdt->wdt_device.timeout);
>  	if (ret) {
>  		started = s3c2410wdt_set_heartbeat(&wdt->wdt_device,
> -					CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
> +					S3C2410_WATCHDOG_DEFAULT_TIME);
>
>  		if (started == 0)
>  			dev_info(dev,
>  			   "tmr_margin value out of range, default %d used\n",
> -			       CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME);
> +			       S3C2410_WATCHDOG_DEFAULT_TIME);
>  		else
>  			dev_info(dev, "default timer value is out of range, "
>  							"cannot start\n");
>

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

* Re: [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode
  2017-02-24 15:11 ` [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode Krzysztof Kozlowski
@ 2017-02-24 15:37   ` Guenter Roeck
  2017-02-24 17:30     ` Krzysztof Kozlowski
  2017-02-28  1:12   ` Rob Herring
  1 sibling, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2017-02-24 15:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wim Van Sebroeck, Kukjin Kim,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

On 02/24/2017 07:11 AM, Krzysztof Kozlowski wrote:
> In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
> of an interrupt.  However the interrupt itself was not cleared thus on
> first hit, the system enters infinite interrupt handling loop.
>
> On Odroid U3 (Exynos4412), when booted with s3c2410_wdt.soft_noboot=1
> argument the console is flooded:
> 	# killall -9 watchdog
> 	[   60.523760] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
> 	[   60.536744] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
>
> Fix this by writing something to the WTCLRINT register to clear the
> interrupt.  The register WTCLRINT however appeared in S3C6410 so a new
> watchdog quirk and flavor are needed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

>
> ---
>
> I was thinking about CC-ing stable, especially when I thought about
> adding unconditional WTCLRINT clear.  However it appears that S3C2410
> does not have the WTCLRINT register, this a new chip flavor has to be
> added.  This makes the fix spread over driver and DTS changes.
>
> Worth adding:
> 	Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> ?

How would that be different to Cc: stable ?

> ---
>  .../devicetree/bindings/watchdog/samsung-wdt.txt    |  9 +++++----
>  drivers/watchdog/s3c2410_wdt.c                      | 21 ++++++++++++++++++---
>  2 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
> index 8f3d96af81d7..1f6e101e299a 100644
> --- a/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/samsung-wdt.txt
> @@ -6,10 +6,11 @@ occurred.
>
>  Required properties:
>  - compatible : should be one among the following
> -	(a) "samsung,s3c2410-wdt" for Exynos4 and previous SoCs
> -	(b) "samsung,exynos5250-wdt" for Exynos5250
> -	(c) "samsung,exynos5420-wdt" for Exynos5420
> -	(c) "samsung,exynos7-wdt" for Exynos7
> +	- "samsung,s3c2410-wdt" for S3C2410
> +	- "samsung,s3c6410-wdt" for S3C6410, S5PV210 and Exynos4
> +	- "samsung,exynos5250-wdt" for Exynos5250
> +	- "samsung,exynos5420-wdt" for Exynos5420
> +	- "samsung,exynos7-wdt" for Exynos7
>
>  - reg : base physical address of the controller and length of memory mapped
>  	region.
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 3e216f54cb6f..7db7847a005c 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -46,6 +46,7 @@
>  #define S3C2410_WTCON		0x00
>  #define S3C2410_WTDAT		0x04
>  #define S3C2410_WTCNT		0x08
> +#define S3C2410_WTCLRINT	0x0c
>
>  #define S3C2410_WTCNT_MAXCNT	0xffff
>
> @@ -72,6 +73,7 @@
>  #define EXYNOS5_WDT_MASK_RESET_REG_OFFSET	0x040c
>  #define QUIRK_HAS_PMU_CONFIG			(1 << 0)
>  #define QUIRK_HAS_RST_STAT			(1 << 1)
> +#define QUIRK_HAS_WTCLRINT_REG			(1 << 2)
>
>  /* These quirks require that we have a PMU register map */
>  #define QUIRKS_HAVE_PMUREG			(QUIRK_HAS_PMU_CONFIG | \
> @@ -143,13 +145,18 @@ static const struct s3c2410_wdt_variant drv_data_s3c2410 = {
>  };
>
>  #ifdef CONFIG_OF
> +static const struct s3c2410_wdt_variant drv_data_s3c6410 = {
> +	.quirks = QUIRK_HAS_WTCLRINT_REG,
> +};
> +
>  static const struct s3c2410_wdt_variant drv_data_exynos5250  = {
>  	.disable_reg = EXYNOS5_WDT_DISABLE_REG_OFFSET,
>  	.mask_reset_reg = EXYNOS5_WDT_MASK_RESET_REG_OFFSET,
>  	.mask_bit = 20,
>  	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
>  	.rst_stat_bit = 20,
> -	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT,
> +	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT \
> +		  | QUIRK_HAS_WTCLRINT_REG,
>  };
>
>  static const struct s3c2410_wdt_variant drv_data_exynos5420 = {
> @@ -158,7 +165,8 @@ static const struct s3c2410_wdt_variant drv_data_exynos5420 = {
>  	.mask_bit = 0,
>  	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
>  	.rst_stat_bit = 9,
> -	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT,
> +	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT \
> +		  | QUIRK_HAS_WTCLRINT_REG,
>  };
>
>  static const struct s3c2410_wdt_variant drv_data_exynos7 = {
> @@ -167,12 +175,15 @@ static const struct s3c2410_wdt_variant drv_data_exynos7 = {
>  	.mask_bit = 23,
>  	.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
>  	.rst_stat_bit = 23,	/* A57 WDTRESET */
> -	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT,
> +	.quirks = QUIRK_HAS_PMU_CONFIG | QUIRK_HAS_RST_STAT \
> +		  | QUIRK_HAS_WTCLRINT_REG,
>  };
>
>  static const struct of_device_id s3c2410_wdt_match[] = {
>  	{ .compatible = "samsung,s3c2410-wdt",
>  	  .data = &drv_data_s3c2410 },
> +	{ .compatible = "samsung,s3c6410-wdt",
> +	  .data = &drv_data_s3c6410 },
>  	{ .compatible = "samsung,exynos5250-wdt",
>  	  .data = &drv_data_exynos5250 },
>  	{ .compatible = "samsung,exynos5420-wdt",
> @@ -418,6 +429,10 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param)
>  	dev_info(wdt->dev, "watchdog timer expired (irq)\n");
>
>  	s3c2410wdt_keepalive(&wdt->wdt_device);
> +
> +	if (wdt->drv_data->quirks & QUIRK_HAS_WTCLRINT_REG)
> +		writel(0x1, wdt->reg_base + S3C2410_WTCLRINT);
> +
>  	return IRQ_HANDLED;
>  }
>
>

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

* Re: [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode
  2017-02-24 15:37   ` Guenter Roeck
@ 2017-02-24 17:30     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 14+ messages in thread
From: Krzysztof Kozlowski @ 2017-02-24 17:30 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Wim Van Sebroeck, Kukjin Kim, Javier Martinez Canillas,
	linux-watchdog, devicetree, linux-kernel, linux-arm-kernel,
	linux-samsung-soc

On Fri, Feb 24, 2017 at 07:37:53AM -0800, Guenter Roeck wrote:
> On 02/24/2017 07:11 AM, Krzysztof Kozlowski wrote:
> > In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
> > of an interrupt.  However the interrupt itself was not cleared thus on
> > first hit, the system enters infinite interrupt handling loop.
> > 
> > On Odroid U3 (Exynos4412), when booted with s3c2410_wdt.soft_noboot=1
> > argument the console is flooded:
> > 	# killall -9 watchdog
> > 	[   60.523760] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
> > 	[   60.536744] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
> > 
> > Fix this by writing something to the WTCLRINT register to clear the
> > interrupt.  The register WTCLRINT however appeared in S3C6410 so a new
> > watchdog quirk and flavor are needed.
> > 
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> > 
> > ---
> > 
> > I was thinking about CC-ing stable, especially when I thought about
> > adding unconditional WTCLRINT clear.  However it appears that S3C2410
> > does not have the WTCLRINT register, this a new chip flavor has to be
> > added.  This makes the fix spread over driver and DTS changes.
> > 
> > Worth adding:
> > 	Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> > ?
> 
> How would that be different to Cc: stable ?

I guess not much... except for the metrics that some bug was fixed.

Best regards,
Krzysztof

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

* Re: [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode
  2017-02-24 15:11 ` [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode Krzysztof Kozlowski
  2017-02-24 15:37   ` Guenter Roeck
@ 2017-02-28  1:12   ` Rob Herring
  1 sibling, 0 replies; 14+ messages in thread
From: Rob Herring @ 2017-02-28  1:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Wim Van Sebroeck, Guenter Roeck, Kukjin Kim,
	Javier Martinez Canillas, linux-watchdog, devicetree,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

On Fri, Feb 24, 2017 at 05:11:16PM +0200, Krzysztof Kozlowski wrote:
> In soft (no-reboot) mode, the driver self-pings watchdog upon expiration
> of an interrupt.  However the interrupt itself was not cleared thus on
> first hit, the system enters infinite interrupt handling loop.
> 
> On Odroid U3 (Exynos4412), when booted with s3c2410_wdt.soft_noboot=1
> argument the console is flooded:
> 	# killall -9 watchdog
> 	[   60.523760] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
> 	[   60.536744] s3c2410-wdt 10060000.watchdog: watchdog timer expired (irq)
> 
> Fix this by writing something to the WTCLRINT register to clear the
> interrupt.  The register WTCLRINT however appeared in S3C6410 so a new
> watchdog quirk and flavor are needed.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> 
> ---
> 
> I was thinking about CC-ing stable, especially when I thought about
> adding unconditional WTCLRINT clear.  However it appears that S3C2410
> does not have the WTCLRINT register, this a new chip flavor has to be
> added.  This makes the fix spread over driver and DTS changes.
> 
> Worth adding:
> 	Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> ?
> ---
>  .../devicetree/bindings/watchdog/samsung-wdt.txt    |  9 +++++----

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/watchdog/s3c2410_wdt.c                      | 21 ++++++++++++++++++---
>  2 files changed, 23 insertions(+), 7 deletions(-)

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

end of thread, other threads:[~2017-02-28  4:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-24 15:11 [PATCH 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
2017-02-24 15:11 ` [PATCH 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines Krzysztof Kozlowski
2017-02-24 15:32   ` Guenter Roeck
2017-02-24 15:11 ` [PATCH 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode Krzysztof Kozlowski
2017-02-24 15:37   ` Guenter Roeck
2017-02-24 17:30     ` Krzysztof Kozlowski
2017-02-28  1:12   ` Rob Herring
2017-02-24 15:11 ` [PATCH 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412 Krzysztof Kozlowski
2017-02-24 15:25   ` Krzysztof Kozlowski
2017-02-24 15:11 ` [PATCH 4/8] ARM: dts: s3c64xx: Enable watchdog on all S3C64xx boards Krzysztof Kozlowski
2017-02-24 15:11 ` [PATCH 5/8] ARM: dts: exynos: Enable watchdog on all Exynos4 boards Krzysztof Kozlowski
2017-02-24 15:11 ` [PATCH 6/8] ARM: dts: exynos: Fix infinite interrupt in soft mode on Exynos5440 Krzysztof Kozlowski
2017-02-24 15:11 ` [PATCH 7/8] ARM: dts: s3c64xx: Fix infinite interrupt in soft mode Krzysztof Kozlowski
2017-02-24 15:11 ` [PATCH 8/8] ARM: dts: s5pv210: " Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).