Merge tag 'u-boot-rockchip-20200531' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / drivers / timer / atcpit100_timer.c
index d5146ddfa41b044281a43d340eedd0d3f4c2902a..c5d43b4a4ae5e683d89cc9e14dc64fec9e1be98c 100644 (file)
@@ -1,10 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Andestech ATCPIT100 timer driver
  *
  * (C) Copyright 2016
  * Rick Chen, NDS32 Software Engineering, rick@andestech.com
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
 #include <dm.h>
@@ -12,8 +11,6 @@
 #include <timer.h>
 #include <linux/io.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define REG32_TMR(x)   (*(u32 *)       ((plat->regs) + (x>>2)))
 
 /*
@@ -73,7 +70,7 @@ struct atcpit_timer_platdata {
 
 static int atcpit_timer_get_count(struct udevice *dev, u64 *count)
 {
-       struct atcpit_timer_platdata *plat = dev->platdata;
+       struct atcpit_timer_platdata *plat = dev_get_platdata(dev);
        u32 val;
        val = ~(REG32_TMR(CH_CNT(1))+0xffffffff);
        *count = timer_conv_64(val);
@@ -82,7 +79,7 @@ static int atcpit_timer_get_count(struct udevice *dev, u64 *count)
 
 static int atcpit_timer_probe(struct udevice *dev)
 {
-       struct atcpit_timer_platdata *plat = dev->platdata;
+       struct atcpit_timer_platdata *plat = dev_get_platdata(dev);
        REG32_TMR(CH_REL(1)) = 0xffffffff;
        REG32_TMR(CH_CTL(1)) = APB_CLK|TMR_32;
        REG32_TMR(CH_EN) |= CH_TMR_EN(1 , 0);
@@ -113,5 +110,4 @@ U_BOOT_DRIVER(atcpit100_timer) = {
        .platdata_auto_alloc_size = sizeof(struct atcpit_timer_platdata),
        .probe = atcpit_timer_probe,
        .ops    = &atcpit_timer_ops,
-       .flags = DM_FLAG_PRE_RELOC,
 };