Lines Matching refs:port

54 #define UBRLCR(port)		((port)->iobase + UBRLCR1 - SYSCON1)
55 #define UARTDR(port) ((port)->iobase + UARTDR1 - SYSCON1)
56 #define SYSFLG(port) ((port)->iobase + SYSFLG1 - SYSCON1)
57 #define SYSCON(port) ((port)->iobase + SYSCON1 - SYSCON1)
59 #define TX_IRQ(port) ((port)->irq)
60 #define RX_IRQ(port) ((port)->irq + 1)
64 #define tx_enabled(port) ((port)->unused[0])
66 static void clps711xuart_stop_tx(struct uart_port *port)
68 if (tx_enabled(port)) {
69 disable_irq(TX_IRQ(port));
70 tx_enabled(port) = 0;
74 static void clps711xuart_start_tx(struct uart_port *port)
76 if (!tx_enabled(port)) {
77 enable_irq(TX_IRQ(port));
78 tx_enabled(port) = 1;
82 static void clps711xuart_stop_rx(struct uart_port *port)
84 disable_irq(RX_IRQ(port));
87 static void clps711xuart_enable_ms(struct uart_port *port)
93 struct uart_port *port = dev_id;
94 struct tty_struct *tty = port->state->port.tty;
97 status = clps_readl(SYSFLG(port));
99 ch = clps_readl(UARTDR(port));
101 port->icount.rx++;
111 port->icount.parity++;
113 port->icount.frame++;
115 port->icount.overrun++;
117 ch &= port->read_status_mask;
125 port->sysrq = 0;
129 if (uart_handle_sysrq_char(port, ch))
136 uart_insert_char(port, ch, UARTDR_OVERR, ch, flg);
139 status = clps_readl(SYSFLG(port));
147 struct uart_port *port = dev_id;
148 struct circ_buf *xmit = &port->state->xmit;
151 if (port->x_char) {
152 clps_writel(port->x_char, UARTDR(port));
153 port->icount.tx++;
154 port->x_char = 0;
158 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
161 count = port->fifosize >> 1;
163 clps_writel(xmit->buf[xmit->tail], UARTDR(port));
165 port->icount.tx++;
171 uart_write_wakeup(port);
175 disable_irq_nosync(TX_IRQ(port));
176 tx_enabled(port) = 0;
182 static unsigned int clps711xuart_tx_empty(struct uart_port *port)
184 unsigned int status = clps_readl(SYSFLG(port));
188 static unsigned int clps711xuart_get_mctrl(struct uart_port *port)
194 port_addr = SYSFLG(port);
209 clps711xuart_set_mctrl_null(struct uart_port *port, unsigned int mctrl)
213 static void clps711xuart_break_ctl(struct uart_port *port, int break_state)
218 spin_lock_irqsave(&port->lock, flags);
219 ubrlcr = clps_readl(UBRLCR(port));
224 clps_writel(ubrlcr, UBRLCR(port));
225 spin_unlock_irqrestore(&port->lock, flags);
228 static int clps711xuart_startup(struct uart_port *port)
233 tx_enabled(port) = 1;
238 retval = request_irq(TX_IRQ(port), clps711xuart_int_tx, 0,
239 "clps711xuart_tx", port);
243 retval = request_irq(RX_IRQ(port), clps711xuart_int_rx, 0,
244 "clps711xuart_rx", port);
246 free_irq(TX_IRQ(port), port);
251 * enable the port
253 syscon = clps_readl(SYSCON(port));
255 clps_writel(syscon, SYSCON(port));
260 static void clps711xuart_shutdown(struct uart_port *port)
267 free_irq(TX_IRQ(port), port); /* TX interrupt */
268 free_irq(RX_IRQ(port), port); /* RX interrupt */
271 * disable the port
273 syscon = clps_readl(SYSCON(port));
275 clps_writel(syscon, SYSCON(port));
280 ubrlcr = clps_readl(UBRLCR(port));
282 clps_writel(ubrlcr, UBRLCR(port));
286 clps711xuart_set_termios(struct uart_port *port, struct ktermios *termios,
300 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
301 quot = uart_get_divisor(port, baud);
324 if (port->fifosize > 1)
327 spin_lock_irqsave(&port->lock, flags);
330 * Update the per-port timeout.
332 uart_update_timeout(port, termios->c_cflag, baud);
334 port->read_status_mask = UARTDR_OVERR;
336 port->read_status_mask |= UARTDR_PARERR | UARTDR_FRMERR;
341 port->ignore_status_mask = 0;
343 port->ignore_status_mask |= UARTDR_FRMERR | UARTDR_PARERR;
350 port->ignore_status_mask |= UARTDR_OVERR;
355 clps_writel(ubrlcr | quot, UBRLCR(port));
357 spin_unlock_irqrestore(&port->lock, flags);
360 static const char *clps711xuart_type(struct uart_port *port)
362 return port->type == PORT_CLPS711X ? "CLPS711x" : NULL;
366 * Configure/autoconfigure the port.
368 static void clps711xuart_config_port(struct uart_port *port, int flags)
371 port->type = PORT_CLPS711X;
374 static void clps711xuart_release_port(struct uart_port *port)
378 static int clps711xuart_request_port(struct uart_port *port)
423 static void clps711xuart_console_putchar(struct uart_port *port, int ch)
425 while (clps_readl(SYSFLG(port)) & SYSFLG_UTXFF)
427 clps_writel(ch, UARTDR(port));
431 * Print a string to the serial port trying not to disturb
432 * any possible real use of the port...
442 struct uart_port *port = clps711x_ports + co->index;
446 * Ensure that the port is enabled.
448 syscon = clps_readl(SYSCON(port));
449 clps_writel(syscon | SYSCON_UARTEN, SYSCON(port));
451 uart_console_write(port, s, count, clps711xuart_console_putchar);
458 status = clps_readl(SYSFLG(port));
461 clps_writel(syscon, SYSCON(port));
465 clps711xuart_console_get_options(struct uart_port *port, int *baud,
468 if (clps_readl(SYSCON(port)) & SYSCON_UARTEN) {
471 ubrlcr = clps_readl(UBRLCR(port));
487 *baud = port->uartclk / (16 * (quot + 1));
493 struct uart_port *port;
501 * if so, search for the first available port that does have
504 port = uart_get_console(clps711x_ports, UART_NR, co);
509 clps711xuart_console_get_options(port, &baud, &parity, &bits);
511 return uart_set_options(port, co, baud, parity, bits, flow);