U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@kernel.org>
To: Siddharth Vadapalli <s-vadapalli@ti.com>,
	vigneshr@ti.com, bb@ti.com, trini@konsulko.com, marex@denx.de,
	hnagalla@ti.com, mkorpershoek@baylibre.com,
	caleb.connolly@linaro.org, neil.armstrong@linaro.org,
	jan.kiszka@siemens.com, jonas@kwiboo.se, j-humphreys@ti.com,
	nm@ti.com, devarsht@ti.com, ilias.apalodimas@linaro.org
Cc: u-boot@lists.denx.de, srk@ti.com
Subject: Re: [PATCH 1/2] usb: dwc3-generic: set "mode" based on caller of dwc3_generic_probe()
Date: Thu, 28 Nov 2024 15:10:27 +0200	[thread overview]
Message-ID: <f4c4cb82-0e8c-49a1-aff0-2c539f15047d@kernel.org> (raw)
In-Reply-To: <20241126120322.1760862-2-s-vadapalli@ti.com>



On 26/11/2024 14:03, Siddharth Vadapalli wrote:
> There are only two callers of "dwc3_generic_probe()", namely:
> 1. dwc3_generic_peripheral_probe()
> 2. dwc3_generic_host_probe()
> Currently, the "mode" is set based on the device-tree node of the
> platform device. Also, the DWC3 core doesn't support updating the "mode"
> dynamically at runtime if it is set to "OTG", i.e. "OTG" is treated as a
> separate mode in itself, rather than being treated as a mode which should
> eventually lead to "host"/"peripheral".
> 
> Given that the callers of "dwc3_generic_probe()" clarify the expected
> "mode" of the USB Controller, use that "mode" instead of the one
> specified in the device-tree. This shall allow the USB Controller to
> function both as a "Host" and as a "Peripheral" when the "mode" is "otg"
> in the device-tree, based on the caller of "dwc3_generic_probe()".
> 
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> ---
>  drivers/usb/dwc3/dwc3-generic.c | 9 +++++----

TI AM62a is not even using this driver so how did you test this?
Did I miss a DT patch?

>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 2ab41cbae45..55e62b35c61 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -51,7 +51,8 @@ struct dwc3_generic_host_priv {
>  };
>  
>  static int dwc3_generic_probe(struct udevice *dev,
> -			      struct dwc3_generic_priv *priv)
> +			      struct dwc3_generic_priv *priv,
> +			      enum usb_dr_mode mode)
>  {
>  	int rc;
>  	struct dwc3_generic_plat *plat = dev_get_plat(dev);
> @@ -62,7 +63,7 @@ static int dwc3_generic_probe(struct udevice *dev,
>  
>  	dwc3->dev = dev;
>  	dwc3->maximum_speed = plat->maximum_speed;
> -	dwc3->dr_mode = plat->dr_mode;
> +	dwc3->dr_mode = mode;

if platform supported mode was "host" only or "peripheral" only
then you shouldn't we prevent from using the other role?

In u-boot shell, if user starts Host driver first and then starts peripheral driver
how does it work?
Did you test this case?

>  #if CONFIG_IS_ENABLED(OF_CONTROL)
>  	dwc3_of_parse(dwc3);
>  
> @@ -197,7 +198,7 @@ static int dwc3_generic_peripheral_probe(struct udevice *dev)
>  {
>  	struct dwc3_generic_priv *priv = dev_get_priv(dev);
>  
> -	return dwc3_generic_probe(dev, priv);
> +	return dwc3_generic_probe(dev, priv, USB_DR_MODE_PERIPHERAL);
>  }
>  
>  static int dwc3_generic_peripheral_remove(struct udevice *dev)
> @@ -241,7 +242,7 @@ static int dwc3_generic_host_probe(struct udevice *dev)
>  	struct dwc3_generic_host_priv *priv = dev_get_priv(dev);
>  	int rc;
>  
> -	rc = dwc3_generic_probe(dev, &priv->gen_priv);
> +	rc = dwc3_generic_probe(dev, &priv->gen_priv, USB_DR_MODE_HOST);
>  	if (rc)
>  		return rc;
>  

-- 
cheers,
-roger


  reply	other threads:[~2024-11-28 13:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 12:03 [PATCH 0/2] AM62A DWC3: Add support for USB DFU boot in OTG mode Siddharth Vadapalli
2024-11-26 12:03 ` [PATCH 1/2] usb: dwc3-generic: set "mode" based on caller of dwc3_generic_probe() Siddharth Vadapalli
2024-11-28 13:10   ` Roger Quadros [this message]
2024-11-28 17:20     ` Siddharth Vadapalli
2024-11-29 12:28       ` Roger Quadros
2024-12-02  5:42         ` Siddharth Vadapalli
2024-12-02 14:09           ` Roger Quadros
2024-12-04 22:24   ` Roger Quadros
2024-12-13 19:45   ` Marek Vasut
2024-11-26 12:03 ` [PATCH 2/2] board: ti: am62ax: env: include environment for DFU Siddharth Vadapalli
2024-12-04 22:25   ` Roger Quadros
2024-11-28 12:45 ` [PATCH 0/2] AM62A DWC3: Add support for USB DFU boot in OTG mode Roger Quadros
2024-11-28 16:47   ` Siddharth Vadapalli
2024-12-13 23:16 ` Tom Rini

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=f4c4cb82-0e8c-49a1-aff0-2c539f15047d@kernel.org \
    --to=rogerq@kernel.org \
    --cc=bb@ti.com \
    --cc=caleb.connolly@linaro.org \
    --cc=devarsht@ti.com \
    --cc=hnagalla@ti.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=j-humphreys@ti.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jonas@kwiboo.se \
    --cc=marex@denx.de \
    --cc=mkorpershoek@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=nm@ti.com \
    --cc=s-vadapalli@ti.com \
    --cc=srk@ti.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /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