Skip to contentSkip to conversation

Blackfin serial driver bug fixing

PATCH In review Bryan Wu 2 participants 4 messages Aug 15, 2008

lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

cover Blackfin serial driver bug fixing

Hi Alan,

Here is 2 critical bug fixing patch for Blackfin serial driver. And as you acked the previous 8 Blackfin serial driver patches, need I push them to blackfin-2.6 git tree and ask Linus to pull from that or they were queued in your serial tree?

Thanks,
-Bryan

author
#1 lore raw

PATCH 1/2 Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode

From: Sonic Zhang <[email protected]>

---
 arch/blackfin/kernel/bfin_dma_5xx.c |   13 ++++-----
 drivers/serial/bfin_5xx.c           |   50 +++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 7 deletions(-)
arch/blackfin/kernel/bfin_dma_5xx.c +6 -7
index 93229b3..339293d 100644
@@ -117,15 +117,14 @@ int request_dma(unsigned int channel, char *device_id)
 
 #ifdef CONFIG_BF54x
 	if (channel >= CH_UART2_RX && channel <= CH_UART3_TX) {
-		if (strncmp(device_id, "BFIN_UART", 9) == 0) {
-			dma_ch[channel].regs->peripheral_map &= 0x0FFF;
-			dma_ch[channel].regs->peripheral_map |=
+		unsigned int per_map;
+		per_map = dma_ch[channel].regs->peripheral_map & 0xFFF;
+		if (strncmp(device_id, "BFIN_UART", 9) == 0)
+			dma_ch[channel].regs->peripheral_map = per_map |
 				((channel - CH_UART2_RX + 0xC)<<12);
-		} else {
-			dma_ch[channel].regs->peripheral_map &= 0x0FFF;
-			dma_ch[channel].regs->peripheral_map |=
+		else
+			dma_ch[channel].regs->peripheral_map = per_map |
 				((channel - CH_UART2_RX + 0x6)<<12);
-		}
 	}
 #endif
 
drivers/serial/bfin_5xx.c +50 -0

62 lines not on this page · raw message

Signature · 1 line
1.5.6
author
#2 lore raw

PATCH 2/2 Blackfin Serial Driver: fix bug - Avoid null point exception in kgdb over UART

In reply to Bryan Wu

From: Sonic Zhang <[email protected]>

---
 drivers/serial/bfin_5xx.c |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)
drivers/serial/bfin_5xx.c +26 -17
index 487a562..a5ff54e 100644
@@ -124,8 +124,6 @@ static void bfin_serial_enable_ms(struct uart_port *port)
 }
 
 #ifdef CONFIG_KGDB_UART
-static int kgdb_entry_state;
-
 void kgdb_put_debug_char(int chr)
 {
 	struct bfin_serial_port *uart;
@@ -178,7 +176,7 @@ int kgdb_get_debug_char(void)
 #ifdef CONFIG_SERIAL_BFIN_PIO
 static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
 {
-	struct tty_struct *tty = uart->port.info->port.tty;
+	struct tty_struct *tty = NULL;
 	unsigned int status, ch, flg;
 	static struct timeval anomaly_start = { .tv_sec = 0 };
 
@@ -191,24 +189,33 @@ static void bfin_serial_rx_chars(struct bfin_serial_port *uart)
 #ifdef CONFIG_KGDB_UART
 	if (uart->port.line == CONFIG_KGDB_UART_PORT) {
 		struct pt_regs *regs = get_irq_regs();
-		if (uart->port.cons->index == CONFIG_KGDB_UART_PORT && ch == 0x1) { /* Ctrl + A */
-			kgdb_breakkey_pressed(regs);
-			return;
-		} else if (kgdb_entry_state == 0 && ch == '$') {/* connection from KGDB */
-			kgdb_entry_state = 1;
-		} else if (kgdb_entry_state == 1 && ch == 'q') {
-			kgdb_entry_state = 0;
+		int kgdb_timeout;
+		if (uart->port.cons->index == CONFIG_KGDB_UART_PORT
+			&& ch == 0x1) { /* Ctrl + A */
 			kgdb_breakkey_pressed(regs);
 			return;
+		}
+		if (ch == '$') {
+			/* connection from KGDB */
+			kgdb_timeout = get_cclk()/10000;
+			while (!(UART_GET_LSR(uart) & DR)
+				&& kgdb_timeout > 0) {
+				kgdb_timeout--;
+				cpu_relax();
+			}
+			if (kgdb_timeout && UART_GET_CHAR(uart) == 'q') {
+				kgdb_breakkey_pressed(regs);
+				return;
+			}
 		} else if (ch == 0x3) {/* Ctrl + C */
-			kgdb_entry_state = 0;
 			kgdb_breakkey_pressed(regs);
 			return;
-		} else {
-			kgdb_entry_state = 0;
 		}
+		if (!uart->port.info)
+			return;
 	}
 #endif
+	tty = uart->port.info->tty;
 
 	if (ANOMALY_05000363) {
 		/* The BF533 (and BF561) family of processors have a nice anomaly
@@ -1076,10 +1083,7 @@ static int __init bfin_serial_rs_console_init(void)
 {
 	bfin_serial_init_ports();
 	register_console(&bfin_serial_console);
-#ifdef CONFIG_KGDB_UART
-	kgdb_entry_state = 0;
-	init_kgdb_uart();
-#endif
+
 	return 0;
 }
 console_initcall(bfin_serial_rs_console_init);
@@ -1266,6 +1270,7 @@ static int __init bfin_serial_init(void)
 		t.c_line = CONFIG_KGDB_UART_PORT;
 		bfin_serial_set_termios(&uart->port, &t, &t);
 	}
+	init_kgdb_uart();
 #endif
 	return ret;
 }
@@ -1276,7 +1281,11 @@ static void __exit bfin_serial_exit(void)
 	uart_unregister_driver(&bfin_serial_reg);
 }
 
+#ifdef CONFIG_KGDB_UART
+subsys_initcall(bfin_serial_init);
+#else
 module_init(bfin_serial_init);
+#endif
 module_exit(bfin_serial_exit);
 
 MODULE_AUTHOR("Aubrey.Li <[email protected]>");
Signature · 1 line
1.5.6
#3 lore raw
In reply to Bryan Wu
Quoted 7 lines · On Fri, 15 Aug 2008 16:14:07 +0800 Bryan Wu <[email protected]> wrote:

Hi Alan,

Here is 2 critical bug fixing patch for Blackfin serial driver. And as you acked the previous 8 Blackfin serial driver patches, need I push them to blackfin-2.6 git tree and ask Linus to pull from that or they were queued in your serial tree?

The existing ones were queued for 2.6.28 as I assumed that was what your email meant you want to do. If you have critical fixes at this point in the -rc series I would send them direct to Linus