[PATCH 2/2] usb: add support for barebox,dr_mode
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Nov 28 09:21:36 PST 2025
It's not rare to have barebox configure a USB-A port as peripheral or
OTG, because it's used for initial bootstrap of the system with a
non-spec compliant cable.
Allow for this reason to set a barebox,dr_mode that barebox will use
instead of dr_mode if available and Linux will ignore.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/usb/core/of.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/core/of.c b/drivers/usb/core/of.c
index bfe0ae315763..3c2ba5a64ae2 100644
--- a/drivers/usb/core/of.c
+++ b/drivers/usb/core/of.c
@@ -36,9 +36,9 @@ static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str)
* usb_get_dr_mode - Get dual role mode for given device
* @dev: Pointer to the given device
*
- * The function gets phy interface string from property 'dr_mode',
- * in the given device's device tree node and returns the correspondig
- * enum usb_dr_mode
+ * The function gets phy interface string from property 'barebox,dr_mode'
+ * or 'dr_mode' in the given device's device tree node and returns the
+ * correspondig enum usb_dr_mode
*/
enum usb_dr_mode usb_get_dr_mode(struct device *dev)
{
@@ -46,7 +46,9 @@ enum usb_dr_mode usb_get_dr_mode(struct device *dev)
const char *dr_mode;
int err;
- err = of_property_read_string(np, "dr_mode", &dr_mode);
+ err = of_property_read_string(np, "barebox,dr_mode", &dr_mode);
+ if (err < 0)
+ err = of_property_read_string(np, "dr_mode", &dr_mode);
if (err < 0)
return USB_DR_MODE_UNKNOWN;
--
2.47.3
More information about the barebox
mailing list