Lines Matching refs:port
115 struct uart_port port; member
118 static void netx_stop_tx(struct uart_port *port) in netx_stop_tx() argument
121 val = readl(port->membase + UART_CR); in netx_stop_tx()
122 writel(val & ~CR_TIE, port->membase + UART_CR); in netx_stop_tx()
125 static void netx_stop_rx(struct uart_port *port) in netx_stop_rx() argument
128 val = readl(port->membase + UART_CR); in netx_stop_rx()
129 writel(val & ~CR_RIE, port->membase + UART_CR); in netx_stop_rx()
132 static void netx_enable_ms(struct uart_port *port) in netx_enable_ms() argument
135 val = readl(port->membase + UART_CR); in netx_enable_ms()
136 writel(val | CR_MSIE, port->membase + UART_CR); in netx_enable_ms()
139 static inline void netx_transmit_buffer(struct uart_port *port) in netx_transmit_buffer() argument
141 struct circ_buf *xmit = &port->state->xmit; in netx_transmit_buffer()
143 if (port->x_char) { in netx_transmit_buffer()
144 writel(port->x_char, port->membase + UART_DR); in netx_transmit_buffer()
145 port->icount.tx++; in netx_transmit_buffer()
146 port->x_char = 0; in netx_transmit_buffer()
150 if (uart_tx_stopped(port) || uart_circ_empty(xmit)) { in netx_transmit_buffer()
151 netx_stop_tx(port); in netx_transmit_buffer()
158 writel(xmit->buf[xmit->tail], port->membase + UART_DR); in netx_transmit_buffer()
161 port->icount.tx++; in netx_transmit_buffer()
164 } while (!(readl(port->membase + UART_FR) & FR_TXFF)); in netx_transmit_buffer()
167 netx_stop_tx(port); in netx_transmit_buffer()
170 static void netx_start_tx(struct uart_port *port) in netx_start_tx() argument
173 readl(port->membase + UART_CR) | CR_TIE, port->membase + UART_CR); in netx_start_tx()
175 if (!(readl(port->membase + UART_FR) & FR_TXFF)) in netx_start_tx()
176 netx_transmit_buffer(port); in netx_start_tx()
179 static unsigned int netx_tx_empty(struct uart_port *port) in netx_tx_empty() argument
181 return readl(port->membase + UART_FR) & FR_BUSY ? 0 : TIOCSER_TEMT; in netx_tx_empty()
184 static void netx_txint(struct uart_port *port) in netx_txint() argument
186 struct circ_buf *xmit = &port->state->xmit; in netx_txint()
188 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { in netx_txint()
189 netx_stop_tx(port); in netx_txint()
193 netx_transmit_buffer(port); in netx_txint()
196 uart_write_wakeup(port); in netx_txint()
199 static void netx_rxint(struct uart_port *port, unsigned long *flags) in netx_rxint() argument
203 while (!(readl(port->membase + UART_FR) & FR_RXFE)) { in netx_rxint()
204 rx = readl(port->membase + UART_DR); in netx_rxint()
206 port->icount.rx++; in netx_rxint()
207 status = readl(port->membase + UART_SR); in netx_rxint()
209 writel(0, port->membase + UART_SR); in netx_rxint()
210 if (uart_handle_break(port)) in netx_rxint()
217 port->icount.parity++; in netx_rxint()
219 port->icount.frame++; in netx_rxint()
221 port->icount.overrun++; in netx_rxint()
223 status &= port->read_status_mask; in netx_rxint()
233 if (uart_handle_sysrq_char(port, rx)) in netx_rxint()
236 uart_insert_char(port, status, SR_OE, rx, flg); in netx_rxint()
239 spin_unlock_irqrestore(&port->lock, *flags); in netx_rxint()
240 tty_flip_buffer_push(&port->state->port); in netx_rxint()
241 spin_lock_irqsave(&port->lock, *flags); in netx_rxint()
246 struct uart_port *port = dev_id; in netx_int() local
250 spin_lock_irqsave(&port->lock,flags); in netx_int()
252 status = readl(port->membase + UART_IIR) & IIR_MASK; in netx_int()
255 netx_rxint(port, &flags); in netx_int()
257 netx_txint(port); in netx_int()
259 if (readl(port->membase + UART_FR) & FR_CTS) in netx_int()
260 uart_handle_cts_change(port, 1); in netx_int()
262 uart_handle_cts_change(port, 0); in netx_int()
264 writel(0, port->membase + UART_IIR); in netx_int()
265 status = readl(port->membase + UART_IIR) & IIR_MASK; in netx_int()
268 spin_unlock_irqrestore(&port->lock,flags); in netx_int()
272 static unsigned int netx_get_mctrl(struct uart_port *port) in netx_get_mctrl() argument
276 if (readl(port->membase + UART_FR) & FR_CTS) in netx_get_mctrl()
282 static void netx_set_mctrl(struct uart_port *port, unsigned int mctrl) in netx_set_mctrl() argument
288 val = readl(port->membase + UART_RTS_CR); in netx_set_mctrl()
289 writel(val | RTS_CR_RTS, port->membase + UART_RTS_CR); in netx_set_mctrl()
293 static void netx_break_ctl(struct uart_port *port, int break_state) in netx_break_ctl() argument
296 spin_lock_irq(&port->lock); in netx_break_ctl()
298 line_cr = readl(port->membase + UART_LINE_CR); in netx_break_ctl()
303 writel(line_cr, port->membase + UART_LINE_CR); in netx_break_ctl()
305 spin_unlock_irq(&port->lock); in netx_break_ctl()
308 static int netx_startup(struct uart_port *port) in netx_startup() argument
312 ret = request_irq(port->irq, netx_int, 0, in netx_startup()
313 DRIVER_NAME, port); in netx_startup()
315 dev_err(port->dev, "unable to grab irq%d\n",port->irq); in netx_startup()
319 writel(readl(port->membase + UART_LINE_CR) | LINE_CR_FEN, in netx_startup()
320 port->membase + UART_LINE_CR); in netx_startup()
323 port->membase + UART_CR); in netx_startup()
329 static void netx_shutdown(struct uart_port *port) in netx_shutdown() argument
331 writel(0, port->membase + UART_CR) ; in netx_shutdown()
333 free_irq(port->irq, port); in netx_shutdown()
337 netx_set_termios(struct uart_port *port, struct ktermios *termios, in netx_set_termios() argument
372 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); in netx_set_termios()
378 spin_lock_irq(&port->lock); in netx_set_termios()
380 uart_update_timeout(port, termios->c_cflag, baud); in netx_set_termios()
382 old_cr = readl(port->membase + UART_CR); in netx_set_termios()
386 port->membase + UART_CR); in netx_set_termios()
389 while (readl(port->membase + UART_FR) & FR_BUSY); in netx_set_termios()
392 writel(old_cr & ~CR_UART_EN, port->membase + UART_CR); in netx_set_termios()
396 if (UART_ENABLE_MS(port, termios->c_cflag)) in netx_set_termios()
399 writel((quot>>8) & 0xff, port->membase + UART_BAUDDIV_MSB); in netx_set_termios()
400 writel(quot & 0xff, port->membase + UART_BAUDDIV_LSB); in netx_set_termios()
401 writel(line_cr, port->membase + UART_LINE_CR); in netx_set_termios()
403 writel(rts_cr, port->membase + UART_RTS_CR); in netx_set_termios()
408 port->ignore_status_mask = 0; in netx_set_termios()
410 port->ignore_status_mask |= SR_PE; in netx_set_termios()
412 port->ignore_status_mask |= SR_BE; in netx_set_termios()
418 port->ignore_status_mask |= SR_PE; in netx_set_termios()
421 port->read_status_mask = 0; in netx_set_termios()
423 port->read_status_mask |= SR_BE; in netx_set_termios()
425 port->read_status_mask |= SR_PE | SR_FE; in netx_set_termios()
427 writel(old_cr, port->membase + UART_CR); in netx_set_termios()
429 spin_unlock_irq(&port->lock); in netx_set_termios()
432 static const char *netx_type(struct uart_port *port) in netx_type() argument
434 return port->type == PORT_NETX ? "NETX" : NULL; in netx_type()
437 static void netx_release_port(struct uart_port *port) in netx_release_port() argument
439 release_mem_region(port->mapbase, UART_PORT_SIZE); in netx_release_port()
442 static int netx_request_port(struct uart_port *port) in netx_request_port() argument
444 return request_mem_region(port->mapbase, UART_PORT_SIZE, in netx_request_port()
448 static void netx_config_port(struct uart_port *port, int flags) in netx_config_port() argument
450 if (flags & UART_CONFIG_TYPE && netx_request_port(port) == 0) in netx_config_port()
451 port->type = PORT_NETX; in netx_config_port()
455 netx_verify_port(struct uart_port *port, struct serial_struct *ser) in netx_verify_port() argument
486 .port = {
499 .port = {
512 .port = {
529 static void netx_console_putchar(struct uart_port *port, int ch) in netx_console_putchar() argument
531 while (readl(port->membase + UART_FR) & FR_BUSY); in netx_console_putchar()
532 writel(ch, port->membase + UART_DR); in netx_console_putchar()
538 struct uart_port *port = &netx_ports[co->index].port; in netx_console_write() local
541 cr_save = readl(port->membase + UART_CR); in netx_console_write()
542 writel(cr_save | CR_UART_EN, port->membase + UART_CR); in netx_console_write()
544 uart_console_write(port, s, count, netx_console_putchar); in netx_console_write()
546 while (readl(port->membase + UART_FR) & FR_BUSY); in netx_console_write()
547 writel(cr_save, port->membase + UART_CR); in netx_console_write()
551 netx_console_get_options(struct uart_port *port, int *baud, in netx_console_get_options() argument
556 *baud = (readl(port->membase + UART_BAUDDIV_MSB) << 8) | in netx_console_get_options()
557 readl(port->membase + UART_BAUDDIV_LSB); in netx_console_get_options()
564 line_cr = readl(port->membase + UART_LINE_CR); in netx_console_get_options()
588 if (readl(port->membase + UART_RTS_CR) & RTS_CR_AUTO) in netx_console_get_options()
616 if (readl(sport->port.membase + UART_CR) & CR_UART_EN) { in netx_console_setup()
617 netx_console_get_options(&sport->port, &baud, in netx_console_setup()
623 return uart_set_options(&sport->port, co, baud, parity, bits, flow); in netx_console_setup()
664 uart_suspend_port(&netx_reg, &sport->port); in serial_netx_suspend()
674 uart_resume_port(&netx_reg, &sport->port); in serial_netx_resume()
681 struct uart_port *port = &netx_ports[pdev->id].port; in serial_netx_probe() local
685 port->dev = &pdev->dev; in serial_netx_probe()
687 writel(1, port->membase + UART_RXFIFO_IRQLEVEL); in serial_netx_probe()
688 uart_add_one_port(&netx_reg, &netx_ports[pdev->id].port); in serial_netx_probe()
699 uart_remove_one_port(&netx_reg, &sport->port); in serial_netx_remove()