All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] watchdog: dm: Support manual relocation for watchdogs
@ 2018-07-11 14:41 Michal Simek
  2018-07-11 20:13 ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Michal Simek @ 2018-07-11 14:41 UTC (permalink / raw)
  To: u-boot

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>
---

based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html

---
 drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index f6f2fe3739d3..23b7e3360d32 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,
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-07-20  2:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 14:41 [U-Boot] [PATCH] watchdog: dm: Support manual relocation for watchdogs Michal Simek
2018-07-11 20:13 ` Simon Glass
2018-07-12  5:47   ` Michal Simek
2018-07-15 21:21     ` Simon Glass
2018-07-16  5:34       ` Michal Simek
2018-07-19  1:31         ` Simon Glass
2018-07-19  6:52           ` Michal Simek
2018-07-19 15:21             ` Simon Glass
2018-07-19 15:47               ` Tom Rini
2018-07-20  2:16                 ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.