* [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support
@ 2023-04-07 6:07 Stanley Chang
2023-05-09 17:33 ` Klaus Kudielka
0 siblings, 1 reply; 5+ messages in thread
From: Stanley Chang @ 2023-04-07 6:07 UTC (permalink / raw)
To: Mathias Nyman; +Cc: linux-usb
For Realtek SoC, the usb xhci uses different driver for u2phy and u3phy.
Therefore, add a hook to retrieve the USB 3.0 PHY to XHCI plat.
Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
---
drivers/usb/host/xhci-plat.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index b9f9625467d6..61c95349b998 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
goto dealloc_usb2_hcd;
}
+ xhci->shared_hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev,
+ "usb-phy", 1);
+ if (IS_ERR(xhci->shared_hcd->usb_phy)) {
+ if (PTR_ERR(xhci->shared_hcd->usb_phy) != -ENODEV)
+ dev_err(sysdev, "%s get usb3phy fail (ret=%d)\n",
+ __func__,
+ (int)PTR_ERR(xhci->shared_hcd->usb_phy));
+ xhci->shared_hcd->usb_phy = NULL;
+ } else {
+ ret = usb_phy_init(xhci->shared_hcd->usb_phy);
+ if (ret)
+ dev_err(sysdev, "%s init usb3phy fail (ret=%d)\n",
+ __func__, ret);
+ }
+
xhci->shared_hcd->tpl_support = hcd->tpl_support;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support
2023-04-07 6:07 [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support Stanley Chang
@ 2023-05-09 17:33 ` Klaus Kudielka
2023-05-10 3:16 ` Stanley Chang[昌育德]
0 siblings, 1 reply; 5+ messages in thread
From: Klaus Kudielka @ 2023-05-09 17:33 UTC (permalink / raw)
To: Stanley Chang, Mathias Nyman; +Cc: linux-usb
On Fri, 2023-04-07 at 14:07 +0800, Stanley Chang wrote:
> For Realtek SoC, the usb xhci uses different driver for u2phy and u3phy.
> Therefore, add a hook to retrieve the USB 3.0 PHY to XHCI plat.
>
> Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
> ---
> drivers/usb/host/xhci-plat.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index b9f9625467d6..61c95349b998 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
> goto dealloc_usb2_hcd;
> }
>
> + xhci->shared_hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev,
> + "usb-phy", 1);
> + if (IS_ERR(xhci->shared_hcd->usb_phy)) {
> + if (PTR_ERR(xhci->shared_hcd->usb_phy) != -ENODEV)
> + dev_err(sysdev, "%s get usb3phy fail (ret=%d)\n",
Hello,
I'm booting 6.4-rc1 on a Turris Omnia (arm/boot/dts/armada-385-turris-omnia.dts)
and get those error messages:
[ 0.231609] xhci-hcd f10f0000.usb3: xhci_plat_probe get usb3phy fail (ret=-6)
[ 0.239716] xhci-hcd f10f8000.usb3: xhci_plat_probe get usb3phy fail (ret=-6)
It looks like a cosmetic issue with error codes, but maybe it can be fixed?
> + __func__,
> + (int)PTR_ERR(xhci->shared_hcd->usb_phy));
> + xhci->shared_hcd->usb_phy = NULL;
> + } else {
> + ret = usb_phy_init(xhci->shared_hcd->usb_phy);
> + if (ret)
> + dev_err(sysdev, "%s init usb3phy fail (ret=%d)\n",
> + __func__, ret);
> + }
> +
> xhci->shared_hcd->tpl_support = hcd->tpl_support;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support
2023-05-09 17:33 ` Klaus Kudielka
@ 2023-05-10 3:16 ` Stanley Chang[昌育德]
2023-05-10 6:11 ` Klaus Kudielka
0 siblings, 1 reply; 5+ messages in thread
From: Stanley Chang[昌育德] @ 2023-05-10 3:16 UTC (permalink / raw)
To: Klaus Kudielka, Mathias Nyman; +Cc: linux-usb@vger.kernel.org
Hi Klaus,
> > diff --git a/drivers/usb/host/xhci-plat.c
> > b/drivers/usb/host/xhci-plat.c index b9f9625467d6..61c95349b998 100644
> > --- a/drivers/usb/host/xhci-plat.c
> > +++ b/drivers/usb/host/xhci-plat.c
> > @@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev,
> struct device *sysdev, const s
> > goto dealloc_usb2_hcd;
> > }
> >
> > + xhci->shared_hcd->usb_phy =
> devm_usb_get_phy_by_phandle(sysdev,
> > + "usb-phy", 1);
> > + if (IS_ERR(xhci->shared_hcd->usb_phy)) {
> > + if (PTR_ERR(xhci->shared_hcd->usb_phy) !=
> -ENODEV)
> > + dev_err(sysdev, "%s get usb3phy fail
> > + (ret=%d)\n",
>
> Hello,
>
> I'm booting 6.4-rc1 on a Turris Omnia
> (arm/boot/dts/armada-385-turris-omnia.dts)
> and get those error messages:
> [ 0.231609] xhci-hcd f10f0000.usb3: xhci_plat_probe get usb3phy fail
> (ret=-6)
> [ 0.239716] xhci-hcd f10f8000.usb3: xhci_plat_probe get usb3phy fail
> (ret=-6)
>
> It looks like a cosmetic issue with error codes, but maybe it can be fixed?
>
1. I checked arm/boot/dts/armada-385-turris-omnia.dts.
The xhci node doesn't seem to have usb-phy.
In this case it should get error code -ENODEV (-19).
I'm not sure why the error code is -ENXIO (-6).
Can you provide more details?
2. This error message will be printed only when getting the usb3 phy fails.
And usb_phy set to NULL, It does not affect the original behavior.
Maybe I'm missing checking -ENXIO or some other error code.
I can delete this log according to usb2 phy situation.
Thanks,
Stanley
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support
2023-05-10 3:16 ` Stanley Chang[昌育德]
@ 2023-05-10 6:11 ` Klaus Kudielka
2023-05-10 6:25 ` Stanley Chang[昌育德]
0 siblings, 1 reply; 5+ messages in thread
From: Klaus Kudielka @ 2023-05-10 6:11 UTC (permalink / raw)
To: Stanley Chang[昌育德], Mathias Nyman
Cc: linux-usb@vger.kernel.org
On 10.05.2023 05:16, Stanley Chang[昌育德] wrote:
> Hi Klaus,
>
>>
>> I'm booting 6.4-rc1 on a Turris Omnia
>> (arm/boot/dts/armada-385-turris-omnia.dts)
>> and get those error messages:
>> [ 0.231609] xhci-hcd f10f0000.usb3: xhci_plat_probe get usb3phy fail
>> (ret=-6)
>> [ 0.239716] xhci-hcd f10f8000.usb3: xhci_plat_probe get usb3phy fail
>> (ret=-6)
>>
>> It looks like a cosmetic issue with error codes, but maybe it can be fixed?
>>
> 1. I checked arm/boot/dts/armada-385-turris-omnia.dts.
> The xhci node doesn't seem to have usb-phy.
> In this case it should get error code -ENODEV (-19).
> I'm not sure why the error code is -ENXIO (-6).
> Can you provide more details?
I have CONFIG_USB_PHY disabled. In that case, devm_usb_get_phy_by_phandle
is declared static inline and returns -ENXIO. See include/linux/usb/phy.h.
> 2. This error message will be printed only when getting the usb3 phy fails.
> And usb_phy set to NULL, It does not affect the original behavior.
> Maybe I'm missing checking -ENXIO or some other error code.
> I can delete this log according to usb2 phy situation.
Checking for -ENXIO in addition to -ENODEV would cover the !CONFIG_USB_PHY
case, I guess. Whether there are other "false alarm" cases, I don't know.
> Thanks,
> Stanley
Best regards, Klaus
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support
2023-05-10 6:11 ` Klaus Kudielka
@ 2023-05-10 6:25 ` Stanley Chang[昌育德]
0 siblings, 0 replies; 5+ messages in thread
From: Stanley Chang[昌育德] @ 2023-05-10 6:25 UTC (permalink / raw)
To: Klaus Kudielka, Mathias Nyman; +Cc: linux-usb@vger.kernel.org
> >>
> >> I'm booting 6.4-rc1 on a Turris Omnia
> >> (arm/boot/dts/armada-385-turris-omnia.dts)
> >> and get those error messages:
> >> [ 0.231609] xhci-hcd f10f0000.usb3: xhci_plat_probe get usb3phy fail
> >> (ret=-6)
> >> [ 0.239716] xhci-hcd f10f8000.usb3: xhci_plat_probe get usb3phy fail
> >> (ret=-6)
> >>
> >> It looks like a cosmetic issue with error codes, but maybe it can be fixed?
> >>
> > 1. I checked arm/boot/dts/armada-385-turris-omnia.dts.
> > The xhci node doesn't seem to have usb-phy.
> > In this case it should get error code -ENODEV (-19).
> > I'm not sure why the error code is -ENXIO (-6).
> > Can you provide more details?
>
> I have CONFIG_USB_PHY disabled. In that case,
> devm_usb_get_phy_by_phandle is declared static inline and returns -ENXIO.
> See include/linux/usb/phy.h.
>
> > 2. This error message will be printed only when getting the usb3 phy fails.
> > And usb_phy set to NULL, It does not affect the original behavior.
> > Maybe I'm missing checking -ENXIO or some other error code.
> > I can delete this log according to usb2 phy situation.
>
> Checking for -ENXIO in addition to -ENODEV would cover
> the !CONFIG_USB_PHY case, I guess. Whether there are other "false alarm"
> cases, I don't know.
>
Okay, I will remove this log message.
I think using the log in drivers/usb/phy/phy.c can easy to debug error case.
Thanks,
Stanley
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-10 6:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-07 6:07 [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support Stanley Chang
2023-05-09 17:33 ` Klaus Kudielka
2023-05-10 3:16 ` Stanley Chang[昌育德]
2023-05-10 6:11 ` Klaus Kudielka
2023-05-10 6:25 ` Stanley Chang[昌育德]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox