usb: xhci: plat: Add USB 3.0 phy support
Subsystems (2)
PATCH 1/1 usb: xhci: plat: Add USB 3.0 phy support
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.
--- drivers/usb/host/xhci-plat.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/usb/host/xhci-plat.c +15 -0
@@ -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; }
Signature · 1 line
2.34.1
Quoted 15 lines · Stanley Chang
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 <[email protected]>---
drivers/usb/host/xhci-plat.c | 15 +++++++++++++++1 file changed, 15 insertions(+)drivers/usb/host/xhci-plat.c +0
-0@@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s goto dealloc_usb2_hcd; }
Quoted 6 lines
+ 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?
Quoted 13 lines
+
__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;
}
Hi Klaus,
Quoted 23 lines
drivers/usb/host/xhci-plat.c int xhci_plat_probe(struct platform_device *pdev,
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/usb/host/xhci-plat.cindexb9f9625467d6..61c95349b998100644drivers/usb/host/xhci-plat.c +0
-0@@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev,struct device *sysdev, const s
drivers/usb/host/xhci-plat.c int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
Quoted 4 lines
drivers/usb/host/xhci-plat.c +1
-0goto dealloc_usb2_hcd; } + xhci->shared_hcd->usb_phy =devm_usb_get_phy_by_phandle(sysdev,
drivers/usb/host/xhci-plat.c int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
Quoted 3 lines
drivers/usb/host/xhci-plat.c +3
-0+ "usb-phy", 1); +if (IS_ERR (xhci->shared_hcd->usb_phy)) { + if (PTR_ERR(xhci->shared_hcd->usb_phy) !=
-ENODEV)drivers/usb/host/xhci-plat.c int xhci_plat_probe(struct platform_device *pdev, · line 299
Quoted 2 lines
drivers/usb/host/xhci-plat.c +2
-0+ 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:
Quoted 7 lines
[ 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
Quoted 11 lines · Stanley Chang[昌育德]
Hi Klaus,
Quoted 9 lines
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)
Quoted 7 lines
Quoted 2 lines
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.
Quoted 4 lines
2. This error message will be printed only when getting the usb3 phy fails. And
usb_physet to NULL, It does not affect the original behavior. Maybe I'm missing checking-ENXIOor 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.
Quoted 2 lines
Thanks,
Stanley
Best regards, Klaus
Quoted 21 lines
Quoted 9 lines
Quoted 9 lines
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)
Quoted 7 lines
Quoted 2 lines
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_PHYdisabled. In that case,devm_usb_get_phy_by_phandleis declared static inline and returns-ENXIO. Seeinclude/linux/usb/phy.h.
Quoted 9 lines
Quoted 4 lines
2. This error message will be printed only when getting the usb3 phy fails. And
usb_physet to NULL, It does not affect the original behavior. Maybe I'm missing checking-ENXIOor some other error code.
I can delete this log according to usb2 phy situation.Checking for
-ENXIOin addition to-ENODEVwould 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