Skip to content

Commit

Permalink
MIPS, ttyFDC: Add early FDC console support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Hogan authored and Ralf Baechle committed Mar 31, 2015
1 parent 4cebec6 commit e934945
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/mips/include/asm/cdmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,15 @@ void mips_cdmm_driver_unregister(struct mips_cdmm_driver *);
module_driver(__mips_cdmm_driver, mips_cdmm_driver_register, \
mips_cdmm_driver_unregister)

/* drivers/tty/mips_ejtag_fdc.c */

#ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON
int setup_early_fdc_console(void);
#else
static inline int setup_early_fdc_console(void)
{
return -ENODEV;
}
#endif

#endif /* __ASM_CDMM_H */
2 changes: 2 additions & 0 deletions arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <asm/bootinfo.h>
#include <asm/bugs.h>
#include <asm/cache.h>
#include <asm/cdmm.h>
#include <asm/cpu.h>
#include <asm/sections.h>
#include <asm/setup.h>
Expand Down Expand Up @@ -763,6 +764,7 @@ void __init setup_arch(char **cmdline_p)
cpu_probe();
prom_init();

setup_early_fdc_console();
#ifdef CONFIG_EARLY_PRINTK
setup_early_printk();
#endif
Expand Down
13 changes: 13 additions & 0 deletions drivers/tty/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -437,4 +437,17 @@ config MIPS_EJTAG_FDC_TTY

If unsure, say N.

config MIPS_EJTAG_FDC_EARLYCON
bool "Early FDC console"
depends on MIPS_EJTAG_FDC_TTY
help
This registers a console on FDC channel 1 very early during boot (from
MIPS arch code). This is useful for bring-up and debugging early boot
issues.

Do not enable unless there is a debug probe attached to drain the FDC
TX FIFO.

If unsure, say N.

endif # TTY
20 changes: 20 additions & 0 deletions drivers/tty/mips_ejtag_fdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
#define REG_FDSTAT_TXE BIT(1) /* Tx Empty */
#define REG_FDSTAT_TXF BIT(0) /* Tx Full */

/* Default channel for the early console */
#define CONSOLE_CHANNEL 1

#define NUM_TTY_CHANNELS 16

#define RX_BUF_SIZE 1024
Expand Down Expand Up @@ -1124,3 +1127,20 @@ static int __init mips_ejtag_fdc_init_console(void)
return mips_ejtag_fdc_console_init(&mips_ejtag_fdc_con);
}
console_initcall(mips_ejtag_fdc_init_console);

#ifdef CONFIG_MIPS_EJTAG_FDC_EARLYCON
static struct mips_ejtag_fdc_console mips_ejtag_fdc_earlycon = {
.cons = {
.name = "early_fdc",
.write = mips_ejtag_fdc_console_write,
.flags = CON_PRINTBUFFER | CON_BOOT,
.index = CONSOLE_CHANNEL,
},
.lock = __RAW_SPIN_LOCK_UNLOCKED(mips_ejtag_fdc_earlycon.lock),
};

int __init setup_early_fdc_console(void)
{
return mips_ejtag_fdc_console_init(&mips_ejtag_fdc_earlycon);
}
#endif

0 comments on commit e934945

Please sign in to comment.