Lines Matching refs:port

53 	struct uart_port	port;  member
60 static unsigned int mcf_tx_empty(struct uart_port *port) in mcf_tx_empty() argument
62 return (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXEMPTY) ? in mcf_tx_empty()
68 static unsigned int mcf_get_mctrl(struct uart_port *port) in mcf_get_mctrl() argument
70 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_get_mctrl()
73 sigs = (readb(port->membase + MCFUART_UIPR) & MCFUART_UIPR_CTS) ? in mcf_get_mctrl()
76 sigs |= (mcf_getppdcd(port->line) ? TIOCM_CD : 0); in mcf_get_mctrl()
77 sigs |= (mcf_getppdtr(port->line) ? TIOCM_DTR : 0); in mcf_get_mctrl()
84 static void mcf_set_mctrl(struct uart_port *port, unsigned int sigs) in mcf_set_mctrl() argument
86 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_set_mctrl()
89 mcf_setppdtr(port->line, (sigs & TIOCM_DTR)); in mcf_set_mctrl()
91 writeb(MCFUART_UOP_RTS, port->membase + MCFUART_UOP1); in mcf_set_mctrl()
93 writeb(MCFUART_UOP_RTS, port->membase + MCFUART_UOP0); in mcf_set_mctrl()
98 static void mcf_start_tx(struct uart_port *port) in mcf_start_tx() argument
100 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_start_tx()
102 if (port->rs485.flags & SER_RS485_ENABLED) { in mcf_start_tx()
104 writeb(MCFUART_UCR_TXENABLE, port->membase + MCFUART_UCR); in mcf_start_tx()
106 writeb(MCFUART_UOP_RTS, port->membase + MCFUART_UOP1); in mcf_start_tx()
109 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_start_tx()
114 static void mcf_stop_tx(struct uart_port *port) in mcf_stop_tx() argument
116 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_stop_tx()
119 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_stop_tx()
124 static void mcf_stop_rx(struct uart_port *port) in mcf_stop_rx() argument
126 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_stop_rx()
129 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_stop_rx()
134 static void mcf_break_ctl(struct uart_port *port, int break_state) in mcf_break_ctl() argument
138 uart_port_lock_irqsave(port, &flags); in mcf_break_ctl()
140 writeb(MCFUART_UCR_CMDBREAKSTART, port->membase + MCFUART_UCR); in mcf_break_ctl()
142 writeb(MCFUART_UCR_CMDBREAKSTOP, port->membase + MCFUART_UCR); in mcf_break_ctl()
143 uart_port_unlock_irqrestore(port, flags); in mcf_break_ctl()
148 static int mcf_startup(struct uart_port *port) in mcf_startup() argument
150 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_startup()
153 uart_port_lock_irqsave(port, &flags); in mcf_startup()
156 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); in mcf_startup()
157 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); in mcf_startup()
161 port->membase + MCFUART_UCR); in mcf_startup()
165 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_startup()
167 uart_port_unlock_irqrestore(port, flags); in mcf_startup()
174 static void mcf_shutdown(struct uart_port *port) in mcf_shutdown() argument
176 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_shutdown()
179 uart_port_lock_irqsave(port, &flags); in mcf_shutdown()
183 writeb(pp->imr, port->membase + MCFUART_UIMR); in mcf_shutdown()
186 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); in mcf_shutdown()
187 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); in mcf_shutdown()
189 uart_port_unlock_irqrestore(port, flags); in mcf_shutdown()
194 static void mcf_set_termios(struct uart_port *port, struct ktermios *termios, in mcf_set_termios() argument
204 baud = uart_get_baud_rate(port, termios, old, 0, 230400); in mcf_set_termios()
255 uart_port_lock_irqsave(port, &flags); in mcf_set_termios()
256 if (port->rs485.flags & SER_RS485_ENABLED) { in mcf_set_termios()
257 dev_dbg(port->dev, "Setting UART to RS485\n"); in mcf_set_termios()
261 uart_update_timeout(port, termios->c_cflag, baud); in mcf_set_termios()
262 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR); in mcf_set_termios()
263 writeb(MCFUART_UCR_CMDRESETTX, port->membase + MCFUART_UCR); in mcf_set_termios()
264 writeb(MCFUART_UCR_CMDRESETMRPTR, port->membase + MCFUART_UCR); in mcf_set_termios()
265 writeb(mr1, port->membase + MCFUART_UMR); in mcf_set_termios()
266 writeb(mr2, port->membase + MCFUART_UMR); in mcf_set_termios()
267 writeb((baudclk & 0xff00) >> 8, port->membase + MCFUART_UBG1); in mcf_set_termios()
268 writeb((baudclk & 0xff), port->membase + MCFUART_UBG2); in mcf_set_termios()
270 writeb((baudfr & 0x0f), port->membase + MCFUART_UFPD); in mcf_set_termios()
273 port->membase + MCFUART_UCSR); in mcf_set_termios()
275 port->membase + MCFUART_UCR); in mcf_set_termios()
276 uart_port_unlock_irqrestore(port, flags); in mcf_set_termios()
283 struct uart_port *port = &pp->port; in mcf_rx_chars() local
286 while ((status = readb(port->membase + MCFUART_USR)) & MCFUART_USR_RXREADY) { in mcf_rx_chars()
287 ch = readb(port->membase + MCFUART_URB); in mcf_rx_chars()
289 port->icount.rx++; in mcf_rx_chars()
293 port->membase + MCFUART_UCR); in mcf_rx_chars()
296 port->icount.brk++; in mcf_rx_chars()
297 if (uart_handle_break(port)) in mcf_rx_chars()
300 port->icount.parity++; in mcf_rx_chars()
302 port->icount.overrun++; in mcf_rx_chars()
304 port->icount.frame++; in mcf_rx_chars()
307 status &= port->read_status_mask; in mcf_rx_chars()
317 if (uart_handle_sysrq_char(port, ch)) in mcf_rx_chars()
319 uart_insert_char(port, status, MCFUART_USR_RXOVERRUN, ch, flag); in mcf_rx_chars()
322 tty_flip_buffer_push(&port->state->port); in mcf_rx_chars()
329 struct uart_port *port = &pp->port; in mcf_tx_chars() local
333 pending = uart_port_tx(port, ch, in mcf_tx_chars()
334 readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY, in mcf_tx_chars()
335 writeb(ch, port->membase + MCFUART_UTB)); in mcf_tx_chars()
338 if (!pending && (port->rs485.flags & SER_RS485_ENABLED)) in mcf_tx_chars()
339 writeb(MCFUART_UCR_TXDISABLE, port->membase + MCFUART_UCR); in mcf_tx_chars()
346 struct uart_port *port = data; in mcf_interrupt() local
347 struct mcf_uart *pp = container_of(port, struct mcf_uart, port); in mcf_interrupt()
351 isr = readb(port->membase + MCFUART_UISR) & pp->imr; in mcf_interrupt()
353 uart_port_lock(port); in mcf_interrupt()
362 uart_port_unlock(port); in mcf_interrupt()
369 static void mcf_config_port(struct uart_port *port, int flags) in mcf_config_port() argument
371 port->type = PORT_MCF; in mcf_config_port()
372 port->fifosize = MCFUART_TXFIFOSIZE; in mcf_config_port()
375 writeb(0, port->membase + MCFUART_UIMR); in mcf_config_port()
377 if (request_irq(port->irq, mcf_interrupt, 0, "UART", port)) in mcf_config_port()
379 "interrupt vector=%d\n", port->line, port->irq); in mcf_config_port()
384 static const char *mcf_type(struct uart_port *port) in mcf_type() argument
386 return (port->type == PORT_MCF) ? "ColdFire UART" : NULL; in mcf_type()
391 static int mcf_request_port(struct uart_port *port) in mcf_request_port() argument
399 static void mcf_release_port(struct uart_port *port) in mcf_release_port() argument
406 static int mcf_verify_port(struct uart_port *port, struct serial_struct *ser) in mcf_verify_port() argument
416 static int mcf_config_rs485(struct uart_port *port, struct ktermios *termios, in mcf_config_rs485() argument
422 mr1 = readb(port->membase + MCFUART_UMR); in mcf_config_rs485()
423 mr2 = readb(port->membase + MCFUART_UMR); in mcf_config_rs485()
425 dev_dbg(port->dev, "Setting UART to RS485\n"); in mcf_config_rs485()
429 dev_dbg(port->dev, "Setting UART to RS232\n"); in mcf_config_rs485()
432 writeb(mr1, port->membase + MCFUART_UMR); in mcf_config_rs485()
433 writeb(mr2, port->membase + MCFUART_UMR); in mcf_config_rs485()
475 struct uart_port *port = &(mcf_ports + co->index)->port; in mcf_console_putc() local
479 if (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) in mcf_console_putc()
482 writeb(c, port->membase + MCFUART_UTB); in mcf_console_putc()
484 if (readb(port->membase + MCFUART_USR) & MCFUART_USR_TXREADY) in mcf_console_putc()
504 struct uart_port *port; in mcf_console_setup() local
512 port = &mcf_ports[co->index].port; in mcf_console_setup()
513 if (port->membase == 0) in mcf_console_setup()
519 return uart_set_options(port, co, baud, parity, bits, flow); in mcf_console_setup()
574 struct uart_port *port; in mcf_probe() local
578 port = &mcf_ports[i].port; in mcf_probe()
580 port->line = i; in mcf_probe()
581 port->type = PORT_MCF; in mcf_probe()
582 port->mapbase = platp[i].mapbase; in mcf_probe()
583 port->membase = (platp[i].membase) ? platp[i].membase : in mcf_probe()
585 port->dev = &pdev->dev; in mcf_probe()
586 port->iotype = SERIAL_IO_MEM; in mcf_probe()
587 port->irq = platp[i].irq; in mcf_probe()
588 port->uartclk = MCF_BUSCLK; in mcf_probe()
589 port->ops = &mcf_uart_ops; in mcf_probe()
590 port->flags = UPF_BOOT_AUTOCONF; in mcf_probe()
591 port->rs485_config = mcf_config_rs485; in mcf_probe()
592 port->rs485_supported = mcf_rs485_supported; in mcf_probe()
593 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MCF_CONSOLE); in mcf_probe()
595 uart_add_one_port(&mcf_driver, port); in mcf_probe()
605 struct uart_port *port; in mcf_remove() local
609 port = &mcf_ports[i].port; in mcf_remove()
610 if (port) in mcf_remove()
611 uart_remove_one_port(&mcf_driver, port); in mcf_remove()