Skip to contentSkip to conversation

altera_jtag_uart: bypass when no jtag connection

PATCH Superseded Thomas Chou 2 participants 3 messages Mar 27, 2010 – Apr 23, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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,
#define CONFIG_ALTERA_JTAG_UART_BYPASS

---
 drivers/serial/altera_jtag_uart.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/serial/altera_jtag_uart.c +10 -2
index 9eccaa0..54d481b 100644
@@ -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 (&jtag->data, (unsigned char)c);
 }
 
Signature · 1 line
1.6.6.1
#1 lore raw

PATCH v2 1/1 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,

---
follow the "Fix outx/writex parameter order in io.h" patch from Scott.

 drivers/serial/altera_jtag_uart.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/serial/altera_jtag_uart.c +10 -2
index fb28aa9..2980e4d 100644
@@ -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);
 }
 
Signature · 1 line
1.6.6.1
Applied
#2 lore raw

PATCH v2 1/1 altera_jtag_uart: bypass when no jtag connection

Applied. Thanks.
--Scott

Quoted 36 lines · Thomas Chou

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,

---
follow the "Fix outx/writex parameter order in io.h" patch from Scott.

 drivers/serial/altera_jtag_uart.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
drivers/serial/altera_jtag_uart.c +10 -2
index fb28aa9..2980e4d 100644
@@ -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);
 }