public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Prasanth Babu Mantena <p-mantena@ti.com>,
	Marek Vasut <marek.vasut+usb@mailbox.org>
Cc: u-boot@lists.denx.de, n-francis@ti.com, u-kumar1@ti.com,
	vigneshr@ti.com, s-vadapalli@ti.com
Subject: Re: [PATCH] Revert "usb: cdns3: use VBUS Valid to determine role for dr_mode OTG"
Date: Thu, 12 Mar 2026 07:50:19 -0600	[thread overview]
Message-ID: <20260312135019.GA502704@bill-the-cat> (raw)
In-Reply-To: <20260312133247.2192335-1-p-mantena@ti.com>

[-- Attachment #1: Type: text/plain, Size: 3967 bytes --]

On Thu, Mar 12, 2026 at 07:02:47PM +0530, Prasanth Babu Mantena wrote:

> While USB DFU boot works with this patch, but the non USB boot modes like
> SD Boot and flash boot fails for J784S4 EVM device.
> 
> So, Reverting this patch.
> 
> This reverts commit bfb530e06ca6c19f66c079601e568c761a001993.
> 
> Signed-off-by: Prasanth Babu Mantena <p-mantena@ti.com>
> ---
>  drivers/usb/cdns3/core.c | 53 ----------------------------------------
>  drivers/usb/cdns3/drd.c  | 11 ---------
>  2 files changed, 64 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
> index 10bc4cabed4..4434dc15bec 100644
> --- a/drivers/usb/cdns3/core.c
> +++ b/drivers/usb/cdns3/core.c
> @@ -392,52 +392,6 @@ static const struct udevice_id cdns3_ids[] = {
>  	{ },
>  };
>  
> -/*
> - * The VBUS Valid Bit in the OTG Status register can be used to determine
> - * the role. When VBUS Valid is set, it indicates that a USB Host is supplying
> - * power, so the Controller should assume the PERIPHERAL role. If it isn't set,
> - * it indicates the absence of a USB Host, so the Controller should assume the
> - * HOST role. If the OTG Status register is inaccessible, return an error.
> - */
> -static int cdns3_get_otg_mode(struct udevice *parent, enum usb_dr_mode *mode)
> -{
> -	/* Create a temporary child device for using devfdt_remap_addr_name() */
> -	struct udevice child = {
> -		.parent = parent,
> -	};
> -	struct cdns3 cdns, *cdnsp;
> -	void __iomem *otg_regs;
> -
> -	dev_set_ofnode(&child, ofnode_first_subnode(dev_ofnode(parent)));
> -	otg_regs = devfdt_remap_addr_name(&child, "otg");
> -	if (!otg_regs) {
> -		dev_err(parent, "failed to get otg registers for child node\n");
> -		return -ENXIO;
> -	}
> -
> -	/*
> -	 * As mentioned in drivers/usb/cdns3/drd.c, there are two versions
> -	 * of the Controller. The following logic detects the version of the
> -	 * Controller and interprets the register layout accordingly.
> -	 */
> -	cdnsp = &cdns;
> -	cdnsp->otg_v0_regs = otg_regs;
> -	if (!readl(&cdnsp->otg_v0_regs->cmd)) {
> -		cdnsp->otg_regs = otg_regs;
> -	} else {
> -		cdnsp->otg_v1_regs = otg_regs;
> -		cdnsp->otg_regs = (void *)&cdnsp->otg_v1_regs->cmd;
> -	}
> -
> -	/* Use VBUS Valid to determine role */
> -	if (readl(&cdnsp->otg_regs->sts) & OTGSTS_VBUS_VALID)
> -		*mode = USB_DR_MODE_PERIPHERAL;
> -	else
> -		*mode = USB_DR_MODE_HOST;
> -
> -	return 0;
> -}
> -
>  int cdns3_bind(struct udevice *parent)
>  {
>  	enum usb_dr_mode dr_mode;
> @@ -459,13 +413,6 @@ int cdns3_bind(struct udevice *parent)
>  	if (dr_mode == USB_DR_MODE_UNKNOWN)
>  		dr_mode = usb_get_dr_mode(dev_ofnode(parent));
>  
> -	/* Use VBUS Valid to determine role */
> -	if (dr_mode == USB_DR_MODE_OTG) {
> -		ret = cdns3_get_otg_mode(parent, &dr_mode);
> -		if (ret < 0)
> -			return ret;
> -	}
> -
>  	switch (dr_mode) {
>  #if defined(CONFIG_SPL_USB_HOST) || \
>  	(!defined(CONFIG_XPL_BUILD) && defined(CONFIG_USB_HOST))
> diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c
> index 0ca40a5cc8d..cbb13342343 100644
> --- a/drivers/usb/cdns3/drd.c
> +++ b/drivers/usb/cdns3/drd.c
> @@ -301,17 +301,6 @@ int cdns3_drd_init(struct cdns3 *cdns)
>  		cdns->dr_mode = USB_DR_MODE_PERIPHERAL;
>  	}
>  
> -	/*
> -	 * In the absence of STRAP configuration, use VBUS Valid to
> -	 * determine the appropriate role to be assigned to dr_mode.
> -	 */
> -	if (cdns->dr_mode == USB_DR_MODE_OTG) {
> -		if (cdns3_get_vbus(cdns))
> -			cdns->dr_mode = USB_DR_MODE_PERIPHERAL;
> -		else
> -			cdns->dr_mode = USB_DR_MODE_HOST;
> -	}
> -
>  	state = readl(&cdns->otg_regs->sts);
>  	if (OTGSTS_OTG_NRDY(state) != 0) {
>  		dev_err(cdns->dev, "Cadence USB3 OTG device not ready\n");

Adding in the USB custodian as this revert is intended for master and
v2026.04 I assume as the commit being reverted is also in master.
Thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-03-12 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 13:32 [PATCH] Revert "usb: cdns3: use VBUS Valid to determine role for dr_mode OTG" Prasanth Babu Mantena
2026-03-12 13:50 ` Tom Rini [this message]
2026-03-12 15:01   ` Marek Vasut
2026-03-13  3:59     ` Siddharth Vadapalli
2026-04-02 11:03       ` Siddharth Vadapalli
2026-04-03 22:39         ` Marek Vasut
2026-04-03 22:38       ` Marek Vasut
2026-04-04 18:25 ` 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=20260312135019.GA502704@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=marek.vasut+usb@mailbox.org \
    --cc=n-francis@ti.com \
    --cc=p-mantena@ti.com \
    --cc=s-vadapalli@ti.com \
    --cc=u-boot@lists.denx.de \
    --cc=u-kumar1@ti.com \
    --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