Takashi Iwai 194265
From 95d698869b404772cc8b72560df71548491c10bc Mon Sep 17 00:00:00 2001
Takashi Iwai 194265
From: Andrew Davis <afd@ti.com>
Takashi Iwai 194265
Date: Thu, 20 Apr 2023 11:02:09 -0500
Takashi Iwai 194265
Subject: [PATCH] serial: 8250_exar: Add support for USR298x PCI Modems
Takashi Iwai 194265
Git-commit: 95d698869b404772cc8b72560df71548491c10bc
Takashi Iwai 194265
Patch-mainline: v6.4-rc3
Takashi Iwai 194265
References: git-fixes
Takashi Iwai 194265
Takashi Iwai 194265
Possibly the last PCI controller-based (i.e. not a soft/winmodem)
Takashi Iwai 194265
dial-up modem one can still buy.
Takashi Iwai 194265
Takashi Iwai 194265
Looks to have a stock XR17C154 PCI UART chip for communication, but for
Takashi Iwai 194265
some reason when provisioning the PCI IDs they swapped the vendor and
Takashi Iwai 194265
subvendor IDs. Otherwise this card would have worked out of the box.
Takashi Iwai 194265
Takashi Iwai 194265
Searching online, some folks seem to not have this issue and others do,
Takashi Iwai 194265
so it is possible only some batches of cards have this error.
Takashi Iwai 194265
Takashi Iwai 194265
Create a new macro to handle the switched IDs and add support here.
Takashi Iwai 194265
Takashi Iwai 194265
Signed-off-by: Andrew Davis <afd@ti.com>
Takashi Iwai 194265
Cc: stable <stable@kernel.org>
Takashi Iwai 194265
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Takashi Iwai 194265
Link: https://lore.kernel.org/r/20230420160209.28221-1-afd@ti.com
Takashi Iwai 194265
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Takashi Iwai 194265
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 194265
Takashi Iwai 194265
---
Takashi Iwai 194265
 drivers/tty/serial/8250/8250_exar.c | 17 +++++++++++++++++
Takashi Iwai 194265
 1 file changed, 17 insertions(+)
Takashi Iwai 194265
Takashi Iwai 194265
diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
Takashi Iwai 194265
index 64770c62bbec..b406cba10b0e 100644
Takashi Iwai 194265
--- a/drivers/tty/serial/8250/8250_exar.c
Takashi Iwai 194265
+++ b/drivers/tty/serial/8250/8250_exar.c
Takashi Iwai 194265
@@ -40,9 +40,13 @@
Takashi Iwai 194265
 #define PCI_DEVICE_ID_COMMTECH_4224PCIE		0x0020
Takashi Iwai 194265
 #define PCI_DEVICE_ID_COMMTECH_4228PCIE		0x0021
Takashi Iwai 194265
 #define PCI_DEVICE_ID_COMMTECH_4222PCIE		0x0022
Takashi Iwai 194265
+
Takashi Iwai 194265
 #define PCI_DEVICE_ID_EXAR_XR17V4358		0x4358
Takashi Iwai 194265
 #define PCI_DEVICE_ID_EXAR_XR17V8358		0x8358
Takashi Iwai 194265
 
Takashi Iwai 194265
+#define PCI_SUBDEVICE_ID_USR_2980		0x0128
Takashi Iwai 194265
+#define PCI_SUBDEVICE_ID_USR_2981		0x0129
Takashi Iwai 194265
+
Takashi Iwai 194265
 #define PCI_DEVICE_ID_SEALEVEL_710xC		0x1001
Takashi Iwai 194265
 #define PCI_DEVICE_ID_SEALEVEL_720xC		0x1002
Takashi Iwai 194265
 #define PCI_DEVICE_ID_SEALEVEL_740xC		0x1004
Takashi Iwai 194265
@@ -829,6 +833,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
Takashi Iwai 194265
 		(kernel_ulong_t)&bd			\
Takashi Iwai 194265
 	}
Takashi Iwai 194265
 
Takashi Iwai 194265
+#define USR_DEVICE(devid, sdevid, bd) {			\
Takashi Iwai 194265
+	PCI_DEVICE_SUB(					\
Takashi Iwai 194265
+		PCI_VENDOR_ID_USR,			\
Takashi Iwai 194265
+		PCI_DEVICE_ID_EXAR_##devid,		\
Takashi Iwai 194265
+		PCI_VENDOR_ID_EXAR,			\
Takashi Iwai 194265
+		PCI_SUBDEVICE_ID_USR_##sdevid), 0, 0,	\
Takashi Iwai 194265
+		(kernel_ulong_t)&bd			\
Takashi Iwai 194265
+	}
Takashi Iwai 194265
+
Takashi Iwai 194265
 static const struct pci_device_id exar_pci_tbl[] = {
Takashi Iwai 194265
 	EXAR_DEVICE(ACCESSIO, COM_2S, pbn_exar_XR17C15x),
Takashi Iwai 194265
 	EXAR_DEVICE(ACCESSIO, COM_4S, pbn_exar_XR17C15x),
Takashi Iwai 194265
@@ -853,6 +866,10 @@ static const struct pci_device_id exar_pci_tbl[] = {
Takashi Iwai 194265
 
Takashi Iwai 194265
 	IBM_DEVICE(XR17C152, SATURN_SERIAL_ONE_PORT, pbn_exar_ibm_saturn),
Takashi Iwai 194265
 
Takashi Iwai 194265
+	/* USRobotics USR298x-OEM PCI Modems */
Takashi Iwai 194265
+	USR_DEVICE(XR17C152, 2980, pbn_exar_XR17C15x),
Takashi Iwai 194265
+	USR_DEVICE(XR17C152, 2981, pbn_exar_XR17C15x),
Takashi Iwai 194265
+
Takashi Iwai 194265
 	/* Exar Corp. XR17C15[248] Dual/Quad/Octal UART */
Takashi Iwai 194265
 	EXAR_DEVICE(EXAR, XR17C152, pbn_exar_XR17C15x),
Takashi Iwai 194265
 	EXAR_DEVICE(EXAR, XR17C154, pbn_exar_XR17C15x),
Takashi Iwai 194265
-- 
Takashi Iwai 194265
2.35.3
Takashi Iwai 194265