Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / drivers / timer / ast_timer.c
index d7c5460..e313249 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2016 Google Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -10,8 +9,7 @@
 #include <timer.h>
 #include <asm/io.h>
 #include <asm/arch/timer.h>
-
-DECLARE_GLOBAL_DATA_PTR;
+#include <linux/err.h>
 
 #define AST_TICK_TIMER  1
 #define AST_TMC_RELOAD_VAL  0xffffffff
@@ -66,9 +64,9 @@ static int ast_timer_ofdata_to_platdata(struct udevice *dev)
 {
        struct ast_timer_priv *priv = dev_get_priv(dev);
 
-       priv->regs = dev_get_addr_ptr(dev);
-       if (IS_ERR(priv->regs))
-               return PTR_ERR(priv->regs);
+       priv->regs = dev_read_addr_ptr(dev);
+       if (!priv->regs)
+               return -EINVAL;
 
        priv->tmc = ast_get_timer_counter(priv->regs, AST_TICK_TIMER);
 
@@ -93,5 +91,4 @@ U_BOOT_DRIVER(ast_timer) = {
        .priv_auto_alloc_size = sizeof(struct ast_timer_priv),
        .ofdata_to_platdata = ast_timer_ofdata_to_platdata,
        .ops = &ast_timer_ops,
-       .flags = DM_FLAG_PRE_RELOC,
 };