]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Mar 2026 07:38:00 +0000 (08:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Mar 2026 07:38:00 +0000 (08:38 +0100)
added patches:
usb-serial-f81232-fix-incomplete-serial-port-generation.patch

queue-6.1/series
queue-6.1/usb-serial-f81232-fix-incomplete-serial-port-generation.patch [new file with mode: 0644]

index c09206993718dd333bff4e07a51a9843391a31e8..456f8554af6a37c3eeefcac310cb24e544cc6e47 100644 (file)
@@ -443,3 +443,4 @@ drm-fix-use-after-free-on-framebuffers-and-property-blobs-when-calling-drm_dev_u
 bluetooth-hci_core-fix-use-after-free-in-vhci_flush.patch
 mailbox-prevent-out-of-bounds-access-in-of_mbox_index_xlate.patch
 sched-fair-fix-pelt-clock-sync-when-entering-idle.patch
+usb-serial-f81232-fix-incomplete-serial-port-generation.patch
diff --git a/queue-6.1/usb-serial-f81232-fix-incomplete-serial-port-generation.patch b/queue-6.1/usb-serial-f81232-fix-incomplete-serial-port-generation.patch
new file mode 100644 (file)
index 0000000..8af35ff
--- /dev/null
@@ -0,0 +1,133 @@
+From cd644b805da8a253198718741bf363c4c58862ff Mon Sep 17 00:00:00 2001
+From: "Ji-Ze Hong (Peter Hong)" <peter_hong@fintek.com.tw>
+Date: Fri, 12 Dec 2025 15:08:31 +0800
+Subject: USB: serial: f81232: fix incomplete serial port generation
+
+From: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
+
+commit cd644b805da8a253198718741bf363c4c58862ff upstream.
+
+The Fintek F81532A/534A/535/536 family relies on the
+F81534A_CTRL_CMD_ENABLE_PORT (116h) register during initialization to
+both determine serial port status and control port creation. If the
+driver experiences fast load/unload cycles, the device state may becomes
+unstable, resulting in the incomplete generation of serial ports.
+
+Performing a dummy read operation on the register prior to the initial
+write command resolves the issue. This clears the device's stale internal
+state. Subsequent write operations will correctly generate all serial
+ports.
+
+This patch also removes the retry loop in f81534a_ctrl_set_register()
+because the stale state has been fixed.
+
+Tested on: HygonDM1SLT(Hygon C86 3250 8-core Processor)
+
+Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/serial/f81232.c |   77 ++++++++++++++++++++++++++------------------
+ 1 file changed, 47 insertions(+), 30 deletions(-)
+
+--- a/drivers/usb/serial/f81232.c
++++ b/drivers/usb/serial/f81232.c
+@@ -70,7 +70,6 @@ MODULE_DEVICE_TABLE(usb, combined_id_tab
+ #define F81232_REGISTER_REQUEST               0xa0
+ #define F81232_GET_REGISTER           0xc0
+ #define F81232_SET_REGISTER           0x40
+-#define F81534A_ACCESS_REG_RETRY      2
+ #define SERIAL_BASE_ADDRESS           0x0120
+ #define RECEIVE_BUFFER_REGISTER               (0x00 + SERIAL_BASE_ADDRESS)
+@@ -822,36 +821,31 @@ static void f81232_lsr_worker(struct wor
+ static int f81534a_ctrl_set_register(struct usb_interface *intf, u16 reg,
+                                       u16 size, void *val)
+ {
+-      struct usb_device *dev = interface_to_usbdev(intf);
+-      int retry = F81534A_ACCESS_REG_RETRY;
+-      int status;
+-
+-      while (retry--) {
+-              status = usb_control_msg_send(dev,
+-                                            0,
+-                                            F81232_REGISTER_REQUEST,
+-                                            F81232_SET_REGISTER,
+-                                            reg,
+-                                            0,
+-                                            val,
+-                                            size,
+-                                            USB_CTRL_SET_TIMEOUT,
+-                                            GFP_KERNEL);
+-              if (status) {
+-                      status = usb_translate_errors(status);
+-                      if (status == -EIO)
+-                              continue;
+-              }
+-
+-              break;
+-      }
+-
+-      if (status) {
+-              dev_err(&intf->dev, "failed to set register 0x%x: %d\n",
+-                              reg, status);
+-      }
++      return usb_control_msg_send(interface_to_usbdev(intf),
++                                              0,
++                                              F81232_REGISTER_REQUEST,
++                                              F81232_SET_REGISTER,
++                                              reg,
++                                              0,
++                                              val,
++                                              size,
++                                              USB_CTRL_SET_TIMEOUT,
++                                              GFP_KERNEL);
++}
+-      return status;
++static int f81534a_ctrl_get_register(struct usb_interface *intf, u16 reg,
++                                      u16 size, void *val)
++{
++      return usb_control_msg_recv(interface_to_usbdev(intf),
++                                              0,
++                                              F81232_REGISTER_REQUEST,
++                                              F81232_GET_REGISTER,
++                                              reg,
++                                              0,
++                                              val,
++                                              size,
++                                              USB_CTRL_GET_TIMEOUT,
++                                              GFP_KERNEL);
+ }
+ static int f81534a_ctrl_enable_all_ports(struct usb_interface *intf, bool en)
+@@ -867,6 +861,29 @@ static int f81534a_ctrl_enable_all_ports
+        * bit 0~11     : Serial port enable bit.
+        */
+       if (en) {
++              /*
++               * The Fintek F81532A/534A/535/536 family relies on the
++               * F81534A_CTRL_CMD_ENABLE_PORT (116h) register during
++               * initialization to both determine serial port status and
++               * control port creation.
++               *
++               * If the driver experiences fast load/unload cycles, the
++               * device state may becomes unstable, resulting in the
++               * incomplete generation of serial ports.
++               *
++               * Performing a dummy read operation on the register prior
++               * to the initial write command resolves the issue.
++               *
++               * This clears the device's stale internal state. Subsequent
++               * write operations will correctly generate all serial ports.
++               */
++              status = f81534a_ctrl_get_register(intf,
++                                              F81534A_CTRL_CMD_ENABLE_PORT,
++                                              sizeof(enable),
++                                              enable);
++              if (status)
++                      return status;
++
+               enable[0] = 0xff;
+               enable[1] = 0x8f;
+       }