diff mbox

[usb-next] usb: xhci: skip phys initialization of shared hcd

Message ID 1ece0d5508a00bca67d16e64310a071646b59c7d.1521612280.git.chunfeng.yun@mediatek.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chunfeng Yun (云春峰) March 21, 2018, 6:12 a.m. UTC
The phys has already been initialized when add primary hcd,
including usb2 phys and usb3 phys also if exist, so needn't
re-parse "phys" property again.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c  | 1 +
 drivers/usb/host/xhci-plat.c | 1 +
 2 files changed, 2 insertions(+)

Comments

Roger Quadros March 21, 2018, 9:05 a.m. UTC | #1
Hi Chunfeng,

On 21/03/18 08:12, Chunfeng Yun wrote:
> The phys has already been initialized when add primary hcd,
> including usb2 phys and usb3 phys also if exist, so needn't
> re-parse "phys" property again.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>  drivers/usb/host/xhci-mtk.c  | 1 +
>  drivers/usb/host/xhci-plat.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 7334da9..6bb23fb 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -554,6 +554,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
>  	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
>  		xhci->shared_hcd->can_do_streams = 1;
>  
> +	xhci->shared_hcd->skip_phy_initialization = 1;
>  	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
>  	if (ret)
>  		goto dealloc_usb2_hcd;
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 6700e5e..65a4294 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -294,6 +294,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
>  		xhci->shared_hcd->can_do_streams = 1;
>  
> +	xhci->shared_hcd->skip_phy_initialization = 1;

I think this is unnecessary.
There aren't separate PHYs for the primary and shared HCDs right?

Also how can you be sure that phy_init() has been done for all platform HCD users?

>  	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
>  	if (ret)
>  		goto dealloc_usb2_hcd;
>
Chunfeng Yun (云春峰) March 21, 2018, 11:50 a.m. UTC | #2
Hi Roger,

On Wed, 2018-03-21 at 11:05 +0200, Roger Quadros wrote:
> Hi Chunfeng,
> 
> On 21/03/18 08:12, Chunfeng Yun wrote:
> > The phys has already been initialized when add primary hcd,
> > including usb2 phys and usb3 phys also if exist, so needn't
> > re-parse "phys" property again.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >  drivers/usb/host/xhci-mtk.c  | 1 +
> >  drivers/usb/host/xhci-plat.c | 1 +
> >  2 files changed, 2 insertions(+)
> > 
> > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> > index 7334da9..6bb23fb 100644
> > --- a/drivers/usb/host/xhci-mtk.c
> > +++ b/drivers/usb/host/xhci-mtk.c
> > @@ -554,6 +554,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
> >  	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
> >  		xhci->shared_hcd->can_do_streams = 1;
> >  
> > +	xhci->shared_hcd->skip_phy_initialization = 1;
> >  	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> >  	if (ret)
> >  		goto dealloc_usb2_hcd;
> > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> > index 6700e5e..65a4294 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -294,6 +294,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
> >  	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
> >  		xhci->shared_hcd->can_do_streams = 1;
> >  
> > +	xhci->shared_hcd->skip_phy_initialization = 1;
> 
> I think this is unnecessary.
> There aren't separate PHYs for the primary and shared HCDs right?
Yes, the primary and shared HCDs will get the same PHYs provided by
"phys" property.

> 
> Also how can you be sure that phy_init() has been done for all platform HCD users?
Here I assume that "phys" and "usb-phy" properties are not used at the
same time. There are two cases:
1. Using "usb-phy": no "phys" to be got by shared HCD.
2. Using "phys": the primary HCD will get those phys, so shared HCD can
skip them.

> 
> >  	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> >  	if (ret)
> >  		goto dealloc_usb2_hcd;
> > 
>
diff mbox

Patch

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 7334da9..6bb23fb 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -554,6 +554,7 @@  static int xhci_mtk_probe(struct platform_device *pdev)
 	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
 		xhci->shared_hcd->can_do_streams = 1;
 
+	xhci->shared_hcd->skip_phy_initialization = 1;
 	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
 	if (ret)
 		goto dealloc_usb2_hcd;
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 6700e5e..65a4294 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -294,6 +294,7 @@  static int xhci_plat_probe(struct platform_device *pdev)
 	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
 		xhci->shared_hcd->can_do_streams = 1;
 
+	xhci->shared_hcd->skip_phy_initialization = 1;
 	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
 	if (ret)
 		goto dealloc_usb2_hcd;