summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2013-02-06 22:01:18 +0800
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-02-08 03:24:09 +0100
commitb868d40830787ba5a92721d131c38165285b7795 (patch)
tree382cf2dbf7896d9e370a1361797a72bd35540882
parent580fa2bf316d4796e5ed76cbbd3e454479fb0688 (diff)
armv7: Use same console initialization procedure for all ARM stages
Use same console initialization procedure for all ARM stages (bootblock, romstage, and ramstage): #include <console/console.h> ... console_init() ... printk(level, format, ...) Verified to boot on armv7/snow with console messages in all stages. Change-Id: Idd689219035e67450ea133838a2ca02f8d74557e Signed-off-by: Hung-Te Lin <hungte@chromium.org> Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/2301 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r--src/arch/armv7/Makefile.inc9
-rw-r--r--src/arch/armv7/bootblock_simple.c2
-rw-r--r--src/arch/armv7/include/common.h13
-rw-r--r--src/arch/armv7/lib/Makefile.inc6
-rw-r--r--src/arch/armv7/lib/early_console.c (renamed from src/arch/armv7/lib/romstage_console.c)22
-rw-r--r--src/cpu/samsung/exynos5-common/uart.h2
-rw-r--r--src/cpu/samsung/exynos5250/Makefile.inc13
-rw-r--r--src/cpu/samsung/exynos5250/uart.c4
-rw-r--r--src/include/uart.h5
-rw-r--r--src/mainboard/google/snow/bootblock.c16
-rw-r--r--src/mainboard/google/snow/ramstage.c4
11 files changed, 40 insertions, 56 deletions
diff --git a/src/arch/armv7/Makefile.inc b/src/arch/armv7/Makefile.inc
index 7d02e7c109..0471b942dd 100644
--- a/src/arch/armv7/Makefile.inc
+++ b/src/arch/armv7/Makefile.inc
@@ -223,17 +223,18 @@ $(objgenerated)/bootblock_inc.S: $$(bootblock_inc)
$(objgenerated)/bootblock.o: $(objgenerated)/bootblock.s
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
+ $(CC) $(bootblock-S-ccopts) -Wa,-acdlns -c -o $@ $< > $(basename $@).disasm
$(objgenerated)/bootblock.s: $(objgenerated)/bootblock_inc.S $(obj)/config.h $(obj)/build.h
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/armv7/include -I$(obj) -include $(obj)/build.h -include $(obj)/config.h -I. -I$(src) $< -o $@
+ $(CC) $(bootblock-S-ccopts) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/armv7/include -I$(obj) -include $(obj)/build.h -include $(obj)/config.h -I. -I$(src) $< -o $@
$(objgenerated)/bootblock.inc: $(src)/arch/armv7/$(subst ",,$(CONFIG_BOOTBLOCK_SOURCE)) $(bootblock_custom) $(OPTION_TABLE_H)
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(CC) $(INCLUDES) -MM -MT$(objgenerated)/bootblock.inc \
+ $(CC) $(bootblock-c-ccopts) $(INCLUDES) -MM \
+ -MT$(objgenerated)/bootblock.inc \
$< > $(objgenerated)/bootblock.inc.d
- $(CC) -c -S $(CFLAGS) -I. $(INCLUDES) $< -o $@
+ $(CC) $(bootblock-c-ccopts) -c -S $(CFLAGS) -I. $(INCLUDES) $< -o $@
$(objcbfs)/bootblock.debug: $(objgenerated)/bootblock.o $(objgenerated)/bootblock.ld $$(bootblock-objs) $(stages)
@printf " LINK $(subst $(obj)/,,$(@))\n"
diff --git a/src/arch/armv7/bootblock_simple.c b/src/arch/armv7/bootblock_simple.c
index fe2662e022..0132b87bad 100644
--- a/src/arch/armv7/bootblock_simple.c
+++ b/src/arch/armv7/bootblock_simple.c
@@ -23,6 +23,7 @@
#include <arch/hlt.h>
#include <arch/stages.h>
#include <cbfs.h>
+#include <console/console.h>
#include "stages.c"
@@ -46,6 +47,7 @@ void main(void)
bootblock_mainboard_init();
}
+ console_init();
printk(BIOS_INFO, "hello from bootblock\n");
printk(BIOS_INFO, "bootblock main(): loading romstage\n");
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name);
diff --git a/src/arch/armv7/include/common.h b/src/arch/armv7/include/common.h
index d95a74d3a8..d8698db208 100644
--- a/src/arch/armv7/include/common.h
+++ b/src/arch/armv7/include/common.h
@@ -422,19 +422,6 @@ int strcmp_compar(const void *, const void *);
/* lib/time.c */
void udelay (unsigned long);
-#if 0
-/* lib/vsprintf.c */
-ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
-int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
-unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
-long simple_strtol(const char *cp,char **endp,unsigned int base);
-void panic(const char *fmt, ...)
- __attribute__ ((format (__printf__, 1, 2), noreturn));
-int sprintf(char * buf, const char *fmt, ...)
- __attribute__ ((format (__printf__, 2, 3)));
-int vsprintf(char *buf, const char *fmt, va_list args);
-#endif
-
/* lib/strmhz.c */
char * strmhz(char *buf, unsigned long hz);
diff --git a/src/arch/armv7/lib/Makefile.inc b/src/arch/armv7/lib/Makefile.inc
index 343e9f8378..048e0717df 100644
--- a/src/arch/armv7/lib/Makefile.inc
+++ b/src/arch/armv7/lib/Makefile.inc
@@ -1,14 +1,12 @@
bootblock-y += syslib.c
-bootblock-y += romstage_console.c
+bootblock-$(CONFIG_EARLY_CONSOLE) += early_console.c
romstage-y += cache_v7.c
romstage-y += cache-cp15.c
romstage-y += div0.c
romstage-y += div64.S
-romstage-y += romstage_console.c
romstage-y += syslib.c
-
-#ramstage-y += printk_init.c
+romstage-$(CONFIG_EARLY_CONSOLE) += early_console.c
ramstage-y += div0.c
ramstage-y += div64.S
diff --git a/src/arch/armv7/lib/romstage_console.c b/src/arch/armv7/lib/early_console.c
index b0ac34e32e..68e81c632e 100644
--- a/src/arch/armv7/lib/romstage_console.c
+++ b/src/arch/armv7/lib/early_console.c
@@ -19,13 +19,6 @@
#include <console/console.h>
#include <console/vtxprintf.h>
-// TODO Unify with x86 (CONFIG_CONSOLE_SERIAL8250)
-#if CONFIG_CONSOLE_SERIAL
-#include <uart.h>
-#endif
-#if CONFIG_USBDEBUG
-#include <usbdebug.h>
-#endif
/* FIXME: need to make console driver more generic */
void console_tx_byte(unsigned char byte)
@@ -33,6 +26,15 @@ void console_tx_byte(unsigned char byte)
if (byte == '\n')
console_tx_byte('\r');
+#if CONFIG_CONSOLE_SERIAL8250MEM
+ if (oxford_oxpcie_present) {
+ uart8250_mem_tx_byte(
+ CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000, byte);
+ }
+#endif
+#if CONFIG_CONSOLE_SERIAL8250
+ uart8250_tx_byte(CONFIG_TTYS0_BASE, byte);
+#endif
#if CONFIG_CONSOLE_SERIAL_UART
uart_tx_byte(byte);
#endif
@@ -46,6 +48,12 @@ void console_tx_byte(unsigned char byte)
static void _console_tx_flush(void)
{
+#if CONFIG_CONSOLE_SERIAL8250MEM
+ uart8250_mem_tx_flush(CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000);
+#endif
+#if CONFIG_CONSOLE_SERIAL8250
+ uart8250_tx_flush(CONFIG_TTYS0_BASE);
+#endif
#if CONFIG_CONSOLE_SERIAL_UART
uart_tx_flush();
#endif
diff --git a/src/cpu/samsung/exynos5-common/uart.h b/src/cpu/samsung/exynos5-common/uart.h
index 52da62d55a..350e224b86 100644
--- a/src/cpu/samsung/exynos5-common/uart.h
+++ b/src/cpu/samsung/exynos5-common/uart.h
@@ -52,6 +52,4 @@ static inline int s5p_uart_divslot(void)
return 0;
}
-void uart_init(void);
-
#endif
diff --git a/src/cpu/samsung/exynos5250/Makefile.inc b/src/cpu/samsung/exynos5250/Makefile.inc
index 1c6d7169a0..13baa7ef65 100644
--- a/src/cpu/samsung/exynos5250/Makefile.inc
+++ b/src/cpu/samsung/exynos5250/Makefile.inc
@@ -10,7 +10,7 @@ bootblock-y += clock_init.c
bootblock-y += clock.c
bootblock-y += pinmux.c
bootblock-y += soc.c
-bootblock-y += uart.c
+bootblock-$(CONFIG_EARLY_CONSOLE) += uart.c
romstage-y += clock.c
romstage-y += clock_init.c
@@ -18,23 +18,18 @@ romstage-y += exynos_cache.c
romstage-y += pinmux.c
romstage-y += power.c
romstage-y += soc.c
-romstage-y += uart.c
romstage-y += dmc_common.c
romstage-y += dmc_init_ddr3.c
+romstage-$(CONFIG_EARLY_CONSOLE) += uart.c
-#ramstage-y += clock.c
-#ramstage-y += clock_init.c
-#ramstage-y += power.c
-#ramstage-y += uart.c
-#ramstage-y += pinmux.c
-##ramstage-y += tzpc_init.c
+#ramstage-y += tzpc_init.c
ramstage-y += clock.c
ramstage-y += clock_init.c
ramstage-y += exynos_cache.c
ramstage-y += pinmux.c
ramstage-y += power.c
ramstage-y += soc.c
-ramstage-y += uart.c
+ramstage-$(CONFIG_CONSOLE_SERIAL_UART) += uart.c
#ramstage-$(CONFIG_EXYNOS_ACE_SHA) += ace_sha.c
#ramstage-$(CONFIG_SATA_AHCI) += sata.c
diff --git a/src/cpu/samsung/exynos5250/uart.c b/src/cpu/samsung/exynos5250/uart.c
index 92ffd26599..3e80017a2c 100644
--- a/src/cpu/samsung/exynos5250/uart.c
+++ b/src/cpu/samsung/exynos5250/uart.c
@@ -28,6 +28,8 @@
#include <console/console.h> /* for __console definition */
#include <cpu/samsung/exynos5-common/exynos5-common.h>
+#include <cpu/samsung/exynos5-common/uart.h>
+#include <cpu/samsung/exynos5250/uart.h>
#include <cpu/samsung/exynos5250/clk.h>
#define RX_FIFO_COUNT_MASK 0xff
@@ -191,7 +193,7 @@ static void exynos5_uart_tx_byte(unsigned char data)
writeb(data, &uart->utxh);
}
-#if !defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__)
+#if !defined(__PRE_RAM__)
static const struct console_driver exynos5_uart_console __console = {
.init = exynos5_init_dev,
.tx_byte = exynos5_uart_tx_byte,
diff --git a/src/include/uart.h b/src/include/uart.h
index e42449653f..ca5191e292 100644
--- a/src/include/uart.h
+++ b/src/include/uart.h
@@ -30,14 +30,11 @@
#include <uart8250.h>
#endif
-#if CONFIG_CPU_SAMSUNG_EXYNOS5
-#include <cpu/samsung/exynos5-common/uart.h>
-#endif
-
#if !defined(__ROMCC__) && CONFIG_CONSOLE_SERIAL_UART
unsigned char uart_rx_byte(void);
void uart_tx_byte(unsigned char data);
void uart_tx_flush(void);
+void uart_init(void);
#endif
#endif /* UART_H */
diff --git a/src/mainboard/google/snow/bootblock.c b/src/mainboard/google/snow/bootblock.c
index b57b6c3533..00e97c1674 100644
--- a/src/mainboard/google/snow/bootblock.c
+++ b/src/mainboard/google/snow/bootblock.c
@@ -17,18 +17,18 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#if CONFIG_EARLY_CONSOLE
#include <types.h>
#include <arch/io.h>
-#include <cbfs.h>
-#include <uart.h>
-#include <console/console.h>
+#include <device/i2c.h>
#include <cpu/samsung/exynos5250/clk.h>
#include <cpu/samsung/exynos5250/dmc.h>
#include <cpu/samsung/exynos5250/periph.h>
#include <cpu/samsung/exynos5250/clock_init.h>
+#include <src/cpu/samsung/exynos5250/power.h>
+#include <drivers/maxim/max77686/max77686.h>
+#include <console/console.h>
-#endif
+#define I2C0_BASE 0x12c60000
void bootblock_mainboard_init(void);
void bootblock_mainboard_init(void)
@@ -39,10 +39,8 @@ void bootblock_mainboard_init(void)
mem = get_mem_timings();
arm_ratios = get_arm_clk_ratios();
system_clock_init(mem, arm_ratios);
-
-#if CONFIG_EARLY_CONSOLE
exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
- uart_init();
+
+ console_init();
printk(BIOS_INFO, "\n\n\n%s: UART initialized\n", __func__);
-#endif
}
diff --git a/src/mainboard/google/snow/ramstage.c b/src/mainboard/google/snow/ramstage.c
index 50050d37a5..f9d9c9600c 100644
--- a/src/mainboard/google/snow/ramstage.c
+++ b/src/mainboard/google/snow/ramstage.c
@@ -24,9 +24,7 @@ void main(void)
// volatile unsigned long *pshold = (unsigned long *)0x1004330c;
// *pshold &= ~0x100; /* shut down */
- /* FIXME: console_init() seems to cause things to die... Maybe
- we need to reset our stack pointer? */
-// console_init();
+ console_init();
printk(BIOS_INFO, "hello from ramstage\n");
while (1);
}