From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/2] usb: add support for barebox,dr_mode
Date: Fri, 28 Nov 2025 18:21:36 +0100 [thread overview]
Message-ID: <20251128172138.35867-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251128172138.35867-1-a.fatoum@pengutronix.de>
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@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
next prev parent reply other threads:[~2025-11-28 17:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 17:21 [PATCH 1/2] usb: align with Linux usb_get_dr_mode API Ahmad Fatoum
2025-11-28 17:21 ` Ahmad Fatoum [this message]
2025-12-01 9:56 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251128172138.35867-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox