[PATCH v2] usb: gadget: dwc2: Move dr_mode check from of_to_plat() to bind()

Marek Vasut marek.vasut at mailbox.org
Thu Jan 29 21:32:58 CET 2026


On 1/29/26 9:13 PM, Mattijs Korpershoek wrote:
> Hi Jonas,
> 
> Thank you for the patch.
> 
> On Thu, Jan 29, 2026 at 19:52, Jonas Karlman <jonas at kwiboo.se> wrote:
> 
>> Rockchip RK3288 and RK3506 contain two DWC2 USB controllers, typically
>> one controller use dr_mode=otg and the other one use dr_mode=host.
>>
>> With USB_GADGET_DWC2_OTG, DM_USB_GADGET and USB_DWC2 enabled this result
>> in the dwc2-udc-otg driver binding to both controllers, however only one
>> will probe due to use of dr_mode=host on the other one.
>>
>> After the commit 6668b8e7cc68 ("dm: core: Support multiple drivers with
>> same compatibles") it is possible to bind one controller to the
>> dwc2-udc-otg driver and the other one to the dwc2_usb driver.
>>
>> Move the dr_mode check from of_to_plat() to bind() to allow dm core to
>> bind the dwc2 host driver to dr_mode=host controllers.
>>
>> Before this:
>>
>>    => dm tree
>>     ...
>>     usb_gadget    0  [   ]   dwc2-udc-otg          |   |-- usb at ff740000
>>     usb_gadget    1  [   ]   dwc2-udc-otg          |   |-- usb at ff780000
>>
>>    => usb start
>>    starting USB...
>>    No USB controllers found
>>
>> After this:
>>
>>    dwc2-udc-otg usb at ff780000: Invalid dr_mode 1
>>
>>    => dm tree
>>     ...
>>     usb_gadget    0  [   ]   dwc2-udc-otg          |   |-- usb at ff740000
>>     usb           0  [   ]   dwc2_usb              |   |-- usb at ff780000
>>
>>    => usb start
>>    starting USB...
>>    USB DWC2
>>    Bus usb at ff780000: 1 USB Device(s) found
>>
>> Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
> 
> Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.org>
> 
> Marek, can I pick this up since it's gadget or do you want to take it?
Sure, go for it

Reviewed-by: Marek Vasut <marek.vasut at mailbox.org>

Thanks !


More information about the U-Boot mailing list