summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2010-03-31 08:30:08 +0800
committerScott McNutt <smcnutt@psyent.com>2010-04-24 18:21:23 -0400
commit994852966d2e6cf98c1dbeea8ee62c233b305ffb (patch)
tree191b401b163ca8f965224e9ed99a1b589ef16efc
parent7e812f2e9cdac80f6287d4aee5deb434597c4f8b (diff)
altera_jtag_uart: bypass when no jtag connection
This patch adds an option to bypass output waiting when there is no jtag connection. This allows the jtag uart work similar to a serial uart, ie, boot even without connection. This option is enabled with CONFIG_ALTERA_JTAG_UART_BYPASS Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Scott McNutt <smcnutt@psyent.com>
-rw-r--r--drivers/serial/altera_jtag_uart.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index fb28aa9eb94..2980e4d07c1 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -38,8 +38,16 @@ int serial_init( void ) { return(0);}
void serial_putc (char c)
{
- while (NIOS_JTAG_WSPACE ( readl (&jtag->control)) == 0)
- WATCHDOG_RESET ();
+ while (1) {
+ unsigned st = readl(&jtag->control);
+ if (NIOS_JTAG_WSPACE(st))
+ break;
+#ifdef CONFIG_ALTERA_JTAG_UART_BYPASS
+ if (!(st & NIOS_JTAG_AC)) /* no connection */
+ return;
+#endif
+ WATCHDOG_RESET();
+ }
writel ((unsigned char)c, &jtag->data);
}