Lines Matching +full:auto +full:- +full:baud
1 // SPDX-License-Identifier: GPL-2.0
3 * Probe module for 8250/16550-type Exar chips PCI serial ports.
53 #define UART_FCTR_EXAR_485 0x20 /* Auto 485 half duplex dir ctl */
59 #define UART_EXAR_TXTRG 0x0a /* Tx FIFO trigger level write-only */
60 #define UART_EXAR_RXTRG 0x0b /* Rx FIFO trigger level write-only */
81 * ---- ---- --------
85 * 3 - <reserved>
89 * 7 - <reserved>
92 * 10 - Red LED
93 * 11..15 - <unused>
120 * struct exar8250_board - board information
123 * @setup: quirk run at ->probe() stage
124 * @exit: quirk run at ->remove() stage
154 * Calculate divisor with extra 4-bit fractional portion
156 static unsigned int xr17v35x_get_divisor(struct uart_port *p, unsigned int baud, in xr17v35x_get_divisor() argument
161 quot_16 = DIV_ROUND_CLOSEST(p->uartclk, baud); in xr17v35x_get_divisor()
167 static void xr17v35x_set_divisor(struct uart_port *p, unsigned int baud, in xr17v35x_set_divisor() argument
170 serial8250_do_set_divisor(p, baud, quot, quot_frac); in xr17v35x_set_divisor()
199 struct circ_buf *xmit = &port->state->xmit; in exar_shutdown()
218 const struct exar8250_board *board = priv->board; in default_setup()
222 port->port.iotype = UPIO_MEM; in default_setup()
223 port->port.mapbase = pci_resource_start(pcidev, bar) + offset; in default_setup()
224 port->port.membase = priv->virt + offset; in default_setup()
225 port->port.regshift = board->reg_shift; in default_setup()
234 status = readb(port->port.membase + UART_EXAR_DVID); in default_setup()
236 port->port.type = PORT_XR17V35X; in default_setup()
238 port->port.get_divisor = xr17v35x_get_divisor; in default_setup()
239 port->port.set_divisor = xr17v35x_set_divisor; in default_setup()
241 port->port.startup = xr17v35x_startup; in default_setup()
243 port->port.type = PORT_XR17D15X; in default_setup()
246 port->port.pm = exar_pm; in default_setup()
247 port->port.shutdown = exar_shutdown; in default_setup()
257 unsigned int baud = 1843200; in pci_fastcom335_setup() local
261 port->port.uartclk = baud * 16; in pci_fastcom335_setup()
267 p = port->port.membase; in pci_fastcom335_setup()
278 switch (pcidev->device) { in pci_fastcom335_setup()
305 unsigned int baud = 1843200; in pci_connect_tech_setup() local
307 port->port.uartclk = baud * 16; in pci_connect_tech_setup()
316 unsigned int baud = 921600; in pci_xr17c154_setup() local
318 port->port.uartclk = baud * 16; in pci_xr17c154_setup()
326 * devices will export them as GPIOs, so we pre-configure them safely in setup_gpio()
332 if ((pcidev->vendor == PCI_VENDOR_ID_EXAR) && in setup_gpio()
333 (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) { in setup_gpio()
365 pdev->dev.parent = &pcidev->dev; in __xr17v35x_register_gpio()
366 ACPI_COMPANION_SET(&pdev->dev, ACPI_COMPANION(&pcidev->dev)); in __xr17v35x_register_gpio()
378 PROPERTY_ENTRY_U32("exar,first-pin", 0),
386 if (pcidev->vendor == PCI_VENDOR_ID_EXAR) in xr17v35x_register_gpio()
387 port->port.private_data = in xr17v35x_register_gpio()
396 bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); in generic_rs485_config()
397 u8 __iomem *p = port->membase; in generic_rs485_config()
411 port->rs485 = *rs485; in generic_rs485_config()
424 bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); in iot2040_rs485_config()
425 u8 __iomem *p = port->membase; in iot2040_rs485_config()
430 if (rs485->flags & SER_RS485_RX_DURING_TX) in iot2040_rs485_config()
435 if (rs485->flags & SER_RS485_TERMINATE_BUS) in iot2040_rs485_config()
441 if (port->line == 3) { in iot2040_rs485_config()
455 PROPERTY_ENTRY_U32("exar,first-pin", 10),
463 u8 __iomem *p = port->port.membase; in iot2040_register_gpio()
470 port->port.private_data = in iot2040_register_gpio()
503 unsigned int baud = 7812500; in pci_xr17v35x_setup() local
509 platform = dmi_match->driver_data; in pci_xr17v35x_setup()
513 port->port.uartclk = baud * 16; in pci_xr17v35x_setup()
514 port->port.rs485_config = platform->rs485_config; in pci_xr17v35x_setup()
521 port->port.uartclk /= 2; in pci_xr17v35x_setup()
527 p = port->port.membase; in pci_xr17v35x_setup()
538 ret = platform->register_gpio(pcidev, port); in pci_xr17v35x_setup()
547 struct uart_8250_port *port = serial8250_get_port(priv->line[0]); in pci_xr17v35x_exit()
548 struct platform_device *pdev = port->port.private_data; in pci_xr17v35x_exit()
551 port->port.private_data = NULL; in pci_xr17v35x_exit()
557 readb(priv->virt + UART_EXAR_INT0); in exar_misc_clear()
560 if (priv->board->num_ports > 8) in exar_misc_clear()
561 readb(priv->virt + 0x2000 + UART_EXAR_INT0); in exar_misc_clear()
589 board = (struct exar8250_board *)ent->driver_data; in exar_pci_probe()
591 return -EINVAL; in exar_pci_probe()
597 maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3); in exar_pci_probe()
599 nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f; in exar_pci_probe()
601 priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL); in exar_pci_probe()
603 return -ENOMEM; in exar_pci_probe()
605 priv->board = board; in exar_pci_probe()
606 priv->virt = pcim_iomap(pcidev, bar, 0); in exar_pci_probe()
607 if (!priv->virt) in exar_pci_probe()
608 return -ENOMEM; in exar_pci_probe()
619 uart.port.dev = &pcidev->dev; in exar_pci_probe()
621 rc = devm_request_irq(&pcidev->dev, uart.port.irq, exar_misc_handler, in exar_pci_probe()
630 rc = board->setup(priv, pcidev, &uart, i); in exar_pci_probe()
632 dev_err(&pcidev->dev, "Failed to setup port %u\n", i); in exar_pci_probe()
636 dev_dbg(&pcidev->dev, "Setup PCI port: port %lx, irq %d, type %d\n", in exar_pci_probe()
639 priv->line[i] = serial8250_register_8250_port(&uart); in exar_pci_probe()
640 if (priv->line[i] < 0) { in exar_pci_probe()
641 dev_err(&pcidev->dev, in exar_pci_probe()
644 uart.port.iotype, priv->line[i]); in exar_pci_probe()
648 priv->nr = i; in exar_pci_probe()
658 for (i = 0; i < priv->nr; i++) in exar_pci_remove()
659 serial8250_unregister_port(priv->line[i]); in exar_pci_remove()
661 if (priv->board->exit) in exar_pci_remove()
662 priv->board->exit(pcidev); in exar_pci_remove()
671 for (i = 0; i < priv->nr; i++) in exar_suspend()
672 if (priv->line[i] >= 0) in exar_suspend()
673 serial8250_suspend_port(priv->line[i]); in exar_suspend()
676 if (priv->board->exit) in exar_suspend()
677 priv->board->exit(pcidev); in exar_suspend()
689 for (i = 0; i < priv->nr; i++) in exar_resume()
690 if (priv->line[i] >= 0) in exar_resume()
691 serial8250_resume_port(priv->line[i]); in exar_resume()