Commit 4aba1a7e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'linux-watchdog-5.4-rc7' of git://www.linux-watchdog.org/linux-watchdog

Pull watchdog fixes from Wim Van Sebroeck:

 - cpwd: fix build regression

 - pm8916_wdt: fix pretimeout registration flow

 - meson: Fix the wrong value of left time

 - imx_sc_wdt: Pretimeout should follow SCU firmware format

 - bd70528: Add MODULE_ALIAS to allow module auto loading

* tag 'linux-watchdog-5.4-rc7' of git://www.linux-watchdog.org/linux-watchdog:
  watchdog: bd70528: Add MODULE_ALIAS to allow module auto loading
  watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format
  watchdog: meson: Fix the wrong value of left time
  watchdog: pm8916_wdt: fix pretimeout registration flow
  watchdog: cpwd: fix build regression
parents 0058b0a5 81363f24
...@@ -288,3 +288,4 @@ module_platform_driver(bd70528_wdt); ...@@ -288,3 +288,4 @@ module_platform_driver(bd70528_wdt);
MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"); MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
MODULE_DESCRIPTION("BD70528 watchdog driver"); MODULE_DESCRIPTION("BD70528 watchdog driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:bd70528-wdt");
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/compat.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return 0; return 0;
} }
static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
}
static ssize_t cpwd_write(struct file *file, const char __user *buf, static ssize_t cpwd_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
...@@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer, ...@@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer,
static const struct file_operations cpwd_fops = { static const struct file_operations cpwd_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.unlocked_ioctl = cpwd_ioctl, .unlocked_ioctl = cpwd_ioctl,
.compat_ioctl = compat_ptr_ioctl, .compat_ioctl = cpwd_compat_ioctl,
.open = cpwd_open, .open = cpwd_open,
.write = cpwd_write, .write = cpwd_write,
.read = cpwd_read, .read = cpwd_read,
......
...@@ -99,8 +99,14 @@ static int imx_sc_wdt_set_pretimeout(struct watchdog_device *wdog, ...@@ -99,8 +99,14 @@ static int imx_sc_wdt_set_pretimeout(struct watchdog_device *wdog,
{ {
struct arm_smccc_res res; struct arm_smccc_res res;
/*
* SCU firmware calculates pretimeout based on current time
* stamp instead of watchdog timeout stamp, need to convert
* the pretimeout to SCU firmware's timeout value.
*/
arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG, arm_smccc_smc(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG,
pretimeout * 1000, 0, 0, 0, 0, 0, &res); (wdog->timeout - pretimeout) * 1000, 0, 0, 0,
0, 0, &res);
if (res.a0) if (res.a0)
return -EACCES; return -EACCES;
......
...@@ -89,8 +89,8 @@ static unsigned int meson_gxbb_wdt_get_timeleft(struct watchdog_device *wdt_dev) ...@@ -89,8 +89,8 @@ static unsigned int meson_gxbb_wdt_get_timeleft(struct watchdog_device *wdt_dev)
reg = readl(data->reg_base + GXBB_WDT_TCNT_REG); reg = readl(data->reg_base + GXBB_WDT_TCNT_REG);
return ((reg >> GXBB_WDT_TCNT_CNT_SHIFT) - return ((reg & GXBB_WDT_TCNT_SETUP_MASK) -
(reg & GXBB_WDT_TCNT_SETUP_MASK)) / 1000; (reg >> GXBB_WDT_TCNT_CNT_SHIFT)) / 1000;
} }
static const struct watchdog_ops meson_gxbb_wdt_ops = { static const struct watchdog_ops meson_gxbb_wdt_ops = {
......
...@@ -163,9 +163,17 @@ static int pm8916_wdt_probe(struct platform_device *pdev) ...@@ -163,9 +163,17 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq > 0) { if (irq > 0) {
if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt", err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
wdt)) "pm8916_wdt", wdt);
irq = 0; if (err)
return err;
wdt->wdev.info = &pm8916_wdt_pt_ident;
} else {
if (irq == -EPROBE_DEFER)
return -EPROBE_DEFER;
wdt->wdev.info = &pm8916_wdt_ident;
} }
/* Configure watchdog to hard-reset mode */ /* Configure watchdog to hard-reset mode */
...@@ -177,7 +185,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev) ...@@ -177,7 +185,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
return err; return err;
} }
wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
wdt->wdev.ops = &pm8916_wdt_ops, wdt->wdev.ops = &pm8916_wdt_ops,
wdt->wdev.parent = dev; wdt->wdev.parent = dev;
wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT; wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment