diff options
Diffstat (limited to 'drivers/timer')
| -rw-r--r-- | drivers/timer/timer-uclass.c | 16 | ||||
| -rw-r--r-- | drivers/timer/xilinx-timer.c | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index cbc36476987..bb719792135 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -18,6 +18,7 @@ #include <init.h> #include <timer.h> #include <linux/err.h> +#include <relocate.h> DECLARE_GLOBAL_DATA_PTR; @@ -32,7 +33,7 @@ DECLARE_GLOBAL_DATA_PTR; int notrace timer_get_count(struct udevice *dev, u64 *count) { - const struct timer_ops *ops = device_get_ops(dev); + struct timer_ops *ops = timer_get_ops(dev); if (!ops->get_count) return -ENOSYS; @@ -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; diff --git a/drivers/timer/xilinx-timer.c b/drivers/timer/xilinx-timer.c index 75b4473b639..172fd9f9296 100644 --- a/drivers/timer/xilinx-timer.c +++ b/drivers/timer/xilinx-timer.c @@ -40,7 +40,7 @@ static u64 xilinx_timer_get_count(struct udevice *dev) regmap_read(priv->regs, TIMER_COUNTER_OFFSET, &value); - return value; + return timer_conv_64(value); } static int xilinx_timer_probe(struct udevice *dev) |
