Lines Matching full:port
54 #define UBRLCR(port) ((port)->iobase + UBRLCR1 - SYSCON1) argument
55 #define UARTDR(port) ((port)->iobase + UARTDR1 - SYSCON1) argument
56 #define SYSFLG(port) ((port)->iobase + SYSFLG1 - SYSCON1) argument
57 #define SYSCON(port) ((port)->iobase + SYSCON1 - SYSCON1) argument
59 #define TX_IRQ(port) ((port)->irq) argument
60 #define RX_IRQ(port) ((port)->irq + 1) argument
64 #define tx_enabled(port) ((port)->unused[0]) argument
66 static void clps711xuart_stop_tx(struct uart_port *port) in clps711xuart_stop_tx() argument
68 if (tx_enabled(port)) { in clps711xuart_stop_tx()
69 disable_irq(TX_IRQ(port)); in clps711xuart_stop_tx()
70 tx_enabled(port) = 0; in clps711xuart_stop_tx()
74 static void clps711xuart_start_tx(struct uart_port *port) in clps711xuart_start_tx() argument
76 if (!tx_enabled(port)) { in clps711xuart_start_tx()
77 enable_irq(TX_IRQ(port)); in clps711xuart_start_tx()
78 tx_enabled(port) = 1; in clps711xuart_start_tx()
82 static void clps711xuart_stop_rx(struct uart_port *port) in clps711xuart_stop_rx() argument
84 disable_irq(RX_IRQ(port)); in clps711xuart_stop_rx()
87 static void clps711xuart_enable_ms(struct uart_port *port) in clps711xuart_enable_ms() argument
93 struct uart_port *port = dev_id; in clps711xuart_int_rx() local
94 struct tty_struct *tty = port->state->port.tty; in clps711xuart_int_rx()
97 status = clps_readl(SYSFLG(port)); in clps711xuart_int_rx()
99 ch = clps_readl(UARTDR(port)); in clps711xuart_int_rx()
101 port->icount.rx++; in clps711xuart_int_rx()
111 port->icount.parity++; in clps711xuart_int_rx()
113 port->icount.frame++; in clps711xuart_int_rx()
115 port->icount.overrun++; in clps711xuart_int_rx()
117 ch &= port->read_status_mask; in clps711xuart_int_rx()
125 port->sysrq = 0; in clps711xuart_int_rx()
129 if (uart_handle_sysrq_char(port, ch)) in clps711xuart_int_rx()
136 uart_insert_char(port, ch, UARTDR_OVERR, ch, flg); in clps711xuart_int_rx()
139 status = clps_readl(SYSFLG(port)); in clps711xuart_int_rx()
147 struct uart_port *port = dev_id; in clps711xuart_int_tx() local
148 struct circ_buf *xmit = &port->state->xmit; in clps711xuart_int_tx()
151 if (port->x_char) { in clps711xuart_int_tx()
152 clps_writel(port->x_char, UARTDR(port)); in clps711xuart_int_tx()
153 port->icount.tx++; in clps711xuart_int_tx()
154 port->x_char = 0; in clps711xuart_int_tx()
157 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { in clps711xuart_int_tx()
158 clps711xuart_stop_tx(port); in clps711xuart_int_tx()
162 count = port->fifosize >> 1; in clps711xuart_int_tx()
164 clps_writel(xmit->buf[xmit->tail], UARTDR(port)); in clps711xuart_int_tx()
166 port->icount.tx++; in clps711xuart_int_tx()
172 uart_write_wakeup(port); in clps711xuart_int_tx()
175 clps711xuart_stop_tx(port); in clps711xuart_int_tx()
180 static unsigned int clps711xuart_tx_empty(struct uart_port *port) in clps711xuart_tx_empty() argument
182 unsigned int status = clps_readl(SYSFLG(port)); in clps711xuart_tx_empty()
186 static unsigned int clps711xuart_get_mctrl(struct uart_port *port) in clps711xuart_get_mctrl() argument
192 port_addr = SYSFLG(port); in clps711xuart_get_mctrl()
207 clps711xuart_set_mctrl_null(struct uart_port *port, unsigned int mctrl) in clps711xuart_set_mctrl_null() argument
211 static void clps711xuart_break_ctl(struct uart_port *port, int break_state) in clps711xuart_break_ctl() argument
216 spin_lock_irqsave(&port->lock, flags); in clps711xuart_break_ctl()
217 ubrlcr = clps_readl(UBRLCR(port)); in clps711xuart_break_ctl()
222 clps_writel(ubrlcr, UBRLCR(port)); in clps711xuart_break_ctl()
223 spin_unlock_irqrestore(&port->lock, flags); in clps711xuart_break_ctl()
226 static int clps711xuart_startup(struct uart_port *port) in clps711xuart_startup() argument
231 tx_enabled(port) = 1; in clps711xuart_startup()
236 retval = request_irq(TX_IRQ(port), clps711xuart_int_tx, 0, in clps711xuart_startup()
237 "clps711xuart_tx", port); in clps711xuart_startup()
241 retval = request_irq(RX_IRQ(port), clps711xuart_int_rx, 0, in clps711xuart_startup()
242 "clps711xuart_rx", port); in clps711xuart_startup()
244 free_irq(TX_IRQ(port), port); in clps711xuart_startup()
249 * enable the port in clps711xuart_startup()
251 syscon = clps_readl(SYSCON(port)); in clps711xuart_startup()
253 clps_writel(syscon, SYSCON(port)); in clps711xuart_startup()
258 static void clps711xuart_shutdown(struct uart_port *port) in clps711xuart_shutdown() argument
265 free_irq(TX_IRQ(port), port); /* TX interrupt */ in clps711xuart_shutdown()
266 free_irq(RX_IRQ(port), port); /* RX interrupt */ in clps711xuart_shutdown()
269 * disable the port in clps711xuart_shutdown()
271 syscon = clps_readl(SYSCON(port)); in clps711xuart_shutdown()
273 clps_writel(syscon, SYSCON(port)); in clps711xuart_shutdown()
278 ubrlcr = clps_readl(UBRLCR(port)); in clps711xuart_shutdown()
280 clps_writel(ubrlcr, UBRLCR(port)); in clps711xuart_shutdown()
284 clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios, in clps711xuart_set_termios() argument
298 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); in clps711xuart_set_termios()
299 quot = uart_get_divisor(port, baud); in clps711xuart_set_termios()
322 if (port->fifosize > 1) in clps711xuart_set_termios()
325 spin_lock_irqsave(&port->lock, flags); in clps711xuart_set_termios()
328 * Update the per-port timeout. in clps711xuart_set_termios()
330 uart_update_timeout(port, termios->c_cflag, baud); in clps711xuart_set_termios()
332 port->read_status_mask = UARTDR_OVERR; in clps711xuart_set_termios()
334 port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR; in clps711xuart_set_termios()
339 port->ignore_status_mask = 0; in clps711xuart_set_termios()
341 port->ignore_status_mask |= UARTDR_FRMERR | UARTDR_PARERR; in clps711xuart_set_termios()
348 port->ignore_status_mask |= UARTDR_OVERR; in clps711xuart_set_termios()
353 clps_writel(ubrlcr | quot, UBRLCR(port)); in clps711xuart_set_termios()
355 spin_unlock_irqrestore(&port->lock, flags); in clps711xuart_set_termios()
358 static const char *clps711xuart_type(struct uart_port *port) in clps711xuart_type() argument
360 return port->type == PORT_CLPS711X ? "CLPS711x" : NULL; in clps711xuart_type()
364 * Configure/autoconfigure the port.
366 static void clps711xuart_config_port(struct uart_port *port, int flags) in clps711xuart_config_port() argument
369 port->type = PORT_CLPS711X; in clps711xuart_config_port()
372 static void clps711xuart_release_port(struct uart_port *port) in clps711xuart_release_port() argument
376 static int clps711xuart_request_port(struct uart_port *port) in clps711xuart_request_port() argument
421 static void clps711xuart_console_putchar(struct uart_port *port, int ch) in clps711xuart_console_putchar() argument
423 while (clps_readl(SYSFLG(port)) & SYSFLG_UTXFF) in clps711xuart_console_putchar()
425 clps_writel(ch, UARTDR(port)); in clps711xuart_console_putchar()
429 * Print a string to the serial port trying not to disturb
430 * any possible real use of the port...
440 struct uart_port *port = clps711x_ports + co->index; in clps711xuart_console_write() local
444 * Ensure that the port is enabled. in clps711xuart_console_write()
446 syscon = clps_readl(SYSCON(port)); in clps711xuart_console_write()
447 clps_writel(syscon | SYSCON_UARTEN, SYSCON(port)); in clps711xuart_console_write()
449 uart_console_write(port, s, count, clps711xuart_console_putchar); in clps711xuart_console_write()
456 status = clps_readl(SYSFLG(port)); in clps711xuart_console_write()
459 clps_writel(syscon, SYSCON(port)); in clps711xuart_console_write()
463 clps711xuart_console_get_options(struct uart_port *port, int *baud, in clps711xuart_console_get_options() argument
466 if (clps_readl(SYSCON(port)) & SYSCON_UARTEN) { in clps711xuart_console_get_options()
469 ubrlcr = clps_readl(UBRLCR(port)); in clps711xuart_console_get_options()
485 *baud = port->uartclk / (16 * (quot + 1)); in clps711xuart_console_get_options()
491 struct uart_port *port; in clps711xuart_console_setup() local
499 * if so, search for the first available port that does have in clps711xuart_console_setup()
502 port = uart_get_console(clps711x_ports, UART_NR, co); in clps711xuart_console_setup()
507 clps711xuart_console_get_options(port, &baud, &parity, &bits); in clps711xuart_console_setup()
509 return uart_set_options(port, co, baud, parity, bits, flow); in clps711xuart_console_setup()