aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2015-01-29 06:14:13 -0500
committerRalf Baechle <ralf@linux-mips.org>2015-03-31 06:04:12 -0400
commite934945db7625716f9cc469e31fc5da8666c8024 (patch)
treeec3381a503bb92b2d40ee656e8b9b4b222add244
parent4cebec609aea6dff23e67a42b6516d852fa87d07 (diff)
MIPS, ttyFDC: Add early FDC console support
Add support for early console of MIPS Fast Debug Channel (FDC) on channel 1 with a call very early from the MIPS setup_arch(). Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/9145/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/include/asm/cdmm.h11
-rw-r--r--arch/mips/kernel/setup.c2
-rw-r--r--drivers/tty/Kconfig13
-rw-r--r--drivers/tty/mips_ejtag_fdc.c20
4 files changed, 46 insertions, 0 deletions
diff --git a/arch/mips/include/asm/cdmm.h b/arch/mips/include/asm/cdmm.h
index b7d520f28d30..16e22ce9719f 100644
--- a/arch/mips/include/asm/cdmm.h
+++ b/arch/mips/include/asm/cdmm.h
@@ -84,4 +84,15 @@ void mips_cdmm_driver_unregister(struct mips_cdmm_driver *);
84 module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \ 84 module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \
85 mips_cdmm_driver_unregister) 85 mips_cdmm_driver_unregister)
86 86
87/* drivers/tty/mips_ejtag_fdc.c */
88
89#ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON
90int setup_early_fdc_console(void);
91#else
92static inline int setup_early_fdc_console(void)
93{
94 return -ENODEV;
95}
96#endif
97
87#endif /* __ASM_CDMM_H */ 98#endif /* __ASM_CDMM_H */
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 058929041368..be73c491182b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -31,6 +31,7 @@
31#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
32#include <asm/bugs.h> 32#include <asm/bugs.h>
33#include <asm/cache.h> 33#include <asm/cache.h>
34#include <asm/cdmm.h>
34#include <asm/cpu.h> 35#include <asm/cpu.h>
35#include <asm/sections.h> 36#include <asm/sections.h>
36#include <asm/setup.h> 37#include <asm/setup.h>
@@ -763,6 +764,7 @@ void __init setup_arch(char **cmdline_p)
763 cpu_probe(); 764 cpu_probe();
764 prom_init(); 765 prom_init();
765 766
767 setup_early_fdc_console();
766#ifdef CONFIG_EARLY_PRINTK 768#ifdef CONFIG_EARLY_PRINTK
767 setup_early_printk(); 769 setup_early_printk();
768#endif 770#endif
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 39469ca4231c..e0c18e5b7057 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -437,4 +437,17 @@ config MIPS_EJTAG_FDC_TTY
437 437
438 If unsure, say N. 438 If unsure, say N.
439 439
440config MIPS_EJTAG_FDC_EARLYCON
441 bool "Early FDC console"
442 depends on MIPS_EJTAG_FDC_TTY
443 help
444 This registers a console on FDC channel 1 very early during boot (from
445 MIPS arch code). This is useful for bring-up and debugging early boot
446 issues.
447
448 Do not enable unless there is a debug probe attached to drain the FDC
449 TX FIFO.
450
451 If unsure, say N.
452
440endif # TTY 453endif # TTY
diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
index 51672cfe7e45..8d9bf6f90110 100644
--- a/drivers/tty/mips_ejtag_fdc.c
+++ b/drivers/tty/mips_ejtag_fdc.c
@@ -69,6 +69,9 @@
69#define REG_FDSTAT_TXE BIT(1) /* Tx Empty */ 69#define REG_FDSTAT_TXE BIT(1) /* Tx Empty */
70#define REG_FDSTAT_TXF BIT(0) /* Tx Full */ 70#define REG_FDSTAT_TXF BIT(0) /* Tx Full */
71 71
72/* Default channel for the early console */
73#define CONSOLE_CHANNEL 1
74
72#define NUM_TTY_CHANNELS 16 75#define NUM_TTY_CHANNELS 16
73 76
74#define RX_BUF_SIZE 1024 77#define RX_BUF_SIZE 1024
@@ -1124,3 +1127,20 @@ static int __init mips_ejtag_fdc_init_console(void)
1124 return mips_ejtag_fdc_console_init(&mips_ejtag_fdc_con); 1127 return mips_ejtag_fdc_console_init(&mips_ejtag_fdc_con);
1125} 1128}
1126console_initcall(mips_ejtag_fdc_init_console); 1129console_initcall(mips_ejtag_fdc_init_console);
1130
1131#ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON
1132static struct mips_ejtag_fdc_console mips_ejtag_fdc_earlycon = {
1133 .cons = {
1134 .name = "early_fdc",
1135 .write = mips_ejtag_fdc_console_write,
1136 .flags = CON_PRINTBUFFER | CON_BOOT,
1137 .index = CONSOLE_CHANNEL,
1138 },
1139 .lock = __RAW_SPIN_LOCK_UNLOCKED(mips_ejtag_fdc_earlycon.lock),
1140};
1141
1142int __init setup_early_fdc_console(void)
1143{
1144 return mips_ejtag_fdc_console_init(&mips_ejtag_fdc_earlycon);
1145}
1146#endif