diff options
author | Tom Rini <trini@konsulko.com> | 2020-03-26 13:18:22 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-03-26 13:18:22 -0400 |
commit | 779e6dc6a429ac28dfd4f07ab0c3648a31399d4a (patch) | |
tree | 2dfc6d6953793e85d78b4ca79bec6b1a5fbca421 /drivers/timer/sti-timer.c | |
parent | 2738f0edea7d19960d692284d1f378b1a2b4c4a5 (diff) | |
parent | 5b5699cdc97122e08e7fd0886a9e4474ca3ccb35 (diff) |
Merge tag 'u-boot-stm32-20200324' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm into next
- stm32mp: fix command stboard
- stm32mp: update kernel device tree according the part number
- stm32mp: add 800 MHz profile support = stm32mp15xd and stm32mp15xf
- stm32mp: set cp15 frequency in psci cpu on
- stm32mp: DT alignment with Linux 5.6-rc1
- stm32mp: clk: add SPI5 support and correct CKSELR masks
- stm32mp: ram: fixes on LPDDR2/LPDDR3 support and on tuning
- stm32: i2c: allows for any bus frequency
- sti: timer: livetree and clk API conversion
Diffstat (limited to 'drivers/timer/sti-timer.c')
-rw-r--r-- | drivers/timer/sti-timer.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/drivers/timer/sti-timer.c b/drivers/timer/sti-timer.c index 9def7e02f4b..ff42056abdd 100644 --- a/drivers/timer/sti-timer.c +++ b/drivers/timer/sti-timer.c @@ -6,14 +6,13 @@ #include <common.h> #include <dm.h> -#include <fdtdec.h> +#include <clk.h> #include <timer.h> +#include <linux/err.h> #include <asm/io.h> #include <asm/arch-armv7/globaltimer.h> -DECLARE_GLOBAL_DATA_PTR; - struct sti_timer_priv { struct globaltimer *global_timer; }; @@ -44,13 +43,24 @@ static int sti_timer_probe(struct udevice *dev) { struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); struct sti_timer_priv *priv = dev_get_priv(dev); - fdt_addr_t addr; - - uc_priv->clock_rate = CONFIG_SYS_HZ_CLOCK; + struct clk clk; + int err; + ulong ret; /* get arm global timer base address */ - addr = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), "reg"); - priv->global_timer = (struct globaltimer *)addr; + priv->global_timer = (struct globaltimer *)dev_read_addr_ptr(dev); + if (!priv->global_timer) + return -ENOENT; + + err = clk_get_by_index(dev, 0, &clk); + if (!err) { + ret = clk_get_rate(&clk); + if (IS_ERR_VALUE(ret)) + return ret; + uc_priv->clock_rate = ret; + } else { + uc_priv->clock_rate = CONFIG_SYS_HZ_CLOCK; + } /* init timer */ writel(0x01, &priv->global_timer->ctl); |