Lines Matching +full:auto +full:- +full:baud
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2019-2020 Antmicro <www.antmicro.com>
25 * The definitions below are true for LiteX SoC configured for 8-bit CSR Bus,
26 * 32-bit aligned.
76 uart->irq_reg |= mask; in liteuart_update_irq_reg()
78 uart->irq_reg &= ~mask; in liteuart_update_irq_reg()
80 if (port->irq) in liteuart_update_irq_reg()
81 litex_write8(port->membase + OFF_EV_ENABLE, uart->irq_reg); in liteuart_update_irq_reg()
99 del_timer(&uart->timer); in liteuart_stop_rx()
104 unsigned char __iomem *membase = port->membase; in liteuart_rx_chars()
109 port->icount.rx++; in liteuart_rx_chars()
119 tty_flip_buffer_push(&port->state->port); in liteuart_rx_chars()
127 !litex_read8(port->membase + OFF_TXFULL), in liteuart_tx_chars()
128 litex_write8(port->membase + OFF_RXTX, ch)); in liteuart_tx_chars()
134 struct uart_port *port = &uart->port; in liteuart_interrupt()
143 isr = litex_read8(port->membase + OFF_EV_PENDING) & uart->irq_reg; in liteuart_interrupt()
156 struct uart_port *port = &uart->port; in liteuart_timer()
159 mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); in liteuart_timer()
165 if (!litex_read8(port->membase + OFF_TXFULL)) in liteuart_tx_empty()
187 if (port->irq) { in liteuart_startup()
188 ret = request_irq(port->irq, liteuart_interrupt, 0, in liteuart_startup()
191 dev_warn(port->dev, in liteuart_startup()
193 port->line, port->irq); in liteuart_startup()
194 port->irq = 0; in liteuart_startup()
203 if (!port->irq) { in liteuart_startup()
204 timer_setup(&uart->timer, liteuart_timer, 0); in liteuart_startup()
205 mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); in liteuart_startup()
220 if (port->irq) in liteuart_shutdown()
221 free_irq(port->irq, port); in liteuart_shutdown()
223 del_timer_sync(&uart->timer); in liteuart_shutdown()
229 unsigned int baud; in liteuart_set_termios() local
235 baud = uart_get_baud_rate(port, new, old, 0, 460800); in liteuart_set_termios()
236 uart_update_timeout(port, new->c_cflag, baud); in liteuart_set_termios()
249 * Driver core for serial ports forces a non-zero value for port type. in liteuart_config_port()
253 port->type = 1; in liteuart_config_port()
259 if (port->type != PORT_UNKNOWN && ser->type != 1) in liteuart_verify_port()
260 return -EINVAL; in liteuart_verify_port()
287 uart = devm_kzalloc(&pdev->dev, sizeof(struct liteuart_port), GFP_KERNEL); in liteuart_probe()
289 return -ENOMEM; in liteuart_probe()
291 port = &uart->port; in liteuart_probe()
294 port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in liteuart_probe()
295 if (IS_ERR(port->membase)) in liteuart_probe()
296 return PTR_ERR(port->membase); in liteuart_probe()
299 if (ret < 0 && ret != -ENXIO) in liteuart_probe()
302 port->irq = ret; in liteuart_probe()
304 /* look for aliases; auto-enumerate for free index if not found */ in liteuart_probe()
305 dev_id = of_alias_get_id(pdev->dev.of_node, "serial"); in liteuart_probe()
316 port->dev = &pdev->dev; in liteuart_probe()
317 port->iotype = UPIO_MEM; in liteuart_probe()
318 port->flags = UPF_BOOT_AUTOCONF; in liteuart_probe()
319 port->ops = &liteuart_ops; in liteuart_probe()
320 port->fifosize = 16; in liteuart_probe()
321 port->type = PORT_UNKNOWN; in liteuart_probe()
322 port->line = dev_id; in liteuart_probe()
323 spin_lock_init(&port->lock); in liteuart_probe()
327 ret = uart_add_one_port(&liteuart_driver, &uart->port); in liteuart_probe()
342 unsigned int line = port->line; in liteuart_remove()
367 while (litex_read8(port->membase + OFF_TXFULL)) in liteuart_putchar()
370 litex_write8(port->membase + OFF_RXTX, ch); in liteuart_putchar()
380 uart = (struct liteuart_port *)xa_load(&liteuart_array, co->index); in liteuart_console_write()
381 port = &uart->port; in liteuart_console_write()
392 int baud = 115200; in liteuart_console_setup() local
397 uart = (struct liteuart_port *)xa_load(&liteuart_array, co->index); in liteuart_console_setup()
399 return -ENODEV; in liteuart_console_setup()
401 port = &uart->port; in liteuart_console_setup()
402 if (!port->membase) in liteuart_console_setup()
403 return -ENODEV; in liteuart_console_setup()
406 uart_parse_options(options, &baud, &parity, &bits, &flow); in liteuart_console_setup()
408 return uart_set_options(port, co, baud, parity, bits, flow); in liteuart_console_setup()
417 .index = -1,
432 struct earlycon_device *device = console->data; in early_liteuart_write()
433 struct uart_port *port = &device->port; in early_liteuart_write()
441 if (!device->port.membase) in early_liteuart_setup()
442 return -ENODEV; in early_liteuart_setup()
444 device->con->write = early_liteuart_write; in early_liteuart_setup()