diff options
author | Tom Rini <trini@konsulko.com> | 2021-09-27 11:09:23 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-09-27 11:09:23 -0400 |
commit | 1d1f98c8eed7bb4792300e655c2cb70136928f74 (patch) | |
tree | d08df140d52bd1298fa0e81ce908e2e09a880e5d /drivers/timer/timer-uclass.c | |
parent | e908d20fcbd847e17345591fc171b59d9a156516 (diff) | |
parent | 933bf2644591281ed96f9d5771cbb35fe95bcb00 (diff) | |
download | u-boot-1d1f98c8eed7bb4792300e655c2cb70136928f74.tar.gz |
Merge tag 'dm-pull-next-27sep21' of https://source.denx.de/u-boot/custodians/u-boot-dm into nextWIP/27Sep2021-next
Various of-platdata improvements, including CONFIG_OF_REAL
Diffstat (limited to 'drivers/timer/timer-uclass.c')
-rw-r--r-- | drivers/timer/timer-uclass.c | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index c8e8419b22..6ea9e39e12 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -50,27 +50,29 @@ unsigned long notrace timer_get_rate(struct udevice *dev) static int timer_pre_probe(struct udevice *dev) { -#if !CONFIG_IS_ENABLED(OF_PLATDATA) - struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); - struct clk timer_clk; - int err; - ulong ret; + if (CONFIG_IS_ENABLED(OF_REAL)) { + struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev); + struct clk timer_clk; + int err; + ulong ret; - /* It is possible that a timer device has a null ofnode */ - if (!dev_has_ofnode(dev)) - return 0; + /* + * It is possible that a timer device has a null ofnode + */ + if (!dev_has_ofnode(dev)) + return 0; - err = clk_get_by_index(dev, 0, &timer_clk); - if (!err) { - ret = clk_get_rate(&timer_clk); - if (IS_ERR_VALUE(ret)) - return ret; - uc_priv->clock_rate = ret; - } else { - uc_priv->clock_rate = - dev_read_u32_default(dev, "clock-frequency", 0); + err = clk_get_by_index(dev, 0, &timer_clk); + if (!err) { + ret = clk_get_rate(&timer_clk); + if (IS_ERR_VALUE(ret)) + return ret; + uc_priv->clock_rate = ret; + } else { + uc_priv->clock_rate = + dev_read_u32_default(dev, "clock-frequency", 0); + } } -#endif return 0; } @@ -136,23 +138,23 @@ int notrace dm_timer_init(void) if (gd->dm_root == NULL) return -EAGAIN; -#if !CONFIG_IS_ENABLED(OF_PLATDATA) - /* Check for a chosen timer to be used for tick */ - node = ofnode_get_chosen_node("tick-timer"); - - if (ofnode_valid(node) && - uclass_get_device_by_ofnode(UCLASS_TIMER, node, &dev)) { - /* - * If the timer is not marked to be bound before - * relocation, bind it anyway. - */ - if (!lists_bind_fdt(dm_root(), node, &dev, false)) { - ret = device_probe(dev); - if (ret) - return ret; + if (CONFIG_IS_ENABLED(OF_REAL)) { + /* Check for a chosen timer to be used for tick */ + node = ofnode_get_chosen_node("tick-timer"); + + if (ofnode_valid(node) && + uclass_get_device_by_ofnode(UCLASS_TIMER, node, &dev)) { + /* + * If the timer is not marked to be bound before + * relocation, bind it anyway. + */ + if (!lists_bind_fdt(dm_root(), node, &dev, false)) { + ret = device_probe(dev); + if (ret) + return ret; + } } } -#endif if (!dev) { /* Fall back to the first available timer */ |