aboutsummaryrefslogtreecommitdiff
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorMichal Simek2018-07-11 15:42:25 +0200
committerMichal Simek2018-07-19 10:49:54 +0200
commitf238b3f0fbc9ebc3a9702ddfc5ef22dff09f35d8 (patch)
tree9788c64baf354df53461ec719c48d54d4ff3184a /drivers/watchdog
parent9713fac1eb104e87f8e2fe578c29c96bddef304c (diff)
watchdog: dm: Support manual relocation for watchdogs
Relocate watchdog ops as was done by: "dm: Add support for all targets which requires MANUAL_RELOC" (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/wdt-uclass.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index f6f2fe3739d..23b7e3360d3 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -63,8 +63,31 @@ int wdt_expire_now(struct udevice *dev, ulong flags)
return ret;
}
+static int wdt_post_bind(struct udevice *dev)
+{
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+ struct wdt_ops *ops = (struct wdt_ops *)device_get_ops(dev);
+ static int reloc_done;
+
+ if (!reloc_done) {
+ if (ops->start)
+ ops->start += gd->reloc_off;
+ if (ops->stop)
+ ops->stop += gd->reloc_off;
+ if (ops->reset)
+ ops->reset += gd->reloc_off;
+ if (ops->expire_now)
+ ops->expire_now += gd->reloc_off;
+
+ reloc_done++;
+ }
+#endif
+ return 0;
+}
+
UCLASS_DRIVER(wdt) = {
.id = UCLASS_WDT,
.name = "watchdog",
.flags = DM_UC_FLAG_SEQ_ALIAS,
+ .post_bind = wdt_post_bind,
};