Lines Matching refs:port

36 /* Set the max number of UART port
37 * Intel EG20T PCH: 4 port
38 * LAPIS Semiconductor ML7213 IOH: 3 port
39 * LAPIS Semiconductor ML7223 IOH: 2 port
207 struct uart_port port;
249 * @port_type: The type of UART port
250 * @line_no: UART port line number (0, 1, 2...)
314 "PCH EG20T port[%d] regs:\n", priv->port.line);
444 dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div);
452 dev_err(priv->port.dev, "Invalid parity(0x%x)\n", parity);
457 dev_err(priv->port.dev, "Invalid bits(0x%x)\n", bits);
462 dev_err(priv->port.dev, "Invalid STB(0x%x)\n", stb);
470 dev_dbg(priv->port.dev, "%s:baud = %u, div = %04x, lcr = %02x (%lu)\n",
484 dev_err(priv->port.dev, "%s:Invalid flag(0x%x)\n",
504 dev_err(priv->port.dev, "%s:Invalid DMA Mode(0x%x)\n",
510 dev_err(priv->port.dev, "%s:Invalid FIFO SIZE(0x%x)\n",
516 dev_err(priv->port.dev, "%s:Invalid TRIGGER(0x%x)\n",
574 struct uart_port *port = &priv->port;
583 port->icount.brk++;
584 if (uart_handle_break(port))
587 if (uart_handle_sysrq_char(port, rbr))
622 struct uart_port *port = &priv->port;
623 struct tty_port *tport = &port->state->port;
634 struct uart_port *port = &priv->port;
635 struct tty_port *tport = &port->state->port;
640 dev_warn(port->dev, "Rx overrun: dropping %u bytes\n",
647 port->icount.rx += room;
652 static void pch_free_dma(struct uart_port *port)
655 priv = container_of(port, struct eg20t_port, port);
667 dma_free_coherent(port->dev, port->fifosize, priv->rx_buf_virt,
689 static void pch_request_dma(struct uart_port *port)
696 container_of(port, struct eg20t_port, port);
707 param->chan_id = priv->port.line * 2; /* Tx = 0, 2, 4, ... */
709 param->tx_reg = port->mapbase + UART_TX;
712 dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n",
722 param->chan_id = priv->port.line * 2 + 1; /* Rx = Tx + 1 */
724 param->rx_reg = port->mapbase + UART_RX;
727 dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Rx)\n",
736 priv->rx_buf_virt = dma_alloc_coherent(port->dev, port->fifosize,
746 struct uart_port *port = &priv->port;
749 dma_sync_sg_for_cpu(port->dev, &priv->sg_rx, 1, DMA_FROM_DEVICE);
752 tty_flip_buffer_push(&port->state->port);
761 struct uart_port *port = &priv->port;
762 struct circ_buf *xmit = &port->state->xmit;
768 port->icount.tx += sg_dma_len(sg);
772 dma_unmap_sg(port->dev, priv->sg_tx_p, priv->orig_nent, DMA_TO_DEVICE);
783 struct uart_port *port = &priv->port;
784 struct circ_buf *xmit = &port->state->xmit;
786 if (uart_tx_stopped(port) || uart_circ_empty(xmit) || count >= size)
799 dev_dbg(priv->port.dev, "%d characters. Remained %d characters.(%lu)\n",
833 struct uart_port *port = &priv->port;
837 priv = container_of(port, struct eg20t_port, port);
867 struct uart_port *port = &priv->port;
868 struct circ_buf *xmit = &port->state->xmit;
875 dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n",
884 if (port->x_char) {
885 pch_uart_hal_write(priv, &port->x_char, 1);
886 port->icount.tx++;
887 port->x_char = 0;
897 port->icount.tx += tx_size;
905 uart_write_wakeup(port);
913 struct uart_port *port = &priv->port;
914 struct circ_buf *xmit = &port->state->xmit;
926 dev_info(priv->port.dev, "%s:Tx isn't started. (%lu)\n",
934 dev_dbg(priv->port.dev, "%s:Tx is not completed. (%lu)\n",
943 if (port->x_char) {
944 pch_uart_hal_write(priv, &port->x_char, 1);
945 port->icount.tx++;
946 port->x_char = 0;
954 dev_dbg(priv->port.dev, "%s 0 bytes return\n", __func__);
956 uart_write_wakeup(port);
970 dev_dbg(priv->port.dev, "%s num=%d size=%d rem=%d\n",
977 dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
994 nent = dma_map_sg(port->dev, sg, num, DMA_TO_DEVICE);
996 dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__);
1017 dev_err(priv->port.dev, "%s:dmaengine_prep_slave_sg Failed\n",
1021 dma_sync_sg_for_device(port->dev, priv->sg_tx_p, nent, DMA_TO_DEVICE);
1035 struct uart_port *port = &priv->port;
1036 struct tty_struct *tty = tty_port_tty_get(&port->state->port);
1044 port->icount.frame++;
1049 port->icount.parity++;
1054 port->icount.overrun++;
1128 dev_err(priv->port.dev, "%s:iid=%02x (%lu)\n", __func__,
1141 /* This function tests whether the transmitter fifo and shifter for the port
1142 described by 'port' is empty. */
1143 static unsigned int pch_uart_tx_empty(struct uart_port *port)
1147 priv = container_of(port, struct eg20t_port, port);
1155 static unsigned int pch_uart_get_mctrl(struct uart_port *port)
1161 priv = container_of(port, struct eg20t_port, port);
1179 static void pch_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
1182 struct eg20t_port *priv = container_of(port, struct eg20t_port, port);
1198 static void pch_uart_stop_tx(struct uart_port *port)
1201 priv = container_of(port, struct eg20t_port, port);
1206 static void pch_uart_start_tx(struct uart_port *port)
1210 priv = container_of(port, struct eg20t_port, port);
1214 dev_dbg(priv->port.dev, "%s : Tx DMA is NOT empty.\n",
1224 static void pch_uart_stop_rx(struct uart_port *port)
1227 priv = container_of(port, struct eg20t_port, port);
1234 static void pch_uart_enable_ms(struct uart_port *port)
1237 priv = container_of(port, struct eg20t_port, port);
1242 static void pch_uart_break_ctl(struct uart_port *port, int ctl)
1247 priv = container_of(port, struct eg20t_port, port);
1254 static int pch_uart_startup(struct uart_port *port)
1261 priv = container_of(port, struct eg20t_port, port);
1264 if (port->uartclk)
1265 priv->uartclk = port->uartclk;
1267 port->uartclk = priv->uartclk;
1314 ret = request_irq(priv->port.irq, pch_uart_interrupt, IRQF_SHARED,
1320 pch_request_dma(port);
1325 uart_update_timeout(port, CS8, default_baud);
1330 static void pch_uart_shutdown(struct uart_port *port)
1335 priv = container_of(port, struct eg20t_port, port);
1341 dev_err(priv->port.dev,
1344 pch_free_dma(port);
1346 free_irq(priv->port.irq, priv);
1349 /* Change the port parameters, including word length, parity, stop
1352 static void pch_uart_set_termios(struct uart_port *port,
1360 priv = container_of(port, struct eg20t_port, port);
1397 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk / 16);
1400 spin_lock(&port->lock);
1402 uart_update_timeout(port, termios->c_cflag, baud);
1407 pch_uart_set_mctrl(&priv->port, priv->port.mctrl);
1413 spin_unlock(&port->lock);
1417 static const char *pch_uart_type(struct uart_port *port)
1422 static void pch_uart_release_port(struct uart_port *port)
1426 priv = container_of(port, struct eg20t_port, port);
1431 static int pch_uart_request_port(struct uart_port *port)
1437 priv = container_of(port, struct eg20t_port, port);
1447 priv->membase = port->membase = membase;
1452 static void pch_uart_config_port(struct uart_port *port, int type)
1456 priv = container_of(port, struct eg20t_port, port);
1458 port->type = priv->port_type;
1459 pch_uart_request_port(port);
1463 static int pch_uart_verify_port(struct uart_port *port,
1468 priv = container_of(port, struct eg20t_port, port);
1470 dev_info(priv->port.dev,
1476 dev_err(priv->port.dev, "%s : PCH DMA is not Loaded.\n",
1481 pch_request_dma(port);
1485 dev_info(priv->port.dev, "PCH UART: %s\n",
1513 if (up->port.flags & UPF_CONS_FLOW) {
1531 static int pch_uart_get_poll_char(struct uart_port *port)
1534 container_of(port, struct eg20t_port, port);
1544 static void pch_uart_put_poll_char(struct uart_port *port,
1549 container_of(port, struct eg20t_port, port);
1598 static void pch_console_putchar(struct uart_port *port, int ch)
1601 container_of(port, struct eg20t_port, port);
1608 * Print a string to the serial port trying not to disturb
1609 * any possible real use of the port...
1627 if (priv->port.sysrq) {
1630 /* serial8250_handle_port() already took the port lock */
1634 port_locked = spin_trylock(&priv->port.lock);
1637 spin_lock(&priv->port.lock);
1647 uart_console_write(&priv->port, s, count, pch_console_putchar);
1657 spin_unlock(&priv->port.lock);
1665 struct uart_port *port;
1673 * if so, search for the first available port that does have
1678 port = &pch_uart_ports[co->index]->port;
1680 if (!port || (!port->iobase && !port->membase))
1683 port->uartclk = pch_uart_get_uartclk();
1688 return uart_set_options(port, co, baud, parity, bits, flow);
1773 priv->port.dev = &pdev->dev;
1774 priv->port.iobase = iobase;
1775 priv->port.membase = NULL;
1776 priv->port.mapbase = mapbase;
1777 priv->port.irq = pdev->irq;
1778 priv->port.iotype = UPIO_PORT;
1779 priv->port.ops = &pch_uart_ops;
1780 priv->port.flags = UPF_BOOT_AUTOCONF;
1781 priv->port.fifosize = fifosize;
1782 priv->port.line = board->line_no;
1783 priv->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PCH_UART_CONSOLE);
1788 priv->port.line);
1790 spin_lock_init(&priv->port.lock);
1803 ret = uart_add_one_port(&pch_uart_driver, &priv->port);
1833 uart_remove_one_port(&pch_uart_driver, &priv->port);
1844 pch_uart_ports[priv->port.line] = NULL;
1856 uart_suspend_port(&pch_uart_driver, &priv->port);
1865 uart_resume_port(&pch_uart_driver, &priv->port);