Lines Matching refs:port
17 * hope for a better port registration and dynamic device allocation scheme
42 struct uart_port port;
54 return readl(up->port.membase + offset);
60 writel(value, up->port.membase + offset);
63 static void serial_pxa_enable_ms(struct uart_port *port)
65 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
71 static void serial_pxa_stop_tx(struct uart_port *port)
73 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
81 static void serial_pxa_stop_rx(struct uart_port *port)
83 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
86 up->port.read_status_mask &= ~UART_LSR_DR;
108 up->port.icount.rx++;
117 up->port.icount.brk++;
124 if (uart_handle_break(&up->port))
127 up->port.icount.parity++;
129 up->port.icount.frame++;
131 up->port.icount.overrun++;
136 *status &= up->port.read_status_mask;
139 if (up->port.line == up->port.cons->index) {
153 if (uart_handle_sysrq_char(&up->port, ch))
156 uart_insert_char(&up->port, *status, UART_LSR_OE, ch, flag);
161 tty_flip_buffer_push(&up->port.state->port);
176 struct circ_buf *xmit = &up->port.state->xmit;
179 if (up->port.x_char) {
180 serial_out(up, UART_TX, up->port.x_char);
181 up->port.icount.tx++;
182 up->port.x_char = 0;
185 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
186 serial_pxa_stop_tx(&up->port);
190 count = up->port.fifosize / 2;
194 up->port.icount.tx++;
200 uart_write_wakeup(&up->port);
204 serial_pxa_stop_tx(&up->port);
207 static void serial_pxa_start_tx(struct uart_port *port)
209 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
217 /* should hold up->port.lock */
228 up->port.icount.rng++;
230 up->port.icount.dsr++;
232 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
234 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
236 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
240 * This handles the interrupt from one port.
250 spin_lock(&up->port.lock);
257 spin_unlock(&up->port.lock);
261 static unsigned int serial_pxa_tx_empty(struct uart_port *port)
263 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
267 spin_lock_irqsave(&up->port.lock, flags);
269 spin_unlock_irqrestore(&up->port.lock, flags);
274 static unsigned int serial_pxa_get_mctrl(struct uart_port *port)
276 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
294 static void serial_pxa_set_mctrl(struct uart_port *port, unsigned int mctrl)
296 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
315 static void serial_pxa_break_ctl(struct uart_port *port, int break_state)
317 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
320 spin_lock_irqsave(&up->port.lock, flags);
326 spin_unlock_irqrestore(&up->port.lock, flags);
329 static int serial_pxa_startup(struct uart_port *port)
331 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
335 if (port->line == 3) /* HWUART */
340 up->port.uartclk = clk_get_rate(up->clk);
345 retval = request_irq(up->port.irq, serial_pxa_irq, 0, up->name, up);
371 spin_lock_irqsave(&up->port.lock, flags);
372 up->port.mctrl |= TIOCM_OUT2;
373 serial_pxa_set_mctrl(&up->port, up->port.mctrl);
374 spin_unlock_irqrestore(&up->port.lock, flags);
395 static void serial_pxa_shutdown(struct uart_port *port)
397 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
400 free_irq(up->port.irq, up);
403 * Disable interrupts from this port
408 spin_lock_irqsave(&up->port.lock, flags);
409 up->port.mctrl &= ~TIOCM_OUT2;
410 serial_pxa_set_mctrl(&up->port, up->port.mctrl);
411 spin_unlock_irqrestore(&up->port.lock, flags);
424 serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios,
427 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
459 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
460 quot = uart_get_divisor(port, baud);
462 if ((up->port.uartclk / quot) < (2400 * 16))
464 else if ((up->port.uartclk / quot) < (230400 * 16))
470 * Ok, we're now changing the port state. Do it with
473 spin_lock_irqsave(&up->port.lock, flags);
476 * Ensure the port will be enabled.
482 * Update the per-port timeout.
484 uart_update_timeout(port, termios->c_cflag, baud);
486 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
488 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
490 up->port.read_status_mask |= UART_LSR_BI;
495 up->port.ignore_status_mask = 0;
497 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
499 up->port.ignore_status_mask |= UART_LSR_BI;
505 up->port.ignore_status_mask |= UART_LSR_OE;
512 up->port.ignore_status_mask |= UART_LSR_DR;
518 if (UART_ENABLE_MS(&up->port, termios->c_cflag))
541 serial_pxa_set_mctrl(&up->port, up->port.mctrl);
543 spin_unlock_irqrestore(&up->port.lock, flags);
547 serial_pxa_pm(struct uart_port *port, unsigned int state,
550 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
558 static void serial_pxa_release_port(struct uart_port *port)
562 static int serial_pxa_request_port(struct uart_port *port)
567 static void serial_pxa_config_port(struct uart_port *port, int flags)
569 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
570 up->port.type = PORT_PXA;
574 serial_pxa_verify_port(struct uart_port *port, struct serial_struct *ser)
576 /* we don't want the core code to modify any port params */
581 serial_pxa_type(struct uart_port *port)
583 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
614 if (up->port.flags & UPF_CONS_FLOW) {
622 static void serial_pxa_console_putchar(struct uart_port *port, int ch)
624 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
631 * Print a string to the serial port trying not to disturb
632 * any possible real use of the port...
646 if (up->port.sysrq)
649 locked = spin_trylock(&up->port.lock);
651 spin_lock(&up->port.lock);
659 uart_console_write(&up->port, s, count, serial_pxa_console_putchar);
669 spin_unlock(&up->port.lock);
681 static int serial_pxa_get_poll_char(struct uart_port *port)
683 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
693 static void serial_pxa_put_poll_char(struct uart_port *port,
697 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
739 return uart_set_options(&up->port, co, baud, parity, bits, flow);
797 uart_suspend_port(&serial_pxa_reg, &sport->port);
807 uart_resume_port(&serial_pxa_reg, &sport->port);
838 sport->port.line = ret;
869 sport->port.type = PORT_PXA;
870 sport->port.iotype = UPIO_MEM;
871 sport->port.mapbase = mmres->start;
872 sport->port.irq = irqres->start;
873 sport->port.fifosize = 64;
874 sport->port.ops = &serial_pxa_pops;
875 sport->port.dev = &dev->dev;
876 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
877 sport->port.uartclk = clk_get_rate(sport->clk);
878 sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PXA_CONSOLE);
882 sport->port.line = dev->id;
885 if (sport->port.line >= ARRAY_SIZE(serial_pxa_ports)) {
886 dev_err(&dev->dev, "serial%d out of range\n", sport->port.line);
890 snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);
892 sport->port.membase = ioremap(mmres->start, resource_size(mmres));
893 if (!sport->port.membase) {
898 serial_pxa_ports[sport->port.line] = sport;
900 uart_add_one_port(&serial_pxa_reg, &sport->port);