]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
usb: dwc3: host: add support for OTG in DWC3 host driver
authorManish Narani <manish.narani@xilinx.com>
Fri, 27 Jan 2017 10:06:12 +0000 (15:36 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 30 Jan 2017 10:09:08 +0000 (11:09 +0100)
This patch adds support for OTG host mode initialization in DWC3
host driver. Before the host initialization sequence begins. The
driver has to make sure the no OTG peripheral mode is enabled.

This sequence is executed before the OTG driver actually senses
the ID and takes up the respective role (A or B device).

Signed-off-by: Manish Narani <mnarani@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/dwc3/host.c

index f6533c68fed1e0dcc73b1af4b2f7948a6313fb7e..17fe51a81c5eeb200fb276a568aa0ff75c93921e 100644 (file)
@@ -103,6 +103,17 @@ int dwc3_host_init(struct dwc3 *dwc)
        phy_create_lookup(dwc->usb3_generic_phy, "usb3-phy",
                          dev_name(&xhci->dev));
 
+       if (dwc->dr_mode == USB_DR_MODE_OTG) {
+               struct usb_phy *phy;
+               phy = usb_get_phy(USB_PHY_TYPE_USB3);
+               if (!IS_ERR(phy)) {
+                       if (phy && phy->otg)
+                               otg_set_host(phy->otg,
+                                               (struct usb_bus *)(long)1);
+                       usb_put_phy(phy);
+               }
+       }
+
        ret = platform_device_add(xhci);
        if (ret) {
                dev_err(dwc->dev, "failed to register xHCI device\n");