Lines Matching +full:nr +full:- +full:outputs

1 // SPDX-License-Identifier: GPL-2.0
3 * Probe module for 8250/16550-type Exar chips PCI serial ports.
111 #define UART_EXAR_TXTRG 0x0a /* Tx FIFO trigger level write-only */
112 #define UART_EXAR_RXTRG 0x0b /* Rx FIFO trigger level write-only */
133 * ---- ---- --------
137 * 3 - <reserved>
141 * 7 - <reserved>
144 * 10 - Red LED
145 * 11..15 - <unused>
162 #define IOT2040_UARTS_GPIO_HI_MODE 0xF8 /* enable & LED as outputs */
175 * struct exar8250_board - board information
178 * @setup: quirk run at ->probe() stage
179 * @exit: quirk run at ->remove() stage
190 unsigned int nr; member
209 * Calculate divisor with extra 4-bit fractional portion
216 quot_16 = DIV_ROUND_CLOSEST(p->uartclk, baud); in xr17v35x_get_divisor()
246 spin_lock_irq(&port->lock); in xr17v35x_startup()
248 spin_unlock_irq(&port->lock); in xr17v35x_startup()
257 struct circ_buf *xmit = &port->state->xmit; in exar_shutdown()
277 const struct exar8250_board *board = priv->board; in default_setup()
281 port->port.iotype = UPIO_MEM; in default_setup()
282 port->port.mapbase = pci_resource_start(pcidev, bar) + offset; in default_setup()
283 port->port.membase = priv->virt + offset; in default_setup()
284 port->port.regshift = board->reg_shift; in default_setup()
293 status = readb(port->port.membase + UART_EXAR_DVID); in default_setup()
295 port->port.type = PORT_XR17V35X; in default_setup()
297 port->port.get_divisor = xr17v35x_get_divisor; in default_setup()
298 port->port.set_divisor = xr17v35x_set_divisor; in default_setup()
300 port->port.startup = xr17v35x_startup; in default_setup()
302 port->port.type = PORT_XR17D15X; in default_setup()
305 port->port.pm = exar_pm; in default_setup()
306 port->port.shutdown = exar_shutdown; in default_setup()
320 port->port.uartclk = baud * 16; in pci_fastcom335_setup()
326 p = port->port.membase; in pci_fastcom335_setup()
337 switch (pcidev->device) { in pci_fastcom335_setup()
366 port->port.uartclk = baud * 16; in pci_connect_tech_setup()
377 port->port.uartclk = baud * 16; in pci_xr17c154_setup()
385 * devices will export them as GPIOs, so we pre-configure them safely in setup_gpio()
391 if ((pcidev->vendor == PCI_VENDOR_ID_EXAR) && in setup_gpio()
392 (pcidev->subsystem_vendor != PCI_VENDOR_ID_SEALEVEL)) { in setup_gpio()
396 // Configure GPIO as outputs for SeaLevel adapters in setup_gpio()
423 pdev->dev.parent = &pcidev->dev; in __xr17v35x_register_gpio()
424 ACPI_COMPANION_SET(&pdev->dev, ACPI_COMPANION(&pcidev->dev)); in __xr17v35x_register_gpio()
426 if (device_add_software_node(&pdev->dev, node) < 0 || in __xr17v35x_register_gpio()
437 device_remove_software_node(&pdev->dev); in __xr17v35x_unregister_gpio()
442 PROPERTY_ENTRY_U32("exar,first-pin", 0),
453 if (pcidev->vendor == PCI_VENDOR_ID_EXAR) in xr17v35x_register_gpio()
454 port->port.private_data = in xr17v35x_register_gpio()
462 if (!port->port.private_data) in xr17v35x_unregister_gpio()
465 __xr17v35x_unregister_gpio(port->port.private_data); in xr17v35x_unregister_gpio()
466 port->port.private_data = NULL; in xr17v35x_unregister_gpio()
472 bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); in generic_rs485_config()
473 u8 __iomem *p = port->membase; in generic_rs485_config()
504 bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); in iot2040_rs485_config()
505 u8 __iomem *p = port->membase; in iot2040_rs485_config()
510 if (rs485->flags & SER_RS485_RX_DURING_TX) in iot2040_rs485_config()
515 if (rs485->flags & SER_RS485_TERMINATE_BUS) in iot2040_rs485_config()
521 if (port->line == 3) { in iot2040_rs485_config()
540 PROPERTY_ENTRY_U32("exar,first-pin", 10),
552 u8 __iomem *p = port->port.membase; in iot2040_register_gpio()
559 port->port.private_data = in iot2040_register_gpio()
593 return dmi_match->driver_data; in exar_get_platform()
608 port->port.uartclk = baud * 16; in pci_xr17v35x_setup()
609 port->port.rs485_config = platform->rs485_config; in pci_xr17v35x_setup()
610 port->port.rs485_supported = *(platform->rs485_supported); in pci_xr17v35x_setup()
617 port->port.uartclk /= 2; in pci_xr17v35x_setup()
623 p = port->port.membase; in pci_xr17v35x_setup()
634 ret = platform->register_gpio(pcidev, port); in pci_xr17v35x_setup()
644 struct uart_8250_port *port = serial8250_get_port(priv->line[0]); in pci_xr17v35x_exit()
646 platform->unregister_gpio(port); in pci_xr17v35x_exit()
652 readb(priv->virt + UART_EXAR_INT0); in exar_misc_clear()
655 if (priv->board->num_ports > 8) in exar_misc_clear()
656 readb(priv->virt + 0x2000 + UART_EXAR_INT0); in exar_misc_clear()
684 board = (struct exar8250_board *)ent->driver_data; in exar_pci_probe()
686 return -EINVAL; in exar_pci_probe()
692 maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3); in exar_pci_probe()
694 if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO) in exar_pci_probe()
695 nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1); in exar_pci_probe()
696 else if (board->num_ports) in exar_pci_probe()
697 nr_ports = board->num_ports; in exar_pci_probe()
698 else if (pcidev->vendor == PCI_VENDOR_ID_SEALEVEL) in exar_pci_probe()
699 nr_ports = pcidev->device & 0xff; in exar_pci_probe()
701 nr_ports = pcidev->device & 0x0f; in exar_pci_probe()
703 priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL); in exar_pci_probe()
705 return -ENOMEM; in exar_pci_probe()
707 priv->board = board; in exar_pci_probe()
708 priv->virt = pcim_iomap(pcidev, bar, 0); in exar_pci_probe()
709 if (!priv->virt) in exar_pci_probe()
710 return -ENOMEM; in exar_pci_probe()
721 uart.port.dev = &pcidev->dev; in exar_pci_probe()
723 rc = devm_request_irq(&pcidev->dev, uart.port.irq, exar_misc_handler, in exar_pci_probe()
732 rc = board->setup(priv, pcidev, &uart, i); in exar_pci_probe()
734 dev_err(&pcidev->dev, "Failed to setup port %u\n", i); in exar_pci_probe()
738 dev_dbg(&pcidev->dev, "Setup PCI port: port %lx, irq %d, type %d\n", in exar_pci_probe()
741 priv->line[i] = serial8250_register_8250_port(&uart); in exar_pci_probe()
742 if (priv->line[i] < 0) { in exar_pci_probe()
743 dev_err(&pcidev->dev, in exar_pci_probe()
746 uart.port.iotype, priv->line[i]); in exar_pci_probe()
750 priv->nr = i; in exar_pci_probe()
760 for (i = 0; i < priv->nr; i++) in exar_pci_remove()
761 serial8250_unregister_port(priv->line[i]); in exar_pci_remove()
764 if (priv->board->exit) in exar_pci_remove()
765 priv->board->exit(pcidev); in exar_pci_remove()
774 for (i = 0; i < priv->nr; i++) in exar_suspend()
775 if (priv->line[i] >= 0) in exar_suspend()
776 serial8250_suspend_port(priv->line[i]); in exar_suspend()
788 for (i = 0; i < priv->nr; i++) in exar_resume()
789 if (priv->line[i] >= 0) in exar_resume()
790 serial8250_resume_port(priv->line[i]); in exar_resume()
913 /* USRobotics USR298x-OEM PCI Modems */