Lines Matching refs:port
17 * hope for a better port registration and dynamic device allocation scheme
43 struct uart_port port;
55 return readl(up->port.membase + offset);
61 writel(value, up->port.membase + offset);
64 static void serial_pxa_enable_ms(struct uart_port *port)
66 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
72 static void serial_pxa_stop_tx(struct uart_port *port)
74 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
82 static void serial_pxa_stop_rx(struct uart_port *port)
84 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
87 up->port.read_status_mask &= ~UART_LSR_DR;
109 up->port.icount.rx++;
118 up->port.icount.brk++;
125 if (uart_handle_break(&up->port))
128 up->port.icount.parity++;
130 up->port.icount.frame++;
132 up->port.icount.overrun++;
137 *status &= up->port.read_status_mask;
140 if (up->port.line == up->port.cons->index) {
154 if (uart_handle_sysrq_char(&up->port, ch))
157 uart_insert_char(&up->port, *status, UART_LSR_OE, ch, flag);
162 tty_flip_buffer_push(&up->port.state->port);
179 uart_port_tx_limited(&up->port, ch, up->port.fifosize / 2,
185 static void serial_pxa_start_tx(struct uart_port *port)
187 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
195 /* should hold up->port.lock */
206 up->port.icount.rng++;
208 up->port.icount.dsr++;
210 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
212 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
214 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
218 * This handles the interrupt from one port.
228 spin_lock(&up->port.lock);
235 spin_unlock(&up->port.lock);
239 static unsigned int serial_pxa_tx_empty(struct uart_port *port)
241 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
245 spin_lock_irqsave(&up->port.lock, flags);
247 spin_unlock_irqrestore(&up->port.lock, flags);
252 static unsigned int serial_pxa_get_mctrl(struct uart_port *port)
254 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
272 static void serial_pxa_set_mctrl(struct uart_port *port, unsigned int mctrl)
274 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
293 static void serial_pxa_break_ctl(struct uart_port *port, int break_state)
295 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
298 spin_lock_irqsave(&up->port.lock, flags);
304 spin_unlock_irqrestore(&up->port.lock, flags);
307 static int serial_pxa_startup(struct uart_port *port)
309 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
313 if (port->line == 3) /* HWUART */
318 up->port.uartclk = clk_get_rate(up->clk);
323 retval = request_irq(up->port.irq, serial_pxa_irq, 0, up->name, up);
349 spin_lock_irqsave(&up->port.lock, flags);
350 up->port.mctrl |= TIOCM_OUT2;
351 serial_pxa_set_mctrl(&up->port, up->port.mctrl);
352 spin_unlock_irqrestore(&up->port.lock, flags);
373 static void serial_pxa_shutdown(struct uart_port *port)
375 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
378 free_irq(up->port.irq, up);
381 * Disable interrupts from this port
386 spin_lock_irqsave(&up->port.lock, flags);
387 up->port.mctrl &= ~TIOCM_OUT2;
388 serial_pxa_set_mctrl(&up->port, up->port.mctrl);
389 spin_unlock_irqrestore(&up->port.lock, flags);
402 serial_pxa_set_termios(struct uart_port *port, struct ktermios *termios,
405 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
423 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
424 quot = uart_get_divisor(port, baud);
426 if ((up->port.uartclk / quot) < (2400 * 16))
428 else if ((up->port.uartclk / quot) < (230400 * 16))
434 * Ok, we're now changing the port state. Do it with
437 spin_lock_irqsave(&up->port.lock, flags);
440 * Ensure the port will be enabled.
446 * Update the per-port timeout.
448 uart_update_timeout(port, termios->c_cflag, baud);
450 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
452 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
454 up->port.read_status_mask |= UART_LSR_BI;
459 up->port.ignore_status_mask = 0;
461 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
463 up->port.ignore_status_mask |= UART_LSR_BI;
469 up->port.ignore_status_mask |= UART_LSR_OE;
476 up->port.ignore_status_mask |= UART_LSR_DR;
482 if (UART_ENABLE_MS(&up->port, termios->c_cflag))
505 serial_pxa_set_mctrl(&up->port, up->port.mctrl);
507 spin_unlock_irqrestore(&up->port.lock, flags);
511 serial_pxa_pm(struct uart_port *port, unsigned int state,
514 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
522 static void serial_pxa_release_port(struct uart_port *port)
526 static int serial_pxa_request_port(struct uart_port *port)
531 static void serial_pxa_config_port(struct uart_port *port, int flags)
533 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
534 up->port.type = PORT_PXA;
538 serial_pxa_verify_port(struct uart_port *port, struct serial_struct *ser)
540 /* we don't want the core code to modify any port params */
545 serial_pxa_type(struct uart_port *port)
547 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
576 if (up->port.flags & UPF_CONS_FLOW) {
584 static void serial_pxa_console_putchar(struct uart_port *port, unsigned char ch)
586 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
593 * Print a string to the serial port trying not to disturb
594 * any possible real use of the port...
608 if (up->port.sysrq)
611 locked = spin_trylock(&up->port.lock);
613 spin_lock(&up->port.lock);
621 uart_console_write(&up->port, s, count, serial_pxa_console_putchar);
631 spin_unlock(&up->port.lock);
643 static int serial_pxa_get_poll_char(struct uart_port *port)
645 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
655 static void serial_pxa_put_poll_char(struct uart_port *port,
659 struct uart_pxa_port *up = (struct uart_pxa_port *)port;
701 return uart_set_options(&up->port, co, baud, parity, bits, flow);
759 uart_suspend_port(&serial_pxa_reg, &sport->port);
769 uart_resume_port(&serial_pxa_reg, &sport->port);
800 sport->port.line = ret;
835 sport->port.type = PORT_PXA;
836 sport->port.iotype = UPIO_MEM;
837 sport->port.mapbase = mmres->start;
838 sport->port.irq = irq;
839 sport->port.fifosize = 64;
840 sport->port.ops = &serial_pxa_pops;
841 sport->port.dev = &dev->dev;
842 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
843 sport->port.uartclk = clk_get_rate(sport->clk);
844 sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PXA_CONSOLE);
848 sport->port.line = dev->id;
851 if (sport->port.line >= ARRAY_SIZE(serial_pxa_ports)) {
852 dev_err(&dev->dev, "serial%d out of range\n", sport->port.line);
856 snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);
858 sport->port.membase = ioremap(mmres->start, resource_size(mmres));
859 if (!sport->port.membase) {
864 serial_pxa_ports[sport->port.line] = sport;
866 uart_add_one_port(&serial_pxa_reg, &sport->port);