* [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling
@ 2025-11-10 11:12 Johan Hovold
2025-11-10 11:12 ` [PATCH 1/8] USB: serial: ftdi_sio: match on interface number for jtag Johan Hovold
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
A recent discussion about some JTAG devices made me revisit the ftdi_sio
quirk handling which could use a bit of cleanup.
Johan
Johan Hovold (8):
USB: serial: ftdi_sio: match on interface number for jtag
USB: serial: ftdi_sio: silence jtag probe
USB: serial: ftdi_sio: rewrite 8u2232c quirk
USB: serial: ftdi_sio: clean up quirk comments
USB: serial: ftdi_sio: rename quirk symbols
USB: serial: ftdi_sio: enable NDI speed hack consistently
USB: serial: ftdi_sio: clean up NDI speed hack
USB: serial: ftdi_sio: drop NDI quirk module parameter
drivers/usb/serial/ftdi_sio.c | 200 ++++++++++++----------------------
1 file changed, 68 insertions(+), 132 deletions(-)
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/8] USB: serial: ftdi_sio: match on interface number for jtag
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 2/8] USB: serial: ftdi_sio: silence jtag probe Johan Hovold
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel, stable
Some FTDI devices have the first port reserved for JTAG and have been
using a dedicated quirk to prevent binding to it.
As can be inferred directly or indirectly from the commit messages,
almost all of these devices are dual port devices which means that the
more recently added macro for matching on interface number can be used
instead (and some such devices do so already).
This avoids probing interfaces that will never be bound and cleans up
the match table somewhat.
Note that the JTAG quirk is kept for quad port devices, which would
otherwise require three match entries.
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 72 ++++++++++++-----------------------
1 file changed, 24 insertions(+), 48 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b37fa31f5694..9993a5123344 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -628,10 +628,8 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
- { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_TIAO_UMPA_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_NT_ORIONLXM_PID, 1) },
{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) },
@@ -842,24 +840,17 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) },
- { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, CYBER_CORTEX_AV_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_PID, 1) },
{ USB_DEVICE_INTERFACE_NUMBER(OLIMEX_VID, OLIMEX_ARM_USB_TINY_H_PID, 1) },
- { USB_DEVICE(FIC_VID, FIC_NEO1973_DEBUG_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, FTDI_OOCDLINK_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, LMI_LM3S_ICDI_BOARD_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FIC_VID, FIC_NEO1973_DEBUG_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_OOCDLINK_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, LMI_LM3S_ICDI_BOARD_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_TURTELIZER_PID, 1) },
{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) },
{ USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
@@ -901,17 +892,14 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(ATMEL_VID, STK541_PID) },
{ USB_DEVICE(DE_VID, STB_PID) },
{ USB_DEVICE(DE_VID, WHT_PID) },
- { USB_DEVICE(ADI_VID, ADI_GNICE_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(ADI_VID, ADI_GNICE_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(ADI_VID, ADI_GNICEPLUS_PID, 1) },
{ USB_DEVICE_AND_INTERFACE_INFO(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID,
USB_CLASS_VENDOR_SPEC,
USB_SUBCLASS_VENDOR_SPEC, 0x00) },
{ USB_DEVICE_INTERFACE_NUMBER(ACTEL_VID, MICROSEMI_ARROW_SF2PLUS_BOARD_PID, 2) },
{ USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
- { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(MARVELL_VID, MARVELL_SHEEVAPLUG_PID, 1) },
{ USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
{ USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
{ USB_DEVICE(FTDI_VID, PI_C865_PID) },
@@ -934,10 +922,8 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(PI_VID, PI_1016_PID) },
{ USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
{ USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
- { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, TI_XDS100V2_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, MARVELL_OPENRD_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, TI_XDS100V2_PID, 1) },
{ USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
{ USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
{ USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
@@ -946,18 +932,14 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
{ USB_DEVICE(FTDI_VID, MJSG_HD_RADIO_PID) },
{ USB_DEVICE(FTDI_VID, MJSG_XM_RADIO_PID) },
- { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_ST_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, XVERVE_SIGNALYZER_ST_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, XVERVE_SIGNALYZER_SLITE_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, XVERVE_SIGNALYZER_SH2_PID, 1) },
{ USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
{ USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
{ USB_DEVICE(FTDI_VID, ACCESIO_COM4SM_PID) },
- { USB_DEVICE(IONICS_VID, IONICS_PLUGCOMPUTER_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(IONICS_VID, IONICS_PLUGCOMPUTER_PID, 1) },
{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_24_MASTER_WING_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_PC_WING_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_CHAMSYS_USB_DMX_PID) },
@@ -972,15 +954,12 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_FHE_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
- { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(ST_VID, ST_STMCLT_2232_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(ST_VID, ST_STMCLT_2232_PID, 1) },
{ USB_DEVICE(ST_VID, ST_STMCLT_4232_PID),
.driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_RF_R106) },
- { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID, 1) },
{ USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) },
/* Crucible Devices */
{ USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) },
@@ -1055,8 +1034,7 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7561U_PID) },
{ USB_DEVICE(ICPDAS_VID, ICPDAS_I7563U_PID) },
{ USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
- { USB_DEVICE(TI_VID, TI_CC3200_LAUNCHPAD_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(TI_VID, TI_CC3200_LAUNCHPAD_PID, 1) },
{ USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) },
{ USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) },
{ USB_DEVICE(AIRBUS_DS_VID, AIRBUS_DS_P8GR) },
@@ -1076,10 +1054,8 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) },
{ USB_DEVICE_INTERFACE_NUMBER(UBLOX_VID, UBLOX_EVK_M101_PID, 2) },
/* FreeCalypso USB adapters */
- { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_BUF_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
- { USB_DEVICE(FTDI_VID, FTDI_FALCONIA_JTAG_UNBUF_PID),
- .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_FALCONIA_JTAG_BUF_PID, 1) },
+ { USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_FALCONIA_JTAG_UNBUF_PID, 1) },
/* GMC devices */
{ USB_DEVICE(GMC_VID, GMC_Z216C_PID) },
/* Altera USB Blaster 3 */
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/8] USB: serial: ftdi_sio: silence jtag probe
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
2025-11-10 11:12 ` [PATCH 1/8] USB: serial: ftdi_sio: match on interface number for jtag Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 3/8] USB: serial: ftdi_sio: rewrite 8u2232c quirk Johan Hovold
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
Probe of a device should generally be silent unless errors are
encountered.
Stop logging that the JTAG port is ignored when probing devices with
such a reserved port.
This also maintains consistency with devices that match on interface
number to avoid binding to reserved ports.
Note that the message is not even correct for the second port of the ST
Micro Connect Lite.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 9993a5123344..a9d3451cd628 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2295,10 +2295,8 @@ static int ftdi_jtag_probe(struct usb_serial *serial)
struct usb_interface *intf = serial->interface;
int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
- if (ifnum == 0) {
- dev_info(&intf->dev, "Ignoring interface reserved for JTAG\n");
+ if (ifnum == 0)
return -ENODEV;
- }
return 0;
}
@@ -2331,10 +2329,8 @@ static int ftdi_stmclite_probe(struct usb_serial *serial)
struct usb_interface *intf = serial->interface;
int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
- if (ifnum < 2) {
- dev_info(&intf->dev, "Ignoring interface reserved for JTAG\n");
+ if (ifnum < 2)
return -ENODEV;
- }
return 0;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/8] USB: serial: ftdi_sio: rewrite 8u2232c quirk
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
2025-11-10 11:12 ` [PATCH 1/8] USB: serial: ftdi_sio: match on interface number for jtag Johan Hovold
2025-11-10 11:12 ` [PATCH 2/8] USB: serial: ftdi_sio: silence jtag probe Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 4/8] USB: serial: ftdi_sio: clean up quirk comments Johan Hovold
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
Rewrite the 8u2232c quirk to avoid the manufacturer and product string
comparisons for the second port which will always be bound.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index a9d3451cd628..dd03d9458441 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2303,16 +2303,21 @@ static int ftdi_jtag_probe(struct usb_serial *serial)
static int ftdi_8u2232c_probe(struct usb_serial *serial)
{
+ struct usb_interface *intf = serial->interface;
struct usb_device *udev = serial->dev;
+ int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
- if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems"))
- return ftdi_jtag_probe(serial);
+ if (ifnum == 0) {
+ if (udev->manufacturer &&
+ !strcmp(udev->manufacturer, "CALAO Systems"))
+ return -ENODEV;
- if (udev->product &&
- (!strcmp(udev->product, "Arrow USB Blaster") ||
- !strcmp(udev->product, "BeagleBone/XDS100V2") ||
- !strcmp(udev->product, "SNAP Connect E10")))
- return ftdi_jtag_probe(serial);
+ if (udev->product &&
+ (!strcmp(udev->product, "Arrow USB Blaster") ||
+ !strcmp(udev->product, "BeagleBone/XDS100V2") ||
+ !strcmp(udev->product, "SNAP Connect E10")))
+ return -ENODEV;
+ }
return 0;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/8] USB: serial: ftdi_sio: clean up quirk comments
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
` (2 preceding siblings ...)
2025-11-10 11:12 ` [PATCH 3/8] USB: serial: ftdi_sio: rewrite 8u2232c quirk Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 5/8] USB: serial: ftdi_sio: rename quirk symbols Johan Hovold
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
Clean up the quirk function comments that were using odd formatting and
were referring to a non-existing function.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index dd03d9458441..75f354ef6095 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2231,9 +2231,10 @@ static int ftdi_port_probe(struct usb_serial_port *port)
return result;
}
-/* Setup for the USB-UIRT device, which requires hardwired
- * baudrate (38400 gets mapped to 312500) */
-/* Called from usbserial:serial_probe */
+/*
+ * Setup for the USB-UIRT device, which requires hardwired baudrate
+ * (38400 gets mapped to 312500).
+ */
static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
{
priv->flags |= ASYNC_SPD_CUST;
@@ -2241,9 +2242,10 @@ static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
priv->force_baud = 38400;
}
-/* Setup for the HE-TIRA1 device, which requires hardwired
- * baudrate (38400 gets mapped to 100000) and RTS-CTS enabled. */
-
+/*
+ * Setup for the HE-TIRA1 device, which requires hardwired baudrate
+ * (38400 gets mapped to 100000) and RTS-CTS enabled.
+ */
static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
{
priv->flags |= ASYNC_SPD_CUST;
@@ -2259,10 +2261,9 @@ static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
*/
static int ndi_latency_timer = 1;
-/* Setup for the NDI FTDI-based USB devices, which requires hardwired
+/*
+ * Setup for the NDI FTDI-based USB devices, which requires hardwired
* baudrate (19200 gets mapped to 1200000).
- *
- * Called from usbserial:serial_probe.
*/
static int ftdi_NDI_device_setup(struct usb_serial *serial)
{
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/8] USB: serial: ftdi_sio: rename quirk symbols
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
` (3 preceding siblings ...)
2025-11-10 11:12 ` [PATCH 4/8] USB: serial: ftdi_sio: clean up quirk comments Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 6/8] USB: serial: ftdi_sio: enable NDI speed hack consistently Johan Hovold
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
Use lower case names for the quirk symbols and rename the NDI quirk
probe function for consistency.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 40 +++++++++++++++++------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 75f354ef6095..d583b39b64cc 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -107,26 +107,26 @@ struct ftdi_quirk {
};
static int ftdi_jtag_probe(struct usb_serial *serial);
-static int ftdi_NDI_device_setup(struct usb_serial *serial);
+static int ftdi_ndi_probe(struct usb_serial *serial);
static int ftdi_stmclite_probe(struct usb_serial *serial);
static int ftdi_8u2232c_probe(struct usb_serial *serial);
-static void ftdi_USB_UIRT_setup(struct ftdi_private *priv);
-static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv);
+static void ftdi_usb_uirt_setup(struct ftdi_private *priv);
+static void ftdi_he_tira1_setup(struct ftdi_private *priv);
static const struct ftdi_quirk ftdi_jtag_quirk = {
.probe = ftdi_jtag_probe,
};
-static const struct ftdi_quirk ftdi_NDI_device_quirk = {
- .probe = ftdi_NDI_device_setup,
+static const struct ftdi_quirk ftdi_ndi_quirk = {
+ .probe = ftdi_ndi_probe,
};
-static const struct ftdi_quirk ftdi_USB_UIRT_quirk = {
- .port_probe = ftdi_USB_UIRT_setup,
+static const struct ftdi_quirk ftdi_usb_uirt_quirk = {
+ .port_probe = ftdi_usb_uirt_setup,
};
-static const struct ftdi_quirk ftdi_HE_TIRA1_quirk = {
- .port_probe = ftdi_HE_TIRA1_setup,
+static const struct ftdi_quirk ftdi_he_tira1_quirk = {
+ .port_probe = ftdi_he_tira1_setup,
};
static const struct ftdi_quirk ftdi_stmclite_quirk = {
@@ -590,9 +590,9 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(OCT_VID, OCT_US101_PID) },
{ USB_DEVICE(OCT_VID, OCT_DK201_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID),
- .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_he_tira1_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID),
- .driver_info = (kernel_ulong_t)&ftdi_USB_UIRT_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_usb_uirt_quirk },
{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_1) },
{ USB_DEVICE(FTDI_VID, PROTEGO_R2X0) },
{ USB_DEVICE(FTDI_VID, PROTEGO_SPECIAL_3) },
@@ -792,17 +792,17 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) },
{ USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID),
- .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_ndi_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_NDI_SPECTRA_SCU_PID),
- .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_ndi_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_2_PID),
- .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_ndi_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_3_PID),
- .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_ndi_quirk },
{ USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID),
- .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_ndi_quirk },
{ USB_DEVICE(FTDI_NDI_VID, FTDI_NDI_EMGUIDE_GEMINI_PID),
- .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
+ .driver_info = (kernel_ulong_t)&ftdi_ndi_quirk },
{ USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
{ USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) },
{ USB_DEVICE(FTDI_VID, RTSYSTEMS_USB_VX8_PID) },
@@ -2235,7 +2235,7 @@ static int ftdi_port_probe(struct usb_serial_port *port)
* Setup for the USB-UIRT device, which requires hardwired baudrate
* (38400 gets mapped to 312500).
*/
-static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
+static void ftdi_usb_uirt_setup(struct ftdi_private *priv)
{
priv->flags |= ASYNC_SPD_CUST;
priv->custom_divisor = 77;
@@ -2246,7 +2246,7 @@ static void ftdi_USB_UIRT_setup(struct ftdi_private *priv)
* Setup for the HE-TIRA1 device, which requires hardwired baudrate
* (38400 gets mapped to 100000) and RTS-CTS enabled.
*/
-static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv)
+static void ftdi_he_tira1_setup(struct ftdi_private *priv)
{
priv->flags |= ASYNC_SPD_CUST;
priv->custom_divisor = 240;
@@ -2265,7 +2265,7 @@ static int ndi_latency_timer = 1;
* Setup for the NDI FTDI-based USB devices, which requires hardwired
* baudrate (19200 gets mapped to 1200000).
*/
-static int ftdi_NDI_device_setup(struct usb_serial *serial)
+static int ftdi_ndi_probe(struct usb_serial *serial)
{
struct usb_device *udev = serial->dev;
int latency = ndi_latency_timer;
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/8] USB: serial: ftdi_sio: enable NDI speed hack consistently
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
` (4 preceding siblings ...)
2025-11-10 11:12 ` [PATCH 5/8] USB: serial: ftdi_sio: rename quirk symbols Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 7/8] USB: serial: ftdi_sio: clean up NDI speed hack Johan Hovold
2025-11-10 11:12 ` [PATCH 8/8] USB: serial: ftdi_sio: drop NDI quirk module parameter Johan Hovold
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
The original submission adding support for NDI EMGUIDE Gemini enabled
the existing NDI speed hack which remaps the 19200 line speed to 1.2
Mbps, but this silently fell out during resubmission.
Enable the speed hack also for the new NDI product for consistency. This
will also allow for cleaning up the implementation without resorting to
overengineering.
Link: https://lore.kernel.org/all/YQXPR01MB49870CB7B3075ADDF88A3FD4DF43A@YQXPR01MB4987.CANPRD01.PROD.OUTLOOK.COM/
Link: https://lore.kernel.org/all/YQXPR01MB4987F1E0DA41E689779E6958DF48A@YQXPR01MB4987.CANPRD01.PROD.OUTLOOK.COM/
Cc: Ryan Mann <rmann@ndigital.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index d583b39b64cc..f5786689697c 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1312,7 +1312,8 @@ static u32 get_ftdi_divisor(struct tty_struct *tty,
(product_id == FTDI_NDI_SPECTRA_SCU_PID) ||
(product_id == FTDI_NDI_FUTURE_2_PID) ||
(product_id == FTDI_NDI_FUTURE_3_PID) ||
- (product_id == FTDI_NDI_AURORA_SCU_PID)) &&
+ (product_id == FTDI_NDI_AURORA_SCU_PID) ||
+ (product_id == FTDI_NDI_EMGUIDE_GEMINI_PID)) &&
(baud == 19200)) {
baud = 1200000;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/8] USB: serial: ftdi_sio: clean up NDI speed hack
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
` (5 preceding siblings ...)
2025-11-10 11:12 ` [PATCH 6/8] USB: serial: ftdi_sio: enable NDI speed hack consistently Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
2025-11-10 11:12 ` [PATCH 8/8] USB: serial: ftdi_sio: drop NDI quirk module parameter Johan Hovold
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
NDI devices remap the 19200 line speed to 1.2 Mbps.
Use the quirk pointer from the match table to enable the quirk instead
of comparing PIDs on every speed change.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index f5786689697c..26f1260ff995 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1247,6 +1247,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
static u32 get_ftdi_divisor(struct tty_struct *tty,
struct usb_serial_port *port)
{
+ const struct ftdi_quirk *quirk = usb_get_serial_data(port->serial);
struct ftdi_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
u32 div_value = 0;
@@ -1306,17 +1307,8 @@ static u32 get_ftdi_divisor(struct tty_struct *tty,
case FT232R:
case FTX:
if (baud <= 3000000) {
- u16 product_id = le16_to_cpu(
- port->serial->dev->descriptor.idProduct);
- if (((product_id == FTDI_NDI_HUC_PID) ||
- (product_id == FTDI_NDI_SPECTRA_SCU_PID) ||
- (product_id == FTDI_NDI_FUTURE_2_PID) ||
- (product_id == FTDI_NDI_FUTURE_3_PID) ||
- (product_id == FTDI_NDI_AURORA_SCU_PID) ||
- (product_id == FTDI_NDI_EMGUIDE_GEMINI_PID)) &&
- (baud == 19200)) {
+ if (quirk == &ftdi_ndi_quirk && baud == 19200)
baud = 1200000;
- }
div_value = ftdi_232bm_baud_to_divisor(baud);
} else {
dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 8/8] USB: serial: ftdi_sio: drop NDI quirk module parameter
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
` (6 preceding siblings ...)
2025-11-10 11:12 ` [PATCH 7/8] USB: serial: ftdi_sio: clean up NDI speed hack Johan Hovold
@ 2025-11-10 11:12 ` Johan Hovold
7 siblings, 0 replies; 9+ messages in thread
From: Johan Hovold @ 2025-11-10 11:12 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Ryan Mann, Andreas Messer, linux-usb,
linux-kernel
NDI devices have been using a latency timer of 1 ms since commit
b760dac290c3 ("USB: ftdi: support NDI devices"), which also added a
vendor specific module parameter that could be used to override the
default value for these devices.
Module parameters should generally be avoided as they apply to all
devices managed by a driver and vendor specific hacks should be kept out
of mainline.
Drop the module parameter in favour of the generic sysfs interface for
setting the latency timer (e.g. using udev rules) while keeping the
default 1 ms timer for NDI devices.
Note that there seems to be no (correct) public references to the module
parameter and most likely no one is using it.
Cc: Ryan Mann <rmann@ndigital.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/ftdi_sio.c | 41 +++--------------------------------
1 file changed, 3 insertions(+), 38 deletions(-)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 26f1260ff995..fe2f21d85737 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -107,7 +107,6 @@ struct ftdi_quirk {
};
static int ftdi_jtag_probe(struct usb_serial *serial);
-static int ftdi_ndi_probe(struct usb_serial *serial);
static int ftdi_stmclite_probe(struct usb_serial *serial);
static int ftdi_8u2232c_probe(struct usb_serial *serial);
static void ftdi_usb_uirt_setup(struct ftdi_private *priv);
@@ -118,7 +117,6 @@ static const struct ftdi_quirk ftdi_jtag_quirk = {
};
static const struct ftdi_quirk ftdi_ndi_quirk = {
- .probe = ftdi_ndi_probe,
};
static const struct ftdi_quirk ftdi_usb_uirt_quirk = {
@@ -2205,7 +2203,9 @@ static int ftdi_port_probe(struct usb_serial_port *port)
goto err_free;
ftdi_set_max_packet_size(port);
- if (read_latency_timer(port) < 0)
+ if (quirk == &ftdi_ndi_quirk)
+ priv->latency = 1;
+ else if (read_latency_timer(port) < 0)
priv->latency = 16;
write_latency_timer(port);
@@ -2247,38 +2247,6 @@ static void ftdi_he_tira1_setup(struct ftdi_private *priv)
priv->force_rtscts = 1;
}
-/*
- * Module parameter to control latency timer for NDI FTDI-based USB devices.
- * If this value is not set in /etc/modprobe.d/ its value will be set
- * to 1ms.
- */
-static int ndi_latency_timer = 1;
-
-/*
- * Setup for the NDI FTDI-based USB devices, which requires hardwired
- * baudrate (19200 gets mapped to 1200000).
- */
-static int ftdi_ndi_probe(struct usb_serial *serial)
-{
- struct usb_device *udev = serial->dev;
- int latency = ndi_latency_timer;
-
- if (latency == 0)
- latency = 1;
- if (latency > 99)
- latency = 99;
-
- dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
- dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
-
- /* FIXME: errors are not returned */
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- FTDI_SIO_SET_LATENCY_TIMER_REQUEST,
- FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE,
- latency, 0, NULL, 0, WDR_TIMEOUT);
- return 0;
-}
-
/*
* First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko
* Neo1973 Debug Board is reserved for JTAG interface and can be accessed from
@@ -2906,6 +2874,3 @@ module_usb_serial_driver(serial_drivers, id_table_combined);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
-
-module_param(ndi_latency_timer, int, 0644);
-MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override");
--
2.51.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-10 11:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 11:12 [PATCH 0/8] USB: serial: ftdi_sio: clean up quirk handling Johan Hovold
2025-11-10 11:12 ` [PATCH 1/8] USB: serial: ftdi_sio: match on interface number for jtag Johan Hovold
2025-11-10 11:12 ` [PATCH 2/8] USB: serial: ftdi_sio: silence jtag probe Johan Hovold
2025-11-10 11:12 ` [PATCH 3/8] USB: serial: ftdi_sio: rewrite 8u2232c quirk Johan Hovold
2025-11-10 11:12 ` [PATCH 4/8] USB: serial: ftdi_sio: clean up quirk comments Johan Hovold
2025-11-10 11:12 ` [PATCH 5/8] USB: serial: ftdi_sio: rename quirk symbols Johan Hovold
2025-11-10 11:12 ` [PATCH 6/8] USB: serial: ftdi_sio: enable NDI speed hack consistently Johan Hovold
2025-11-10 11:12 ` [PATCH 7/8] USB: serial: ftdi_sio: clean up NDI speed hack Johan Hovold
2025-11-10 11:12 ` [PATCH 8/8] USB: serial: ftdi_sio: drop NDI quirk module parameter Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).