From 94863c8f3239d491339923213077f930b90fe486 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Wed, 16 Mar 2011 16:53:31 +0800 Subject: [PATCH] rk29: add early printk support --- arch/arm/mach-rk29/Makefile | 4 +++ arch/arm/mach-rk29/clock.c | 2 -- arch/arm/mach-rk29/early_printk.c | 46 +++++++++++++++++++++++++ arch/arm/mach-rk29/include/mach/board.h | 2 +- 4 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 arch/arm/mach-rk29/early_printk.c diff --git a/arch/arm/mach-rk29/Makefile b/arch/arm/mach-rk29/Makefile index 4861a83e84e2..7e0b128894fc 100644 --- a/arch/arm/mach-rk29/Makefile +++ b/arch/arm/mach-rk29/Makefile @@ -1,4 +1,8 @@ obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o gpio.o ddr.o sram.o memcpy_dma.o reset.o +obj-y += early_printk.o +ifndef CONFIG_DEBUG_LL +obj-y += ../kernel/debug.o +endif obj-$(CONFIG_PM) += pm.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_RK29_VPU) += vpu.o vpu_mem.o diff --git a/arch/arm/mach-rk29/clock.c b/arch/arm/mach-rk29/clock.c index 4ccc2d708072..bb682f32a64c 100755 --- a/arch/arm/mach-rk29/clock.c +++ b/arch/arm/mach-rk29/clock.c @@ -2270,9 +2270,7 @@ static void __init clk_enable_init_clocks(void) clk_enable_nolock(&clk_ddr); clk_enable_nolock(&clk_debug); clk_enable_nolock(&clk_jtag); -#ifdef CONFIG_DEBUG_LL clk_enable_nolock(&clk_uart1); -#endif } static int __init clk_disable_unused(void) diff --git a/arch/arm/mach-rk29/early_printk.c b/arch/arm/mach-rk29/early_printk.c new file mode 100644 index 000000000000..ff0c36f23119 --- /dev/null +++ b/arch/arm/mach-rk29/early_printk.c @@ -0,0 +1,46 @@ +/* + * arch/arm/mach-rk29/early_printk.c + * + * Copyright (C) 2009 Sascha Hauer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +#ifndef CONFIG_DEBUG_LL +extern void printch(int); + +static void early_write(const char *s, unsigned n) +{ + while (n-- > 0) { + if (*s == '\n') + printch('\r'); + printch(*s); + s++; + } +} + +static void early_console_write(struct console *con, const char *s, unsigned n) +{ + early_write(s, n); +} + +static struct console early_console = { + .name = "earlycon", + .write = early_console_write, + .flags = CON_PRINTBUFFER | CON_BOOT, + .index = -1, +}; +#endif + +void __init rk29_setup_early_printk(void) +{ +#ifndef CONFIG_DEBUG_LL + register_console(&early_console); +#endif +} diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h index 40a73a3ea485..01c0eee2df88 100755 --- a/arch/arm/mach-rk29/include/mach/board.h +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -197,7 +197,7 @@ struct akm8975_platform_data { int gpio_DRDY; }; - +void __init rk29_setup_early_printk(void); void __init rk29_map_common_io(void); void __init rk29_clock_init(void); -- 2.34.1