]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/cpu/arm926ejs/mxs/timer.c
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
[u-boot] / arch / arm / cpu / arm926ejs / mxs / timer.c
index 2a95bcb68c3b33647f5b6a80a8c7251f6d586f1b..f2e72257d15b5d77fb7d583152f2b19b1f32a95f 100644 (file)
@@ -7,23 +7,7 @@
  * Based on code from LTIB:
  * (C) Copyright 2009-2010 Freescale Semiconductor, Inc.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -46,22 +30,22 @@ DECLARE_GLOBAL_DATA_PTR;
 /*
  * This driver uses 1kHz clock source.
  */
-#define        MX28_INCREMENTER_HZ             1000
+#define        MXS_INCREMENTER_HZ              1000
 
 static inline unsigned long tick_to_time(unsigned long tick)
 {
-       return tick / (MX28_INCREMENTER_HZ / CONFIG_SYS_HZ);
+       return tick / (MXS_INCREMENTER_HZ / CONFIG_SYS_HZ);
 }
 
 static inline unsigned long time_to_tick(unsigned long time)
 {
-       return time * (MX28_INCREMENTER_HZ / CONFIG_SYS_HZ);
+       return time * (MXS_INCREMENTER_HZ / CONFIG_SYS_HZ);
 }
 
 /* Calculate how many ticks happen in "us" microseconds */
 static inline unsigned long us_to_tick(unsigned long us)
 {
-       return (us * MX28_INCREMENTER_HZ) / 1000000;
+       return (us * MXS_INCREMENTER_HZ) / 1000000;
 }
 
 int timer_init(void)
@@ -107,6 +91,8 @@ unsigned long long get_ticks(void)
                TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET;
 #elif defined(CONFIG_MX28)
        now = readl(&timrot_regs->hw_timrot_running_count0);
+#else
+#error "Don't know how to read timrot_regs"
 #endif
 
        if (lastdec >= now) {
@@ -136,17 +122,17 @@ ulong get_timer(ulong base)
 }
 
 /* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */
-#define        MX28_HW_DIGCTL_MICROSECONDS     0x8001c0c0
+#define        MXS_HW_DIGCTL_MICROSECONDS      0x8001c0c0
 
 void __udelay(unsigned long usec)
 {
        uint32_t old, new, incr;
        uint32_t counter = 0;
 
-       old = readl(MX28_HW_DIGCTL_MICROSECONDS);
+       old = readl(MXS_HW_DIGCTL_MICROSECONDS);
 
        while (counter < usec) {
-               new = readl(MX28_HW_DIGCTL_MICROSECONDS);
+               new = readl(MXS_HW_DIGCTL_MICROSECONDS);
 
                /* Check if the timer wrapped. */
                if (new < old) {
@@ -171,5 +157,5 @@ void __udelay(unsigned long usec)
 
 ulong get_tbclk(void)
 {
-       return MX28_INCREMENTER_HZ;
+       return MXS_INCREMENTER_HZ;
 }