• Home
  • Raw
  • Download

Lines Matching refs:port

57 	struct uart_port	port;  member
64 static unsigned int mcf_tx_empty(struct uart_port *port) in mcf_tx_empty() argument
66 return (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXEMPTY) ? in mcf_tx_empty()
72 static unsigned int mcf_get_mctrl(struct uart_port *port) in mcf_get_mctrl() argument
74 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_get_mctrl()
77 sigs = (readb(port->membase + MCFUART_UIPR) & MCFUART_UIPR_CTS) ? in mcf_get_mctrl()
80 sigs |= (mcf_getppdcd(port->line) ? TIOCM_CD : 0); in mcf_get_mctrl()
81 sigs |= (mcf_getppdtr(port->line) ? TIOCM_DTR : 0); in mcf_get_mctrl()
88 static void mcf_set_mctrl(struct uart_port *port, unsigned int sigs) in mcf_set_mctrl() argument
90 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_set_mctrl()
93 mcf_setppdtr(port->line, (sigs & TIOCM_DTR)); in mcf_set_mctrl()
95 writeb(MCFUART_UOP_RTS, port->membase + MCFUART_UOP1); in mcf_set_mctrl()
97 writeb(MCFUART_UOP_RTS, port->membase + MCFUART_UOP0); in mcf_set_mctrl()
102 static void mcf_start_tx(struct uart_port *port) in mcf_start_tx() argument
104 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_start_tx()
106 if (port->rs485.flags & SER_RS485_ENABLED) { in mcf_start_tx()
108 writeb(MCFUART_UCR_TXENABLE, port->membase + MCFUART_UCR); in mcf_start_tx()
110 writeb(MCFUART_UOP_RTS, port->membase + MCFUART_UOP1); in mcf_start_tx()
113 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_start_tx()
118 static void mcf_stop_tx(struct uart_port *port) in mcf_stop_tx() argument
120 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_stop_tx()
123 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_stop_tx()
128 static void mcf_stop_rx(struct uart_port *port) in mcf_stop_rx() argument
130 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_stop_rx()
133 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_stop_rx()
138 static void mcf_break_ctl(struct uart_port *port, int break_state) in mcf_break_ctl() argument
142 spin_lock_irqsave(&port->lock, flags); in mcf_break_ctl()
144 writeb(MCFUART_UCR_CMDBREAKSTART, port->membase + MCFUART_UCR); in mcf_break_ctl()
146 writeb(MCFUART_UCR_CMDBREAKSTOP, port->membase + MCFUART_UCR); in mcf_break_ctl()
147 spin_unlock_irqrestore(&port->lock, flags); in mcf_break_ctl()
152 static int mcf_startup(struct uart_port *port) in mcf_startup() argument
154 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_startup()
157 spin_lock_irqsave(&port->lock, flags); in mcf_startup()
160 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); in mcf_startup()
161 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); in mcf_startup()
165 port->membase + MCFUART_UCR); in mcf_startup()
169 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_startup()
171 spin_unlock_irqrestore(&port->lock, flags); in mcf_startup()
178 static void mcf_shutdown(struct uart_port *port) in mcf_shutdown() argument
180 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_shutdown()
183 spin_lock_irqsave(&port->lock, flags); in mcf_shutdown()
187 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_shutdown()
190 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); in mcf_shutdown()
191 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); in mcf_shutdown()
193 spin_unlock_irqrestore(&port->lock, flags); in mcf_shutdown()
198 static void mcf_set_termios(struct uart_port *port, struct ktermios *termios, in mcf_set_termios() argument
208 baud = uart_get_baud_rate(port, termios, old, 0, 230400); in mcf_set_termios()
259 spin_lock_irqsave(&port->lock, flags); in mcf_set_termios()
260 if (port->rs485.flags & SER_RS485_ENABLED) { in mcf_set_termios()
261 dev_dbg(port->dev, "Setting UART to RS485\n"); in mcf_set_termios()
265 uart_update_timeout(port, termios->c_cflag, baud); in mcf_set_termios()
266 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); in mcf_set_termios()
267 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); in mcf_set_termios()
268 writeb(MCFUART_UCR_CMDRESETMRPTR, port->membase + MCFUART_UCR); in mcf_set_termios()
269 writeb(mr1, port->membase + MCFUART_UMR); in mcf_set_termios()
270 writeb(mr2, port->membase + MCFUART_UMR); in mcf_set_termios()
271 writeb((baudclk & 0xff00) >> 8, port->membase + MCFUART_UBG1); in mcf_set_termios()
272 writeb((baudclk & 0xff), port->membase + MCFUART_UBG2); in mcf_set_termios()
274 writeb((baudfr & 0x0f), port->membase + MCFUART_UFPD); in mcf_set_termios()
277 port->membase + MCFUART_UCSR); in mcf_set_termios()
279 port->membase + MCFUART_UCR); in mcf_set_termios()
280 spin_unlock_irqrestore(&port->lock, flags); in mcf_set_termios()
287 struct uart_port *port = &pp->port; in mcf_rx_chars() local
290 while ((status = readb(port->membase + MCFUART_USR)) & MCFUART_USR_RXREADY) { in mcf_rx_chars()
291 ch = readb(port->membase + MCFUART_URB); in mcf_rx_chars()
293 port->icount.rx++; in mcf_rx_chars()
297 port->membase + MCFUART_UCR); in mcf_rx_chars()
300 port->icount.brk++; in mcf_rx_chars()
301 if (uart_handle_break(port)) in mcf_rx_chars()
304 port->icount.parity++; in mcf_rx_chars()
306 port->icount.overrun++; in mcf_rx_chars()
308 port->icount.frame++; in mcf_rx_chars()
311 status &= port->read_status_mask; in mcf_rx_chars()
321 if (uart_handle_sysrq_char(port, ch)) in mcf_rx_chars()
323 uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); in mcf_rx_chars()
326 spin_unlock(&port->lock); in mcf_rx_chars()
327 tty_flip_buffer_push(&port->state->port); in mcf_rx_chars()
328 spin_lock(&port->lock); in mcf_rx_chars()
335 struct uart_port *port = &pp->port; in mcf_tx_chars() local
336 struct circ_buf *xmit = &port->state->xmit; in mcf_tx_chars()
338 if (port->x_char) { in mcf_tx_chars()
340 writeb(port->x_char, port->membase + MCFUART_UTB); in mcf_tx_chars()
341 port->x_char = 0; in mcf_tx_chars()
342 port->icount.tx++; in mcf_tx_chars()
346 while (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) { in mcf_tx_chars()
349 writeb(xmit->buf[xmit->tail], port->membase + MCFUART_UTB); in mcf_tx_chars()
351 port->icount.tx++; in mcf_tx_chars()
355 uart_write_wakeup(port); in mcf_tx_chars()
359 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_tx_chars()
361 if (port->rs485.flags & SER_RS485_ENABLED) in mcf_tx_chars()
363 port->membase + MCFUART_UCR); in mcf_tx_chars()
371 struct uart_port *port = data; in mcf_interrupt() local
372 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_interrupt()
376 isr = readb(port->membase + MCFUART_UISR) & pp->imr; in mcf_interrupt()
378 spin_lock(&port->lock); in mcf_interrupt()
387 spin_unlock(&port->lock); in mcf_interrupt()
394 static void mcf_config_port(struct uart_port *port, int flags) in mcf_config_port() argument
396 port->type = PORT_MCF; in mcf_config_port()
397 port->fifosize = MCFUART_TXFIFOSIZE; in mcf_config_port()
400 writeb(0, port->membase + MCFUART_UIMR); in mcf_config_port()
402 if (request_irq(port->irq, mcf_interrupt, 0, "UART", port)) in mcf_config_port()
404 "interrupt vector=%d\n", port->line, port->irq); in mcf_config_port()
409 static const char *mcf_type(struct uart_port *port) in mcf_type() argument
411 return (port->type == PORT_MCF) ? "ColdFire UART" : NULL; in mcf_type()
416 static int mcf_request_port(struct uart_port *port) in mcf_request_port() argument
424 static void mcf_release_port(struct uart_port *port) in mcf_release_port() argument
431 static int mcf_verify_port(struct uart_port *port, struct serial_struct *ser) in mcf_verify_port() argument
441 static int mcf_config_rs485(struct uart_port *port, struct serial_rs485 *rs485) in mcf_config_rs485() argument
446 mr1 = readb(port->membase + MCFUART_UMR); in mcf_config_rs485()
447 mr2 = readb(port->membase + MCFUART_UMR); in mcf_config_rs485()
449 dev_dbg(port->dev, "Setting UART to RS485\n"); in mcf_config_rs485()
453 dev_dbg(port->dev, "Setting UART to RS232\n"); in mcf_config_rs485()
456 writeb(mr1, port->membase + MCFUART_UMR); in mcf_config_rs485()
457 writeb(mr2, port->membase + MCFUART_UMR); in mcf_config_rs485()
458 port->rs485 = *rs485; in mcf_config_rs485()
496 struct uart_port *port; in early_mcf_setup() local
500 port = &mcf_ports[i].port; in early_mcf_setup()
502 port->line = i; in early_mcf_setup()
503 port->type = PORT_MCF; in early_mcf_setup()
504 port->mapbase = platp[i].mapbase; in early_mcf_setup()
505 port->membase = (platp[i].membase) ? platp[i].membase : in early_mcf_setup()
506 (unsigned char __iomem *) port->mapbase; in early_mcf_setup()
507 port->iotype = SERIAL_IO_MEM; in early_mcf_setup()
508 port->irq = platp[i].irq; in early_mcf_setup()
509 port->uartclk = MCF_BUSCLK; in early_mcf_setup()
510 port->flags = UPF_BOOT_AUTOCONF; in early_mcf_setup()
511 port->rs485_config = mcf_config_rs485; in early_mcf_setup()
512 port->ops = &mcf_uart_ops; in early_mcf_setup()
522 struct uart_port *port = &(mcf_ports + co->index)->port; in mcf_console_putc() local
526 if (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) in mcf_console_putc()
529 writeb(c, port->membase + MCFUART_UTB); in mcf_console_putc()
531 if (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) in mcf_console_putc()
551 struct uart_port *port; in mcf_console_setup() local
559 port = &mcf_ports[co->index].port; in mcf_console_setup()
560 if (port->membase == 0) in mcf_console_setup()
566 return uart_set_options(port, co, baud, parity, bits, flow); in mcf_console_setup()
621 struct uart_port *port; in mcf_probe() local
625 port = &mcf_ports[i].port; in mcf_probe()
627 port->line = i; in mcf_probe()
628 port->type = PORT_MCF; in mcf_probe()
629 port->mapbase = platp[i].mapbase; in mcf_probe()
630 port->membase = (platp[i].membase) ? platp[i].membase : in mcf_probe()
632 port->dev = &pdev->dev; in mcf_probe()
633 port->iotype = SERIAL_IO_MEM; in mcf_probe()
634 port->irq = platp[i].irq; in mcf_probe()
635 port->uartclk = MCF_BUSCLK; in mcf_probe()
636 port->ops = &mcf_uart_ops; in mcf_probe()
637 port->flags = UPF_BOOT_AUTOCONF; in mcf_probe()
638 port->rs485_config = mcf_config_rs485; in mcf_probe()
640 uart_add_one_port(&mcf_driver, port); in mcf_probe()
650 struct uart_port *port; in mcf_remove() local
654 port = &mcf_ports[i].port; in mcf_remove()
655 if (port) in mcf_remove()
656 uart_remove_one_port(&mcf_driver, port); in mcf_remove()