Loading drivers/usb/serial/ftdi_sio.c +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ static __u16 product; struct ftdi_private { struct kref kref; ftdi_chip_type_t chip_type; enum ftdi_chip_type chip_type; /* type of device, either SIO or FT8U232AM */ int baud_base; /* baud base clock for divisor setting */ int custom_divisor; /* custom_divisor kludge, this is for Loading drivers/usb/serial/ftdi_sio.h +66 −60 Original line number Diff line number Diff line Loading @@ -27,8 +27,10 @@ #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ #define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */ #define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */ #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */ #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */ #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */ #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */ #define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */ #define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */ #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */ Loading Loading @@ -103,20 +105,21 @@ * wLength: 0 * Data: None * The BaudDivisor values are calculated as follows: * - BaseClock is either 12000000 or 48000000 depending on the device. FIXME: I wish * I knew how to detect old chips to select proper base clock! * - BaseClock is either 12000000 or 48000000 depending on the device. * FIXME: I wish I knew how to detect old chips to select proper base clock! * - BaudDivisor is a fixed point number encoded in a funny way. * (--WRONG WAY OF THINKING--) * BaudDivisor is a fixed point number encoded with following bit weighs: * (-2)(-1)(13..0). It is a radical with a denominator of 4, so values * end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...). * (--THE REALITY--) * The both-bits-set has quite different meaning from 0.75 - the chip designers * have decided it to mean 0.125 instead of 0.75. * The both-bits-set has quite different meaning from 0.75 - the chip * designers have decided it to mean 0.125 instead of 0.75. * This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates * and Flow Control Consideration for USB to RS232". * - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should * automagically re-encode the resulting value to take fractions into consideration. * automagically re-encode the resulting value to take fractions into * consideration. * As all values are integers, some bit twiddling is in order: * BaudDivisor = (BaseClock / 16 / BaudRate) | * (((BaseClock / 2 / BaudRate) & 4) ? 0x4000 // 0.5 Loading Loading @@ -146,7 +149,7 @@ * not supported by the FT8U232AM). */ typedef enum { enum ftdi_chip_type { SIO = 1, FT8U232AM = 2, FT232BM = 3, Loading @@ -154,9 +157,9 @@ typedef enum { FT232RL = 5, FT2232H = 6, FT4232H = 7 } ftdi_chip_type_t; }; typedef enum { enum ftdi_sio_baudrate { ftdi_sio_b300 = 0, ftdi_sio_b600 = 1, ftdi_sio_b1200 = 2, Loading @@ -167,13 +170,12 @@ typedef enum { ftdi_sio_b38400 = 7, ftdi_sio_b57600 = 8, ftdi_sio_b115200 = 9 } FTDI_SIO_baudrate_t; }; /* * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor values * are calculated internally. * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor * values are calculated internally. */ #define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA #define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8) Loading Loading @@ -287,8 +289,8 @@ typedef enum { * * A value of zero in the hIndex field disables handshaking * * If Xon/Xoff handshaking is specified, the hValue field should contain the XOFF character * and the lValue field contains the XON character. * If Xon/Xoff handshaking is specified, the hValue field should contain the * XOFF character and the lValue field contains the XON character. */ /* Loading Loading @@ -373,7 +375,10 @@ typedef enum { /* FTDI_SIO_SET_ERROR_CHAR */ /* Set the parity error replacement character for the specified communications port */ /* * Set the parity error replacement character for the specified communications * port */ /* * BmRequestType: 0100 0000b Loading Loading @@ -496,9 +501,10 @@ typedef enum { * * IN Endpoint * * The device reserves the first two bytes of data on this endpoint to contain the current * values of the modem and line status registers. In the absence of data, the device * generates a message consisting of these two status bytes every 40 ms * The device reserves the first two bytes of data on this endpoint to contain * the current values of the modem and line status registers. In the absence of * data, the device generates a message consisting of these two status bytes * every 40 ms * * Byte 0: Modem Status * Loading Loading @@ -542,9 +548,9 @@ typedef enum { /* * OUT Endpoint * * This device reserves the first bytes of data on this endpoint contain the length * and port identifier of the message. For the FTDI USB Serial converter the port * identifier is always 1. * This device reserves the first bytes of data on this endpoint contain the * length and port identifier of the message. For the FTDI USB Serial converter * the port identifier is always 1. * * Byte 0: Line Status * Loading drivers/usb/serial/ftdi_sio_ids.h +21 −21 File changed.Contains only whitespace changes. Show changes Loading
drivers/usb/serial/ftdi_sio.c +1 −1 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ static __u16 product; struct ftdi_private { struct kref kref; ftdi_chip_type_t chip_type; enum ftdi_chip_type chip_type; /* type of device, either SIO or FT8U232AM */ int baud_base; /* baud base clock for divisor setting */ int custom_divisor; /* custom_divisor kludge, this is for Loading
drivers/usb/serial/ftdi_sio.h +66 −60 Original line number Diff line number Diff line Loading @@ -27,8 +27,10 @@ #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ #define FTDI_SIO_SET_FLOW_CTRL 2 /* Set flow control register */ #define FTDI_SIO_SET_BAUD_RATE 3 /* Set baud rate */ #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */ #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */ #define FTDI_SIO_SET_DATA 4 /* Set the data characteristics of the port */ #define FTDI_SIO_GET_MODEM_STATUS 5 /* Retrieve current value of modem status register */ #define FTDI_SIO_SET_EVENT_CHAR 6 /* Set the event character */ #define FTDI_SIO_SET_ERROR_CHAR 7 /* Set the error character */ #define FTDI_SIO_SET_LATENCY_TIMER 9 /* Set the latency timer */ Loading Loading @@ -103,20 +105,21 @@ * wLength: 0 * Data: None * The BaudDivisor values are calculated as follows: * - BaseClock is either 12000000 or 48000000 depending on the device. FIXME: I wish * I knew how to detect old chips to select proper base clock! * - BaseClock is either 12000000 or 48000000 depending on the device. * FIXME: I wish I knew how to detect old chips to select proper base clock! * - BaudDivisor is a fixed point number encoded in a funny way. * (--WRONG WAY OF THINKING--) * BaudDivisor is a fixed point number encoded with following bit weighs: * (-2)(-1)(13..0). It is a radical with a denominator of 4, so values * end with 0.0 (00...), 0.25 (10...), 0.5 (01...), and 0.75 (11...). * (--THE REALITY--) * The both-bits-set has quite different meaning from 0.75 - the chip designers * have decided it to mean 0.125 instead of 0.75. * The both-bits-set has quite different meaning from 0.75 - the chip * designers have decided it to mean 0.125 instead of 0.75. * This info looked up in FTDI application note "FT8U232 DEVICES \ Data Rates * and Flow Control Consideration for USB to RS232". * - BaudDivisor = (BaseClock / 16) / BaudRate, where the (=) operation should * automagically re-encode the resulting value to take fractions into consideration. * automagically re-encode the resulting value to take fractions into * consideration. * As all values are integers, some bit twiddling is in order: * BaudDivisor = (BaseClock / 16 / BaudRate) | * (((BaseClock / 2 / BaudRate) & 4) ? 0x4000 // 0.5 Loading Loading @@ -146,7 +149,7 @@ * not supported by the FT8U232AM). */ typedef enum { enum ftdi_chip_type { SIO = 1, FT8U232AM = 2, FT232BM = 3, Loading @@ -154,9 +157,9 @@ typedef enum { FT232RL = 5, FT2232H = 6, FT4232H = 7 } ftdi_chip_type_t; }; typedef enum { enum ftdi_sio_baudrate { ftdi_sio_b300 = 0, ftdi_sio_b600 = 1, ftdi_sio_b1200 = 2, Loading @@ -167,13 +170,12 @@ typedef enum { ftdi_sio_b38400 = 7, ftdi_sio_b57600 = 8, ftdi_sio_b115200 = 9 } FTDI_SIO_baudrate_t; }; /* * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor values * are calculated internally. * The ftdi_8U232AM_xxMHz_byyy constants have been removed. The encoded divisor * values are calculated internally. */ #define FTDI_SIO_SET_DATA_REQUEST FTDI_SIO_SET_DATA #define FTDI_SIO_SET_DATA_REQUEST_TYPE 0x40 #define FTDI_SIO_SET_DATA_PARITY_NONE (0x0 << 8) Loading Loading @@ -287,8 +289,8 @@ typedef enum { * * A value of zero in the hIndex field disables handshaking * * If Xon/Xoff handshaking is specified, the hValue field should contain the XOFF character * and the lValue field contains the XON character. * If Xon/Xoff handshaking is specified, the hValue field should contain the * XOFF character and the lValue field contains the XON character. */ /* Loading Loading @@ -373,7 +375,10 @@ typedef enum { /* FTDI_SIO_SET_ERROR_CHAR */ /* Set the parity error replacement character for the specified communications port */ /* * Set the parity error replacement character for the specified communications * port */ /* * BmRequestType: 0100 0000b Loading Loading @@ -496,9 +501,10 @@ typedef enum { * * IN Endpoint * * The device reserves the first two bytes of data on this endpoint to contain the current * values of the modem and line status registers. In the absence of data, the device * generates a message consisting of these two status bytes every 40 ms * The device reserves the first two bytes of data on this endpoint to contain * the current values of the modem and line status registers. In the absence of * data, the device generates a message consisting of these two status bytes * every 40 ms * * Byte 0: Modem Status * Loading Loading @@ -542,9 +548,9 @@ typedef enum { /* * OUT Endpoint * * This device reserves the first bytes of data on this endpoint contain the length * and port identifier of the message. For the FTDI USB Serial converter the port * identifier is always 1. * This device reserves the first bytes of data on this endpoint contain the * length and port identifier of the message. For the FTDI USB Serial converter * the port identifier is always 1. * * Byte 0: Line Status * Loading
drivers/usb/serial/ftdi_sio_ids.h +21 −21 File changed.Contains only whitespace changes. Show changes