st-asc.c (14e77332e74603efab8347c89d3cda447c3b97c9) | st-asc.c (d11cc8c3c4b65e00e01f20a920c5fa412415204a) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * st-asc.c: ST Asynchronous serial controller (ASC) driver 4 * 5 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited 6 */ 7 8#include <linux/module.h> --- 223 unchanged lines hidden (view full) --- 232 233/* 234 * Start transmitting chars. 235 * This is called from both interrupt and task level. 236 * Either way interrupts are disabled. 237 */ 238static void asc_transmit_chars(struct uart_port *port) 239{ | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * st-asc.c: ST Asynchronous serial controller (ASC) driver 4 * 5 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited 6 */ 7 8#include <linux/module.h> --- 223 unchanged lines hidden (view full) --- 232 233/* 234 * Start transmitting chars. 235 * This is called from both interrupt and task level. 236 * Either way interrupts are disabled. 237 */ 238static void asc_transmit_chars(struct uart_port *port) 239{ |
240 struct circ_buf *xmit = &port->state->xmit; 241 int txroom; 242 unsigned char c; | 240 u8 ch; |
243 | 241 |
244 txroom = asc_hw_txroom(port); 245 246 if ((txroom != 0) && port->x_char) { 247 c = port->x_char; 248 port->x_char = 0; 249 asc_out(port, ASC_TXBUF, c); 250 port->icount.tx++; 251 txroom = asc_hw_txroom(port); 252 } 253 254 if (uart_tx_stopped(port)) { 255 /* 256 * We should try and stop the hardware here, but I 257 * don't think the ASC has any way to do that. 258 */ 259 asc_disable_tx_interrupts(port); 260 return; 261 } 262 263 if (uart_circ_empty(xmit)) { 264 asc_disable_tx_interrupts(port); 265 return; 266 } 267 268 if (txroom == 0) 269 return; 270 271 do { 272 c = xmit->buf[xmit->tail]; 273 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 274 asc_out(port, ASC_TXBUF, c); 275 port->icount.tx++; 276 txroom--; 277 } while ((txroom > 0) && (!uart_circ_empty(xmit))); 278 279 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 280 uart_write_wakeup(port); 281 282 if (uart_circ_empty(xmit)) 283 asc_disable_tx_interrupts(port); | 242 uart_port_tx_limited(port, ch, asc_hw_txroom(port), 243 true, 244 asc_out(port, ASC_TXBUF, ch), 245 ({})); |
284} 285 286static void asc_receive_chars(struct uart_port *port) 287{ 288 struct tty_port *tport = &port->state->port; 289 unsigned long status, mode; 290 unsigned long c = 0; 291 char flag; --- 718 unchanged lines hidden --- | 246} 247 248static void asc_receive_chars(struct uart_port *port) 249{ 250 struct tty_port *tport = &port->state->port; 251 unsigned long status, mode; 252 unsigned long c = 0; 253 char flag; --- 718 unchanged lines hidden --- |