[PATCH 1/3] usb: common: default dr_mode to OTG when not set

Casey Connolly casey.connolly at linaro.org
Fri Jan 16 18:05:35 CET 2026



On 1/16/26 13:30, Mattijs Korpershoek wrote:
> On Thu, Jan 15, 2026 at 10:17, Mattijs Korpershoek <mkorpershoek at kernel.org> wrote:
> 
>> Hi Casey,
>>
>> Thank you for the patch.
>>
>> On Wed, Jan 14, 2026 at 15:13, Casey Connolly <casey.connolly at linaro.org> wrote:
>>
>>> DT bindings dictate that dr_mode being unset on a DRD capable USB
>>
>> For the curious, this is defined in https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/usb/usb-drd.yaml#n23
>>
>>> controller means we should default to OTG mode. Adjust usb_get_dr_mode()
>>> to reflect this.
>>>
>>> Signed-off-by: Casey Connolly <casey.connolly at linaro.org>
>>> ---
>>>   drivers/usb/common/common.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
>>> index 13e9a61072a9..e3bd7339e68e 100644
>>> --- a/drivers/usb/common/common.c
>>> +++ b/drivers/usb/common/common.c
>>> @@ -29,9 +29,10 @@ enum usb_dr_mode usb_get_dr_mode(ofnode node)
>>>   
>>>   	dr_mode = ofnode_read_string(node, "dr_mode");
>>>   	if (!dr_mode) {
>>>   		pr_debug("usb dr_mode not found\n");
>>> -		return USB_DR_MODE_UNKNOWN;
>>> +		/* Default to OTG mode as per DT bindings */
>>
>> Nitpick: can we change the comment to:
>> /* Default to OTG mode as per devicetree/bindings/usb/usb-drd.yaml */
>>
>> This tells the same but is more precise and is imho, a more helpful
>> comment.
>>
>> Reviewed-by: Mattijs Korpershoek <mkorpershoek at kernel.org>
> 
> Also, I just noticed, but there is another similar change here:
> https://lore.kernel.org/all/20260108-usb-dwc3-exynos7870-v3-1-343fa1e81e48@disroot.org/
> 
> Casey, can you see if the above is useful to you?

Oh yep, same patch basically. I'll drop my version in the next revision.

> 
>>
>>
>>> +		return USB_DR_MODE_OTG;
>>>   	}
>>>   
>>>   	for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++)
>>>   		if (!strcmp(dr_mode, usb_dr_modes[i]))
>>>
>>> -- 
>>> 2.51.0



More information about the U-Boot mailing list