All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: serial: ftdi_sio: fix FTX sub-integer prescaler
@ 2021-01-26 13:59 Johan Hovold
  2021-01-26 14:11 ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2021-01-26 13:59 UTC (permalink / raw)
  To: linux-usb; +Cc: Johan Hovold, Vladimir, stable

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.

Reported-by: Vladimir <svv75@mail.ru>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=210351
Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/ftdi_sio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 94398f89e600..4168801b9595 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] USB: serial: ftdi_sio: fix FTX sub-integer prescaler
  2021-01-26 13:59 [PATCH] USB: serial: ftdi_sio: fix FTX sub-integer prescaler Johan Hovold
@ 2021-01-26 14:11 ` Johan Hovold
  2021-01-26 14:22   ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2021-01-26 14:11 UTC (permalink / raw)
  To: linux-usb; +Cc: Johan Hovold, Vladimir, stable

On Tue, Jan 26, 2021 at 02:59:17PM +0100, Johan Hovold wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] USB: serial: ftdi_sio: fix FTX sub-integer prescaler
  2021-01-26 14:11 ` Johan Hovold
@ 2021-01-26 14:22   ` Johan Hovold
  0 siblings, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2021-01-26 14:22 UTC (permalink / raw)
  To: linux-usb; +Cc: Johan Hovold, Vladimir, stable

On Tue, Jan 26, 2021 at 03:11:15PM +0100, Johan Hovold wrote:
> On Tue, Jan 26, 2021 at 02:59:17PM +0100, Johan Hovold wrote:
> > 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-26 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 13:59 [PATCH] USB: serial: ftdi_sio: fix FTX sub-integer prescaler Johan Hovold
2021-01-26 14:11 ` Johan Hovold
2021-01-26 14:22   ` Johan Hovold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.