summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-sprd-adi.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2020-01-06 12:35:33 +0300
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2020-01-06 12:35:33 +0300
commit22164fbe274c2dd96d2887fe121896d321000a61 (patch)
tree629a8af05ecbe3ed8e18938de2564517c9b44d92 /drivers/spi/spi-sprd-adi.c
parent3d0dad869aeb5d8e81985c73a6c73428258f8083 (diff)
parentf5c547efa16c0ea5abff0596e829f502be11902e (diff)
downloadlinux-22164fbe274c2dd96d2887fe121896d321000a61.tar.xz
Merge drm/drm-next into drm-misc-next
Requested, and we need v5.5-rc1 backported as our current branch is still based on v5.4. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'drivers/spi/spi-sprd-adi.c')
-rw-r--r--drivers/spi/spi-sprd-adi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c
index 9a051286f120..87dadb6b8ebf 100644
--- a/drivers/spi/spi-sprd-adi.c
+++ b/drivers/spi/spi-sprd-adi.c
@@ -77,6 +77,7 @@
/* Bits definitions for register REG_WDG_CTRL */
#define BIT_WDG_RUN BIT(1)
+#define BIT_WDG_NEW BIT(2)
#define BIT_WDG_RST BIT(3)
/* Registers definitions for PMIC */
@@ -383,6 +384,10 @@ static int sprd_adi_restart_handler(struct notifier_block *this,
/* Unlock the watchdog */
sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOCK, WDG_UNLOCK_KEY);
+ sprd_adi_read(sadi, sadi->slave_pbase + REG_WDG_CTRL, &val);
+ val |= BIT_WDG_NEW;
+ sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_CTRL, val);
+
/* Load the watchdog timeout value, 50ms is always enough. */
sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOAD_LOW,
WDG_LOAD_VAL & WDG_LOAD_MASK);
@@ -393,6 +398,9 @@ static int sprd_adi_restart_handler(struct notifier_block *this,
val |= BIT_WDG_RUN | BIT_WDG_RST;
sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_CTRL, val);
+ /* Lock the watchdog */
+ sprd_adi_write(sadi, sadi->slave_pbase + REG_WDG_LOCK, ~WDG_UNLOCK_KEY);
+
mdelay(1000);
dev_emerg(sadi->dev, "Unable to restart system\n");