All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Kaustabh Chakraborty <kauschluss@disroot.org>,
	Mattijs Korpershoek <mkorpershoek@kernel.org>,
	Kaustabh Chakraborty <kauschluss@disroot.org>,
	u-boot@lists.denx.de
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	Marek Vasut <marek.vasut@mailbox.org>,
	Casey Connolly <casey.connolly@linaro.org>
Subject: Re: [PATCH v3 1/2] usb: dwc3-generic: allow fallback of dr_mode property to "otg"
Date: Fri, 16 Jan 2026 16:16:29 +0100	[thread overview]
Message-ID: <87pl79d1v6.fsf@kernel.org> (raw)
In-Reply-To: <DFQ22JXT2KP3.2U4ZGBQM3RYRV@disroot.org>

On Fri, Jan 16, 2026 at 19:12, "Kaustabh Chakraborty" <kauschluss@disroot.org> wrote:

> On 2026-01-16 13:33 +01:00, Mattijs Korpershoek wrote:
>> Hi Kaustabh,
>>
>> Thank you for the patch.
>>
>> On Thu, Jan 08, 2026 at 18:03, Kaustabh Chakraborty <kauschluss@disroot.org> wrote:
>>
>>> Documentation [1] states that the default value of the dr_mode property
>>> is "otg". It also isn't marked a mandatory node, so it may or may not be
>>> set. So, accordingly if dr_mode is not mentioned in the devicetree node,
>>> OTG mode must be assumed.
>>>
>>> In this driver however, this case is not handled. If dr_mode is not
>>> mentioned, USB_DR_MODE_UNKNOWN is set. The logic implemented raises an
>>> error, instead of falling back to USB_DR_MODE_OTG. Correct this to
>>> conform to the specification.
>>>
>>> Link: https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/tree/Bindings/usb/usb-drd.yaml?h=v6.18-dts [1]
>>> Reviewed-by: Marek Vasut <marek.vasut@mailbox.org>
>>> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
>>
>> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
>
> Thanks for your insight, but isn't this patch applied? This has been
> merged into u-boot/master already. But I don't see it in next.
> Confusing.

You are right. This patch was already applied. I usually check for an
email that states that the patch was applied but I forgot Marek usually
does not send those.
Sorry about that, I generated un-necessary noise.

It's normal that your patch has only be applied into u-boot/master.

Right now, we are in the U-Boot merge window. During this time, the next
branch is closed. All development and fixes go into master directly.

See:
https://docs.u-boot.org/en/latest/develop/release_cycle.html#current-status
https://docs.u-boot.org/en/latest/develop/process.html#management-summary

Hope that clears out the confusion.

>
>>
>> Note: there is a similar patch submitted by Casey here:
>> https://lore.kernel.org/all/20260114-casey-usb-role-switch-v1-1-fb7a626466b9@linaro.org/
>>
>> Can you have a look at that one please? You could review it or test it
>> to see if it works for you?
>
> This patch addresses a single point of failure, unlike mine.
>
>>
>> Thanks!
>> Mattijs
>>
>>> ---
>>>  drivers/usb/dwc3/dwc3-generic.c | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
>>> index c09014aec60..c15eda19e8f 100644
>>> --- a/drivers/usb/dwc3/dwc3-generic.c
>>> +++ b/drivers/usb/dwc3/dwc3-generic.c
>>> @@ -10,6 +10,7 @@
>>>  #include <dm.h>
>>>  #include <reset.h>
>>>  #include <asm/gpio.h>
>>> +#include <dm/device_compat.h>
>>>  #include <dm/lists.h>
>>>  #include <linux/delay.h>
>>>  #include <linux/usb/gadget.h>
>>> @@ -173,8 +174,8 @@ static int dwc3_generic_of_to_plat(struct udevice *dev)
>>>  		node = dev_ofnode(dev->parent);
>>>  		plat->dr_mode = usb_get_dr_mode(node);
>>>  		if (plat->dr_mode == USB_DR_MODE_UNKNOWN) {
>>> -			pr_err("Invalid usb mode setup\n");
>>> -			return -ENODEV;
>>> +			dev_info(dev, "No USB mode specified. Using 'otg'\n");
>>> +			plat->dr_mode = USB_DR_MODE_OTG;
>>>  		}
>>>  	}
>>>  
>>> @@ -516,6 +517,10 @@ static int dwc3_glue_bind_common(struct udevice *parent, ofnode node)
>>>  	if (!dr_mode)
>>>  		dr_mode = usb_get_dr_mode(node);
>>>  
>>> +	/* usb mode must fallback to peripheral if not known */
>>> +	if (dr_mode == USB_DR_MODE_UNKNOWN)
>>> +		dr_mode = USB_DR_MODE_OTG;
>>> +
>>>  	if (CONFIG_IS_ENABLED(DM_USB_GADGET) &&
>>>  	    (dr_mode == USB_DR_MODE_PERIPHERAL || dr_mode == USB_DR_MODE_OTG)) {
>>>  		debug("%s: dr_mode: OTG or Peripheral\n", __func__);
>>>
>>> -- 
>>> 2.52.0

  reply	other threads:[~2026-01-16 15:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 12:33 [PATCH v3 0/2] Support for Samsung Exynos 7870 DW-USB device in controller Kaustabh Chakraborty
2026-01-08 12:33 ` [PATCH v3 1/2] usb: dwc3-generic: allow fallback of dr_mode property to "otg" Kaustabh Chakraborty
2026-01-16 12:33   ` Mattijs Korpershoek
2026-01-16 13:42     ` Kaustabh Chakraborty
2026-01-16 15:16       ` Mattijs Korpershoek [this message]
2026-01-08 12:33 ` [PATCH v3 2/2] usb: dwc3-generic: add support for exynos7870 Kaustabh Chakraborty
2026-01-16 12:33   ` Mattijs Korpershoek

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=87pl79d1v6.fsf@kernel.org \
    --to=mkorpershoek@kernel.org \
    --cc=casey.connolly@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jonas@kwiboo.se \
    --cc=kauschluss@disroot.org \
    --cc=kever.yang@rock-chips.com \
    --cc=marek.vasut@mailbox.org \
    --cc=marex@denx.de \
    --cc=patrice.chotard@foss.st.com \
    --cc=semen.protsenko@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.