* [PATCH V2 1/1] USB: serial: f81232: fix incomplete serial port generation
@ 2025-11-28 8:52 Ji-Ze Hong (Peter Hong)
2025-12-01 13:38 ` Johan Hovold
0 siblings, 1 reply; 4+ messages in thread
From: Ji-Ze Hong (Peter Hong) @ 2025-11-28 8:52 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-usb, linux-kernel, tom_tsai, peter_hong, yu_chen
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.
Tested on: HygonDM1SLT(Hygon C86 3250 8-core Processor)
Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
---
Changelog:
v2:
1. remove loop in accessor function.
drivers/usb/serial/f81232.c | 38 +++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 530b77fc2f78..c587c58cbacf 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -856,6 +856,21 @@ static int f81534a_ctrl_set_register(struct usb_interface *intf, u16 reg,
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)
{
unsigned char enable[2] = {0};
@@ -869,6 +884,29 @@ static int f81534a_ctrl_enable_all_ports(struct usb_interface *intf, bool en)
* 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;
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH V2 1/1] USB: serial: f81232: fix incomplete serial port generation
2025-11-28 8:52 [PATCH V2 1/1] USB: serial: f81232: fix incomplete serial port generation Ji-Ze Hong (Peter Hong)
@ 2025-12-01 13:38 ` Johan Hovold
2025-12-02 5:40 ` Peter Hong
0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2025-12-01 13:38 UTC (permalink / raw)
To: Ji-Ze Hong (Peter Hong)
Cc: gregkh, linux-usb, linux-kernel, tom_tsai, yu_chen
On Fri, Nov 28, 2025 at 04:52:44PM +0800, Ji-Ze Hong (Peter Hong) wrote:
> 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.
>
> Tested on: HygonDM1SLT(Hygon C86 3250 8-core Processor)
>
> Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
> ---
> Changelog:
> v2:
> 1. remove loop in accessor function.
Thanks for verifying.
Did you try removing the retry loop also in the set_register() helper?
Perhaps that's no longer needed after the dummy read.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2 1/1] USB: serial: f81232: fix incomplete serial port generation
2025-12-01 13:38 ` Johan Hovold
@ 2025-12-02 5:40 ` Peter Hong
2025-12-03 11:04 ` Johan Hovold
0 siblings, 1 reply; 4+ messages in thread
From: Peter Hong @ 2025-12-02 5:40 UTC (permalink / raw)
To: Johan Hovold; +Cc: gregkh, linux-usb, linux-kernel, tom_tsai, yu_chen
Hi,
Johan Hovold 於 2025/12/1 下午 09:38 寫道:
> On Fri, Nov 28, 2025 at 04:52:44PM +0800, Ji-Ze Hong (Peter Hong) wrote:
>> 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.
>>
>> Tested on: HygonDM1SLT(Hygon C86 3250 8-core Processor)
>>
>> Signed-off-by: Ji-Ze Hong (Peter Hong) <peter_hong@fintek.com.tw>
>> ---
>> Changelog:
>> v2:
>> 1. remove loop in accessor function.
> Thanks for verifying.
>
> Did you try removing the retry loop also in the set_register() helper?
> Perhaps that's no longer needed after the dummy read.
I will try removing the retry loop in set_register() helper.
If that worked, could I use the same patch file or series of patches?
Thanks,
--
*洪繼澤 **Peter Hong*
精拓科技股份有限公司
Feature Integration Technology
Address: 302新竹縣竹北市台元二街10號7樓
TEL: 03-5600168 #813
FAX: 03-5600166
E-Mail﹕peter_hong@fintek.com.tw
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2 1/1] USB: serial: f81232: fix incomplete serial port generation
2025-12-02 5:40 ` Peter Hong
@ 2025-12-03 11:04 ` Johan Hovold
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2025-12-03 11:04 UTC (permalink / raw)
To: Peter Hong; +Cc: gregkh, linux-usb, linux-kernel, tom_tsai, yu_chen
On Tue, Dec 02, 2025 at 01:40:28PM +0800, Peter Hong wrote:
> Hi,
>
> Johan Hovold 於 2025/12/1 下午 09:38 寫道:
> > On Fri, Nov 28, 2025 at 04:52:44PM +0800, Ji-Ze Hong (Peter Hong) wrote:
> >> 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.
> > Did you try removing the retry loop also in the set_register() helper?
> > Perhaps that's no longer needed after the dummy read.
>
> I will try removing the retry loop in set_register() helper.
> If that worked, could I use the same patch file or series of patches?
I think you can do it in one patch since I assume the existing retry
loop is there to work around the same underlying issue.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-03 11:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-28 8:52 [PATCH V2 1/1] USB: serial: f81232: fix incomplete serial port generation Ji-Ze Hong (Peter Hong)
2025-12-01 13:38 ` Johan Hovold
2025-12-02 5:40 ` Peter Hong
2025-12-03 11:04 ` Johan Hovold
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®