[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKzKK0rrCojqGKh9N8vSHOZkzu27wM88Fj8HQoX38QLD5FVr1w@mail.gmail.com>
Date: Fri, 22 Aug 2025 17:27:38 +0800
From: Kuen-Han Tsai <khtsai@...gle.com>
To: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
Cc: "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] usb: dwc3: Add trace event for dwc3_set_prtcap
Hi Thinh,
On Fri, Aug 22, 2025 at 7:30 AM Thinh Nguyen <Thinh.Nguyen@...opsys.com> wrote:
>
> On Mon, Aug 18, 2025, Kuen-Han Tsai wrote:
> > Changes to the port capability can be indirectly observed by tracing
> > register writes to DWC3_GCTL. However, this requires interpreting the
> > raw value, which is neither intuitive nor precise for debugging.
> > Monitoring these mode changes is essential for resolving issues related
> > to USB role switching and enumeration.
> >
> > Introduce a dedicated trace event to provide a human-readable log when
> > the port capability is configured.
> >
> > Signed-off-by: Kuen-Han Tsai <khtsai@...gle.com>
> > ---
> > drivers/usb/dwc3/core.c | 1 +
> > drivers/usb/dwc3/debug.h | 18 ++++++++++++++++++
> > drivers/usb/dwc3/trace.h | 17 +++++++++++++++++
> > 3 files changed, 36 insertions(+)
> >
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index 8002c23a5a02..370fc524a468 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -156,6 +156,7 @@ void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy)
> > dwc3_writel(dwc->regs, DWC3_GCTL, reg);
> >
> > dwc->current_dr_role = mode;
> > + trace_dwc3_set_prtcap(mode);
> > }
> >
> > static void __dwc3_set_mode(struct work_struct *work)
> > diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h
> > index 09d703852a92..70d90790f872 100644
> > --- a/drivers/usb/dwc3/debug.h
> > +++ b/drivers/usb/dwc3/debug.h
> > @@ -13,6 +13,24 @@
> >
> > #include "core.h"
> >
> > +/**
> > + * dwc3_mode_string - returns mode name
> > + * @mode: mode code
>
> Minor nit: would be better to document as GCTL.PrtCapDir value, but it's
> obvious looking at this small function. So it's fine.
Thanks for the review. I've updated the description for @mode in the
second patch as you suggested.
Regards,
Kuen-Han
Powered by blists - more mailing lists