linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@nxp.com>
To: Felipe Balbi <balbi@kernel.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"pawell@cadence.com" <pawell@cadence.com>,
	"rogerq@ti.com" <rogerq@ti.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	Jun Li <jun.li@nxp.com>
Subject: Re: [PATCH v7 1/3] usb: cdns3: introduce set_phy_power_on{off} APIs
Date: Fri, 28 Aug 2020 00:33:07 +0000	[thread overview]
Message-ID: <20200828003151.GA13910@b29397-desktop> (raw)
In-Reply-To: <87k0xki6b3.fsf@kernel.org>

On 20-08-27 16:09:36, Felipe Balbi wrote:
> Peter Chen <peter.chen@nxp.com> writes:
> 
> > Since we have both USB2 and USB3 PHYs for cdns3 controller, it is
> > better we have unity APIs to handle both USB2 and USB3's power, it
> > could simplify code for error handling and further power management
> > implementation.
> >
> > Reviewed-by: Pawel Laszczak <pawell@cadence.com>
> > Reviewed-by: Jun Li <jun.li@nxp.com>
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> >  drivers/usb/cdns3/core.c | 43 ++++++++++++++++++++++++++--------------
> >  1 file changed, 28 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
> > index 5c1586ec7824..e56dbb6a898c 100644
> > --- a/drivers/usb/cdns3/core.c
> > +++ b/drivers/usb/cdns3/core.c
> > @@ -371,6 +371,27 @@ static int cdns3_role_set(struct usb_role_switch *sw, enum usb_role role)
> >  	return ret;
> >  }
> >  
> > +static int set_phy_power_on(struct cdns3 *cdns)
> 
> care to keep the cdns3_ prefix? It's useful when you want to use
> e.g. ftrace and function_graph trace

I original added it, but Greg suggested it is not needed.

https://www.spinics.net/lists/linux-usb/msg197076.html

> 
> > +{
> > +	int ret;
> > +
> > +	ret = phy_power_on(cdns->usb2_phy);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = phy_power_on(cdns->usb3_phy);
> 
> let's say we fail here
> 
> > +	if (ret)
> > +		phy_power_off(cdns->usb2_phy);
> 
> usb2_phy will be powered off..

If usb3_phy's power_on has failed, it powers off usb2 phy's power which
is powered on before, and return fail.

> 
> > +	return ret;
> > +}
> > +
> > +static void set_phy_power_off(struct cdns3 *cdns)
> > +{
> > +	phy_power_off(cdns->usb3_phy);
> > +	phy_power_off(cdns->usb2_phy);
> 
> Won't this cause a problem?
> 

What's the problem you have seen?

-- 

Thanks,
Peter Chen

  reply	other threads:[~2020-08-28  0:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25  2:11 [PATCH v7 0/3] usb: cdns3: add runtime pm support Peter Chen
2020-08-25  2:11 ` [PATCH v7 1/3] usb: cdns3: introduce set_phy_power_on{off} APIs Peter Chen
2020-08-27 13:09   ` Felipe Balbi
2020-08-28  0:33     ` Peter Chen [this message]
2020-08-25  2:11 ` [PATCH v7 2/3] usb: cdns3: add runtime PM support Peter Chen
2020-08-27 13:16   ` Felipe Balbi
2020-08-28  1:01     ` Peter Chen
2020-08-25  2:11 ` [PATCH v7 3/3] usb: cdns3: imx: add glue layer runtime pm implementation Peter Chen
2020-08-27 13:20   ` Felipe Balbi
2020-08-28  1:17     ` Peter Chen
2020-09-02  9:49       ` Peter Chen

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=20200828003151.GA13910@b29397-desktop \
    --to=peter.chen@nxp.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    --cc=rogerq@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;
as well as URLs for NNTP newsgroup(s).