Re: [PATCH] usb: core: support interface node for simple USB devices

POPESCU Catalin
2025-01-22T17:17:39Z

On 22/01/2025 14:53, Greg KH wrote:
> This email is not from Hexagon’s Office 365 instance. Please be careful while clicking links, opening attachments, or replying to this email.
>
>
> On Wed, Jan 22, 2025 at 02:47:32PM +0100, Catalin Popescu wrote:
>> A simple usb device has a single configuration and a single interface
>> and is considered as a "combined node" when defined in the devicetree.
>> If available, its interface node is simply ignored which is a problem
>> whenever the interface node has subnodes. To prevent that from happening
>> first check for any subnode and ignore the interface node only if no
>> subnode was found.
>>
>> Example: FTDI chip FT234XD that has only one UART interface which is
>> being used as a serdev by other driver.
>>
>> device@1 {
>> compatible = "usb403,6015";
>> reg = <1>;
>>
>> #address-cells = <2>;
>> #size-cells = <0>;
>>
>> interface@0 {
>> compatible = "usbif403,6015.config1.0";
>> reg = <0 1>;
>>
>> bluetooth {
>> compatible = "nxp,88w8987-bt";
>> };
>> };
>> };
> serdev can not use usb-serial devices due to the lack of hotplugging, so
> why is this an issue? I thought that just would not work.

Well, I can say that on 6.12.0 it's working :

[    0.929493] usb 1-1: new full-speed USB device number 2 using xhci-hcd
[    5.906574] usbcore: registered new interface driver ftdi_sio
[    5.906632] usbserial: USB Serial support registered for FTDI USB
Serial Device
[    5.906727] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[    5.906842] usb 1-1: Detected FT-X
[    5.907809] serial serial0: tty port ttyUSB0 registered
[    5.907832] usb 1-1: FTDI USB Serial Device converter now attached to
ttyUSB0
[    5.918649] btnxpuart serial0-0: supply vcc not found, using dummy
regulator

==> unplug FTDI from USB bus

[  109.410409] usb 1-1: USB disconnect, device number 2
[  109.432556] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now
disconnected from ttyUSB0
[  109.432634] ftdi_sio 1-1:1.0: device disconnected

==> plug back FTDI

[  150.403378] usb 1-1: new full-speed USB device number 3 using xhci-hcd
[  150.553794] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[  150.553920] usb 1-1: Detected FT-X
[  150.554718] serial serial0: tty port ttyUSB0 registered
[  150.554731] usb 1-1: FTDI USB Serial Device converter now attached to
ttyUSB0
[  150.554976] btnxpuart serial0-0: supply vcc not found, using dummy
regulator

btnxpuart is basically the bluetooth driver that's behind the FTDI and
uses ttyUSB0 to communicate with the bluetooth chip.
I can confirm that after unplug/plug the communication with the
bluetooth chip is perfectly working.

BR,
Catalin

> confused,
>
> greg k-h