From 93b600ded7aa847649a175b2a56f154e434fb10c Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Fri, 3 Jan 2014 01:27:23 -0500 Subject: cubieboard: Setup CPU clock in romstage and load ramstage This completes the romstage for the cubieboard. Change-Id: If3272d8a9e414f782892bc41b34b5e2dece5d7e1 Signed-off-by: Alexandru Gagniuc Reviewed-on: http://review.coreboot.org/4686 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/mainboard/cubietech/cubieboard/romstage.c | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/mainboard/cubietech') diff --git a/src/mainboard/cubietech/cubieboard/romstage.c b/src/mainboard/cubietech/cubieboard/romstage.c index 1b4d886b2a..199842b317 100644 --- a/src/mainboard/cubietech/cubieboard/romstage.c +++ b/src/mainboard/cubietech/cubieboard/romstage.c @@ -1,10 +1,17 @@ /* - * Placeholder for Cubieboard romstage + * Basic romstage for Cubieboard + * + * Set up system voltages, then increase the CPU clock, before turning control + * to ramstage. The CPU VDD needs to be properly set before it can run at full + * speed. Setting the CPU at full speed helps lzma-decompress ramstage a lot + * faster. * * Copyright (C) 2013 Alexandru Gagniuc * Subject to the GNU GPL v2, or (at your option) any later version. */ +#include +#include #include #include #include @@ -63,10 +70,25 @@ static enum cb_err cubieboard_setup_power(void) void main(void) { + void *entry; + enum cb_err err; + console_init(); - printk(BIOS_INFO, "You have managed to succesfully load romstage.\n"); /* Configure power rails */ - cubieboard_setup_power(); + err = cubieboard_setup_power(); + + if (err == CB_SUCCESS) { + /* TODO: Get this clock from devicetree.cb */ + a1x_set_cpu_clock(1008); + } else { + /* cubieboard_setup_power() prints more details */ + printk(BIOS_WARNING, "Will run CPU at reduced speed\n"); + a1x_set_cpu_clock(384); + } + + entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram"); + printk(BIOS_INFO, "entry is 0x%p, leaving romstage.\n", entry); + stage_exit(entry); } -- cgit v1.2.3