summaryrefslogtreecommitdiff
path: root/src/soc/imgtec/pistachio/bootblock.c
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2014-11-05 17:50:09 -0800
committerStefan Reinauer <stefan.reinauer@coreboot.org>2015-04-09 00:29:09 +0200
commit52a887985300cf11fbc183f6a4a4408ff9a45ec6 (patch)
tree10cef88314046050b41057689d1e0a8e7b7cefb0 /src/soc/imgtec/pistachio/bootblock.c
parent771819a3806b5e60e3db73b2779072ee0f23890f (diff)
downloadcoreboot-52a887985300cf11fbc183f6a4a4408ff9a45ec6.tar.xz
pistachio: implement timer support
C0_COUNT register is a free running counter clocked by the CPU frequency divided by two. On the FPGA board it results in 25 MHz, on real SOCs it will have to be figured out later. Some magic addresses and numbers are used to find out if the code is running on the FPGA board. timestamp_get() and timer_monotonic_get() are kept in the same file. The CPU initialization makes sure that CO COUNT is in fact enabled and starts from zero. BRANCH=none BUG=chrome-os-partner:33595,chrome-os-partner:31438 TEST=with timer enabled, the startup code properly initializes UART and prints the coreboot bootblock banner message on the serial console. Change-Id: I98fe330b961f677448b222917ab7d586494ed4b7 Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Original-Commit-Id: a7324221c1d856ac72fa2b0ab586b5ea8cab3a05 Original-Change-Id: I2d518213de939e91a35f8aea174aed76d297dd72 Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/227888 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/9188 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/soc/imgtec/pistachio/bootblock.c')
-rw-r--r--src/soc/imgtec/pistachio/bootblock.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/soc/imgtec/pistachio/bootblock.c b/src/soc/imgtec/pistachio/bootblock.c
index f6cc76b0b9..90112646c4 100644
--- a/src/soc/imgtec/pistachio/bootblock.c
+++ b/src/soc/imgtec/pistachio/bootblock.c
@@ -19,6 +19,21 @@
* MA 02110-1301 USA
*/
+#include <stdint.h>
+#include <arch/cpu.h>
+
static void bootblock_cpu_init(void)
{
+ uint32_t cause;
+
+ /*
+ * Make sure the count register is counting by clearing the "Disable
+ * Counter" bit, in case it is set.
+ */
+ cause = read_c0_cause();
+ if (cause & C0_CAUSE_DC)
+ write_c0_cause(cause & ~(C0_CAUSE_DC));
+
+ /* And make sure that it starts from zero. */
+ write_c0_count(0);
}