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

* [PATCHv2] cpm_uart: Fix break generation
  2008-06-26 11:38 [RFC] cpm_uart: Fix break generation Laurent Pinchart
@ 2008-07-24 14:21 ` Laurent Pinchart
  2008-07-24 15:14   ` Kumar Gala
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2008-07-24 14:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: scottwood, linux-serial

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.
---
 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
@@ -269,13 +269,19 @@ static void cpm_uart_break_ctl(struct uart_port *port, int break_state)
 {
 	struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
+	u16 __iomem *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)
+	if (break_state) {
+		out_be16(brkcr, 32767);
 		cpm_line_cr_cmd(pinfo, CPM_CR_STOP_TX);
-	else
+	} else {
+		out_be16(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

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

* Re: [PATCHv2] cpm_uart: Fix break generation
  2008-07-24 14:21 ` [PATCHv2] " Laurent Pinchart
@ 2008-07-24 15:14   ` Kumar Gala
  2008-07-24 15:52     ` Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2008-07-24 15:14 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: scottwood, linuxppc-dev, linux-serial


On Jul 24, 2008, at 9:21 AM, Laurent Pinchart wrote:

> 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.

What do you mean by future CPM revision?  Do you mean QE?

- k

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

* Re: [PATCHv2] cpm_uart: Fix break generation
  2008-07-24 15:14   ` Kumar Gala
@ 2008-07-24 15:52     ` Laurent Pinchart
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2008-07-24 15:52 UTC (permalink / raw)
  To: Kumar Gala; +Cc: scottwood, linuxppc-dev, linux-serial

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

On Thursday 24 July 2008, Kumar Gala wrote:
> 
> On Jul 24, 2008, at 9:21 AM, Laurent Pinchart wrote:
> 
> > 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.
> 
> What do you mean by future CPM revision?  Do you mean QE?

I was thinking about minor revisions of the CPM2 silicon as described in http://www.freescale.com/files/32bit/doc/app_note/AN2291.pdf

-- 
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: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[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).