Skip to content

Commit 5aa84fd

Browse files
pnewman-ctigregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/0c64bdf852f39aec966b38696695d951e485d7e6.1713382717.git.pnewman@connecttech.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 209a20d commit 5aa84fd

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

drivers/tty/serial/8250/8250_exar.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,28 @@ static unsigned int exar_get_nr_ports(struct exar8250_board *board,
711711
{
712712
unsigned int nr_ports = 0;
713713

714-
if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
714+
if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO) {
715715
nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
716-
else if (board->num_ports)
716+
} else if (board->num_ports > 0) {
717+
// Check if board struct overrides number of ports
717718
nr_ports = board->num_ports;
718-
else
719+
} else if (pcidev->vendor == PCI_VENDOR_ID_EXAR) {
720+
// Exar encodes # ports in last nibble of PCI Device ID ex. 0358
719721
nr_ports = pcidev->device & 0x0f;
722+
} else if (pcidev->vendor == PCI_VENDOR_ID_CONNECT_TECH) {
723+
// Handle CTI FPGA cards
724+
switch (pcidev->device) {
725+
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X:
726+
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X:
727+
nr_ports = 12;
728+
break;
729+
case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16:
730+
nr_ports = 16;
731+
break;
732+
default:
733+
break;
734+
}
735+
}
720736

721737
return nr_ports;
722738
}

0 commit comments

Comments
 (0)