aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/arch/arm/armv4/bootblock_simple.c6
-rw-r--r--src/arch/arm/armv7/bootblock_simple.c6
-rw-r--r--src/include/delay.h4
-rw-r--r--src/lib/hardwaremain.c5
-rw-r--r--src/lib/timer.c2
-rw-r--r--src/mainboard/google/storm/Makefile.inc1
-rw-r--r--src/mainboard/google/storm/bootblock.c26
-rw-r--r--src/soc/rockchip/rk3288/bootblock.c2
-rw-r--r--src/soc/rockchip/rk3288/include/soc/timer.h2
-rw-r--r--src/soc/rockchip/rk3288/timer.c2
-rw-r--r--src/soc/samsung/exynos5250/bootblock.c5
-rw-r--r--src/soc/samsung/exynos5250/include/soc/clk.h3
-rw-r--r--src/soc/samsung/exynos5250/timer.c5
-rw-r--r--src/soc/samsung/exynos5420/bootblock.c5
-rw-r--r--src/soc/samsung/exynos5420/include/soc/clk.h3
-rw-r--r--src/soc/samsung/exynos5420/timer.c5
16 files changed, 24 insertions, 58 deletions
diff --git a/src/arch/arm/armv4/bootblock_simple.c b/src/arch/arm/armv4/bootblock_simple.c
index 26646eebf..eea2dd684 100644
--- a/src/arch/arm/armv4/bootblock_simple.c
+++ b/src/arch/arm/armv4/bootblock_simple.c
@@ -24,7 +24,9 @@
#include <bootblock_common.h>
#include <cbfs.h>
#include <console/console.h>
+#include <delay.h>
#include <program_loading.h>
+#include <timestamp.h>
__attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ }
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
@@ -32,6 +34,10 @@ __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
void main(void)
{
+ init_timer();
+ if (IS_ENABLED(CONFIG_HAS_PRECBMEM_TIMESTAMP_REGION))
+ timestamp_init(timestamp_get());
+
bootblock_mainboard_early_init();
if (CONFIG_BOOTBLOCK_CONSOLE) {
diff --git a/src/arch/arm/armv7/bootblock_simple.c b/src/arch/arm/armv7/bootblock_simple.c
index 564db5b80..b8b60c870 100644
--- a/src/arch/arm/armv7/bootblock_simple.c
+++ b/src/arch/arm/armv7/bootblock_simple.c
@@ -24,8 +24,10 @@
#include <bootblock_common.h>
#include <cbfs.h>
#include <console/console.h>
+#include <delay.h>
#include <program_loading.h>
#include <smp/node.h>
+#include <timestamp.h>
__attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ }
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
@@ -33,6 +35,10 @@ __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
void main(void)
{
+ init_timer();
+ if (IS_ENABLED(CONFIG_HAS_PRECBMEM_TIMESTAMP_REGION))
+ timestamp_init(timestamp_get());
+
bootblock_mainboard_early_init();
#if CONFIG_BOOTBLOCK_CONSOLE
diff --git a/src/include/delay.h b/src/include/delay.h
index ab1f4f982..b3d8ed95d 100644
--- a/src/include/delay.h
+++ b/src/include/delay.h
@@ -1,11 +1,7 @@
#ifndef DELAY_H
#define DELAY_H
-#if IS_ENABLED(CONFIG_GENERIC_UDELAY)
-static inline void init_timer(void) {}
-#else
void init_timer(void);
-#endif
void udelay(unsigned usecs);
void mdelay(unsigned msecs);
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 5f06ca762..3d1b8f2a5 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -464,8 +464,9 @@ void main(void)
/* Schedule the static boot state entries. */
boot_state_schedule_static_entries();
- /* FIXME: Is there a better way to handle this? */
- init_timer();
+ /* TODO: Understand why this is here and move to arch/platform code. */
+ if (IS_ENABLED(CONFIG_ARCH_X86))
+ init_timer();
bs_walk_state_machine();
diff --git a/src/lib/timer.c b/src/lib/timer.c
index a2edc5c96..8aeaa063c 100644
--- a/src/lib/timer.c
+++ b/src/lib/timer.c
@@ -22,6 +22,8 @@
#include <delay.h>
#include <thread.h>
+__attribute__((weak)) void init_timer() { /* do nothing */ }
+
void udelay(unsigned usec)
{
struct stopwatch sw;
diff --git a/src/mainboard/google/storm/Makefile.inc b/src/mainboard/google/storm/Makefile.inc
index 453caae14..5add3b3e5 100644
--- a/src/mainboard/google/storm/Makefile.inc
+++ b/src/mainboard/google/storm/Makefile.inc
@@ -17,7 +17,6 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-bootblock-y += bootblock.c
bootblock-y += cdp.c
bootblock-y += reset.c
diff --git a/src/mainboard/google/storm/bootblock.c b/src/mainboard/google/storm/bootblock.c
deleted file mode 100644
index fc9f8f39d..000000000
--- a/src/mainboard/google/storm/bootblock.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright 2014 Google Inc.
- *
- * 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
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <bootblock_common.h>
-#include <delay.h>
-
-void bootblock_mainboard_early_init(void)
-{
- init_timer();
-}
diff --git a/src/soc/rockchip/rk3288/bootblock.c b/src/soc/rockchip/rk3288/bootblock.c
index 4a5b0d269..9ea3ec02a 100644
--- a/src/soc/rockchip/rk3288/bootblock.c
+++ b/src/soc/rockchip/rk3288/bootblock.c
@@ -29,8 +29,6 @@
static void bootblock_soc_init(void)
{
- rk3288_init_timer();
-
rkclk_init();
mmu_init();
diff --git a/src/soc/rockchip/rk3288/include/soc/timer.h b/src/soc/rockchip/rk3288/include/soc/timer.h
index 230168637..248b150ab 100644
--- a/src/soc/rockchip/rk3288/include/soc/timer.h
+++ b/src/soc/rockchip/rk3288/include/soc/timer.h
@@ -40,6 +40,4 @@ static struct rk3288_timer * const timer7_ptr = (void *)TIMER7_BASE;
#define TIMER_LOAD_VAL 0xffffffff
-void rk3288_init_timer(void);
-
#endif /* __SOC_ROCKCHIP_RK3288_TIMER_H__ */
diff --git a/src/soc/rockchip/rk3288/timer.c b/src/soc/rockchip/rk3288/timer.c
index 47f99c23f..253d145b4 100644
--- a/src/soc/rockchip/rk3288/timer.c
+++ b/src/soc/rockchip/rk3288/timer.c
@@ -39,7 +39,7 @@ void timer_monotonic_get(struct mono_time *mt)
mono_time_set_usecs(mt, timer_raw_value() / clocks_per_usec);
}
-void rk3288_init_timer(void)
+void init_timer(void)
{
write32(TIMER_LOAD_VAL, &timer7_ptr->timer_load_count0);
write32(TIMER_LOAD_VAL, &timer7_ptr->timer_load_count1);
diff --git a/src/soc/samsung/exynos5250/bootblock.c b/src/soc/samsung/exynos5250/bootblock.c
index dd0e01c87..5154c5b3c 100644
--- a/src/soc/samsung/exynos5250/bootblock.c
+++ b/src/soc/samsung/exynos5250/bootblock.c
@@ -23,11 +23,6 @@
void bootblock_soc_init(void)
{
- /* kick off the multi-core timer.
- * We want to do this as early as we can.
- */
- mct_start();
-
if (get_wakeup_state() == WAKEUP_DIRECT) {
wakeup();
/* Never returns. */
diff --git a/src/soc/samsung/exynos5250/include/soc/clk.h b/src/soc/samsung/exynos5250/include/soc/clk.h
index cefd37ad4..54b06a748 100644
--- a/src/soc/samsung/exynos5250/include/soc/clk.h
+++ b/src/soc/samsung/exynos5250/include/soc/clk.h
@@ -589,9 +589,6 @@ int clock_set_rate(enum periph_id periph_id, unsigned int rate);
/* Clock gate unused IP */
void clock_gate(void);
-void mct_start(void);
-uint64_t mct_raw_value(void);
-
/* These are the ratio's for configuring ARM clock */
struct arm_clk_ratios {
unsigned int arm_freq_mhz; /* Frequency of ARM core in MHz */
diff --git a/src/soc/samsung/exynos5250/timer.c b/src/soc/samsung/exynos5250/timer.c
index 0947d19d6..1e25771db 100644
--- a/src/soc/samsung/exynos5250/timer.c
+++ b/src/soc/samsung/exynos5250/timer.c
@@ -18,13 +18,14 @@
*/
#include <arch/io.h>
+#include <delay.h>
#include <soc/clk.h>
#include <stdint.h>
#include <timer.h>
static const uint32_t clocks_per_usec = MCT_HZ/1000000;
-uint64_t mct_raw_value(void)
+static uint64_t mct_raw_value(void)
{
uint64_t upper = readl(&exynos_mct->g_cnt_u);
uint64_t lower = readl(&exynos_mct->g_cnt_l);
@@ -32,7 +33,7 @@ uint64_t mct_raw_value(void)
return (upper << 32) | lower;
}
-void mct_start(void)
+void init_timer(void)
{
writel(readl(&exynos_mct->g_tcon) | (0x1 << 8),
&exynos_mct->g_tcon);
diff --git a/src/soc/samsung/exynos5420/bootblock.c b/src/soc/samsung/exynos5420/bootblock.c
index f347677b9..59bc16920 100644
--- a/src/soc/samsung/exynos5420/bootblock.c
+++ b/src/soc/samsung/exynos5420/bootblock.c
@@ -30,11 +30,6 @@
void bootblock_soc_init(void)
{
- /* kick off the multi-core timer.
- * We want to do this as early as we can.
- */
- mct_start();
-
if (get_wakeup_state() == WAKEUP_DIRECT) {
wakeup();
/* Never returns. */
diff --git a/src/soc/samsung/exynos5420/include/soc/clk.h b/src/soc/samsung/exynos5420/include/soc/clk.h
index ca1d721f8..1677a9c18 100644
--- a/src/soc/samsung/exynos5420/include/soc/clk.h
+++ b/src/soc/samsung/exynos5420/include/soc/clk.h
@@ -725,9 +725,6 @@ int clock_set_rate(enum periph_id periph_id, unsigned int rate);
/* Clock gate unused IP */
void clock_gate(void);
-void mct_start(void);
-uint64_t mct_raw_value(void);
-
/* These are the ratio's for configuring ARM clock */
struct arm_clk_ratios {
unsigned int arm_freq_mhz; /* Frequency of ARM core in MHz */
diff --git a/src/soc/samsung/exynos5420/timer.c b/src/soc/samsung/exynos5420/timer.c
index 0947d19d6..1e25771db 100644
--- a/src/soc/samsung/exynos5420/timer.c
+++ b/src/soc/samsung/exynos5420/timer.c
@@ -18,13 +18,14 @@
*/
#include <arch/io.h>
+#include <delay.h>
#include <soc/clk.h>
#include <stdint.h>
#include <timer.h>
static const uint32_t clocks_per_usec = MCT_HZ/1000000;
-uint64_t mct_raw_value(void)
+static uint64_t mct_raw_value(void)
{
uint64_t upper = readl(&exynos_mct->g_cnt_u);
uint64_t lower = readl(&exynos_mct->g_cnt_l);
@@ -32,7 +33,7 @@ uint64_t mct_raw_value(void)
return (upper << 32) | lower;
}
-void mct_start(void)
+void init_timer(void)
{
writel(readl(&exynos_mct->g_tcon) | (0x1 << 8),
&exynos_mct->g_tcon);