Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKernel Build Daemon <kbuild@suse.de>2018-07-12 07:00:20 +0200
committerKernel Build Daemon <kbuild@suse.de>2018-07-12 07:00:20 +0200
commit221d9af3d6d469a107de5e8881f05f01b5962f50 (patch)
treed52dc7010967378f79ed09b38833d6524cb3eb25
parent08f5fed59df17e31e836ed5eeba7b660afa47922 (diff)
parent524eed187aa499c72d8737e27171951ffec33c11 (diff)
Merge branch 'SLE12-SP3' into SLE12-SP3-AZURE
-rw-r--r--patches.fixes/watchdog-da9063-Fix-setting-changing-timeout.patch78
-rw-r--r--patches.fixes/watchdog-da9063-Fix-timeout-handling-during-probe.patch66
-rw-r--r--patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch61
-rw-r--r--series.conf5
4 files changed, 210 insertions, 0 deletions
diff --git a/patches.fixes/watchdog-da9063-Fix-setting-changing-timeout.patch b/patches.fixes/watchdog-da9063-Fix-setting-changing-timeout.patch
new file mode 100644
index 0000000000..9dbb7d37c0
--- /dev/null
+++ b/patches.fixes/watchdog-da9063-Fix-setting-changing-timeout.patch
@@ -0,0 +1,78 @@
+From ca074b63caeaf675017a8e3d0734d4a04cf6ad61 Mon Sep 17 00:00:00 2001
+From: Marco Felsch <m.felsch@pengutronix.de>
+Date: Mon, 28 May 2018 08:45:44 +0200
+Subject: [PATCH] watchdog: da9063: Fix setting/changing timeout
+Patch-mainline: v4.18-rc1
+Git-commit: e46bb55dbc94b06f5ee466e2f50723b56781e661
+References: bsc#1100843
+
+If the timeout value is set more than once the DA9063 watchdog triggers
+a reset signal which reset the system.
+
+To update the timeout value we have to disable the watchdog, clear the
+watchdog counter value and write the new timeout value to the watchdog.
+Clearing the counter value is a feature to be on the safe side because the
+data sheet doesn't describe the behaviour of the watchdog counter value
+after a watchdog disabling-enable-sequence.
+
+The patch is based on Philipp Zabel's previous patch.
+
+Fixes: 5e9c16e37608 ("watchdog: Add DA9063 PMIC watchdog driver.")
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
+Acked-by: Yadan Fan <ydfan@suse.com>
+---
+ drivers/watchdog/da9063_wdt.c | 26 ++++++++++++++++++++++++--
+ 1 file changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
+index 6bf130bd863d..e531c1c6a3f4 100644
+--- a/drivers/watchdog/da9063_wdt.c
++++ b/drivers/watchdog/da9063_wdt.c
+@@ -54,8 +54,31 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs)
+ return DA9063_TWDSCALE_MAX;
+ }
+
++static int da9063_wdt_disable_timer(struct da9063 *da9063)
++{
++ return regmap_update_bits(da9063->regmap, DA9063_REG_CONTROL_D,
++ DA9063_TWDSCALE_MASK,
++ DA9063_TWDSCALE_DISABLE);
++}
++
+ static int _da9063_wdt_set_timeout(struct da9063 *da9063, unsigned int regval)
+ {
++ int ret;
++
++ /*
++ * The watchdog triggers a reboot if a timeout value is already
++ * programmed because the timeout value combines two functions
++ * in one: indicating the counter limit and starting the watchdog.
++ * The watchdog must be disabled to be able to change the timeout
++ * value if the watchdog is already running. Then we can set the
++ * new timeout value which enables the watchdog again.
++ */
++ ret = da9063_wdt_disable_timer(da9063);
++ if (ret)
++ return ret;
++
++ usleep_range(150, 300);
++
+ return regmap_update_bits(da9063->regmap, DA9063_REG_CONTROL_D,
+ DA9063_TWDSCALE_MASK, regval);
+ }
+@@ -80,8 +103,7 @@ static int da9063_wdt_stop(struct watchdog_device *wdd)
+ struct da9063_watchdog *wdt = watchdog_get_drvdata(wdd);
+ int ret;
+
+- ret = regmap_update_bits(wdt->da9063->regmap, DA9063_REG_CONTROL_D,
+- DA9063_TWDSCALE_MASK, DA9063_TWDSCALE_DISABLE);
++ ret = da9063_wdt_disable_timer(da9063);
+ if (ret)
+ dev_alert(wdt->da9063->dev, "Watchdog failed to stop (err = %d)\n",
+ ret);
+--
+2.17.1
+
diff --git a/patches.fixes/watchdog-da9063-Fix-timeout-handling-during-probe.patch b/patches.fixes/watchdog-da9063-Fix-timeout-handling-during-probe.patch
new file mode 100644
index 0000000000..3db44197fe
--- /dev/null
+++ b/patches.fixes/watchdog-da9063-Fix-timeout-handling-during-probe.patch
@@ -0,0 +1,66 @@
+From a4c6e4e53c6d13c1753d6d428c641d13e9040a4d Mon Sep 17 00:00:00 2001
+From: Marco Felsch <m.felsch@pengutronix.de>
+Date: Mon, 28 May 2018 08:45:46 +0200
+Subject: [PATCH] watchdog: da9063: Fix timeout handling during probe
+Patch-mainline: v4.18-rc1
+Git-commit: be9e9c2ad52baea131a5395b15f52ae4f86bfbe3
+References: bsc#1100843
+
+The watchdog can be enabled in previous steps (e.g. the bootloader). Set
+the driver default timeout value (8s) if the watchdog is already running
+and the HW_RUNNING flag. So the watchdog core framework will ping the
+watchdog till the user space activates the watchdog explicit with the
+desired timeout value.
+
+Fixes: 5e9c16e37608 ("watchdog: Add DA9063 PMIC watchdog driver.")
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
+Acked-by: Yadan Fan <ydfan@suse.com>
+---
+ drivers/watchdog/da9063_wdt.c | 21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
+index 3f1517681705..2b2326586258 100644
+--- a/drivers/watchdog/da9063_wdt.c
++++ b/drivers/watchdog/da9063_wdt.c
+@@ -54,6 +54,18 @@ static unsigned int da9063_wdt_timeout_to_sel(unsigned int secs)
+ return DA9063_TWDSCALE_MAX;
+ }
+
++/*
++ * Return 0 if watchdog is disabled, else non zero.
++ */
++static unsigned int da9063_wdt_is_running(struct da9063 *da9063)
++{
++ unsigned int val;
++
++ regmap_read(da9063->regmap, DA9063_REG_CONTROL_D, &val);
++
++ return val & DA9063_TWDSCALE_MASK;
++}
++
+ static int da9063_wdt_disable_timer(struct da9063 *da9063)
+ {
+ return regmap_update_bits(da9063->regmap, DA9063_REG_CONTROL_D,
+@@ -239,6 +251,15 @@ static int da9063_wdt_remove(struct platform_device *pdev)
+
+ watchdog_unregister_device(&wdt->wdtdev);
+
++ /* Change the timeout to the default value if the watchdog is running */
++ if (da9063_wdt_is_running(da9063)) {
++ unsigned int timeout;
++
++ timeout = da9063_wdt_timeout_to_sel(DA9063_WDG_TIMEOUT);
++ _da9063_wdt_set_timeout(da9063, timeout);
++ set_bit(WDOG_HW_RUNNING, &wdd->status);
++ }
++
+ return 0;
+ }
+
+--
+2.17.1
+
diff --git a/patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch b/patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch
new file mode 100644
index 0000000000..cfa9b28069
--- /dev/null
+++ b/patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch
@@ -0,0 +1,61 @@
+From 198e3f2ad3f9c30928ccb090803b05ae3fd0003d Mon Sep 17 00:00:00 2001
+From: Marco Felsch <m.felsch@pengutronix.de>
+Date: Mon, 28 May 2018 08:45:45 +0200
+Subject: [PATCH] watchdog: da9063: Fix updating timeout value
+Patch-mainline: v4.18-rc1
+Git-commit: 44ee54aabfdb3b35866ed909bde3ab01e9679385
+References: bsc#1100843
+
+The DA9063 watchdog has only one register field to store the timeout value
+and to enable the watchdog. The watchdog gets enabled if the value is
+not zero. There is no issue if the watchdog is already running but it
+leads into problems if the watchdog is disabled.
+
+If the watchdog is disabled and only the timeout value should be prepared
+the watchdog gets enabled too. Add a check to get the current watchdog
+state and update the watchdog timeout value on hw-side only if the
+watchdog is already active.
+
+Fixes: 5e9c16e37608 ("watchdog: Add DA9063 PMIC watchdog driver.")
+Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
+Acked-by: Yadan Fan <ydfan@suse.com>
+---
+ drivers/watchdog/da9063_wdt.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
+index e531c1c6a3f4..3f1517681705 100644
+--- a/drivers/watchdog/da9063_wdt.c
++++ b/drivers/watchdog/da9063_wdt.c
+@@ -130,10 +130,23 @@ static int da9063_wdt_set_timeout(struct watchdog_device *wdd,
+ {
+ struct da9063_watchdog *wdt = watchdog_get_drvdata(wdd);
+ unsigned int selector;
+- int ret;
++ int ret = 0;
+
+ selector = da9063_wdt_timeout_to_sel(timeout);
+- ret = _da9063_wdt_set_timeout(wdt->da9063, selector);
++
++ /*
++ * There are two cases when a set_timeout() will be called:
++ * 1. The watchdog is off and someone wants to set the timeout for the
++ * further use.
++ * 2. The watchdog is already running and a new timeout value should be
++ * set.
++ *
++ * The watchdog can't store a timeout value not equal zero without
++ * enabling the watchdog, so the timeout must be buffered by the driver.
++ */
++ if (watchdog_active(wdd))
++ ret = _da9063_wdt_set_timeout(da9063, selector);
++
+ if (ret)
+ dev_err(wdt->da9063->dev, "Failed to set watchdog timeout (err = %d)\n",
+ ret);
+--
+2.17.1
+
diff --git a/series.conf b/series.conf
index bbfb1d8984..e2bba6e364 100644
--- a/series.conf
+++ b/series.conf
@@ -23886,6 +23886,11 @@
# bsc#1097501
patches.drivers/scsi-qla2xxx-Spinlock-recursion-in-qla_target.patch
+ # watchdog da9063
+ patches.fixes/watchdog-da9063-Fix-setting-changing-timeout.patch
+ patches.fixes/watchdog-da9063-Fix-updating-timeout-value.patch
+ patches.fixes/watchdog-da9063-Fix-timeout-handling-during-probe.patch
+
########################################################
# You'd better have a good reason for adding a patch
# below here.