Re: [ftdi_sio] FT232H support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <1310393182.8617.16.camel@AlexS-PC> you wrote:
> Hello,

> We are currently working with a development module which contains a
> FT232H chip and communicates via UART with another chip at a baud rate
> of exactly 115200. After the last patch of the ftdi_sio driver we saw
> that, theoretically, the FT232H should be fully supported by the driver.
> But, when we tried to use it, it didn't work. 

> After digging further, we got to the 'get_ftdi_divisor()' function where
> the FT232H chip was placed on the same branch as FT2232H and FT4232H
> and, for a baud rate of 115200, 0xC068 was calculated as the divisor,
> when the correct value should have been 0x1A. The latter being confirmed
> by both the application note (AN120 from FTDI [1]) and the
> 'ftdi_set_baudrate()' in libftdi. On the other side, the
> 'ftdi_232bm_baud_to_divisor()', used for the FT232BM, FT2232C and
> FT232RL appears to also return the correct divisor for FT232H. 

> Basically, we have 2 issues that aren't really clear:
> 1) Is the FT232H placed in the correct branch when calculating the
> divisor?

If you look at the FT2232H/FT4232H datasheet and the FT232H datasheet in the
section
4.2 Functional Block Descriptions
...
(independant) Baud Rate Generators

you will find that the description is the same for all H-Type chips. So
taking the same branch should be fine.

However some bits of the setting got lost later. See the attached patch.

I would even tend to do 
 		urb_index = (__u16)((urb_index << 8) | priv->interface);
for all chips.

With the present code, the High bit of the fractional divider mask ends in
Bit 0 for AM, BM and in Bit 8 for 2232C and the H types. This sounds starnge
to me, as I expect no difference betwen BM and 2232C. I have no BM chip to
test hower, and as we talk about the fractional bit getting upset on the
AM/BM, this also only has small influence on the baudrate.

Comments welcome

-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>From 58adc484ebae7e4950250f04e3cf952451d37bdf Mon Sep 17 00:00:00 2001
From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Jul 2011 18:47:08 +0200
Subject: ftdi_sio: For the FT232H FTDI_SIO_SET_BAUDRATE_REQUEST, index needs to be shifted too

---
 drivers/usb/serial/ftdi_sio.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 2e06b90..a4a878c 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1205,8 +1205,13 @@ static int change_speed(struct tty_struct *tty, struct usb_serial_port *port)
 	urb_index_value = get_ftdi_divisor(tty, port);
 	urb_value = (__u16)urb_index_value;
 	urb_index = (__u16)(urb_index_value >> 16);
-	if (priv->interface) {	/* FT2232C */
+	switch (priv->chip_type) {
+	case FT2232C:
+	case FT2232H:
+	case FT4232H:
+	case FT232H:
 		urb_index = (__u16)((urb_index << 8) | priv->interface);
+		break;
 	}
 
 	rv = usb_control_msg(port->serial->dev,
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux