[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X9tzlWYKRS9FY9q3@ulmo>
Date: Thu, 17 Dec 2020 16:04:53 +0100
From: Thierry Reding <thierry.reding@...il.com>
To: Dmitry Osipenko <digetx@...il.com>
Cc: Jonathan Hunter <jonathanh@...dia.com>,
Peter Chen <Peter.Chen@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Stern <stern@...land.harvard.edu>,
Felipe Balbi <balbi@...nel.org>,
Matt Merhar <mattmerhar@...tonmail.com>,
Nicolas Chauvet <kwizart@...il.com>,
Peter Geis <pgwipeout@...il.com>,
Ion Agorria <ion@...rria.com>, linux-tegra@...r.kernel.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/8] usb: phy: tegra: Support waking up from a low
power mode
On Thu, Dec 17, 2020 at 04:47:50PM +0300, Dmitry Osipenko wrote:
> 17.12.2020 16:33, Thierry Reding пишет:
> >> + /* PHY won't resume if reset is asserted */
> >> + if (phy->wakeup_enabled)
> >> + goto chrg_cfg0;
> >>
> >> val = readl_relaxed(base + USB_SUSP_CTRL);
> >> val |= UTMIP_RESET;
> >> writel_relaxed(val, base + USB_SUSP_CTRL);
> >>
> >> +chrg_cfg0:
> > I found this diffcult to read until I realized that it was basically
> > just the equivalent of this:
> >
> > if (!phy->wakeup_enabled) {
> > val = readl_relaxed(base + USB_SUSP_CTRL);
> > val |= UTMIP_RESET;
> > writel_relaxed(val, base + USB_SUSP_CTRL);
> > }
> >
> >> val = readl_relaxed(base + UTMIP_BAT_CHRG_CFG0);
> >> val |= UTMIP_PD_CHRG;
> >> writel_relaxed(val, base + UTMIP_BAT_CHRG_CFG0);
> >>
> >> + if (phy->wakeup_enabled)
> >> + goto xcvr_cfg1;
> >> +
> >> val = readl_relaxed(base + UTMIP_XCVR_CFG0);
> >> val |= UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN |
> >> UTMIP_FORCE_PDZI_POWERDOWN;
> >> writel_relaxed(val, base + UTMIP_XCVR_CFG0);
> >>
> >> +xcvr_cfg1:
> > Similarly, I think this is more readable as:
> >
> > if (!phy->wakeup_enabled) {
> > val = readl_relaxed(base + UTMIP_XCVR_CFG0);
> > val |= UTMIP_FORCE_PD_POWERDOWN | UTMIP_FORCE_PD2_POWERDOWN |
> > UTMIP_FORCE_PDZI_POWERDOWN;
> > writel_relaxed(val, base + UTMIP_XCVR_CFG0);
> > }
> >
> >> val = readl_relaxed(base + UTMIP_XCVR_CFG1);
> >> val |= UTMIP_FORCE_PDDISC_POWERDOWN | UTMIP_FORCE_PDCHRP_POWERDOWN |
> >> UTMIP_FORCE_PDDR_POWERDOWN;
> >> writel_relaxed(val, base + UTMIP_XCVR_CFG1);
> >>
> >> + if (phy->wakeup_enabled) {
> > Which then also matches the style of this conditional here.
>
> I'll change it in v3, thanks.
Given that my other comment about the WARN_ONCE seems to have been
resolved, with the above gotos replaced by conditionals as I suggested:
Acked-by: Thierry Reding <treding@...dia.com>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists