]> git.karo-electronics.de Git - linux-beck.git/commitdiff
USB: ftdi_sio: fix resolution of 2232H baud rate dividers
authorDaniel Glöckner <dg@emlix.com>
Mon, 10 Jan 2011 23:42:14 +0000 (00:42 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 23 Jan 2011 03:38:57 +0000 (19:38 -0800)
The 2232H high speed baud rates also support fractional baud
rate divisors, but when the performing the divisions before
the multiplication, the fractional bits are lost.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Acked-by: Mark Adamson <mark.adamson@ftdichip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ftdi_sio.c

index a2668d08926096f827de803289fa7029d7475671..71a0f99023bdfbdf5dd8ba5b9012d4a7939fb6fd 100644 (file)
@@ -955,7 +955,7 @@ static __u32 ftdi_2232h_baud_base_to_divisor(int baud, int base)
        int divisor3;
 
        /* hi-speed baud rate is 10-bit sampling instead of 16-bit */
-       divisor3 = (base / 10 / baud) * 8;
+       divisor3 = base * 8 / (baud * 10);
 
        divisor = divisor3 >> 3;
        divisor |= (__u32)divfrac[divisor3 & 0x7] << 14;