From: 黄涛 Date: Tue, 28 Feb 2012 11:19:37 +0000 (+0800) Subject: rk: move early_printk.c from mach-rk29 to plat-rk and add RK_EARLY_PRINTK config X-Git-Tag: firefly_0821_release~9595^2~111 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4bf971b3406eca491a6fe1ca942324b4db3e2ddd;p=firefly-linux-kernel-4.4.55.git rk: move early_printk.c from mach-rk29 to plat-rk and add RK_EARLY_PRINTK config --- diff --git a/arch/arm/mach-rk29/Makefile b/arch/arm/mach-rk29/Makefile index 79f18f3c6968..4809e2ddeef5 100644 --- a/arch/arm/mach-rk29/Makefile +++ b/arch/arm/mach-rk29/Makefile @@ -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 index ff0c36f23119..000000000000 --- a/arch/arm/mach-rk29/early_printk.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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-rk30/Makefile b/arch/arm/mach-rk30/Makefile index 3d9fa0f22193..ddccc07c64fc 100644 --- a/arch/arm/mach-rk30/Makefile +++ b/arch/arm/mach-rk30/Makefile @@ -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 diff --git a/arch/arm/mach-rk30/common.c b/arch/arm/mach-rk30/common.c index d399887b4bd3..c223e414a6b6 100755 --- a/arch/arm/mach-rk30/common.c +++ b/arch/arm/mach-rk30/common.c @@ -12,8 +12,6 @@ #include #include -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); diff --git a/arch/arm/plat-rk/Kconfig b/arch/arm/plat-rk/Kconfig index 3df471be3408..239095211f36 100644 --- a/arch/arm/plat-rk/Kconfig +++ b/arch/arm/plat-rk/Kconfig @@ -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 diff --git a/arch/arm/plat-rk/Makefile b/arch/arm/plat-rk/Makefile index 874c3063ce02..37be789fc277 100644 --- a/arch/arm/plat-rk/Makefile +++ b/arch/arm/plat-rk/Makefile @@ -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 index 000000000000..ff0c36f23119 --- /dev/null +++ b/arch/arm/plat-rk/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/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h index 8c70dd5e0445..40b96dcd4e4f 100644 --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -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);