rk29: add early printk support
author黄涛 <huangtao@rock-chips.com>
Wed, 16 Mar 2011 08:53:31 +0000 (16:53 +0800)
committer黄涛 <huangtao@rock-chips.com>
Wed, 16 Mar 2011 08:53:31 +0000 (16:53 +0800)
arch/arm/mach-rk29/Makefile
arch/arm/mach-rk29/clock.c
arch/arm/mach-rk29/early_printk.c [new file with mode: 0644]
arch/arm/mach-rk29/include/mach/board.h

index 4861a83e84e2e2dbe3640e6fac288a4f67e23058..7e0b128894fc664a549216ec5c3eb10dfc3ebf6d 100644 (file)
@@ -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
index 4ccc2d70807293f88b846fba1dc8620ce43b83b2..bb682f32a64cf1c01f4f26024cd8696b741f470d 100755 (executable)
@@ -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 (file)
index 0000000..ff0c36f
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ *  arch/arm/mach-rk29/early_printk.c
+ *
+ *  Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de>
+ *
+ * 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 <linux/kernel.h>
+#include <linux/console.h>
+#include <linux/init.h>
+
+#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
+}
index 40a73a3ea48582c624973730dd179e47c4893b3f..01c0eee2df886a9fc43a4e9ad06d1f8182f9d978 100755 (executable)
@@ -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);