usb: host: xhci: plat: add support for otg_set_host() call
Subsystems (2)
RFC PATCH 1/1 usb: host: xhci: plat: add support for otg_set_host() call
This patch will add support for OTG host initialization. This will help OTG drivers to populate their host subsystem.
--- drivers/usb/host/xhci-plat.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/usb/host/xhci-plat.c +39 -0
@@ -19,6 +19,7 @@#include <linux/usb/phy.h> #include <linux/slab.h> #include <linux/acpi.h> +#include <linux/usb/otg.h> #include "xhci.h" #include "xhci-plat.h"
@@ -144,6 +145,37 @@ static const struct of_device_id usb_xhci_of_match[] = {MODULE_DEVICE_TABLE (of, usb_xhci_of_match);#endif +static int usb_otg_set_host (struct device *dev,struct usb_hcd *hcd,bool yes) +{ +int ret =0 ; + + hcd->usb_phy =usb_get_phy (USB_PHY_TYPE_USB3 ); +if (!IS_ERR_OR_NULL (hcd->usb_phy) && hcd->usb_phy->otg) { +dev_dbg (dev,"%s otg support available\n" , __func__); +if (yes) { +if (otg_set_host (hcd->usb_phy->otg, &hcd->self)) { +dev_err (dev,"%s otg_set_host failed\n" , + __func__); +usb_put_phy (hcd->usb_phy); + goto disable_phy; + } + }else { + ret =otg_set_host (hcd->usb_phy->otg,NULL ); +usb_put_phy (hcd->usb_phy); + goto disable_phy; + } + + }else + goto disable_phy; + +return 0 ; + +disable_phy: + hcd->usb_phy =NULL ; + +return ret; +} +static int xhci_plat_probe (struct platform_device *pdev) {const struct of_device_id *match;
@@ -255,6 +287,11 @@ static int xhci_plat_probe(struct platform_device *pdev)if (ret) goto dealloc_usb2_hcd; + ret =usb_otg_set_host (&pdev->dev, hcd,1 ); +if (ret) + goto dealloc_usb2_hcd; + +return 0 ;
@@ -283,6 +320,8 @@ static int xhci_plat_remove(struct platform_device *dev)struct xhci_hcd *xhci =hcd_to_xhci (hcd);struct clk *clk = xhci->clk; +usb_otg_set_host (&dev->dev, hcd,0 ); +usb_remove_hcd (xhci->shared_hcd);usb_phy_shutdown (hcd->usb_phy);
Signature · 1 line
2.1.1
Ping !!
-----Original Message-----
From: Manish Narani [mailto:[email protected]]
Sent: Thursday, December 15, 2016 1:24 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: Anurag Kumar Vulisha <[email protected]>; Punnaiah Choudary Kalluri <[email protected]>; Anirudha Sarangi <[email protected]>; Manish Narani <[email protected]>
Subject: [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call
This patch will add support for OTG host initialization. This will help OTG drivers to populate their host subsystem.
--- drivers/usb/host/xhci-plat.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/usb/host/xhci-plat.c +39 -0
@@ -19,6 +19,7 @@#include <linux/usb/phy.h> #include <linux/slab.h> #include <linux/acpi.h> +#include <linux/usb/otg.h> #include "xhci.h" #include "xhci-plat.h"
@@ -144,6 +145,37 @@ static const struct of_device_id usb_xhci_of_match[] = { MODULE_DEVICE_TABLE(of, usb_xhci_of_match); #endif +static int usb_otg_set_host (struct device *dev,struct usb_hcd *hcd, +bool yes) { +int ret =0 ; + + hcd->usb_phy =usb_get_phy (USB_PHY_TYPE_USB3 ); +if (!IS_ERR_OR_NULL (hcd->usb_phy) && hcd->usb_phy->otg) { +dev_dbg (dev,"%s otg support available\n" , __func__); +if (yes) { +if (otg_set_host (hcd->usb_phy->otg, &hcd->self)) { +dev_err (dev,"%s otg_set_host failed\n" , + __func__); +usb_put_phy (hcd->usb_phy); + goto disable_phy; + } + }else { + ret =otg_set_host (hcd->usb_phy->otg,NULL ); +usb_put_phy (hcd->usb_phy); + goto disable_phy; + } + + }else + goto disable_phy; + +return 0 ; + +disable_phy: + hcd->usb_phy =NULL ; + +return ret; +} +static int xhci_plat_probe (struct platform_device *pdev) {const struct of_device_id *match;
@@ -255,6 +287,11 @@ static int xhci_plat_probe(struct platform_device *pdev)if (ret) goto dealloc_usb2_hcd; + ret =usb_otg_set_host (&pdev->dev, hcd,1 ); +if (ret) + goto dealloc_usb2_hcd; + +return 0 ;
@@ -283,6 +320,8 @@ static int xhci_plat_remove(struct platform_device *dev)struct xhci_hcd *xhci =hcd_to_xhci (hcd);struct clk *clk = xhci->clk; +usb_otg_set_host (&dev->dev, hcd,0 ); +usb_remove_hcd (xhci->shared_hcd);usb_phy_shutdown (hcd->usb_phy);
--
2.1.1
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
[email protected]
maintainerQuoted 10 lines · Manish Narani
Ping !!
-----Original Message-----
From: Manish Narani [mailto:[email protected]]
Sent: Thursday, December 15, 2016 1:24 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: Anurag Kumar Vulisha <[email protected]>; Punnaiah Choudary Kalluri <[email protected]>; Anirudha Sarangi <[email protected]>; Manish Narani <[email protected]>
Subject: [RFC PATCH] usb: host: xhci: plat: add support forotg_set_host()callThis patch will add support for OTG host initialization. This will help OTG drivers to populate their host subsystem.
Don't add new infrastructure that is not used at all :(
Hi Greg,
I need to have this infrastructure while implementing DWC3 OTG driver. The current scenario is that we are using xHCI drivers with High-Speed OTG because DWC3 uses xHCI framework. So I wanted to confirm that before adding DWC3 OTG driver, this support should be already there. I am planning to add DWC3 OTG driver after this patch is added.
Please let me know your valuable suggestions on this.
Thanks,
Manish
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, January 02, 2017 2:53 PM
To: Manish Narani <[email protected]>
Cc: Manish Narani <[email protected]>; [email protected]; [email protected]; [email protected]; Anurag Kumar Vulisha <[email protected]>; Punnaiah Choudary Kalluri <[email protected]>; Anirudha Sarangi <[email protected]>
Subject: Re: [RFC PATCH] usb: host: xhci: plat: add support for otg_set_host() call
Quoted 10 lines · Manish Narani
Ping !!
-----Original Message-----
From: Manish Narani [mailto:[email protected]]
Sent: Thursday, December 15, 2016 1:24 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: Anurag Kumar Vulisha <[email protected]>; Punnaiah Choudary Kalluri <[email protected]>; Anirudha Sarangi <[email protected]>; Manish Narani <[email protected]>
Subject: [RFC PATCH] usb: host: xhci: plat: add support forotg_set_host()callThis patch will add support for OTG host initialization. This will help OTG drivers to populate their host subsystem.
Don't add new infrastructure that is not used at all :(
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
[email protected]
maintainerQ: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
Quoted 10 lines · Manish Narani
Hi Greg,
I need to have this infrastructure while implementing DWC3 OTG driver. The current scenario is that we are using xHCI drivers with High-Speed OTG because DWC3 uses xHCI framework. So I wanted to confirm that before adding DWC3 OTG driver, this support should be already there. I am planning to add DWC3 OTG driver after this patch is added.
Please let me know your valuable suggestions on this.
Post your whole series, that shows how you are using the new infrastructure, otherwise how are we supposed to know this?
thanks,
greg k-h