devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Wim Van Sebroeck <wim@iguana.be>,
	Guenter Roeck <linux@roeck-us.net>,
	Rob Herring <robh+dt@kernel.org>, Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Javier Martinez Canillas <javier@osg.samsung.com>,
	linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org
Subject: [PATCH v2 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode
Date: Sat, 11 Mar 2017 19:25:21 +0200	[thread overview]
Message-ID: <20170311172527.16368-3-krzk@kernel.org> (raw)
In-Reply-To: <20170311172527.16368-1-krzk@kernel.org>

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>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../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

  parent reply	other threads:[~2017-03-11 17:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-11 17:25 [PATCH v2 0/8] watchdog: s3c2410: Fixes and improvements Krzysztof Kozlowski
2017-03-11 17:25 ` [PATCH v2 1/8] watchdog: s3c2410: Remove confusing CONFIG prefix from local defines Krzysztof Kozlowski
     [not found]   ` <20170311172527.16368-2-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-11 17:28     ` Krzysztof Kozlowski
2017-03-11 17:25 ` Krzysztof Kozlowski [this message]
2017-03-11 17:29   ` [PATCH v2 2/8] watchdog: s3c2410: Fix infinite interrupt in soft mode Krzysztof Kozlowski
2017-03-11 17:25 ` [PATCH v2 3/8] ARM: dts: exynos: Fix watchdog reset on Exynos4412 Krzysztof Kozlowski
     [not found]   ` <20170311172527.16368-4-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-12 20:48     ` Guenter Roeck
2017-03-13  6:41       ` Krzysztof Kozlowski
     [not found]   ` <CGME20170314130352epcas5p472cdaa4ae512b4a839d92e85d6dadb81@epcas5p4.samsung.com>
2017-03-14 13:03     ` Bartlomiej Zolnierkiewicz
2017-03-14 13:09       ` Krzysztof Kozlowski
     [not found]         ` <CGME20170314134503epcas1p178241245d202edf9f3ea5885c605ffb6@epcas1p1.samsung.com>
2017-03-14 13:45           ` Bartlomiej Zolnierkiewicz
     [not found] ` <20170311172527.16368-1-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-11 17:25   ` [PATCH v2 4/8] ARM: dts: s3c64xx: Enable watchdog on all S3C64xx boards Krzysztof Kozlowski
     [not found]     ` <20170311172527.16368-5-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-12 20:49       ` Guenter Roeck
2017-03-14 12:58       ` Bartlomiej Zolnierkiewicz
2017-03-14 13:04         ` Krzysztof Kozlowski
     [not found]           ` <CGME20170314133035epcas1p47a04430402688bbb6baebad69b8e5b24@epcas1p4.samsung.com>
     [not found]             ` <CAJKOXPeCK1cjY78+PfcTprTnyXJ1k9zcUj8nW7onG8y0TWGzzQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-14 13:30               ` Bartlomiej Zolnierkiewicz
2017-03-14 13:34                 ` Krzysztof Kozlowski
2017-03-11 17:25   ` [PATCH v2 5/8] ARM: dts: exynos: Enable watchdog on all Exynos4 boards Krzysztof Kozlowski
     [not found]     ` <20170311172527.16368-6-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-12 20:50       ` Guenter Roeck
2017-03-14 13:00       ` Bartlomiej Zolnierkiewicz
2017-03-11 17:25   ` [PATCH v2 6/8] ARM: dts: exynos: Fix infinite interrupt in soft mode on Exynos4210 and Exynos5440 Krzysztof Kozlowski
2017-03-12 20:50     ` Guenter Roeck
     [not found]     ` <CGME20170314130505epcas5p3ae5e356cfdf8b7b1d66256e47ea168ee@epcas5p3.samsung.com>
     [not found]       ` <20170311172527.16368-7-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-14 13:05         ` Bartlomiej Zolnierkiewicz
2017-03-11 17:25   ` [PATCH v2 7/8] ARM: dts: s3c64xx: Fix infinite interrupt in soft mode Krzysztof Kozlowski
     [not found]     ` <20170311172527.16368-8-krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-03-12 20:51       ` Guenter Roeck
2017-03-14 13:07       ` Bartlomiej Zolnierkiewicz
2017-03-11 17:25 ` [PATCH v2 8/8] ARM: dts: s5pv210: " Krzysztof Kozlowski
2017-03-12 20:51   ` Guenter Roeck
     [not found]   ` <CGME20170314130737epcas5p2acd94980f020d95f52ac53e3ca1eb258@epcas5p2.samsung.com>
2017-03-14 13:07     ` Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170311172527.16368-3-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=javier@osg.samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=wim@iguana.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).