summaryrefslogtreecommitdiff
path: root/src/cpu/samsung/exynos5250/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/samsung/exynos5250/timer.c')
-rw-r--r--src/cpu/samsung/exynos5250/timer.c84
1 files changed, 15 insertions, 69 deletions
diff --git a/src/cpu/samsung/exynos5250/timer.c b/src/cpu/samsung/exynos5250/timer.c
index e7cadc3b9d..405effac5b 100644
--- a/src/cpu/samsung/exynos5250/timer.c
+++ b/src/cpu/samsung/exynos5250/timer.c
@@ -1,16 +1,11 @@
/*
- * Copyright (C) 2009 Samsung Electronics
- * Heungjun Kim <riverful.kim@samsung.com>
- * Inki Dae <inki.dae@samsung.com>
- * Minkyu Kang <mk7.kang@samsung.com>
+ * This file is part of the coreboot project.
*
- * See file CREDITS for list of people who contributed to this
- * project.
+ * Copyright (C) 2009 Samsung Electronics
*
- * 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 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,22 +14,18 @@
*
* 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
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <common.h>
+#include <console/console.h>
#include <arch/io.h>
#include <timer.h>
-#include <console/console.h>
-#include <cpu/samsung/exynos5250/pwm.h>
-#include <cpu/samsung/exynos5250/clk.h>
-#include <cpu/samsung/exynos5250/cpu.h>
-#include <cpu/samsung/exynos5250/exynos5-common.h>
+#include <delay.h>
+#include "timer.h"
+#include "pwm.h"
+#include "clk.h"
+#include "cpu.h"
-//#include <pwm.h>
-
-//DECLARE_GLOBAL_DATA_PTR;
static unsigned long long timer_reset_value;
static unsigned long lastinc;
@@ -59,7 +50,7 @@ static unsigned long timer_get_us_down(void)
return readl(&timer->tcnto4);
}
-int init_timer(void)
+void init_timer(void)
{
/* Timer may have been enabled in SPL */
if (!pwm_check_enabled(4)) {
@@ -69,15 +60,11 @@ int init_timer(void)
pwm_enable(4);
/* Use this as the current monotonic time in us */
- //gd->timer_reset_value = 0;
timer_reset_value = 0;
/* Use this as the last timer value we saw */
- //gd->lastinc = timer_get_us_down();
lastinc = timer_get_us_down();
}
-
- return 0;
}
/*
@@ -92,13 +79,6 @@ unsigned long get_timer(unsigned long base)
* The timer may have wrapped around, but it makes no difference to
* our arithmetic here.
*/
-#if 0
- gd->timer_reset_value += gd->lastinc - now;
- gd->lastinc = now;
-
- /* Divide by 1000 to convert from us to ms */
- return gd->timer_reset_value / 1000 - base;
-#endif
timer_reset_value += lastinc - now;
lastinc = now;
@@ -106,20 +86,8 @@ unsigned long get_timer(unsigned long base)
return timer_reset_value / 1000 - base;
}
-unsigned long timer_get_us(void)
-{
- struct s5p_timer *const timer = s5p_get_base_timer();
- unsigned long now_downward_us = readl(&timer->tcnto4);
-
- /*
- * Note that this timer counts downward. The pre-SPL process (BL1)
- * takes about 100ms, so add this in here.
- */
- return CONFIG_SPL_TIME_US - now_downward_us;
-}
-
/* delay x useconds */
-void udelay(unsigned long usec)
+void udelay(unsigned usec)
{
struct mono_time current, end;
@@ -128,7 +96,7 @@ void udelay(unsigned long usec)
mono_time_add_usecs(&end, usec);
if (mono_time_after(&current, &end)) {
- printk(BIOS_EMERG, "udelay: 0x%08lx is impossibly large\n",
+ printk(BIOS_EMERG, "udelay: 0x%08x is impossibly large\n",
usec);
/* There's not much we can do if usec is too big. Use a long,
* paranoid delay value and hope for the best... */
@@ -140,25 +108,3 @@ void udelay(unsigned long usec)
timer_monotonic_get(&current);
}
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-unsigned long long get_ticks(void)
-{
- return get_timer(0);
-}
-
-/*
- * This function is derived from PowerPC code (timebase clock frequency).
- * On ARM it returns the number of timer ticks per second.
- */
-unsigned long get_tbclk(void)
-{
- return CONFIG_SYS_HZ;
-}
-
-unsigned long timer_get_boot_us(void)
-{
- return timer_get_us();
-}