···61616262struct ftdi_private {6363 struct kref kref;6464- ftdi_chip_type_t chip_type;6464+ enum ftdi_chip_type chip_type;6565 /* type of device, either SIO or FT8U232AM */6666 int baud_base; /* baud base clock for divisor setting */6767 int custom_divisor; /* custom_divisor kludge, this is for
+65-59
drivers/usb/serial/ftdi_sio.h
···2323 */24242525/* Commands */2626-#define FTDI_SIO_RESET 0 /* Reset the port */2727-#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */2828-#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */2929-#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */3030-#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */3131-#define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */3232-#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */3333-#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */2626+#define FTDI_SIO_RESET 0 /* Reset the port */2727+#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */2828+#define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */2929+#define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */3030+#define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of3131+ the port */3232+#define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem3333+ status register */3434+#define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */3535+#define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */3436#define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */3537#define FTDI_SIO_GET_LATENCY_TIMER 10 /* Get the latency timer */3638···5452 */55535654/* Port Identifier Table */5757-#define PIT_DEFAULT 0 /* SIOA */5555+#define PIT_DEFAULT 0 /* SIOA */5856#define PIT_SIOA 1 /* SIOA */5957/* The device this driver is tested with one has only one port */6058#define PIT_SIOB 2 /* SIOB */···105103 * wLength: 0106104 * Data: None107105 * The BaudDivisor values are calculated as follows:108108- * - BaseClock is either 12000000 or 48000000 depending on the device. FIXME: I wish109109- * I knew how to detect old chips to select proper base clock!106106+ * - BaseClock is either 12000000 or 48000000 depending on the device.107107+ * FIXME: I wish I knew how to detect old chips to select proper base clock!110108 * - BaudDivisor is a fixed point number encoded in a funny way.111109 * (--WRONG WAY OF THINKING--)112110 * BaudDivisor is a fixed point number encoded with following bit weighs:113111 * (-2)(-1)(13..0). It is a radical with a denominator of 4, so values114112 * end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...).115113 * (--THE REALITY--)116116- * The both-bits-set has quite different meaning from 0.75 - the chip designers117117- * have decided it to mean 0.125 instead of 0.75.114114+ * The both-bits-set has quite different meaning from 0.75 - the chip115115+ * designers have decided it to mean 0.125 instead of 0.75.118116 * This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates119117 * and Flow Control Consideration for USB to RS232".120118 * - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should121121- * automagically re-encode the resulting value to take fractions into consideration.119119+ * automagically re-encode the resulting value to take fractions into120120+ * consideration.122121 * As all values are integers, some bit twiddling is in order:123122 * BaudDivisor = (BaseClock / 16 / BaudRate) |124123 * (((BaseClock / 2 / BaudRate) & 4) ? 0x4000 // 0.5···149146 * not supported by the FT8U232AM).150147 */151148152152-typedef enum {149149+enum ftdi_chip_type {153150 SIO = 1,154151 FT8U232AM = 2,155152 FT232BM = 3,···157154 FT232RL = 5,158155 FT2232H = 6,159156 FT4232H = 7160160-} ftdi_chip_type_t;157157+};161158162162-typedef enum {163163- ftdi_sio_b300 = 0,164164- ftdi_sio_b600 = 1,165165- ftdi_sio_b1200 = 2,166166- ftdi_sio_b2400 = 3,167167- ftdi_sio_b4800 = 4,168168- ftdi_sio_b9600 = 5,169169- ftdi_sio_b19200 = 6,170170- ftdi_sio_b38400 = 7,171171- ftdi_sio_b57600 = 8,172172- ftdi_sio_b115200 = 9173173-} FTDI_SIO_baudrate_t;159159+enum ftdi_sio_baudrate {160160+ ftdi_sio_b300 = 0,161161+ ftdi_sio_b600 = 1,162162+ ftdi_sio_b1200 = 2,163163+ ftdi_sio_b2400 = 3,164164+ ftdi_sio_b4800 = 4,165165+ ftdi_sio_b9600 = 5,166166+ ftdi_sio_b19200 = 6,167167+ ftdi_sio_b38400 = 7,168168+ ftdi_sio_b57600 = 8,169169+ ftdi_sio_b115200 = 9170170+};174171175172/*176176- * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor values177177- * are calculated internally.173173+ * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor174174+ * values are calculated internally.178175 */179179-180180-#define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA181181-#define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40182182-#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8)183183-#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8)184184-#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8)185185-#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8)186186-#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8)187187-#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)188188-#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)189189-#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)190190-#define FTDI_SIO_SET_BREAK (0x1 << 14)176176+#define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA177177+#define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40178178+#define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8)179179+#define FTDI_SIO_SET_DATA_PARITY_ODD (0x1 << 8)180180+#define FTDI_SIO_SET_DATA_PARITY_EVEN (0x2 << 8)181181+#define FTDI_SIO_SET_DATA_PARITY_MARK (0x3 << 8)182182+#define FTDI_SIO_SET_DATA_PARITY_SPACE (0x4 << 8)183183+#define FTDI_SIO_SET_DATA_STOP_BITS_1 (0x0 << 11)184184+#define FTDI_SIO_SET_DATA_STOP_BITS_15 (0x1 << 11)185185+#define FTDI_SIO_SET_DATA_STOP_BITS_2 (0x2 << 11)186186+#define FTDI_SIO_SET_BREAK (0x1 << 14)191187/* FTDI_SIO_SET_DATA */192188193189/*···289287 *290288 * A value of zero in the hIndex field disables handshaking291289 *292292- * If Xon/Xoff handshaking is specified, the hValue field should contain the XOFF character293293- * and the lValue field contains the XON character.290290+ * If Xon/Xoff handshaking is specified, the hValue field should contain the291291+ * XOFF character and the lValue field contains the XON character.294292 */295293296294/*···375373376374/* FTDI_SIO_SET_ERROR_CHAR */377375378378-/* Set the parity error replacement character for the specified communications port */376376+/*377377+ * Set the parity error replacement character for the specified communications378378+ * port379379+ */379380380381/*381382 * BmRequestType: 0100 0000b···501496 *502497 * IN Endpoint503498 *504504- * The device reserves the first two bytes of data on this endpoint to contain the current505505- * values of the modem and line status registers. In the absence of data, the device 506506- * generates a message consisting of these two status bytes every 40 ms499499+ * The device reserves the first two bytes of data on this endpoint to contain500500+ * the current values of the modem and line status registers. In the absence of501501+ * data, the device generates a message consisting of these two status bytes502502+ * every 40 ms507503 *508504 * Byte 0: Modem Status509505 *···536530#define FTDI_RS0_RI (1 << 6)537531#define FTDI_RS0_RLSD (1 << 7)538532539539-#define FTDI_RS_DR 1540540-#define FTDI_RS_OE (1<<1)541541-#define FTDI_RS_PE (1<<2)542542-#define FTDI_RS_FE (1<<3)543543-#define FTDI_RS_BI (1<<4)544544-#define FTDI_RS_THRE (1<<5)545545-#define FTDI_RS_TEMT (1<<6)546546-#define FTDI_RS_FIFO (1<<7)533533+#define FTDI_RS_DR 1534534+#define FTDI_RS_OE (1<<1)535535+#define FTDI_RS_PE (1<<2)536536+#define FTDI_RS_FE (1<<3)537537+#define FTDI_RS_BI (1<<4)538538+#define FTDI_RS_THRE (1<<5)539539+#define FTDI_RS_TEMT (1<<6)540540+#define FTDI_RS_FIFO (1<<7)547541548542/*549543 * OUT Endpoint550544 *551551- * This device reserves the first bytes of data on this endpoint contain the length552552- * and port identifier of the message. For the FTDI USB Serial converter the port 553553- * identifier is always 1.545545+ * This device reserves the first bytes of data on this endpoint contain the546546+ * length and port identifier of the message. For the FTDI USB Serial converter547547+ * the port identifier is always 1.554548 *555549 * Byte 0: Line Status556550 *