All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Peter Chen <peter.chen@nxp.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jun Li <jun.li@nxp.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] usb: host: xhci-plat: fix support for XHCI_SKIP_PHY_INIT quirk
Date: Wed, 23 Dec 2020 02:04:10 +0100	[thread overview]
Message-ID: <20201223010410.6q5y3u2kgd2cohu2@pali> (raw)
In-Reply-To: <20201223010214.GA18398@b29397-desktop>

On Wednesday 23 December 2020 01:02:43 Peter Chen wrote:
> On 20-12-22 14:30:51, Pali Rohár wrote:
> > On Tuesday 22 December 2020 10:23:27 Pali Rohár wrote:
> > > On Tuesday 22 December 2020 02:14:45 Peter Chen wrote:
> > > > On 20-12-21 16:09:03, Pali Rohár wrote:
> > > > > Currently init_quirk callbacks for xhci platform drivers are called
> > > > > xhci_plat_setup() function which is called after chip reset completes.
> > > > > It happens in the middle of the usb_add_hcd() function.
> > > > > 
> > > > > But XHCI_SKIP_PHY_INIT quirk is checked in the xhci_plat_probe() function
> > > > > prior calling usb_add_hcd() function. Therefore this XHCI_SKIP_PHY_INIT
> > > > > currently does nothing as prior xhci_plat_setup() it is not set.
> > > > > 
> > > > > Quirk XHCI_SKIP_PHY_INIT is only setting hcd->skip_phy_initialization value
> > > > > which really needs to be set prior calling usb_add_hcd() as this function
> > > > > at its beginning skips PHY init if this member is set.
> > > > > 
> > > > > This patch fixes implementation of the XHCI_SKIP_PHY_INIT quirk by calling
> > > > > init_quirk callbacks (via xhci_priv_init_quirk()) prior checking if
> > > > > XHCI_SKIP_PHY_INIT is set.
> > > > > 
> > > > > Fixes: f768e718911e0 ("usb: host: xhci-plat: add priv quirk for skip PHY initialization")
> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> Hi Pali,
> 
> I know your case, you need to choose XHCI_SKIP_PHY_INIT quirk
> conditionally, but you may can't add Fixes tag at your patch
> since your issue was existed before my patch.

Ok, no problem, in V2 I will not add it.

> Peter
> 
> 
> > > > > ---
> > > > >  drivers/usb/host/xhci-plat.c | 14 +++++++-------
> > > > >  1 file changed, 7 insertions(+), 7 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> > > > > index 4d34f6005381..58704c5b002b 100644
> > > > > --- a/drivers/usb/host/xhci-plat.c
> > > > > +++ b/drivers/usb/host/xhci-plat.c
> > > > > @@ -89,13 +89,6 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
> > > > >  /* called during probe() after chip reset completes */
> > > > >  static int xhci_plat_setup(struct usb_hcd *hcd)
> > > > >  {
> > > > > -	int ret;
> > > > > -
> > > > > -
> > > > > -	ret = xhci_priv_init_quirk(hcd);
> > > > > -	if (ret)
> > > > > -		return ret;
> > > > > -
> > > > >  	return xhci_gen_setup(hcd, xhci_plat_quirks);
> > > > >  }
> > > > >  
> > > > > @@ -330,6 +323,13 @@ static int xhci_plat_probe(struct platform_device *pdev)
> > > > >  
> > > > >  	hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
> > > > >  	xhci->shared_hcd->tpl_support = hcd->tpl_support;
> > > > > +
> > > > > +	if (priv) {
> > > > > +		ret = xhci_priv_init_quirk(hcd);
> > > > > +		if (ret)
> > > > > +			goto disable_usb_phy;
> > > > > +	}
> > > > > +
> > > > >  	if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
> > > > >  		hcd->skip_phy_initialization = 1;
> > > > >  
> > > > 
> > > > Hi Pali,
> > > > 
> > > > What's problem you have met? In structure xhci_plat_priv, the quirks are
> > > > defined at .quirks entry which is got at below code. .init_quirk is the
> > > > routine if special initializations are needed.
> > > 
> > > Hello!
> > > 
> > > I'm talking about .init_quirk. And if XHCI_SKIP_PHY_INIT quirk is set in
> > > this function then has no effect.
> > 
> > Ok, this patch is not enough, I will send V2.
> > 
> > > I'm working currently on patch for xhci mvebu which conditionally enable
> > > or disable XHCI_SKIP_PHY_INIT quirk (it is going to fix existing
> > > regression since v5.1 kernel) and without this patch XHCI_SKIP_PHY_INIT
> > > quirk from the init_quirk does not work.
> > 
> > And now I have tested V2 with my mvebu regression fix. I will send it to
> > mailing list for review.
> > 
> > > > 	if (pdev->dev.of_node)
> > > > 		priv_match = of_device_get_match_data(&pdev->dev);
> > > > 	else
> > > > 		priv_match = dev_get_platdata(&pdev->dev);
> > > > 
> > > > 	if (priv_match) {
> > > > 		priv = hcd_to_xhci_priv(hcd);
> > > > 		/* Just copy data for now */
> > > > 		*priv = *priv_match;
> > > > 	}
> > > > -- 
> > > > 
> > > > Thanks,
> > > > Peter Chen
> 
> -- 
> 
> Thanks,
> Peter Chen

  reply	other threads:[~2020-12-23  1:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 15:09 [PATCH] usb: host: xhci-plat: fix support for XHCI_SKIP_PHY_INIT quirk Pali Rohár
2020-12-22  2:14 ` Peter Chen
2020-12-22  9:23   ` Pali Rohár
2020-12-22 13:30     ` Pali Rohár
2020-12-23  1:02       ` Peter Chen
2020-12-23  1:04         ` Pali Rohár [this message]
2020-12-23 16:18 ` [PATCH v2] " Pali Rohár
2020-12-24  5:59   ` Peter Chen
2021-01-13 23:20     ` Pali Rohár
2021-01-15 13:32       ` Mathias Nyman
2021-01-25 14:20         ` Pali Rohár
2021-01-26  4:27           ` Yoshihiro Shimoda
2021-01-26  9:06             ` Pali Rohár
2021-02-01 15:11               ` Pali Rohár
2021-02-02  1:17                 ` Yoshihiro Shimoda

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=20201223010410.6q5y3u2kgd2cohu2@pali \
    --to=pali@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jun.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=peter.chen@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.