mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Blackfin serial driver bug fixing
@ 2008-08-15  8:14 Bryan Wu
  2008-08-15  8:14 ` [PATCH 1/2] Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode Bryan Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bryan Wu @ 2008-08-15  8:14 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode
  2008-08-15  8:14 [PATCH 0/2] Blackfin serial driver bug fixing Bryan Wu
@ 2008-08-15  8:14 ` Bryan Wu
  2008-08-15  8:14 ` [PATCH 2/2] Blackfin Serial Driver: fix bug - Avoid null point exception in kgdb over UART Bryan Wu
  2008-08-15  9:00 ` [PATCH 0/2] Blackfin serial driver bug fixing Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Bryan Wu @ 2008-08-15  8:14 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel, Sonic Zhang, Bryan Wu

From: Sonic Zhang <sonic.zhang@analog.com>

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 arch/blackfin/kernel/bfin_dma_5xx.c |   13 ++++-----
 drivers/serial/bfin_5xx.c           |   50 +++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 93229b3..339293d 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -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
 
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 5ae1bfa..487a562 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -649,6 +649,42 @@ static int bfin_serial_startup(struct uart_port *port)
 		free_irq(uart->port.irq, uart);
 		return -EBUSY;
 	}
+
+# ifdef CONFIG_BF54x
+	{
+		unsigned uart_dma_ch_rx, uart_dma_ch_tx;
+
+		switch (uart->port.irq) {
+		case IRQ_UART3_RX:
+			uart_dma_ch_rx = CH_UART3_RX;
+			uart_dma_ch_tx = CH_UART3_TX;
+			break;
+		case IRQ_UART2_RX:
+			uart_dma_ch_rx = CH_UART2_RX;
+			uart_dma_ch_tx = CH_UART2_TX;
+			break;
+		default:
+			uart_dma_ch_rx = uart_dma_ch_tx = 0;
+			break;
+		};
+
+		if (uart_dma_ch_rx &&
+			request_dma(uart_dma_ch_rx, "BFIN_UART_RX") < 0) {
+			printk(KERN_NOTICE"Fail to attach UART interrupt\n");
+			free_irq(uart->port.irq, uart);
+			free_irq(uart->port.irq + 1, uart);
+			return -EBUSY;
+		}
+		if (uart_dma_ch_tx &&
+			request_dma(uart_dma_ch_tx, "BFIN_UART_TX") < 0) {
+			printk(KERN_NOTICE "Fail to attach UART interrupt\n");
+			free_dma(uart_dma_ch_rx);
+			free_irq(uart->port.irq, uart);
+			free_irq(uart->port.irq + 1, uart);
+			return -EBUSY;
+		}
+	}
+# endif
 #endif
 	UART_SET_IER(uart, ERBFI);
 	return 0;
@@ -666,6 +702,20 @@ static void bfin_serial_shutdown(struct uart_port *port)
 	del_timer(&(uart->rx_dma_timer));
 	dma_free_coherent(NULL, PAGE_SIZE, uart->rx_dma_buf.buf, 0);
 #else
+#ifdef CONFIG_BF54x
+	switch (uart->port.irq) {
+	case IRQ_UART3_RX:
+		free_dma(CH_UART3_RX);
+		free_dma(CH_UART3_TX);
+		break;
+	case IRQ_UART2_RX:
+		free_dma(CH_UART2_RX);
+		free_dma(CH_UART2_TX);
+		break;
+	default:
+		break;
+	};
+#endif
 #ifdef	CONFIG_KGDB_UART
 	if (uart->port.line != CONFIG_KGDB_UART_PORT)
 #endif
-- 
1.5.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Blackfin Serial Driver: fix bug - Avoid null point exception in kgdb over UART
  2008-08-15  8:14 [PATCH 0/2] Blackfin serial driver bug fixing Bryan Wu
  2008-08-15  8:14 ` [PATCH 1/2] Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode Bryan Wu
@ 2008-08-15  8:14 ` Bryan Wu
  2008-08-15  9:00 ` [PATCH 0/2] Blackfin serial driver bug fixing Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Bryan Wu @ 2008-08-15  8:14 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel, Sonic Zhang, Bryan Wu

From: Sonic Zhang <sonic.zhang@analog.com>

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 drivers/serial/bfin_5xx.c |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index 487a562..a5ff54e 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -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 <aubrey.li@analog.com>");
-- 
1.5.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Blackfin serial driver bug fixing
  2008-08-15  8:14 [PATCH 0/2] Blackfin serial driver bug fixing Bryan Wu
  2008-08-15  8:14 ` [PATCH 1/2] Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode Bryan Wu
  2008-08-15  8:14 ` [PATCH 2/2] Blackfin Serial Driver: fix bug - Avoid null point exception in kgdb over UART Bryan Wu
@ 2008-08-15  9:00 ` Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2008-08-15  9:00 UTC (permalink / raw)
  To: Bryan Wu; +Cc: linux-kernel

On Fri, 15 Aug 2008 16:14:07 +0800
Bryan Wu <cooloney@kernel.org> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-15  9:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15  8:14 [PATCH 0/2] Blackfin serial driver bug fixing Bryan Wu
2008-08-15  8:14 ` [PATCH 1/2] Blackfin Serial Driver: Fix bug - request UART2/3 peripheral mapped interrupts in PIO mode Bryan Wu
2008-08-15  8:14 ` [PATCH 2/2] Blackfin Serial Driver: fix bug - Avoid null point exception in kgdb over UART Bryan Wu
2008-08-15  9:00 ` [PATCH 0/2] Blackfin serial driver bug fixing Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome