aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/serial/clps711x.c65
-rw-r--r--drivers/serial/sa1100.c65
2 files changed, 51 insertions, 79 deletions
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c
index e145e19b3fb5..6242f3090a96 100644
--- a/drivers/serial/clps711x.c
+++ b/drivers/serial/clps711x.c
@@ -116,54 +116,43 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re
116 * Note that the error handling code is 116 * Note that the error handling code is
117 * out of the main execution path 117 * out of the main execution path
118 */ 118 */
119 if (unlikely(ch & UART_ANY_ERR)) 119 if (unlikely(ch & UART_ANY_ERR)) {
120 goto handle_error; 120 if (ch & UARTDR_PARERR)
121 port->icount.parity++;
122 else if (ch & UARTDR_FRMERR)
123 port->icount.frame++;
124 if (ch & UARTDR_OVERR)
125 port->icount.overrun++;
121 126
122 if (uart_handle_sysrq_char(port, ch, regs)) 127 ch &= port->read_status_mask;
123 goto ignore_char;
124 128
125 error_return: 129 if (ch & UARTDR_PARERR)
126 tty_insert_flip_char(tty, ch, flg); 130 flg = TTY_PARITY;
127 ignore_char: 131 else if (ch & UARTDR_FRMERR)
128 status = clps_readl(SYSFLG(port)); 132 flg = TTY_FRAME;
129 }
130 out:
131 tty_flip_buffer_push(tty);
132 return IRQ_HANDLED;
133 133
134 handle_error: 134#ifdef SUPPORT_SYSRQ
135 if (ch & UARTDR_PARERR) 135 port->sysrq = 0;
136 port->icount.parity++; 136#endif
137 else if (ch & UARTDR_FRMERR) 137 }
138 port->icount.frame++;
139 if (ch & UARTDR_OVERR)
140 port->icount.overrun++;
141
142 if (ch & port->ignore_status_mask) {
143 if (++ignored > 100)
144 goto out;
145 goto ignore_char;
146 }
147 ch &= port->read_status_mask;
148 138
149 if (ch & UARTDR_PARERR) 139 if (uart_handle_sysrq_char(port, ch, regs))
150 flg = TTY_PARITY; 140 goto ignore_char;
151 else if (ch & UARTDR_FRMERR)
152 flg = TTY_FRAME;
153 141
154 if (ch & UARTDR_OVERR) {
155 /* 142 /*
156 * CHECK: does overrun affect the current character? 143 * CHECK: does overrun affect the current character?
157 * ASSUMPTION: it does not. 144 * ASSUMPTION: it does not.
158 */ 145 */
159 tty_insert_flip_char(tty, ch, flg); 146 if ((ch & port->ignore_status_mask & ~RXSTAT_OVERRUN) == 0)
160 ch = 0; 147 tty_insert_flip_char(tty, ch, flg);
161 flg = TTY_OVERRUN; 148 if ((ch & ~port->ignore_status_mask & RXSTAT_OVERRUN) == 0)
149 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
150
151 ignore_char:
152 status = clps_readl(SYSFLG(port));
162 } 153 }
163#ifdef SUPPORT_SYSRQ 154 tty_flip_buffer_push(tty);
164 port->sysrq = 0; 155 return IRQ_HANDLED;
165#endif
166 goto error_return;
167} 156}
168 157
169static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs) 158static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id, struct pt_regs *regs)
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 086065210d1e..157218bc6c6f 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -214,56 +214,39 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs)
214 * note that the error handling code is 214 * note that the error handling code is
215 * out of the main execution path 215 * out of the main execution path
216 */ 216 */
217 if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) 217 if (status & UTSR1_TO_SM(UTSR1_PRE | UTSR1_FRE | UTSR1_ROR)) {
218 goto handle_error; 218 if (status & UTSR1_TO_SM(UTSR1_PRE))
219 sport->port.icount.parity++;
220 else if (status & UTSR1_TO_SM(UTSR1_FRE))
221 sport->port.icount.frame++;
222 if (status & UTSR1_TO_SM(UTSR1_ROR))
223 sport->port.icount.overrun++;
224
225 status &= sport->port.read_status_mask;
226
227 if (status & UTSR1_TO_SM(UTSR1_PRE))
228 flg = TTY_PARITY;
229 else if (status & UTSR1_TO_SM(UTSR1_FRE))
230 flg = TTY_FRAME;
231
232#ifdef SUPPORT_SYSRQ
233 sport->port.sysrq = 0;
234#endif
235 }
219 236
220 if (uart_handle_sysrq_char(&sport->port, ch, regs)) 237 if (uart_handle_sysrq_char(&sport->port, ch, regs))
221 goto ignore_char; 238 goto ignore_char;
222 239
223 error_return: 240 if ((status & port->ignore_status_mask & ~UTSR1_TO_SM(UTSR1_ROR)) == 0)
224 tty_insert_flip_char(tty, ch, flg); 241 tty_insert_flip_char(tty, ch, flg);
242 if (status & ~port->ignore_status_mask & UTSR1_TO_SM(UTSR1_ROR))
243 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
244
225 ignore_char: 245 ignore_char:
226 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) | 246 status = UTSR1_TO_SM(UART_GET_UTSR1(sport)) |
227 UTSR0_TO_SM(UART_GET_UTSR0(sport)); 247 UTSR0_TO_SM(UART_GET_UTSR0(sport));
228 } 248 }
229 out:
230 tty_flip_buffer_push(tty); 249 tty_flip_buffer_push(tty);
231 return;
232
233 handle_error:
234 if (status & UTSR1_TO_SM(UTSR1_PRE))
235 sport->port.icount.parity++;
236 else if (status & UTSR1_TO_SM(UTSR1_FRE))
237 sport->port.icount.frame++;
238 if (status & UTSR1_TO_SM(UTSR1_ROR))
239 sport->port.icount.overrun++;
240
241 if (status & sport->port.ignore_status_mask) {
242 if (++ignored > 100)
243 goto out;
244 goto ignore_char;
245 }
246
247 status &= sport->port.read_status_mask;
248
249 if (status & UTSR1_TO_SM(UTSR1_PRE))
250 flg = TTY_PARITY;
251 else if (status & UTSR1_TO_SM(UTSR1_FRE))
252 flg = TTY_FRAME;
253
254 if (status & UTSR1_TO_SM(UTSR1_ROR)) {
255 /*
256 * overrun does *not* affect the character
257 * we read from the FIFO
258 */
259 tty_insert_flip_char(tty, ch, flg);
260 ch = 0;
261 flg = TTY_OVERRUN;
262 }
263#ifdef SUPPORT_SYSRQ
264 sport->port.sysrq = 0;
265#endif
266 goto error_return;
267} 250}
268 251
269static void sa1100_tx_chars(struct sa1100_port *sport) 252static void sa1100_tx_chars(struct sa1100_port *sport)