From: Ovidiu Panait Date: Wed, 12 Oct 2022 05:36:55 +0000 (+0300) Subject: timer-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC X-Git-Tag: v2025.01-rc5-pxa1908~1204^2~13 X-Git-Url: http://git.dujemihanovic.xyz/%22http:/kyber.dk/phpMyBuilder/static/%7B%7B?a=commitdiff_plain;h=8272d4cb897ca15eef2f39afe488f6731312e5c2;p=u-boot.git timer-uclass: relocate ops pointers for CONFIG_NEEDS_MANUAL_RELOC Relocate timer_ops pointers when CONFIG_NEEDS_MANUAL_RELOC is enabled. The (gd->flags & GD_FLG_RELOC) check was added to make sure the reloc_done logic works for drivers that use DM_FLAG_PRE_RELOC. Signed-off-by: Ovidiu Panait Reviewed-by: Simon Glass Link: https://lore.kernel.org/r/20221012053656.1492457-2-ovpanait@gmail.com Signed-off-by: Michal Simek --- diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index bdc77b3822..bb71979213 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -18,6 +18,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -50,6 +51,19 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { + if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) && + (gd->flags & GD_FLG_RELOC)) { + struct timer_ops *ops = timer_get_ops(dev); + static int reloc_done; + + if (!reloc_done) { + if (ops->get_count) + MANUAL_RELOC(ops->get_count); + + reloc_done++; + } + } + if (CONFIG_IS_ENABLED(OF_REAL)) { struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct clk timer_clk;