+// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2016 Google Inc.
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#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
{
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);
.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,
};