xref: /openbmc/linux/drivers/usb/serial/ftdi_sio.h (revision b868a02e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Driver definitions for the FTDI USB Single Port Serial Converter -
4  * known as FTDI_SIO (Serial Input/Output application of the chipset)
5  *
6  * For USB vendor/product IDs (VID/PID), please see ftdi_sio_ids.h
7  *
8  *
9  * The example I have is known as the USC-1000 which is available from
10  * http://www.dse.co.nz - cat no XH4214 It looks similar to this:
11  * http://www.dansdata.com/usbser.htm but I can't be sure There are other
12  * USC-1000s which don't look like my device though so beware!
13  *
14  * The device is based on the FTDI FT8U100AX chip. It has a DB25 on one side,
15  * USB on the other.
16  *
17  * Thanx to FTDI (http://www.ftdichip.com) for so kindly providing details
18  * of the protocol required to talk to the device and ongoing assistence
19  * during development.
20  *
21  * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the
22  * FTDI_SIO implementation.
23  *
24  */
25 
26 /* Commands */
27 #define FTDI_SIO_RESET			0 /* Reset the port */
28 #define FTDI_SIO_MODEM_CTRL		1 /* Set the modem control register */
29 #define FTDI_SIO_SET_FLOW_CTRL		2 /* Set flow control register */
30 #define FTDI_SIO_SET_BAUD_RATE		3 /* Set baud rate */
31 #define FTDI_SIO_SET_DATA		4 /* Set the data characteristics of
32 					     the port */
33 #define FTDI_SIO_GET_MODEM_STATUS	5 /* Retrieve current value of modem
34 					     status register */
35 #define FTDI_SIO_SET_EVENT_CHAR		6 /* Set the event character */
36 #define FTDI_SIO_SET_ERROR_CHAR		7 /* Set the error character */
37 #define FTDI_SIO_SET_LATENCY_TIMER	9 /* Set the latency timer */
38 #define FTDI_SIO_GET_LATENCY_TIMER	0x0a /* Get the latency timer */
39 #define FTDI_SIO_SET_BITMODE		0x0b /* Set bitbang mode */
40 #define FTDI_SIO_READ_PINS		0x0c /* Read immediate value of pins */
41 #define FTDI_SIO_READ_EEPROM		0x90 /* Read EEPROM */
42 
43 /* Channel indices for FT2232, FT2232H and FT4232H devices */
44 #define CHANNEL_A		1
45 #define CHANNEL_B		2
46 #define CHANNEL_C		3
47 #define CHANNEL_D		4
48 
49 
50 /*
51  *   BmRequestType:  1100 0000b
52  *   bRequest:       FTDI_E2_READ
53  *   wValue:         0
54  *   wIndex:         Address of word to read
55  *   wLength:        2
56  *   Data:           Will return a word of data from E2Address
57  *
58  */
59 
60 /* Port Identifier Table */
61 #define PIT_DEFAULT		0 /* SIOA */
62 #define PIT_SIOA		1 /* SIOA */
63 /* The device this driver is tested with one has only one port */
64 #define PIT_SIOB		2 /* SIOB */
65 #define PIT_PARALLEL		3 /* Parallel */
66 
67 /* FTDI_SIO_RESET */
68 #define FTDI_SIO_RESET_REQUEST FTDI_SIO_RESET
69 #define FTDI_SIO_RESET_REQUEST_TYPE 0x40
70 #define FTDI_SIO_RESET_SIO 0
71 #define FTDI_SIO_RESET_PURGE_RX 1
72 #define FTDI_SIO_RESET_PURGE_TX 2
73 
74 /*
75  * BmRequestType:  0100 0000B
76  * bRequest:       FTDI_SIO_RESET
77  * wValue:         Control Value
78  *                   0 = Reset SIO
79  *                   1 = Purge RX buffer
80  *                   2 = Purge TX buffer
81  * wIndex:         Port
82  * wLength:        0
83  * Data:           None
84  *
85  * The Reset SIO command has this effect:
86  *
87  *    Sets flow control set to 'none'
88  *    Event char = $0D
89  *    Event trigger = disabled
90  *    Purge RX buffer
91  *    Purge TX buffer
92  *    Clear DTR
93  *    Clear RTS
94  *    baud and data format not reset
95  *
96  * The Purge RX and TX buffer commands affect nothing except the buffers
97  *
98    */
99 
100 /* FTDI_SIO_SET_BAUDRATE */
101 #define FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE 0x40
102 #define FTDI_SIO_SET_BAUDRATE_REQUEST 3
103 
104 /*
105  * BmRequestType:  0100 0000B
106  * bRequest:       FTDI_SIO_SET_BAUDRATE
107  * wValue:         BaudDivisor value - see below
108  * wIndex:         Port
109  * wLength:        0
110  * Data:           None
111  * The BaudDivisor values are calculated as follows:
112  * - BaseClock is either 12000000 or 48000000 depending on the device.
113  *   FIXME: I wish I knew how to detect old chips to select proper base clock!
114  * - BaudDivisor is a fixed point number encoded in a funny way.
115  *   (--WRONG WAY OF THINKING--)
116  *   BaudDivisor is a fixed point number encoded with following bit weighs:
117  *   (-2)(-1)(13..0). It is a radical with a denominator of 4, so values
118  *   end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...).
119  *   (--THE REALITY--)
120  *   The both-bits-set has quite different meaning from 0.75 - the chip
121  *   designers have decided it to mean 0.125 instead of 0.75.
122  *   This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates
123  *   and Flow Control Consideration for USB to RS232".
124  * - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should
125  *   automagically re-encode the resulting value to take fractions into
126  *   consideration.
127  * As all values are integers, some bit twiddling is in order:
128  *   BaudDivisor = (BaseClock / 16 / BaudRate) |
129  *   (((BaseClock / 2 / BaudRate) & 4) ? 0x4000    // 0.5
130  *    : ((BaseClock / 2 / BaudRate) & 2) ? 0x8000  // 0.25
131  *    : ((BaseClock / 2 / BaudRate) & 1) ? 0xc000  // 0.125
132  *    : 0)
133  *
134  * For the FT232BM, a 17th divisor bit was introduced to encode the multiples
135  * of 0.125 missing from the FT8U232AM.  Bits 16 to 14 are coded as follows
136  * (the first four codes are the same as for the FT8U232AM, where bit 16 is
137  * always 0):
138  *   000 - add .000 to divisor
139  *   001 - add .500 to divisor
140  *   010 - add .250 to divisor
141  *   011 - add .125 to divisor
142  *   100 - add .375 to divisor
143  *   101 - add .625 to divisor
144  *   110 - add .750 to divisor
145  *   111 - add .875 to divisor
146  * Bits 15 to 0 of the 17-bit divisor are placed in the urb value.  Bit 16 is
147  * placed in bit 0 of the urb index.
148  *
149  * Note that there are a couple of special cases to support the highest baud
150  * rates.  If the calculated divisor value is 1, this needs to be replaced with
151  * 0.  Additionally for the FT232BM, if the calculated divisor value is 0x4001
152  * (1.5), this needs to be replaced with 0x0001 (1) (but this divisor value is
153  * not supported by the FT8U232AM).
154  */
155 
156 enum ftdi_sio_baudrate {
157 	ftdi_sio_b300 = 0,
158 	ftdi_sio_b600 = 1,
159 	ftdi_sio_b1200 = 2,
160 	ftdi_sio_b2400 = 3,
161 	ftdi_sio_b4800 = 4,
162 	ftdi_sio_b9600 = 5,
163 	ftdi_sio_b19200 = 6,
164 	ftdi_sio_b38400 = 7,
165 	ftdi_sio_b57600 = 8,
166 	ftdi_sio_b115200 = 9
167 };
168 
169 /*
170  * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor
171  * values are calculated internally.
172  */
173 #define FTDI_SIO_SET_DATA_REQUEST	FTDI_SIO_SET_DATA
174 #define FTDI_SIO_SET_DATA_REQUEST_TYPE	0x40
175 #define FTDI_SIO_SET_DATA_PARITY_NONE	(0x0 << 8)
176 #define FTDI_SIO_SET_DATA_PARITY_ODD	(0x1 << 8)
177 #define FTDI_SIO_SET_DATA_PARITY_EVEN	(0x2 << 8)
178 #define FTDI_SIO_SET_DATA_PARITY_MARK	(0x3 << 8)
179 #define FTDI_SIO_SET_DATA_PARITY_SPACE	(0x4 << 8)
180 #define FTDI_SIO_SET_DATA_STOP_BITS_1	(0x0 << 11)
181 #define FTDI_SIO_SET_DATA_STOP_BITS_15	(0x1 << 11)
182 #define FTDI_SIO_SET_DATA_STOP_BITS_2	(0x2 << 11)
183 #define FTDI_SIO_SET_BREAK		(0x1 << 14)
184 /* FTDI_SIO_SET_DATA */
185 
186 /*
187  * BmRequestType:  0100 0000B
188  * bRequest:       FTDI_SIO_SET_DATA
189  * wValue:         Data characteristics (see below)
190  * wIndex:         Port
191  * wLength:        0
192  * Data:           No
193  *
194  * Data characteristics
195  *
196  *   B0..7   Number of data bits
197  *   B8..10  Parity
198  *           0 = None
199  *           1 = Odd
200  *           2 = Even
201  *           3 = Mark
202  *           4 = Space
203  *   B11..13 Stop Bits
204  *           0 = 1
205  *           1 = 1.5
206  *           2 = 2
207  *   B14
208  *           1 = TX ON (break)
209  *           0 = TX OFF (normal state)
210  *   B15 Reserved
211  *
212  */
213 
214 
215 
216 /* FTDI_SIO_MODEM_CTRL */
217 #define FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE 0x40
218 #define FTDI_SIO_SET_MODEM_CTRL_REQUEST FTDI_SIO_MODEM_CTRL
219 
220 /*
221  * BmRequestType:   0100 0000B
222  * bRequest:        FTDI_SIO_MODEM_CTRL
223  * wValue:          ControlValue (see below)
224  * wIndex:          Port
225  * wLength:         0
226  * Data:            None
227  *
228  * NOTE: If the device is in RTS/CTS flow control, the RTS set by this
229  * command will be IGNORED without an error being returned
230  * Also - you can not set DTR and RTS with one control message
231  */
232 
233 #define FTDI_SIO_SET_DTR_MASK 0x1
234 #define FTDI_SIO_SET_DTR_HIGH ((FTDI_SIO_SET_DTR_MASK  << 8) | 1)
235 #define FTDI_SIO_SET_DTR_LOW  ((FTDI_SIO_SET_DTR_MASK  << 8) | 0)
236 #define FTDI_SIO_SET_RTS_MASK 0x2
237 #define FTDI_SIO_SET_RTS_HIGH ((FTDI_SIO_SET_RTS_MASK << 8) | 2)
238 #define FTDI_SIO_SET_RTS_LOW  ((FTDI_SIO_SET_RTS_MASK << 8) | 0)
239 
240 /*
241  * ControlValue
242  * B0    DTR state
243  *          0 = reset
244  *          1 = set
245  * B1    RTS state
246  *          0 = reset
247  *          1 = set
248  * B2..7 Reserved
249  * B8    DTR state enable
250  *          0 = ignore
251  *          1 = use DTR state
252  * B9    RTS state enable
253  *          0 = ignore
254  *          1 = use RTS state
255  * B10..15 Reserved
256  */
257 
258 /* FTDI_SIO_SET_FLOW_CTRL */
259 #define FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE 0x40
260 #define FTDI_SIO_SET_FLOW_CTRL_REQUEST FTDI_SIO_SET_FLOW_CTRL
261 #define FTDI_SIO_DISABLE_FLOW_CTRL 0x0
262 #define FTDI_SIO_RTS_CTS_HS (0x1 << 8)
263 #define FTDI_SIO_DTR_DSR_HS (0x2 << 8)
264 #define FTDI_SIO_XON_XOFF_HS (0x4 << 8)
265 /*
266  *   BmRequestType:  0100 0000b
267  *   bRequest:       FTDI_SIO_SET_FLOW_CTRL
268  *   wValue:         Xoff/Xon
269  *   wIndex:         Protocol/Port - hIndex is protocol / lIndex is port
270  *   wLength:        0
271  *   Data:           None
272  *
273  * hIndex protocol is:
274  *   B0 Output handshaking using RTS/CTS
275  *       0 = disabled
276  *       1 = enabled
277  *   B1 Output handshaking using DTR/DSR
278  *       0 = disabled
279  *       1 = enabled
280  *   B2 Xon/Xoff handshaking
281  *       0 = disabled
282  *       1 = enabled
283  *
284  * A value of zero in the hIndex field disables handshaking
285  *
286  * If Xon/Xoff handshaking is specified, the hValue field should contain the
287  * XOFF character and the lValue field contains the XON character.
288  */
289 
290 /*
291  * FTDI_SIO_GET_LATENCY_TIMER
292  *
293  * Set the timeout interval. The FTDI collects data from the
294  * device, transmitting it to the host when either A) 62 bytes are
295  * received, or B) the timeout interval has elapsed and the buffer
296  * contains at least 1 byte.  Setting this value to a small number
297  * can dramatically improve performance for applications which send
298  * small packets, since the default value is 16ms.
299  */
300 #define  FTDI_SIO_GET_LATENCY_TIMER_REQUEST FTDI_SIO_GET_LATENCY_TIMER
301 #define  FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE 0xC0
302 
303 /*
304  *  BmRequestType:   1100 0000b
305  *  bRequest:        FTDI_SIO_GET_LATENCY_TIMER
306  *  wValue:          0
307  *  wIndex:          Port
308  *  wLength:         0
309  *  Data:            latency (on return)
310  */
311 
312 /*
313  * FTDI_SIO_SET_LATENCY_TIMER
314  *
315  * Set the timeout interval. The FTDI collects data from the
316  * device, transmitting it to the host when either A) 62 bytes are
317  * received, or B) the timeout interval has elapsed and the buffer
318  * contains at least 1 byte.  Setting this value to a small number
319  * can dramatically improve performance for applications which send
320  * small packets, since the default value is 16ms.
321  */
322 #define  FTDI_SIO_SET_LATENCY_TIMER_REQUEST FTDI_SIO_SET_LATENCY_TIMER
323 #define  FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE 0x40
324 
325 /*
326  *  BmRequestType:   0100 0000b
327  *  bRequest:        FTDI_SIO_SET_LATENCY_TIMER
328  *  wValue:          Latency (milliseconds)
329  *  wIndex:          Port
330  *  wLength:         0
331  *  Data:            None
332  *
333  * wValue:
334  *   B0..7   Latency timer
335  *   B8..15  0
336  *
337  */
338 
339 /*
340  * FTDI_SIO_SET_EVENT_CHAR
341  *
342  * Set the special event character for the specified communications port.
343  * If the device sees this character it will immediately return the
344  * data read so far - rather than wait 40ms or until 62 bytes are read
345  * which is what normally happens.
346  */
347 
348 
349 #define  FTDI_SIO_SET_EVENT_CHAR_REQUEST FTDI_SIO_SET_EVENT_CHAR
350 #define  FTDI_SIO_SET_EVENT_CHAR_REQUEST_TYPE 0x40
351 
352 
353 /*
354  *  BmRequestType:   0100 0000b
355  *  bRequest:        FTDI_SIO_SET_EVENT_CHAR
356  *  wValue:          EventChar
357  *  wIndex:          Port
358  *  wLength:         0
359  *  Data:            None
360  *
361  * wValue:
362  *   B0..7   Event Character
363  *   B8      Event Character Processing
364  *             0 = disabled
365  *             1 = enabled
366  *   B9..15  Reserved
367  *
368  */
369 
370 /* FTDI_SIO_SET_ERROR_CHAR */
371 
372 /*
373  * Set the parity error replacement character for the specified communications
374  * port
375  */
376 
377 /*
378  *  BmRequestType:  0100 0000b
379  *  bRequest:       FTDI_SIO_SET_EVENT_CHAR
380  *  wValue:         Error Char
381  *  wIndex:         Port
382  *  wLength:        0
383  *  Data:           None
384  *
385  *Error Char
386  *  B0..7  Error Character
387  *  B8     Error Character Processing
388  *           0 = disabled
389  *           1 = enabled
390  *  B9..15 Reserved
391  *
392  */
393 
394 /* FTDI_SIO_GET_MODEM_STATUS */
395 /* Retrieve the current value of the modem status register */
396 
397 #define FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE 0xc0
398 #define FTDI_SIO_GET_MODEM_STATUS_REQUEST FTDI_SIO_GET_MODEM_STATUS
399 #define FTDI_SIO_CTS_MASK 0x10
400 #define FTDI_SIO_DSR_MASK 0x20
401 #define FTDI_SIO_RI_MASK  0x40
402 #define FTDI_SIO_RLSD_MASK 0x80
403 /*
404  *   BmRequestType:   1100 0000b
405  *   bRequest:        FTDI_SIO_GET_MODEM_STATUS
406  *   wValue:          zero
407  *   wIndex:          Port
408  *   wLength:         1
409  *   Data:            Status
410  *
411  * One byte of data is returned
412  * B0..3 0
413  * B4    CTS
414  *         0 = inactive
415  *         1 = active
416  * B5    DSR
417  *         0 = inactive
418  *         1 = active
419  * B6    Ring Indicator (RI)
420  *         0 = inactive
421  *         1 = active
422  * B7    Receive Line Signal Detect (RLSD)
423  *         0 = inactive
424  *         1 = active
425  */
426 
427 /* FTDI_SIO_SET_BITMODE */
428 #define FTDI_SIO_SET_BITMODE_REQUEST_TYPE 0x40
429 #define FTDI_SIO_SET_BITMODE_REQUEST FTDI_SIO_SET_BITMODE
430 
431 /* Possible bitmodes for FTDI_SIO_SET_BITMODE_REQUEST */
432 #define FTDI_SIO_BITMODE_RESET		0x00
433 #define FTDI_SIO_BITMODE_CBUS		0x20
434 
435 /* FTDI_SIO_READ_PINS */
436 #define FTDI_SIO_READ_PINS_REQUEST_TYPE 0xc0
437 #define FTDI_SIO_READ_PINS_REQUEST FTDI_SIO_READ_PINS
438 
439 /*
440  * FTDI_SIO_READ_EEPROM
441  *
442  * EEPROM format found in FTDI AN_201, "FT-X MTP memory Configuration",
443  * http://www.ftdichip.com/Support/Documents/AppNotes/AN_201_FT-X%20MTP%20Memory%20Configuration.pdf
444  */
445 #define FTDI_SIO_READ_EEPROM_REQUEST_TYPE 0xc0
446 #define FTDI_SIO_READ_EEPROM_REQUEST FTDI_SIO_READ_EEPROM
447 
448 #define FTDI_FTX_CBUS_MUX_GPIO		0x8
449 #define FTDI_FT232R_CBUS_MUX_GPIO	0xa
450 
451 
452 /* Descriptors returned by the device
453  *
454  *  Device Descriptor
455  *
456  * Offset	Field		Size	Value	Description
457  * 0	bLength		1	0x12	Size of descriptor in bytes
458  * 1	bDescriptorType	1	0x01	DEVICE Descriptor Type
459  * 2	bcdUSB		2	0x0110	USB Spec Release Number
460  * 4	bDeviceClass	1	0x00	Class Code
461  * 5	bDeviceSubClass	1	0x00	SubClass Code
462  * 6	bDeviceProtocol	1	0x00	Protocol Code
463  * 7	bMaxPacketSize0 1	0x08	Maximum packet size for endpoint 0
464  * 8	idVendor	2	0x0403	Vendor ID
465  * 10	idProduct	2	0x8372	Product ID (FTDI_SIO_PID)
466  * 12	bcdDevice	2	0x0001	Device release number
467  * 14	iManufacturer	1	0x01	Index of man. string desc
468  * 15	iProduct	1	0x02	Index of prod string desc
469  * 16	iSerialNumber	1	0x02	Index of serial nmr string desc
470  * 17	bNumConfigurations 1    0x01	Number of possible configurations
471  *
472  * Configuration Descriptor
473  *
474  * Offset	Field			Size	Value
475  * 0	bLength			1	0x09	Size of descriptor in bytes
476  * 1	bDescriptorType		1	0x02	CONFIGURATION Descriptor Type
477  * 2	wTotalLength		2	0x0020	Total length of data
478  * 4	bNumInterfaces		1	0x01	Number of interfaces supported
479  * 5	bConfigurationValue	1	0x01	Argument for SetCOnfiguration() req
480  * 6	iConfiguration		1	0x02	Index of config string descriptor
481  * 7	bmAttributes		1	0x20	Config characteristics Remote Wakeup
482  * 8	MaxPower		1	0x1E	Max power consumption
483  *
484  * Interface Descriptor
485  *
486  * Offset	Field			Size	Value
487  * 0	bLength			1	0x09	Size of descriptor in bytes
488  * 1	bDescriptorType		1	0x04	INTERFACE Descriptor Type
489  * 2	bInterfaceNumber	1	0x00	Number of interface
490  * 3	bAlternateSetting	1	0x00	Value used to select alternate
491  * 4	bNumEndpoints		1	0x02	Number of endpoints
492  * 5	bInterfaceClass		1	0xFF	Class Code
493  * 6	bInterfaceSubClass	1	0xFF	Subclass Code
494  * 7	bInterfaceProtocol	1	0xFF	Protocol Code
495  * 8	iInterface		1	0x02	Index of interface string description
496  *
497  * IN Endpoint Descriptor
498  *
499  * Offset	Field			Size	Value
500  * 0	bLength			1	0x07	Size of descriptor in bytes
501  * 1	bDescriptorType		1	0x05	ENDPOINT descriptor type
502  * 2	bEndpointAddress	1	0x82	Address of endpoint
503  * 3	bmAttributes		1	0x02	Endpoint attributes - Bulk
504  * 4	bNumEndpoints		2	0x0040	maximum packet size
505  * 5	bInterval		1	0x00	Interval for polling endpoint
506  *
507  * OUT Endpoint Descriptor
508  *
509  * Offset	Field			Size	Value
510  * 0	bLength			1	0x07	Size of descriptor in bytes
511  * 1	bDescriptorType		1	0x05	ENDPOINT descriptor type
512  * 2	bEndpointAddress	1	0x02	Address of endpoint
513  * 3	bmAttributes		1	0x02	Endpoint attributes - Bulk
514  * 4	bNumEndpoints		2	0x0040	maximum packet size
515  * 5	bInterval		1	0x00	Interval for polling endpoint
516  *
517  * DATA FORMAT
518  *
519  * IN Endpoint
520  *
521  * The device reserves the first two bytes of data on this endpoint to contain
522  * the current values of the modem and line status registers. In the absence of
523  * data, the device generates a message consisting of these two status bytes
524  * every 40 ms
525  *
526  * Byte 0: Modem Status
527  *
528  * Offset	Description
529  * B0	Reserved - must be 1
530  * B1	Reserved - must be 0
531  * B2	Reserved - must be 0
532  * B3	Reserved - must be 0
533  * B4	Clear to Send (CTS)
534  * B5	Data Set Ready (DSR)
535  * B6	Ring Indicator (RI)
536  * B7	Receive Line Signal Detect (RLSD)
537  *
538  * Byte 1: Line Status
539  *
540  * Offset	Description
541  * B0	Data Ready (DR)
542  * B1	Overrun Error (OE)
543  * B2	Parity Error (PE)
544  * B3	Framing Error (FE)
545  * B4	Break Interrupt (BI)
546  * B5	Transmitter Holding Register (THRE)
547  * B6	Transmitter Empty (TEMT)
548  * B7	Error in RCVR FIFO
549  *
550  */
551 #define FTDI_RS0_CTS	(1 << 4)
552 #define FTDI_RS0_DSR	(1 << 5)
553 #define FTDI_RS0_RI	(1 << 6)
554 #define FTDI_RS0_RLSD	(1 << 7)
555 
556 #define FTDI_RS_DR	1
557 #define FTDI_RS_OE	(1<<1)
558 #define FTDI_RS_PE	(1<<2)
559 #define FTDI_RS_FE	(1<<3)
560 #define FTDI_RS_BI	(1<<4)
561 #define FTDI_RS_THRE	(1<<5)
562 #define FTDI_RS_TEMT	(1<<6)
563 #define FTDI_RS_FIFO	(1<<7)
564 
565 /*
566  * OUT Endpoint
567  *
568  * This device reserves the first bytes of data on this endpoint contain the
569  * length and port identifier of the message. For the FTDI USB Serial converter
570  * the port identifier is always 1.
571  *
572  * Byte 0: Line Status
573  *
574  * Offset	Description
575  * B0	Reserved - must be 1
576  * B1	Reserved - must be 0
577  * B2..7	Length of message - (not including Byte 0)
578  *
579  */
580