]> git.ipfire.org Git - thirdparty/u-boot.git/commit
usb: cdns3: use VBUS Valid to determine role for dr_mode OTG
authorSiddharth Vadapalli <s-vadapalli@ti.com>
Mon, 16 Feb 2026 04:34:58 +0000 (10:04 +0530)
committerMarek Vasut <marek.vasut+usb@mailbox.org>
Mon, 16 Feb 2026 14:08:43 +0000 (15:08 +0100)
commitbfb530e06ca6c19f66c079601e568c761a001993
treeaca3c200bcfe371dbdb297dd68a956e793c87076
parentf9ffeec4bdcf1da655a0ffea482062adde78fee8
usb: cdns3: use VBUS Valid to determine role for dr_mode OTG

The cdns3_bind() function is responsible for identifying the appropriate
driver to bind to the USB Controller's device-tree node. If the device-tree
node has the 'dr_mode' property set to 'otg', the existing approach fails
to bind a driver, leading to loss of functionality.

To address this, use the VBUS Valid field of the OTG Status register to
determine the role as follows:
- If VBUS Valid field is set, it indicates that a USB Host is supplying
  power and the Controller should assume the Peripheral role.
- If VBUS Valid field is clear, it indicates the absence of a USB Host and
  the Controller should assume the Host role.

Additionally, when 'dr_mode' happens to be 'otg' and the STRAP settings
are not specified, use VBUS Valid to determine the role in cdns3_drd_init()
and assign it to cdns->dr_mode.

Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
drivers/usb/cdns3/core.c
drivers/usb/cdns3/drd.c