summaryrefslogtreecommitdiff
path: root/drivers/watchdog/imgpdc_wdt.c
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@imgtec.com>2015-05-11 14:41:04 -0300
committerWim Van Sebroeck <wim@iguana.be>2015-06-22 15:54:15 +0200
commitdeb8d50eb40085d304b42a524d4ba326fcecc73d (patch)
treef16187fb084ef9ee960297dd67c18b5ebcecfac1 /drivers/watchdog/imgpdc_wdt.c
parentc631f20068369a8b901574df9c7bfc57ce13de75 (diff)
downloadlwn-deb8d50eb40085d304b42a524d4ba326fcecc73d.tar.gz
lwn-deb8d50eb40085d304b42a524d4ba326fcecc73d.zip
watchdog: imgpdc: Fix max timeout
Maximum timeout is currently set in clock cycles, but the watchdog core expects it to be in seconds. Fix it. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/imgpdc_wdt.c')
-rw-r--r--drivers/watchdog/imgpdc_wdt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c
index 28c10e292aa3..56b8ebcc3775 100644
--- a/drivers/watchdog/imgpdc_wdt.c
+++ b/drivers/watchdog/imgpdc_wdt.c
@@ -152,6 +152,7 @@ static int pdc_wdt_restart(struct notifier_block *this, unsigned long mode,
static int pdc_wdt_probe(struct platform_device *pdev)
{
+ u64 div;
int ret, val;
unsigned long clk_rate;
struct resource *res;
@@ -211,7 +212,10 @@ static int pdc_wdt_probe(struct platform_device *pdev)
pdc_wdt->wdt_dev.info = &pdc_wdt_info;
pdc_wdt->wdt_dev.ops = &pdc_wdt_ops;
- pdc_wdt->wdt_dev.max_timeout = 1 << PDC_WDT_CONFIG_DELAY_MASK;
+
+ div = 1ULL << (PDC_WDT_CONFIG_DELAY_MASK + 1);
+ do_div(div, clk_rate);
+ pdc_wdt->wdt_dev.max_timeout = div;
pdc_wdt->wdt_dev.timeout = PDC_WDT_DEF_TIMEOUT;
pdc_wdt->wdt_dev.parent = &pdev->dev;
watchdog_set_drvdata(&pdc_wdt->wdt_dev, pdc_wdt);