* [PATCH] serial: pnx8xxx_uart: Fix break signal handling
@ 2009-01-13 11:09 Jonker M.D.S.X.
2009-01-13 12:11 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Jonker M.D.S.X. @ 2009-01-13 11:09 UTC (permalink / raw)
To: linux-serial; +Cc: linux-kernel, m.d.s.x.jonker
From: Mischa Jonker <mischa.jonker@nxp.com>
When a break signal is detected, the next character should be ignored.
This was not implemented correctly for the pnx8xxx_uart driver.
Signed-off-by: Mischa Jonker <mischa.jonker@nxp.com>
---
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 22e30d2..1bb8f1b 100644
--- a/drivers/serial/pnx8xxx_uart.c
+++ b/drivers/serial/pnx8xxx_uart.c
@@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
- ch = serial_in(sport, PNX8XXX_FIFO);
+ ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
sport->port.icount.rx++;
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
* out of the main execution path
*/
if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
- PNX8XXX_UART_FIFO_RXPAR) |
+ PNX8XXX_UART_FIFO_RXPAR |
+ PNX8XXX_UART_FIFO_RXBRK) |
ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
- if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
+ if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) {
+ status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
+ FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR));
+ sport->port.icount.brk++;
+ if (uart_handle_break(&sport->port))
+ goto ignore_char;
+ } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
sport->port.icount.parity++;
else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
sport->port.icount.frame++;
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
/* Get the interrupts */
status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
- /* Break signal received */
- if (status & PNX8XXX_UART_INT_BREAK) {
- sport->port.icount.brk++;
- uart_handle_break(&sport->port);
- }
-
- /* Byte received */
- if (status & PNX8XXX_UART_INT_RX)
+ /* Byte or break signal received */
+ if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK))
pnx8xxx_rx_chars(sport);
/* TX holding register empty - transmit a byte */
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: pnx8xxx_uart: Fix break signal handling
2009-01-13 11:09 [PATCH] serial: pnx8xxx_uart: Fix break signal handling Jonker M.D.S.X.
@ 2009-01-13 12:11 ` Alan Cox
2009-01-13 13:22 ` Mischa Jonker
0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2009-01-13 12:11 UTC (permalink / raw)
To: Jonker M.D.S.X.; +Cc: linux-serial, linux-kernel, m.d.s.x.jonker
On Tue, 13 Jan 2009 12:09:13 +0100
"Jonker M.D.S.X." <nlv14114@e3.nl-htc01.nxp.com> wrote:
> From: Mischa Jonker <mischa.jonker@nxp.com>
>
> When a break signal is detected, the next character should be ignored.
> This was not implemented correctly for the pnx8xxx_uart driver.
>
> Signed-off-by: Mischa Jonker <mischa.jonker@nxp.com>
> ---
>
> diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
> index 22e30d2..1bb8f1b 100644
> --- a/drivers/serial/pnx8xxx_uart.c
> +++ b/drivers/serial/pnx8xxx_uart.c
> @@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
> status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
> ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
> while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
> - ch = serial_in(sport, PNX8XXX_FIFO);
> + ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
This appears to be unrelated.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: pnx8xxx_uart: Fix break signal handling
2009-01-13 12:11 ` Alan Cox
@ 2009-01-13 13:22 ` Mischa Jonker
2009-01-13 13:48 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Mischa Jonker @ 2009-01-13 13:22 UTC (permalink / raw)
To: Alan Cox; +Cc: Jonker M.D.S.X., linux-serial, linux-kernel
On Tue, Jan 13, 2009 at 1:11 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Tue, 13 Jan 2009 12:09:13 +0100
> "Jonker M.D.S.X." <nlv14114@e3.nl-htc01.nxp.com> wrote:
>
>> From: Mischa Jonker <mischa.jonker@nxp.com>
>>
>> When a break signal is detected, the next character should be ignored.
>> This was not implemented correctly for the pnx8xxx_uart driver.
>>
>> Signed-off-by: Mischa Jonker <mischa.jonker@nxp.com>
>> ---
>>
>> diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
>> index 22e30d2..1bb8f1b 100644
>> --- a/drivers/serial/pnx8xxx_uart.c
>> +++ b/drivers/serial/pnx8xxx_uart.c
>> @@ -187,7 +187,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
>> status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
>> ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
>> while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
>> - ch = serial_in(sport, PNX8XXX_FIFO);
>> + ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
>
> This appears to be unrelated.
>
Correct, you can look to it as two separate bugs:
a) the next character is not ignored while it should;
b) the status bits 31-8 are copied to the 'ch' variable while they shouldn't.
Both bugs prevent correct break signal handling (and therefore correct
behaviour of the magic SysRq key). Bug b didn't cause too much trouble
earlier because in most situations the status bits are all zero; for
this case they unfortunately aren't.
I can split them up if you like, or we can keep them together, as they
are in fact related.
Thanks,
Mischa Jonker
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: pnx8xxx_uart: Fix break signal handling
2009-01-13 13:22 ` Mischa Jonker
@ 2009-01-13 13:48 ` Alan Cox
0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2009-01-13 13:48 UTC (permalink / raw)
To: Mischa Jonker; +Cc: Jonker M.D.S.X., linux-serial, linux-kernel
> > This appears to be unrelated.
> >
>
> Correct, you can look to it as two separate bugs:
> a) the next character is not ignored while it should;
> b) the status bits 31-8 are copied to the 'ch' variable while they shouldn't.
>
> Both bugs prevent correct break signal handling (and therefore correct
> behaviour of the magic SysRq key). Bug b didn't cause too much trouble
> earlier because in most situations the status bits are all zero; for
> this case they unfortunately aren't.
Ok that makes sense - no need to split them.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-13 13:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-13 11:09 [PATCH] serial: pnx8xxx_uart: Fix break signal handling Jonker M.D.S.X.
2009-01-13 12:11 ` Alan Cox
2009-01-13 13:22 ` Mischa Jonker
2009-01-13 13:48 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox