[PATCH] cpm_uart: fix non-console port startup bug

Subsystems: the rest

STALE6409d

2 messages, 2 authors, 2009-03-09 · open the first message on its own page

[PATCH] cpm_uart: fix non-console port startup bug

From: Xiaotian Feng <hidden>
Date: 2009-03-06 02:59:43

  After UART interrupt handler is installed and rx is enabled, if an rx
interrupt comes before hardware init, rx->cur will be updated. Then the
hardware init will reset BD and make rx->cur out of sync, move the hardware
init code before request_irq.

  Signed-off-by: Xiaotian Feng [off-list ref]
---
 drivers/serial/cpm_uart/cpm_uart_core.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index bde4b4b..5c6ef51 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -406,6 +406,18 @@ static int cpm_uart_startup(struct uart_port *port)
 
 	pr_debug("CPM uart[%d]:startup\n", port->line);
 
+	/* If the port is not the console, make sure rx is disabled. */
+	if (!(pinfo->flags & FLAG_CONSOLE)) {
+		/* Disable UART rx */
+		if (IS_SMC(pinfo)) {
+			clrbits16(&pinfo->smcp->smc_smcmr, SMCMR_REN);
+			clrbits8(&pinfo->smcp->smc_smcm, SMCM_RX);
+		} else {
+			clrbits32(&pinfo->sccp->scc_gsmrl, SCC_GSMRL_ENR);
+			clrbits16(&pinfo->sccp->scc_sccm, UART_SCCM_RX);
+		}
+		cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
+	}
 	/* Install interrupt handler. */
 	retval = request_irq(port->irq, cpm_uart_int, 0, "cpm_uart", port);
 	if (retval)
@@ -420,8 +432,6 @@ static int cpm_uart_startup(struct uart_port *port)
 		setbits32(&pinfo->sccp->scc_gsmrl, (SCC_GSMRL_ENR | SCC_GSMRL_ENT));
 	}
 
-	if (!(pinfo->flags & FLAG_CONSOLE))
-		cpm_line_cr_cmd(pinfo, CPM_CR_INIT_TRX);
 	return 0;
 }
 
-- 
1.5.5.1

Re: [PATCH] cpm_uart: fix non-console port startup bug

From: Kumar Gala <hidden>
Date: 2009-03-09 16:47:04

On Mar 5, 2009, at 9:01 PM, Xiaotian Feng wrote:
 After UART interrupt handler is installed and rx is enabled, if an rx
interrupt comes before hardware init, rx->cur will be updated. Then  
the
hardware init will reset BD and make rx->cur out of sync, move the  
hardware
init code before request_irq.

 Signed-off-by: Xiaotian Feng [off-list ref]
---
drivers/serial/cpm_uart/cpm_uart_core.c |   14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
applied to next

- k
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help