Skip to contentSkip to conversation

USB: serial: ftdi_sio: fix FTX sub-integer prescaler

PATCH In review Johan Hovold 1 participant 3 messages Jan 26, 2021

Subsystems (3)
lore
Share & tools
lore

Johan Hovold

author maintainer
#0 lore raw

PATCH 1/1 USB: serial: ftdi_sio: fix FTX sub-integer prescaler

The most-significant bit of the sub-integer-prescaler index is set in the high byte of the baudrate request wIndex also for FTX devices.

This fixes rates like 1152000 which got mapped to 12 MBd.

---
 drivers/usb/serial/ftdi_sio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +3 -2
index 94398f89e600..4168801b9595 100644
@@ -1386,8 +1386,9 @@ static int change_speed(struct tty_struct *tty, struct usb_serial_port *port)
 	index_value = get_ftdi_divisor(tty, port);
 	value = (u16)index_value;
 	index = (u16)(index_value >> 16);
-	if ((priv->chip_type == FT2232C) || (priv->chip_type == FT2232H) ||
-		(priv->chip_type == FT4232H) || (priv->chip_type == FT232H)) {
+	if (priv->chip_type == FT2232C || priv->chip_type == FT2232H ||
+			priv->chip_type == FT4232H || priv->chip_type == FT232H ||
+			priv->chip_type == FTX) {
 		/* Probably the BM type needs the MSB of the encoded fractional
 		 * divider also moved like for the chips above. Any infos? */
 		index = (u16)((index << 8) | priv->interface);
Signature · 1 line
2.26.2
author maintainer
#1 lore raw
Quoted 4 lines · Johan Hovold

The most-significant bit of the sub-integer-prescaler index is set in the high byte of the baudrate request wIndex also for FTX devices.

This fixes rates like 1152000 which got mapped to 12 MBd.

Hmm. I played around with this using an FT232H which has a 12 MHz clock so this example is off for FTX. I'll fix it up before applying.

Johan

author maintainer
#2 lore raw
Quoted 8 lines · Johan Hovold
Quoted 4 lines · Johan Hovold

The most-significant bit of the sub-integer-prescaler index is set in the high byte of the baudrate request wIndex also for FTX devices.

This fixes rates like 1152000 which got mapped to 12 MBd.

Hmm. I played around with this using an FT232H which has a 12 MHz clock so this example is off for FTX. I'll fix it up before applying.

Nope, false alarm, it still holds.

Johan