usb: chipidea: add ci->is_otg condition for otg judgement
authorLi Jun <jun.li@freescale.com>
Fri, 31 Jul 2015 02:41:00 +0000 (10:41 +0800)
committerFelipe Balbi <balbi@ti.com>
Mon, 3 Aug 2015 15:02:46 +0000 (10:02 -0500)
Since some chipidea based controller is not otg capable, add ci->is_otg
condition when setting is_otg flag for gadget.

Signed-off-by: Li Jun <jun.li@freescale.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/chipidea/udc.c

index b7cca3e597bf30aed3c1f8e924d4e8f5859ba448..f5fbe78e8e6af2c3ec8e61786c628b7d72516c52 100644 (file)
@@ -1838,8 +1838,8 @@ static int udc_start(struct ci_hdrc *ci)
        ci->gadget.name         = ci->platdata->name;
        ci->gadget.otg_caps     = otg_caps;
 
-       if (otg_caps->hnp_support || otg_caps->srp_support ||
-                                       otg_caps->adp_support)
+       if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support ||
+                                               otg_caps->adp_support))
                ci->gadget.is_otg = 1;
 
        INIT_LIST_HEAD(&ci->gadget.ep_list);