summaryrefslogtreecommitdiff
path: root/drivers/watchdog/cdns_wdt.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-04-26 20:50:00 +0300
committerTom Rini <trini@konsulko.com>2019-04-26 20:50:00 +0300
commit07b68b7843ad1fa15d63dcd26b5ca5a053fcc27f (patch)
treef9b57804a3f3c57efcb5a17c836396b3b04dbf5f /drivers/watchdog/cdns_wdt.c
parent1c64692df20c1f491ea79de3a732428611bb0ba0 (diff)
parentb684d4031b38b6b6a9e22676c7c6e2770e767cc7 (diff)
downloadu-boot-07b68b7843ad1fa15d63dcd26b5ca5a053fcc27f.tar.xz
Merge git://git.denx.de/u-boot-marvell
- Add DM based generic watchdog start and reset implementation and remove all ad-hoc implementations (Stefan) - Move mv_sdhci to DM (Pierre) - Misc turris_omnia updates (Pierre) - Change openrd targets to correctly build again (size changes and fixes to the dts targets) and bring it back into Travis builds (Stefan) - Add Kirkwood db-88f6281-bp board (Chris)
Diffstat (limited to 'drivers/watchdog/cdns_wdt.c')
-rw-r--r--drivers/watchdog/cdns_wdt.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/watchdog/cdns_wdt.c b/drivers/watchdog/cdns_wdt.c
index fc85fbcec2..6a608b6371 100644
--- a/drivers/watchdog/cdns_wdt.c
+++ b/drivers/watchdog/cdns_wdt.c
@@ -10,6 +10,7 @@
#include <dm.h>
#include <wdt.h>
#include <clk.h>
+#include <div64.h>
#include <linux/io.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -23,7 +24,6 @@ struct cdns_regs {
struct cdns_wdt_priv {
bool rst;
- u32 timeout;
struct cdns_regs *regs;
};
@@ -142,10 +142,10 @@ static int cdns_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
return -1;
}
- if ((timeout < CDNS_WDT_MIN_TIMEOUT) ||
- (timeout > CDNS_WDT_MAX_TIMEOUT)) {
- timeout = priv->timeout;
- }
+ /* Calculate timeout in seconds and restrict to min and max value */
+ do_div(timeout, 1000);
+ timeout = max_t(u64, timeout, CDNS_WDT_MIN_TIMEOUT);
+ timeout = min_t(u64, timeout, CDNS_WDT_MAX_TIMEOUT);
debug("%s: CLK_FREQ %ld, timeout %lld\n", __func__, clk_f, timeout);
@@ -235,12 +235,9 @@ static int cdns_wdt_ofdata_to_platdata(struct udevice *dev)
if (IS_ERR(priv->regs))
return PTR_ERR(priv->regs);
- priv->timeout = dev_read_u32_default(dev, "timeout-sec",
- CDNS_WDT_DEFAULT_TIMEOUT);
-
priv->rst = dev_read_bool(dev, "reset-on-timeout");
- debug("%s: timeout %d, reset %d\n", __func__, priv->timeout, priv->rst);
+ debug("%s: reset %d\n", __func__, priv->rst);
return 0;
}