// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
- * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
+ * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
*/
#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <timer.h>
+#include <dm/device_compat.h>
+#include <linux/bitops.h>
#include <asm/io.h>
struct stm32_timer_regs *base;
};
-static int stm32_timer_get_count(struct udevice *dev, u64 *count)
+static u64 stm32_timer_get_count(struct udevice *dev)
{
struct stm32_timer_priv *priv = dev_get_priv(dev);
struct stm32_timer_regs *regs = priv->base;
- *count = readl(®s->cnt);
-
- return 0;
+ return readl(®s->cnt);
}
static int stm32_timer_probe(struct udevice *dev)
.name = "stm32_timer",
.id = UCLASS_TIMER,
.of_match = stm32_timer_ids,
- .priv_auto_alloc_size = sizeof(struct stm32_timer_priv),
+ .priv_auto = sizeof(struct stm32_timer_priv),
.probe = stm32_timer_probe,
.ops = &stm32_timer_ops,
- .flags = DM_FLAG_PRE_RELOC,
};