rk: move early_printk.c from mach-rk29 to plat-rk and add RK_EARLY_PRINTK config
author黄涛 <huangtao@rock-chips.com>
Tue, 28 Feb 2012 11:19:37 +0000 (19:19 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 28 Feb 2012 11:20:16 +0000 (19:20 +0800)
arch/arm/mach-rk29/Makefile
arch/arm/mach-rk29/early_printk.c [deleted file]
arch/arm/mach-rk30/Makefile
arch/arm/mach-rk30/common.c
arch/arm/plat-rk/Kconfig
arch/arm/plat-rk/Makefile
arch/arm/plat-rk/early_printk.c [new file with mode: 0644]
arch/arm/plat-rk/include/plat/board.h

index 79f18f3c696804408e956a3a11a84fb253588590..4809e2ddeef5a8ed2341af599cdc05dd025558da 100644 (file)
@@ -1,9 +1,5 @@
 obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o ddr.o memcpy_dma.o reset.o
 obj-y += tests.o memtester.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_DDR_FREQ) += ddrfreq.o
diff --git a/arch/arm/mach-rk29/early_printk.c b/arch/arm/mach-rk29/early_printk.c
deleted file mode 100644 (file)
index ff0c36f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  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 3d9fa0f2219352681c050fc88353c489eee85f3a..ddccc07c64fc130cdeae2a4c6a6197fb73599055 100644 (file)
@@ -6,9 +6,5 @@ obj-y += iomux.o
 obj-y += reset.o
 obj-y += timer.o
 obj-$(CONFIG_FIQ) += fiq.o
-obj-y += ../mach-rk29/early_printk.o
-ifndef CONFIG_DEBUG_LL
-obj-y += ../kernel/debug.o
-endif
 obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
 obj-$(CONFIG_MACH_RK30_SDK) += board-rk30-sdk.o board-rk30-sdk-key.o
index d399887b4bd3a3b062acaf4713b2b9f2b6bfe4eb..c223e414a6b6f300b8a1a5dbc8ffd7d0f0da56a9 100755 (executable)
@@ -12,8 +12,6 @@
 #include <mach/iomux.h>
 #include <mach/fiq.h>
 
-extern void __init rk29_setup_early_printk(void);
-
 void __init rk30_init_irq(void)
 {
        gic_init(0, IRQ_LOCALTIMER, RK30_GICD_BASE, RK30_GICC_BASE);
index 3df471be3408a47183b635133c1a0e2fa96585cc..239095211f36c1024d65a8cb3f9d7912ea62be75 100644 (file)
@@ -106,4 +106,12 @@ config RK29_LAST_LOG
        help
          It is only intended for debugging.
 
+config RK_EARLY_PRINTK
+       bool "Early printk"
+       depends on PRINTK && !DEBUG_LL
+       default y
+       help
+         Say Y here if you want to have an early console using the
+         kernel low-level debugging functions.
+
 endif
index 874c3063ce029ab18a181f10102748b7310345c8..37be789fc2770cc51a87e8d695abd86572453bb7 100644 (file)
@@ -3,5 +3,6 @@ obj-$(CONFIG_USB_GADGET) += usb_detect.o
 obj-$(CONFIG_RK29_VPU) += vpu_service.o
 obj-$(CONFIG_ARCH_RK30) += dma-pl330.o
 obj-$(CONFIG_FIQ_DEBUGGER) += rk_fiq_debugger.o
+obj-$(CONFIG_RK_EARLY_PRINTK) += early_printk.o ../kernel/debug.o
 obj-y += mem_reserve.o
 obj-y += sram.o
diff --git a/arch/arm/plat-rk/early_printk.c b/arch/arm/plat-rk/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 8c70dd5e0445f9bd7b853a8bd7785d8882a2b3c1..40b96dcd4e4f146ed576b614269d11787f23ace0 100644 (file)
@@ -93,6 +93,12 @@ int board_usb_detect_init(unsigned gpio);
 static int inline board_usb_detect_init(unsigned gpio) { return 0; }
 #endif
 
+#ifdef CONFIG_RK_EARLY_PRINTK
+void __init rk29_setup_early_printk(void);
+#else
+static void inline rk29_setup_early_printk(void) {}
+#endif
+
 /* for wakeup Android */
 void rk28_send_wakeup_key(void);