]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mach-sunxi: Move timer code to mach folder
authorJesse Taube <mr.bossman075@gmail.com>
Sat, 29 Jan 2022 15:23:01 +0000 (10:23 -0500)
committerAndre Przywara <andre.przywara@arm.com>
Fri, 4 Feb 2022 00:09:57 +0000 (00:09 +0000)
Both armv7 and arm926ejs use this timer code so move it to mach-sunxi.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/cpu/armv7/sunxi/Makefile
arch/arm/mach-sunxi/Makefile
arch/arm/mach-sunxi/timer.c [moved from arch/arm/cpu/armv7/sunxi/timer.c with 97% similarity]

index ad11be78632f3b2229afa2625b7cbcaba4e5e924..3e975b366c432ee6b21e98962737744a078c1587 100644 (file)
@@ -5,7 +5,6 @@
 # Based on some other Makefile
 # (C) Copyright 2000-2003
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-obj-y  += timer.o
 
 obj-$(CONFIG_MACH_SUN6I)       += tzpc.o
 obj-$(CONFIG_MACH_SUN8I_H3)    += tzpc.o
index 5d3fd70f7499c6d3c336919db4172a93511bd964..b1adb75e1708724651527572bd6d03fa6ae6035f 100644 (file)
@@ -25,6 +25,9 @@ obj-$(CONFIG_MACH_SUN8I)      += clock_sun6i.o
 endif
 obj-$(CONFIG_MACH_SUN9I)       += clock_sun9i.o gtbus_sun9i.o
 obj-$(CONFIG_SUN50I_GEN_H6)    += clock_sun50i_h6.o
+ifndef CONFIG_ARM64
+obj-y  += timer.o
+endif
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_DRAM_SUN4I)       += dram_sun4i.o
similarity index 97%
rename from arch/arm/cpu/armv7/sunxi/timer.c
rename to arch/arm/mach-sunxi/timer.c
index b7585996369f67fe1bfb15fb3d69eb150a28b1e0..fc9d419a25e04fb880423a3a8e8d467464333884 100644 (file)
@@ -51,6 +51,7 @@ int timer_init(void)
        struct sunxi_timer_reg *timers =
                (struct sunxi_timer_reg *)SUNXI_TIMER_BASE;
        struct sunxi_timer *timer = &timers->timer[TIMER_NUM];
+
        writel(TIMER_LOAD_VAL, &timer->inter);
        writel(TIMER_MODE | TIMER_DIV | TIMER_SRC | TIMER_RELOAD | TIMER_EN,
               &timer->ctl);
@@ -58,15 +59,14 @@ int timer_init(void)
        return 0;
 }
 
-/* timer without interrupts */
 static ulong get_timer_masked(void)
 {
        /* current tick value */
        ulong now = TICKS_TO_HZ(read_timer());
 
-       if (now >= gd->arch.lastinc)    /* normal (non rollover) */
+       if (now >= gd->arch.lastinc) {  /* normal (non rollover) */
                gd->arch.tbl += (now - gd->arch.lastinc);
-       else {
+       else {
                /* rollover */
                gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL)
                                - gd->arch.lastinc) + now;
@@ -76,6 +76,7 @@ static ulong get_timer_masked(void)
        return gd->arch.tbl;
 }
 
+/* timer without interrupts */
 ulong get_timer(ulong base)
 {
        return get_timer_masked() - base;