mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
timer: add OF_PLATDATA support for timer-uclass
The timer-uclass depends on full OF_CONTROL through its interrogation of /chosen and the code to determine the clock-frequency. For the OF_PLATDATA case, these code-paths are disabled and it becomes the timer driver's responsibility to correctly set the clock-frequency in the uclass priv-data. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
b65236ae3a
commit
b1a16002f2
1 changed files with 6 additions and 2 deletions
|
@ -42,6 +42,7 @@ unsigned long notrace timer_get_rate(struct udevice *dev)
|
||||||
|
|
||||||
static int timer_pre_probe(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 timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||||
struct clk timer_clk;
|
struct clk timer_clk;
|
||||||
int err;
|
int err;
|
||||||
|
@ -56,6 +57,7 @@ static int timer_pre_probe(struct udevice *dev)
|
||||||
} else
|
} else
|
||||||
uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob,
|
uc_priv->clock_rate = fdtdec_get_int(gd->fdt_blob,
|
||||||
dev_of_offset(dev), "clock-frequency", 0);
|
dev_of_offset(dev), "clock-frequency", 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -81,16 +83,18 @@ u64 timer_conv_64(u32 count)
|
||||||
|
|
||||||
int notrace dm_timer_init(void)
|
int notrace dm_timer_init(void)
|
||||||
{
|
{
|
||||||
const void *blob = gd->fdt_blob;
|
__maybe_unused const void *blob = gd->fdt_blob;
|
||||||
struct udevice *dev = NULL;
|
struct udevice *dev = NULL;
|
||||||
int node;
|
int node = -ENOENT;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (gd->timer)
|
if (gd->timer)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
/* Check for a chosen timer to be used for tick */
|
/* Check for a chosen timer to be used for tick */
|
||||||
node = fdtdec_get_chosen_node(blob, "tick-timer");
|
node = fdtdec_get_chosen_node(blob, "tick-timer");
|
||||||
|
#endif
|
||||||
if (node < 0) {
|
if (node < 0) {
|
||||||
/* No chosen timer, trying first available timer */
|
/* No chosen timer, trying first available timer */
|
||||||
ret = uclass_first_device_err(UCLASS_TIMER, &dev);
|
ret = uclass_first_device_err(UCLASS_TIMER, &dev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue