Merge tag 'v2021.01-rc5' into next
[platform/kernel/u-boot.git] / drivers / timer / stm32_timer.c
index 9a856b1..215334f 100644 (file)
@@ -1,7 +1,7 @@
 // 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>
@@ -9,6 +9,8 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <timer.h>
+#include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #include <asm/io.h>
 
@@ -50,14 +52,12 @@ struct stm32_timer_priv {
        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(&regs->cnt);
-
-       return 0;
+       return readl(&regs->cnt);
 }
 
 static int stm32_timer_probe(struct udevice *dev)
@@ -129,9 +129,8 @@ U_BOOT_DRIVER(stm32_timer) = {
        .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,
 };