[U-Boot] [PATCH v2 14/22] omap4: add serial console support to SPL
Aneesh V
aneesh at ti.com
Sun May 15 17:21:32 CEST 2011
Signed-off-by: Aneesh V <aneesh at ti.com>
---
arch/arm/cpu/armv7/omap4/board.c | 3 ++
arch/arm/cpu/armv7/omap4/clocks.c | 27 ++++++++++++++++++
arch/arm/include/asm/arch-omap4/sys_proto.h | 2 +
arch/arm/include/asm/omap_common.h | 1 +
spl/board/ti/omap4.mk | 40 +++++++++++++++++++++++++++
spl/board/ti/spl-omap.c | 20 +++++++++++++
6 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap4/board.c b/arch/arm/cpu/armv7/omap4/board.c
index f83b6d7..4a37171 100644
--- a/arch/arm/cpu/armv7/omap4/board.c
+++ b/arch/arm/cpu/armv7/omap4/board.c
@@ -105,6 +105,9 @@ void s_init(void)
{
watchdog_init();
set_mux_conf_regs();
+#ifdef CONFIG_PRELOADER
+ preloader_console_init();
+#endif
prcm_init();
}
diff --git a/arch/arm/cpu/armv7/omap4/clocks.c b/arch/arm/cpu/armv7/omap4/clocks.c
index 802917f..c405b5c 100644
--- a/arch/arm/cpu/armv7/omap4/clocks.c
+++ b/arch/arm/cpu/armv7/omap4/clocks.c
@@ -713,6 +713,33 @@ void lock_dpll(u32 base)
wait_for_lock(base);
}
+void setup_clocks_for_console(void)
+{
+ /* Do not add any spl_debug prints in this function */
+ modify_reg_32(CM_L4PER_CLKSTCTRL, CD_CLKCTRL_CLKTRCTRL_SHIFT,
+ CD_CLKCTRL_CLKTRCTRL_MASK, CD_CLKCTRL_CLKTRCTRL_SW_WKUP);
+
+ /* Enable all UARTs - console will be on one of them */
+ modify_reg_32(CM_L4PER_UART1_CLKCTRL, MODULE_CLKCTRL_MODULEMODE_SHIFT,
+ MODULE_CLKCTRL_MODULEMODE_MASK,
+ MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN);
+
+ modify_reg_32(CM_L4PER_UART2_CLKCTRL, MODULE_CLKCTRL_MODULEMODE_SHIFT,
+ MODULE_CLKCTRL_MODULEMODE_MASK,
+ MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN);
+
+ modify_reg_32(CM_L4PER_UART3_CLKCTRL, MODULE_CLKCTRL_MODULEMODE_SHIFT,
+ MODULE_CLKCTRL_MODULEMODE_MASK,
+ MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN);
+
+ modify_reg_32(CM_L4PER_UART3_CLKCTRL, MODULE_CLKCTRL_MODULEMODE_SHIFT,
+ MODULE_CLKCTRL_MODULEMODE_MASK,
+ MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN);
+
+ modify_reg_32(CM_L4PER_CLKSTCTRL, CD_CLKCTRL_CLKTRCTRL_SHIFT,
+ CD_CLKCTRL_CLKTRCTRL_MASK, CD_CLKCTRL_CLKTRCTRL_HW_AUTO);
+}
+
void prcm_init(void)
{
switch (omap4_hw_init_context()) {
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h b/arch/arm/include/asm/arch-omap4/sys_proto.h
index 4ba0ee0..3ac972d 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -38,12 +38,14 @@ void set_muxconf_regs_non_essential(void);
void sr32(void *, u32, u32, u32);
u32 wait_on_value(u32, u32, void *, u32);
void sdelay(unsigned long);
+void setup_clocks_for_console(void);
void prcm_init(void);
void bypass_dpll(u32 base);
void freq_update_core(void);
u32 get_sys_clk_freq(void);
u32 omap4_ddr_clk(void);
u32 omap4_revision(void);
+const char *omap4_rev_string(void);
static inline u32 running_from_sdram(void)
{
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 787dd88..10fc9c8 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -53,5 +53,6 @@
u32 omap_boot_device(void);
u32 omap_boot_mode(void);
+void preloader_console_init(void);
#endif /* _OMAP_COMMON_H_ */
diff --git a/spl/board/ti/omap4.mk b/spl/board/ti/omap4.mk
index 0374534..508dc3b 100644
--- a/spl/board/ti/omap4.mk
+++ b/spl/board/ti/omap4.mk
@@ -32,6 +32,46 @@ include $(TOPDIR)/config.mk
SOBJS =
COBJS =
+# serial console
+$(obj)eabi_compat.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/arch/arm/lib/eabi_compat.c $@
+
+$(obj)string.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/lib/string.c $@
+
+$(obj)vsprintf.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/lib/vsprintf.c $@
+
+$(obj)console.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/common/console.c $@
+
+$(obj)stdio.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/common/stdio.c $@
+
+$(obj)serial.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/drivers/serial/serial.c $@
+
+$(obj)ns16550.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/drivers/serial/ns16550.c $@
+
+$(obj)div64.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/lib/div64.c $@
+
+$(obj)ctype.c:
+ @rm -f $@
+ @ln -s $(TOPDIR)/lib/ctype.c $@
+
+COBJS += serial.o ns16550.o string.o vsprintf.o console.o stdio.o
+COBJS += ctype.o eabi_compat.o div64.o
+
# armv7
$(obj)start.S:
@rm -f $@
diff --git a/spl/board/ti/spl-omap.c b/spl/board/ti/spl-omap.c
index 0e08f4f..855572f 100644
--- a/spl/board/ti/spl-omap.c
+++ b/spl/board/ti/spl-omap.c
@@ -29,6 +29,7 @@
#include <asm/u-boot.h>
#include <asm/arch/sys_proto.h>
#include <timestamp_autogenerated.h>
+#include <version_autogenerated.h>
/* Define global data structure pointer to it*/
gd_t gdata __attribute__ ((section(".data")));
@@ -45,3 +46,22 @@ void board_init_r(gd_t *id, ulong dummy)
for (;;)
;
}
+
+void preloader_console_init(void)
+{
+ const char *u_boot_rev = U_BOOT_VERSION;
+
+ gd->bd = &bdata;
+ gd->flags |= GD_FLG_RELOC;
+ gd->baudrate = CONFIG_BAUDRATE;
+
+ setup_clocks_for_console();
+ serial_init(); /* serial communications setup */
+
+ /* Avoid a second "U-Boot" coming from this string */
+ u_boot_rev = &u_boot_rev[7];
+
+ printf("\nU-Boot SPL %s (%s - %s)\n", u_boot_rev, U_BOOT_DATE,
+ U_BOOT_TIME);
+ printf("Texas Instruments %s\n", omap4_rev_string());
+}
--
1.7.0.4
More information about the U-Boot
mailing list