Skip to content

Commit 9fa015b

Browse files
committed
Merge tag 'usb-serial-6.19-rc6' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus
Johan writes: USB serial fix for 6.19-rc6 Here's a fix for an f81232 enumeration issue that could prevent some ports from being enabled (e.g. during driver rebind). Included are also some new device ids. All have been in linux-next with no reported issues. * tag 'usb-serial-6.19-rc6' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial: USB: serial: f81232: fix incomplete serial port generation USB: serial: ftdi_sio: add support for PICAXE AXE027 cable USB: serial: option: add Telit LE910 MBIM composition
2 parents 9bcb4c4 + cd644b8 commit 9fa015b

4 files changed

Lines changed: 51 additions & 30 deletions

File tree

drivers/usb/serial/f81232.c

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ MODULE_DEVICE_TABLE(usb, combined_id_table);
7070
#define F81232_REGISTER_REQUEST 0xa0
7171
#define F81232_GET_REGISTER 0xc0
7272
#define F81232_SET_REGISTER 0x40
73-
#define F81534A_ACCESS_REG_RETRY 2
7473

7574
#define SERIAL_BASE_ADDRESS 0x0120
7675
#define RECEIVE_BUFFER_REGISTER (0x00 + SERIAL_BASE_ADDRESS)
@@ -824,36 +823,31 @@ static void f81232_lsr_worker(struct work_struct *work)
824823
static int f81534a_ctrl_set_register(struct usb_interface *intf, u16 reg,
825824
u16 size, void *val)
826825
{
827-
struct usb_device *dev = interface_to_usbdev(intf);
828-
int retry = F81534A_ACCESS_REG_RETRY;
829-
int status;
830-
831-
while (retry--) {
832-
status = usb_control_msg_send(dev,
833-
0,
834-
F81232_REGISTER_REQUEST,
835-
F81232_SET_REGISTER,
836-
reg,
837-
0,
838-
val,
839-
size,
840-
USB_CTRL_SET_TIMEOUT,
841-
GFP_KERNEL);
842-
if (status) {
843-
status = usb_translate_errors(status);
844-
if (status == -EIO)
845-
continue;
846-
}
847-
848-
break;
849-
}
850-
851-
if (status) {
852-
dev_err(&intf->dev, "failed to set register 0x%x: %d\n",
853-
reg, status);
854-
}
826+
return usb_control_msg_send(interface_to_usbdev(intf),
827+
0,
828+
F81232_REGISTER_REQUEST,
829+
F81232_SET_REGISTER,
830+
reg,
831+
0,
832+
val,
833+
size,
834+
USB_CTRL_SET_TIMEOUT,
835+
GFP_KERNEL);
836+
}
855837

856-
return status;
838+
static int f81534a_ctrl_get_register(struct usb_interface *intf, u16 reg,
839+
u16 size, void *val)
840+
{
841+
return usb_control_msg_recv(interface_to_usbdev(intf),
842+
0,
843+
F81232_REGISTER_REQUEST,
844+
F81232_GET_REGISTER,
845+
reg,
846+
0,
847+
val,
848+
size,
849+
USB_CTRL_GET_TIMEOUT,
850+
GFP_KERNEL);
857851
}
858852

859853
static int f81534a_ctrl_enable_all_ports(struct usb_interface *intf, bool en)
@@ -869,6 +863,29 @@ static int f81534a_ctrl_enable_all_ports(struct usb_interface *intf, bool en)
869863
* bit 0~11 : Serial port enable bit.
870864
*/
871865
if (en) {
866+
/*
867+
* The Fintek F81532A/534A/535/536 family relies on the
868+
* F81534A_CTRL_CMD_ENABLE_PORT (116h) register during
869+
* initialization to both determine serial port status and
870+
* control port creation.
871+
*
872+
* If the driver experiences fast load/unload cycles, the
873+
* device state may becomes unstable, resulting in the
874+
* incomplete generation of serial ports.
875+
*
876+
* Performing a dummy read operation on the register prior
877+
* to the initial write command resolves the issue.
878+
*
879+
* This clears the device's stale internal state. Subsequent
880+
* write operations will correctly generate all serial ports.
881+
*/
882+
status = f81534a_ctrl_get_register(intf,
883+
F81534A_CTRL_CMD_ENABLE_PORT,
884+
sizeof(enable),
885+
enable);
886+
if (status)
887+
return status;
888+
872889
enable[0] = 0xff;
873890
enable[1] = 0x8f;
874891
}

drivers/usb/serial/ftdi_sio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ static const struct usb_device_id id_table_combined[] = {
848848
{ USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, LMI_LM3S_DEVEL_BOARD_PID, 1) },
849849
{ USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID, 1) },
850850
{ USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, LMI_LM3S_ICDI_BOARD_PID, 1) },
851+
{ USB_DEVICE(FTDI_VID, FTDI_AXE027_PID) },
851852
{ USB_DEVICE_INTERFACE_NUMBER(FTDI_VID, FTDI_TURTELIZER_PID, 1) },
852853
{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
853854
{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) },

drivers/usb/serial/ftdi_sio_ids.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696
#define LMI_LM3S_EVAL_BOARD_PID 0xbcd9
9797
#define LMI_LM3S_ICDI_BOARD_PID 0xbcda
9898

99+
#define FTDI_AXE027_PID 0xBD90 /* PICAXE AXE027 USB download cable */
100+
99101
#define FTDI_TURTELIZER_PID 0xBDC8 /* JTAG/RS-232 adapter by egnite GmbH */
100102

101103
/* OpenDCC (www.opendcc.de) product id */

drivers/usb/serial/option.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,6 +1505,7 @@ static const struct usb_device_id option_ids[] = {
15051505
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1231, 0xff), /* Telit LE910Cx (RNDIS) */
15061506
.driver_info = NCTRL(2) | RSVD(3) },
15071507
{ USB_DEVICE_AND_INTERFACE_INFO(TELIT_VENDOR_ID, 0x1250, 0xff, 0x00, 0x00) }, /* Telit LE910Cx (rmnet) */
1508+
{ USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1252, 0xff) }, /* Telit LE910Cx (MBIM) */
15081509
{ USB_DEVICE(TELIT_VENDOR_ID, 0x1260),
15091510
.driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
15101511
{ USB_DEVICE(TELIT_VENDOR_ID, 0x1261),

0 commit comments

Comments
 (0)