• Home
  • Raw
  • Download

Lines Matching refs:port

42 static void apbuart_tx_chars(struct uart_port *port);
44 static void apbuart_stop_tx(struct uart_port *port) in apbuart_stop_tx() argument
48 cr = UART_GET_CTRL(port); in apbuart_stop_tx()
50 UART_PUT_CTRL(port, cr); in apbuart_stop_tx()
53 static void apbuart_start_tx(struct uart_port *port) in apbuart_start_tx() argument
57 cr = UART_GET_CTRL(port); in apbuart_start_tx()
59 UART_PUT_CTRL(port, cr); in apbuart_start_tx()
61 if (UART_GET_STATUS(port) & UART_STATUS_THE) in apbuart_start_tx()
62 apbuart_tx_chars(port); in apbuart_start_tx()
65 static void apbuart_stop_rx(struct uart_port *port) in apbuart_stop_rx() argument
69 cr = UART_GET_CTRL(port); in apbuart_stop_rx()
71 UART_PUT_CTRL(port, cr); in apbuart_stop_rx()
74 static void apbuart_rx_chars(struct uart_port *port) in apbuart_rx_chars() argument
77 unsigned int max_chars = port->fifosize; in apbuart_rx_chars()
79 status = UART_GET_STATUS(port); in apbuart_rx_chars()
83 ch = UART_GET_CHAR(port); in apbuart_rx_chars()
86 port->icount.rx++; in apbuart_rx_chars()
88 rsr = UART_GET_STATUS(port) | UART_DUMMY_RSR_RX; in apbuart_rx_chars()
89 UART_PUT_STATUS(port, 0); in apbuart_rx_chars()
94 port->icount.brk++; in apbuart_rx_chars()
95 if (uart_handle_break(port)) in apbuart_rx_chars()
98 port->icount.parity++; in apbuart_rx_chars()
100 port->icount.frame++; in apbuart_rx_chars()
103 port->icount.overrun++; in apbuart_rx_chars()
105 rsr &= port->read_status_mask; in apbuart_rx_chars()
113 if (uart_handle_sysrq_char(port, ch)) in apbuart_rx_chars()
116 uart_insert_char(port, rsr, UART_STATUS_OE, ch, flag); in apbuart_rx_chars()
120 status = UART_GET_STATUS(port); in apbuart_rx_chars()
123 spin_unlock(&port->lock); in apbuart_rx_chars()
124 tty_flip_buffer_push(&port->state->port); in apbuart_rx_chars()
125 spin_lock(&port->lock); in apbuart_rx_chars()
128 static void apbuart_tx_chars(struct uart_port *port) in apbuart_tx_chars() argument
130 struct circ_buf *xmit = &port->state->xmit; in apbuart_tx_chars()
133 if (port->x_char) { in apbuart_tx_chars()
134 UART_PUT_CHAR(port, port->x_char); in apbuart_tx_chars()
135 port->icount.tx++; in apbuart_tx_chars()
136 port->x_char = 0; in apbuart_tx_chars()
140 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { in apbuart_tx_chars()
141 apbuart_stop_tx(port); in apbuart_tx_chars()
146 count = port->fifosize >> 1; in apbuart_tx_chars()
148 UART_PUT_CHAR(port, xmit->buf[xmit->tail]); in apbuart_tx_chars()
150 port->icount.tx++; in apbuart_tx_chars()
156 uart_write_wakeup(port); in apbuart_tx_chars()
159 apbuart_stop_tx(port); in apbuart_tx_chars()
164 struct uart_port *port = dev_id; in apbuart_int() local
167 spin_lock(&port->lock); in apbuart_int()
169 status = UART_GET_STATUS(port); in apbuart_int()
171 apbuart_rx_chars(port); in apbuart_int()
173 apbuart_tx_chars(port); in apbuart_int()
175 spin_unlock(&port->lock); in apbuart_int()
180 static unsigned int apbuart_tx_empty(struct uart_port *port) in apbuart_tx_empty() argument
182 unsigned int status = UART_GET_STATUS(port); in apbuart_tx_empty()
186 static unsigned int apbuart_get_mctrl(struct uart_port *port) in apbuart_get_mctrl() argument
192 static void apbuart_set_mctrl(struct uart_port *port, unsigned int mctrl) in apbuart_set_mctrl() argument
197 static void apbuart_break_ctl(struct uart_port *port, int break_state) in apbuart_break_ctl() argument
202 static int apbuart_startup(struct uart_port *port) in apbuart_startup() argument
208 retval = request_irq(port->irq, apbuart_int, 0, "apbuart", port); in apbuart_startup()
213 cr = UART_GET_CTRL(port); in apbuart_startup()
214 UART_PUT_CTRL(port, in apbuart_startup()
221 static void apbuart_shutdown(struct uart_port *port) in apbuart_shutdown() argument
226 cr = UART_GET_CTRL(port); in apbuart_shutdown()
227 UART_PUT_CTRL(port, in apbuart_shutdown()
232 free_irq(port->irq, port); in apbuart_shutdown()
235 static void apbuart_set_termios(struct uart_port *port, in apbuart_set_termios() argument
243 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16); in apbuart_set_termios()
245 panic("invalid baudrate %i\n", port->uartclk / 16); in apbuart_set_termios()
248 quot = (uart_get_divisor(port, baud)) * 2; in apbuart_set_termios()
249 cr = UART_GET_CTRL(port); in apbuart_set_termios()
262 spin_lock_irqsave(&port->lock, flags); in apbuart_set_termios()
265 uart_update_timeout(port, termios->c_cflag, baud); in apbuart_set_termios()
267 port->read_status_mask = UART_STATUS_OE; in apbuart_set_termios()
269 port->read_status_mask |= UART_STATUS_FE | UART_STATUS_PE; in apbuart_set_termios()
272 port->ignore_status_mask = 0; in apbuart_set_termios()
274 port->ignore_status_mask |= UART_STATUS_FE | UART_STATUS_PE; in apbuart_set_termios()
278 port->ignore_status_mask |= UART_DUMMY_RSR_RX; in apbuart_set_termios()
282 UART_PUT_SCAL(port, quot); in apbuart_set_termios()
283 UART_PUT_CTRL(port, cr); in apbuart_set_termios()
285 spin_unlock_irqrestore(&port->lock, flags); in apbuart_set_termios()
288 static const char *apbuart_type(struct uart_port *port) in apbuart_type() argument
290 return port->type == PORT_APBUART ? "GRLIB/APBUART" : NULL; in apbuart_type()
293 static void apbuart_release_port(struct uart_port *port) in apbuart_release_port() argument
295 release_mem_region(port->mapbase, 0x100); in apbuart_release_port()
298 static int apbuart_request_port(struct uart_port *port) in apbuart_request_port() argument
300 return request_mem_region(port->mapbase, 0x100, "grlib-apbuart") in apbuart_request_port()
306 static void apbuart_config_port(struct uart_port *port, int flags) in apbuart_config_port() argument
309 port->type = PORT_APBUART; in apbuart_config_port()
310 apbuart_request_port(port); in apbuart_config_port()
315 static int apbuart_verify_port(struct uart_port *port, in apbuart_verify_port() argument
349 static int apbuart_scan_fifo_size(struct uart_port *port, int portnumber) in apbuart_scan_fifo_size() argument
356 ctrl = UART_GET_CTRL(port); in apbuart_scan_fifo_size()
367 UART_PUT_CTRL(port, ctrl | UART_CTRL_TE); in apbuart_scan_fifo_size()
369 while (!UART_TX_READY(UART_GET_STATUS(port))) in apbuart_scan_fifo_size()
377 UART_PUT_CTRL(port, ctrl & ~(UART_CTRL_TE)); in apbuart_scan_fifo_size()
380 UART_PUT_CHAR(port, 0); in apbuart_scan_fifo_size()
388 status = UART_GET_STATUS(port); in apbuart_scan_fifo_size()
391 UART_PUT_CHAR(port, 0); in apbuart_scan_fifo_size()
392 status = UART_GET_STATUS(port); in apbuart_scan_fifo_size()
397 UART_PUT_CTRL(port, ctrl); in apbuart_scan_fifo_size()
406 static void apbuart_flush_fifo(struct uart_port *port) in apbuart_flush_fifo() argument
410 for (i = 0; i < port->fifosize; i++) in apbuart_flush_fifo()
411 UART_GET_CHAR(port); in apbuart_flush_fifo()
421 static void apbuart_console_putchar(struct uart_port *port, int ch) in apbuart_console_putchar() argument
425 status = UART_GET_STATUS(port); in apbuart_console_putchar()
427 UART_PUT_CHAR(port, ch); in apbuart_console_putchar()
433 struct uart_port *port = &grlib_apbuart_ports[co->index]; in apbuart_console_write() local
437 old_cr = UART_GET_CTRL(port); in apbuart_console_write()
439 UART_PUT_CTRL(port, new_cr); in apbuart_console_write()
441 uart_console_write(port, s, count, apbuart_console_putchar); in apbuart_console_write()
448 status = UART_GET_STATUS(port); in apbuart_console_write()
450 UART_PUT_CTRL(port, old_cr); in apbuart_console_write()
454 apbuart_console_get_options(struct uart_port *port, int *baud, in apbuart_console_get_options() argument
457 if (UART_GET_CTRL(port) & (UART_CTRL_RE | UART_CTRL_TE)) { in apbuart_console_get_options()
460 status = UART_GET_STATUS(port); in apbuart_console_get_options()
471 quot = UART_GET_SCAL(port) / 8; in apbuart_console_get_options()
472 *baud = port->uartclk / (16 * (quot + 1)); in apbuart_console_get_options()
478 struct uart_port *port; in apbuart_console_setup() local
495 port = &grlib_apbuart_ports[co->index]; in apbuart_console_setup()
497 spin_lock_init(&port->lock); in apbuart_console_setup()
502 apbuart_console_get_options(port, &baud, &parity, &bits); in apbuart_console_setup()
504 return uart_set_options(port, co, baud, parity, bits, flow); in apbuart_console_setup()
555 struct uart_port *port = NULL; in apbuart_probe() local
562 port = &grlib_apbuart_ports[i]; in apbuart_probe()
563 port->dev = &op->dev; in apbuart_probe()
564 port->irq = op->archdata.irqs[0]; in apbuart_probe()
566 uart_add_one_port(&grlib_apbuart_driver, (struct uart_port *) port); in apbuart_probe()
568 apbuart_flush_fifo((struct uart_port *) port); in apbuart_probe()
571 (unsigned long long) port->mapbase, port->irq); in apbuart_probe()
604 struct uart_port *port; in grlib_apbuart_configure() local
621 port = &grlib_apbuart_ports[line]; in grlib_apbuart_configure()
623 port->mapbase = addr; in grlib_apbuart_configure()
624 port->membase = ioremap(addr, sizeof(struct grlib_apbuart_regs_map)); in grlib_apbuart_configure()
625 port->irq = 0; in grlib_apbuart_configure()
626 port->iotype = UPIO_MEM; in grlib_apbuart_configure()
627 port->ops = &grlib_apbuart_ops; in grlib_apbuart_configure()
628 port->flags = UPF_BOOT_AUTOCONF; in grlib_apbuart_configure()
629 port->line = line; in grlib_apbuart_configure()
630 port->uartclk = *freq_hz; in grlib_apbuart_configure()
631 port->fifosize = apbuart_scan_fifo_size((struct uart_port *) port, line); in grlib_apbuart_configure()