linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC] cpm_uart: Fix break generation
@ 2008-06-26 11:38 Laurent Pinchart
  2008-07-24 14:21 ` [PATCHv2] " Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2008-06-26 11:38 UTC (permalink / raw)
  To: linuxppc-dev, linux-serial; +Cc: scottwood

[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]

When generating a break condition on a serial port, the CPM must be told
beforehand how long the break should be. Unfortunately, this information is
not available through the current serial break handling API. This patch works
around the problem by requesting a 32767 characters break followed by a 0
characters break after the requested duration. The CPM will stop the first
break when the second one is requested. This might not work with future CPM
revisions.

An alternative would be to change the serial break handling API to pass the 
break duration down to the serial drivers.

---
 drivers/serial/cpm_uart/cpm_uart_core.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index c29d87d..aa0a284 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -268,14 +268,23 @@ static void cpm_uart_break_ctl(struct uart_port *port, 
int break_state)
 static void cpm_uart_break_ctl(struct uart_port *port, int break_state)
 {
 	struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
+	volatile u16 *brkcr = IS_SMC(pinfo) ? &pinfo->smcup->smc_brkcr
+				: &pinfo->sccup->scc_brkcr;
 
 	pr_debug("CPM uart[%d]:break ctrl, break_state: %d\n", port->line,
 		break_state);
 
 	if (break_state)
+	{
+		*brkcr = 32767;
 		cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
+	}
 	else
+	{
+		*brkcr = 0;
+		cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
 		cpm_line_cr_cmd(pinfo, CPM_CR_RESTART_TX);
+	}
 }
 
 /*
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussee de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2008-07-24 15:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-26 11:38 [RFC] cpm_uart: Fix break generation Laurent Pinchart
2008-07-24 14:21 ` [PATCHv2] " Laurent Pinchart
2008-07-24 15:14   ` Kumar Gala
2008-07-24 15:52     ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).