From: Gregory Herrero <gregory.herr...@intel.com>

Bind peripheral controller to the phy on udc_start. Unbind on
udc_stop.

Signed-off-by: Gregory Herrero <gregory.herr...@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kau...@intel.com>
---
 drivers/usb/dwc2/gadget.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 1a8e0a6..b5332f0 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2878,6 +2878,8 @@ static int s3c_hsotg_udc_start(struct usb_gadget *gadget,
        }
 
        s3c_hsotg_phy_enable(hsotg);
+       if (!IS_ERR_OR_NULL(hsotg->uphy))
+               otg_set_peripheral(hsotg->uphy->otg, &hsotg->gadget);
 
        spin_lock_irqsave(&hsotg->lock, flags);
        s3c_hsotg_init(hsotg);
@@ -2927,6 +2929,8 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget)
 
        spin_unlock_irqrestore(&hsotg->lock, flags);
 
+       if (!IS_ERR_OR_NULL(hsotg->uphy))
+               otg_set_peripheral(hsotg->uphy->otg, NULL);
        s3c_hsotg_phy_disable(hsotg);
 
        regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to