]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
usb: phy: msm: Fix state machine worker logic for OTG mode.
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fri, 5 Feb 2016 11:50:40 +0000 (11:50 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 13 Apr 2018 14:00:36 +0000 (16:00 +0200)
Issue is that if the board is booted without micro usb cable and usb
device attached, kernel fails to populate the usb host and device.
The reason for this is that the state machine worker logic only checks
for USB_DR_MODE_PERIPHERAL and USB_DR_MODE_HOST modes to run worker
thread. However if the phy is configured in OTG mode it would fail
to run the state machine, resulting in failure to detect for very
first time.

This patch fixes by adding OTG checks in to the logic.

Issue is noticed on Qualcomm Dragon board DB410C.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
(cherry picked from commit 15fddd0d508b672385f4fd6fed33c179a7943c5d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/usb/phy/phy-msm-usb.c

index 2bffa849336c3e730ff9aba16ff952ee8538becd..47cee27e01741363258b107371d94109dd43f6da 100644 (file)
@@ -765,7 +765,8 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
         * Kick the state machine work, if peripheral is not supported
         * or peripheral is already registered with us.
         */
-       if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) {
+       if (motg->pdata->mode == USB_DR_MODE_HOST ||
+                       motg->pdata->mode == USB_DR_MODE_OTG || otg->gadget) {
                pm_runtime_get_sync(otg->usb_phy->dev);
                schedule_work(&motg->sm_work);
        }
@@ -835,7 +836,8 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
         * Kick the state machine work, if host is not supported
         * or host is already registered with us.
         */
-       if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) {
+       if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL ||
+               motg->pdata->mode == USB_DR_MODE_OTG || otg->host) {
                pm_runtime_get_sync(otg->usb_phy->dev);
                schedule_work(&motg->sm_work);
        }