]> git.ipfire.org Git - thirdparty/u-boot.git/commit
usb: gadget: dwc2: Move dr_mode check from of_to_plat() to bind()
authorJonas Karlman <jonas@kwiboo.se>
Thu, 29 Jan 2026 19:52:05 +0000 (19:52 +0000)
committerMattijs Korpershoek <mkorpershoek@kernel.org>
Fri, 30 Jan 2026 08:01:42 +0000 (09:01 +0100)
commite69841fa71d67c560d767b786f956bb6f2873130
treea0ef206a156f55818065eb28ac90167805507eef
parentaef270254f0feaad54837d3fbbc04ad0c060d3fa
usb: gadget: dwc2: Move dr_mode check from of_to_plat() to bind()

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@ff740000
   usb_gadget    1  [   ]   dwc2-udc-otg          |   |-- usb@ff780000

  => usb start
  starting USB...
  No USB controllers found

After this:

  dwc2-udc-otg usb@ff780000: Invalid dr_mode 1

  => dm tree
   ...
   usb_gadget    0  [   ]   dwc2-udc-otg          |   |-- usb@ff740000
   usb           0  [   ]   dwc2_usb              |   |-- usb@ff780000

  => usb start
  starting USB...
  USB DWC2
  Bus usb@ff780000: 1 USB Device(s) found

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
Link: https://lore.kernel.org/r/20260129195207.2260264-1-jonas@kwiboo.se
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
drivers/usb/gadget/dwc2_udc_otg.c