aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty
diff options
context:
space:
mode:
authorGravatar Parker Newman <pnewman@connecttech.com> 2024-04-17 16:31:27 -0400
committerGravatar Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2024-04-18 08:23:50 +0200
commit5aa84fd8d0592ee72387bd807a052a52abaad360 (patch)
treee42fc3c11c982a3dd502bddde853311507387a4b /drivers/tty
parentserial: exar: moved generic_rs485 further up in 8250_exar.c (diff)
downloadlinux-5aa84fd8d0592ee72387bd807a052a52abaad360.tar.gz
linux-5aa84fd8d0592ee72387bd807a052a52abaad360.tar.bz2
linux-5aa84fd8d0592ee72387bd807a052a52abaad360.zip
serial: exar: add CTI cards to exar_get_nr_ports
Add code for getting number of ports of CTI cards to exar_get_nr_ports(). Signed-off-by: Parker Newman <pnewman@connecttech.com> Link: https://lore.kernel.org/r/0c64bdf852f39aec966b38696695d951e485d7e6.1713382717.git.pnewman@connecttech.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/8250/8250_exar.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index e68029a59122..197f45e306ff 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -711,12 +711,28 @@ static unsigned int exar_get_nr_ports(struct exar8250_board *board,
{
unsigned int nr_ports = 0;
- if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
+ if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO) {
nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
- else if (board->num_ports)
+ } else if (board->num_ports > 0) {
+ // Check if board struct overrides number of ports
nr_ports = board->num_ports;
- else
+ } else if (pcidev->vendor == PCI_VENDOR_ID_EXAR) {
+ // Exar encodes # ports in last nibble of PCI Device ID ex. 0358
nr_ports = pcidev->device & 0x0f;
+ } else if (pcidev->vendor == PCI_VENDOR_ID_CONNECT_TECH) {
+ // Handle CTI FPGA cards
+ switch (pcidev->device) {
+ case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X:
+ case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X:
+ nr_ports = 12;
+ break;
+ case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16:
+ nr_ports = 16;
+ break;
+ default:
+ break;
+ }
+ }
return nr_ports;
}