usb: hcd: Initialize USB phy if needed
PATCH 3/9 usb: hcd: Initialize USB phy if needed
From: Valentine Barshak <[email protected]>
This adds external USB phy support to USB HCD driver that allows to find and initialize external USB phy, bound to the HCD, when the HCD is added.
The usb_add_hcd function returns -EPROBE_DEFER if the USB phy, bound to the HCD, is not ready.
If no USB phy is bound, the HCD is initialized as usual.
--- drivers/usb/core/hcd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/usb/core/hcd.c +20 -0
@@ -2597,6 +2597,26 @@ int usb_add_hcd(struct usb_hcd *hcd,int retval;struct usb_device *rhdev; +#ifdef CONFIG_USB_PHY +if (!hcd->phy) { +struct usb_phy *phy =usb_get_phy_dev (hcd->self.controller,0 ); + +if (IS_ERR (phy)) { + retval =PTR_ERR (phy); +if (retval = -EPROBE_DEFER ) +return retval; + }else { + retval =usb_phy_init (phy); +if (retval) { +usb_put_phy (phy); +return retval; + } + hcd->phy = phy; + hcd->remove_phy =1 ; + } + } +#endif +dev_info (hcd->self.controller,"%s\n" , hcd->product_desc);/* Keep old behaviour if authorized_default is not in [0, 1]. */
Signature · 1 line
1.8.4
Quoted 20 lines · Ulrich Hecht
From: Valentine Barshak <[email protected]>
This adds external USB phy support to USB HCD driver that allows to find and initialize external USB phy, bound to the HCD, when the HCD is added.
Theusb_add_hcdfunction returns -EPROBE_DEFER if the USB phy, bound to the HCD, is not ready.
If no USB phy is bound, the HCD is initialized as usual.Signed-off-by Valentine Barshak <[email protected]>Acked-by Alan Stern <[email protected]>--- drivers/usb/core/hcd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/usb/core/hcd.c +0
-0
drivers/usb/core/hcd.c int usb_add_hcd(struct usb_hcd *hcd, · line 2602
Quoted 6 lines
drivers/usb/core/hcd.c +3
-0@@ -2597,6 +2597,26 @@ int usb_add_hcd(struct usb_hcd *hcd,int retval;struct usb_device *rhdev; +#ifdef CONFIG_USB_PHY +if (!hcd->phy) { +struct usb_phy *phy =usb_get_phy_dev (hcd->self.controller,0 );
Wouldn't it be better to use the following instead?
if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->(phy) {Regards,
Fabio Estevam
Quoted 27 lines
drivers/usb/core/hcd.c +17
-1+ +if (IS_ERR (phy)) { + retval =PTR_ERR (phy); +if (retval = -EPROBE_DEFER ) +return retval; + }else { + retval =usb_phy_init (phy); +if (retval) { +usb_put_phy (phy); +return retval; + } + hcd->phy = phy; + hcd->remove_phy =1 ; + } + } +#endif +dev_info (hcd->self.controller,"%s\n" , hcd->product_desc);/* Keep old behaviour if authorized_default is not in [0, 1]. */ --1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Fabio Estevam
Quoted 23 lines · Ulrich Hecht
From: Valentine Barshak <[email protected]>
This adds external USB phy support to USB HCD driver that allows to find and initialize external USB phy, bound to the HCD, when the HCD is added.
Theusb_add_hcdfunction returns -EPROBE_DEFER if the USB phy, bound to the HCD, is not ready.
If no USB phy is bound, the HCD is initialized as usual.Signed-off-by Valentine Barshak <[email protected]>Acked-by Alan Stern <[email protected]>--- drivers/usb/core/hcd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/usb/core/hcd.c +0
-0@@ -2597,6 +2597,26 @@ int usb_add_hcd(struct usb_hcd *hcd,int retval;struct usb_device *rhdev;
Quoted 7 lines
drivers/usb/core/hcd.c int usb_add_hcd(struct usb_hcd *hcd, · line 2602
Quoted 3 lines
drivers/usb/core/hcd.c +3
-0+#ifdef CONFIG_USB_PHY +if (!hcd->phy) { +struct usb_phy *phy =usb_get_phy_dev (hcd->self.controller,0 );Wouldn't it be better to use the following instead?
if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->(phy) {
Since USB_PHY is a bool I don't see much of a difference.
Quoted 4 lines
Regards,
Fabio Estevam
Thanks,
Val.
Quoted 28 lines
Quoted 28 lines
drivers/usb/core/hcd.c +17
-1+ +if (IS_ERR (phy)) { + retval =PTR_ERR (phy); +if (retval = -EPROBE_DEFER ) +return retval; + }else { + retval =usb_phy_init (phy); +if (retval) { +usb_put_phy (phy); +return retval; + } + hcd->phy = phy; + hcd->remove_phy =1 ; + } + } +#endif +dev_info (hcd->self.controller,"%s\n" , hcd->product_desc);/* Keep old behaviour if authorized_default is not in [0, 1]. */ --1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 31 lines · Valentine
Quoted 30 lines · Fabio Estevam
Quoted 20 lines · Ulrich Hecht
From: Valentine Barshak <[email protected]>
This adds external USB phy support to USB HCD driver that allows to find and initialize external USB phy, bound to the HCD, when the HCD is added.
Theusb_add_hcdfunction returns -EPROBE_DEFER if the USB phy, bound to the HCD, is not ready.
If no USB phy is bound, the HCD is initialized as usual.Signed-off-by Valentine Barshak <[email protected]>Acked-by Alan Stern <[email protected]>--- drivers/usb/core/hcd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)drivers/usb/core/hcd.c +0
-0drivers/usb/core/hcd.c int usb_add_hcd(struct usb_hcd *hcd, · line 2602
Quoted 6 lines
drivers/usb/core/hcd.c +3
-0@@ -2597,6 +2597,26 @@ int usb_add_hcd(struct usb_hcd *hcd,int retval;struct usb_device *rhdev; +#ifdef CONFIG_USB_PHY +if (!hcd->phy) { +struct usb_phy *phy =usb_get_phy_dev (hcd->self.controller,0 );Wouldn't it be better to use the following instead?
Quoted 3 lines
Quoted 1 line
if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->(phy) {Since
USB_PHYis a bool I don't see much of a difference.
The difference is that IS_ENABLED() is thought to be less ugly than #ifdef. For this reason I agree with Fabio's comment.
Quoted 38 lines
Quoted 5 lines
Regards,
Fabio Estevam
Thanks,
Val.Quoted 28 lines
Quoted 28 lines
drivers/usb/core/hcd.c +17
-1+ +if (IS_ERR (phy)) { + retval =PTR_ERR (phy); +if (retval = -EPROBE_DEFER ) +return retval; + }else { + retval =usb_phy_init (phy); +if (retval) { +usb_put_phy (phy); +return retval; + } + hcd->phy = phy; + hcd->remove_phy =1 ; + } + } +#endif +dev_info (hcd->self.controller,"%s\n" , hcd->product_desc);/* Keep old behaviour if authorized_default is not in [0, 1]. */ --1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html