Lines Matching +full:8810 +full:pl +full:- +full:uart
1 // SPDX-License-Identifier: GPL-2.0+
128 writel(val, port->membase + off); in rda_uart_write()
133 return readl(port->membase + off); in rda_uart_read()
236 clk_set_rate(rda_port->clk, baud * 8); in rda_uart_change_baudrate()
251 baud = uart_get_baud_rate(port, termios, old, 9600, port->uartclk / 4); in rda_uart_set_termios()
258 switch (termios->c_cflag & CSIZE) { in rda_uart_set_termios()
261 dev_warn(port->dev, "bit size not supported, using 7 bits\n"); in rda_uart_set_termios()
265 termios->c_cflag &= ~CSIZE; in rda_uart_set_termios()
266 termios->c_cflag |= CS7; in rda_uart_set_termios()
274 if (termios->c_cflag & CSTOPB) in rda_uart_set_termios()
280 if (termios->c_cflag & PARENB) { in rda_uart_set_termios()
284 if (termios->c_cflag & CMSPAR) { in rda_uart_set_termios()
285 if (termios->c_cflag & PARODD) in rda_uart_set_termios()
289 } else if (termios->c_cflag & PARODD) { in rda_uart_set_termios()
299 if (termios->c_cflag & CRTSCTS) { in rda_uart_set_termios()
325 /* update the per-port timeout */ in rda_uart_set_termios()
326 uart_update_timeout(port, termios->c_cflag, baud); in rda_uart_set_termios()
333 struct tty_port *tport = &port->state->port; in rda_uart_send_chars()
340 if (port->x_char) { in rda_uart_send_chars()
345 rda_uart_write(port, port->x_char, RDA_UART_RXTX_BUFFER); in rda_uart_send_chars()
346 port->icount.tx++; in rda_uart_send_chars()
347 port->x_char = 0; in rda_uart_send_chars()
354 if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS) in rda_uart_send_chars()
357 if (!kfifo_is_empty(&tport->xmit_fifo)) { in rda_uart_send_chars()
358 /* Re-enable Tx FIFO interrupt */ in rda_uart_send_chars()
374 port->icount.parity++; in rda_uart_receive_chars()
379 port->icount.frame++; in rda_uart_receive_chars()
384 port->icount.overrun++; in rda_uart_receive_chars()
391 port->icount.rx++; in rda_uart_receive_chars()
393 tty_insert_flip_char(&port->state->port, val, flag); in rda_uart_receive_chars()
398 tty_flip_buffer_push(&port->state->port); in rda_uart_receive_chars()
438 ret = request_irq(port->irq, rda_interrupt, IRQF_NO_SUSPEND, in rda_uart_startup()
439 "rda-uart", port); in rda_uart_startup()
478 return (port->type == PORT_RDA) ? "rda-uart" : NULL; in rda_uart_type()
483 struct platform_device *pdev = to_platform_device(port->dev); in rda_uart_request_port()
488 return -ENXIO; in rda_uart_request_port()
490 if (!devm_request_mem_region(port->dev, port->mapbase, in rda_uart_request_port()
491 resource_size(res), dev_name(port->dev))) in rda_uart_request_port()
492 return -EBUSY; in rda_uart_request_port()
494 if (port->flags & UPF_IOREMAP) { in rda_uart_request_port()
495 port->membase = devm_ioremap(port->dev, port->mapbase, in rda_uart_request_port()
497 if (!port->membase) in rda_uart_request_port()
498 return -EBUSY; in rda_uart_request_port()
509 port->type = PORT_RDA; in rda_uart_config_port()
526 struct platform_device *pdev = to_platform_device(port->dev); in rda_uart_release_port()
533 if (port->flags & UPF_IOREMAP) { in rda_uart_release_port()
534 devm_release_mem_region(port->dev, port->mapbase, in rda_uart_release_port()
536 devm_iounmap(port->dev, port->membase); in rda_uart_release_port()
537 port->membase = NULL; in rda_uart_release_port()
544 if (port->type != PORT_RDA) in rda_uart_verify_port()
545 return -EINVAL; in rda_uart_verify_port()
547 if (port->irq != ser->irq) in rda_uart_verify_port()
548 return -EINVAL; in rda_uart_verify_port()
574 if (!port->membase) in rda_console_putchar()
615 rda_port = rda_uart_ports[co->index]; in rda_uart_console_write()
619 rda_uart_port_write(&rda_port->port, s, count); in rda_uart_console_write()
630 if (co->index < 0 || co->index >= RDA_UART_PORT_NUM) in rda_uart_console_setup()
631 return -EINVAL; in rda_uart_console_setup()
633 rda_port = rda_uart_ports[co->index]; in rda_uart_console_setup()
634 if (!rda_port || !rda_port->port.membase) in rda_uart_console_setup()
635 return -ENODEV; in rda_uart_console_setup()
640 return uart_set_options(&rda_port->port, co, baud, parity, bits, flow); in rda_uart_console_setup()
649 .index = -1,
665 struct earlycon_device *dev = co->data; in rda_uart_early_console_write()
667 rda_uart_port_write(&dev->port, s, count); in rda_uart_early_console_write()
673 if (!device->port.membase) in rda_uart_early_console_setup()
674 return -ENODEV; in rda_uart_early_console_setup()
676 device->con->write = rda_uart_early_console_write; in rda_uart_early_console_setup()
681 OF_EARLYCON_DECLARE(rda, "rda,8810pl-uart",
691 .driver_name = "rda-uart",
698 { .compatible = "rda,8810pl-uart" },
709 if (pdev->dev.of_node) in rda_uart_probe()
710 pdev->id = of_alias_get_id(pdev->dev.of_node, "serial"); in rda_uart_probe()
712 if (pdev->id < 0 || pdev->id >= RDA_UART_PORT_NUM) { in rda_uart_probe()
713 dev_err(&pdev->dev, "id %d out of range\n", pdev->id); in rda_uart_probe()
714 return -EINVAL; in rda_uart_probe()
719 dev_err(&pdev->dev, "could not get mem\n"); in rda_uart_probe()
720 return -ENODEV; in rda_uart_probe()
727 if (rda_uart_ports[pdev->id]) { in rda_uart_probe()
728 dev_err(&pdev->dev, "port %d already allocated\n", pdev->id); in rda_uart_probe()
729 return -EBUSY; in rda_uart_probe()
732 rda_port = devm_kzalloc(&pdev->dev, sizeof(*rda_port), GFP_KERNEL); in rda_uart_probe()
734 return -ENOMEM; in rda_uart_probe()
736 rda_port->clk = devm_clk_get(&pdev->dev, NULL); in rda_uart_probe()
737 if (IS_ERR(rda_port->clk)) { in rda_uart_probe()
738 dev_err(&pdev->dev, "could not get clk\n"); in rda_uart_probe()
739 return PTR_ERR(rda_port->clk); in rda_uart_probe()
742 rda_port->port.dev = &pdev->dev; in rda_uart_probe()
743 rda_port->port.regshift = 0; in rda_uart_probe()
744 rda_port->port.line = pdev->id; in rda_uart_probe()
745 rda_port->port.type = PORT_RDA; in rda_uart_probe()
746 rda_port->port.iotype = UPIO_MEM; in rda_uart_probe()
747 rda_port->port.mapbase = res_mem->start; in rda_uart_probe()
748 rda_port->port.irq = irq; in rda_uart_probe()
749 rda_port->port.uartclk = clk_get_rate(rda_port->clk); in rda_uart_probe()
750 if (rda_port->port.uartclk == 0) { in rda_uart_probe()
751 dev_err(&pdev->dev, "clock rate is zero\n"); in rda_uart_probe()
752 return -EINVAL; in rda_uart_probe()
754 rda_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | in rda_uart_probe()
756 rda_port->port.x_char = 0; in rda_uart_probe()
757 rda_port->port.fifosize = RDA_UART_TX_FIFO_SIZE; in rda_uart_probe()
758 rda_port->port.ops = &rda_uart_ops; in rda_uart_probe()
760 rda_uart_ports[pdev->id] = rda_port; in rda_uart_probe()
763 ret = uart_add_one_port(&rda_uart_driver, &rda_port->port); in rda_uart_probe()
765 rda_uart_ports[pdev->id] = NULL; in rda_uart_probe()
774 uart_remove_one_port(&rda_uart_driver, &rda_port->port); in rda_uart_remove()
775 rda_uart_ports[pdev->id] = NULL; in rda_uart_remove()
782 .name = "rda-uart",