aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorMischa Jonker <mischa.jonker@nxp.com>2009-01-15 08:30:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-15 15:48:36 -0500
commitcd1e40f0981e22018373307cd4087dc876b08fb0 (patch)
treec135e194063c85987aa0b36e41db4ed019bc3322 /drivers/serial
parent7fdd4f76e9a289592d020538f1837a7541ea89ff (diff)
When a break signal is detected, the next character should be ignored.
This was not implemented correctly for the pnx8xxx_uart driver. [From further discussion: 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. ] Signed-off-by: Mischa Jonker <mischa.jonker@nxp.com> Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/pnx8xxx_uart.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/serial/pnx8xxx_uart.c b/drivers/serial/pnx8xxx_uart.c
index 22e30d21225e..1bb8f1b45767 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)
187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) | 187 status = FIFO_TO_SM(serial_in(sport, PNX8XXX_FIFO)) |
188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT)); 188 ISTAT_TO_SM(serial_in(sport, PNX8XXX_ISTAT));
189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) { 189 while (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFIFO)) {
190 ch = serial_in(sport, PNX8XXX_FIFO); 190 ch = serial_in(sport, PNX8XXX_FIFO) & 0xff;
191 191
192 sport->port.icount.rx++; 192 sport->port.icount.rx++;
193 193
@@ -198,9 +198,16 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
198 * out of the main execution path 198 * out of the main execution path
199 */ 199 */
200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE | 200 if (status & (FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE |
201 PNX8XXX_UART_FIFO_RXPAR) | 201 PNX8XXX_UART_FIFO_RXPAR |
202 PNX8XXX_UART_FIFO_RXBRK) |
202 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) { 203 ISTAT_TO_SM(PNX8XXX_UART_INT_RXOVRN))) {
203 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR)) 204 if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXBRK)) {
205 status &= ~(FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE) |
206 FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR));
207 sport->port.icount.brk++;
208 if (uart_handle_break(&sport->port))
209 goto ignore_char;
210 } else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXPAR))
204 sport->port.icount.parity++; 211 sport->port.icount.parity++;
205 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) 212 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
206 sport->port.icount.frame++; 213 sport->port.icount.frame++;
@@ -284,14 +291,8 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
284 /* Get the interrupts */ 291 /* Get the interrupts */
285 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN); 292 status = serial_in(sport, PNX8XXX_ISTAT) & serial_in(sport, PNX8XXX_IEN);
286 293
287 /* Break signal received */ 294 /* Byte or break signal received */
288 if (status & PNX8XXX_UART_INT_BREAK) { 295 if (status & (PNX8XXX_UART_INT_RX | PNX8XXX_UART_INT_BREAK))
289 sport->port.icount.brk++;
290 uart_handle_break(&sport->port);
291 }
292
293 /* Byte received */
294 if (status & PNX8XXX_UART_INT_RX)
295 pnx8xxx_rx_chars(sport); 296 pnx8xxx_rx_chars(sport);
296 297
297 /* TX holding register empty - transmit a byte */ 298 /* TX holding register empty - transmit a byte */