[PATCH v3] usb: cdns3: use VBUS Valid to determine role for dr_mode OTG
Siddharth Vadapalli
s-vadapalli at ti.com
Mon Feb 16 05:37:19 CET 2026
On Sun, 2026-02-15 at 16:58 +0100, Marek Vasut wrote:
> On 2/15/26 1:35 PM, Siddharth Vadapalli wrote:
>
> [...]
>
> > +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;
> > + int vbus;
>
> [...]
>
> > + /* Use VBUS Valid to determine role */
> > + vbus = !!(readl(&cdnsp->otg_regs->sts) & OTGSTS_VBUS_VALID);
> > + if (vbus)
> The double-negation is not needed here, simply use:
>
> if (readl(&cdnsp->otg_regs->sts) & OTGSTS_VBUS_VALID) {
> ...
I have implemented the above and have posted the v4 patch at:
https://lore.kernel.org/r/20260216043459.2467850-1-s-vadapalli@ti.com
Thank you for the feedback.
Regards,
Siddharth.
More information about the U-Boot
mailing list