usb: chipidea: update ci_otg_is_fsm_mode conditions
authorLi Jun <jun.li@freescale.com>
Thu, 9 Jul 2015 07:18:46 +0000 (15:18 +0800)
committerFelipe Balbi <balbi@ti.com>
Wed, 29 Jul 2015 14:59:21 +0000 (09:59 -0500)
After introduce usb otg properties, update ci_otg_is_fsm_mode conditions
to be depending on both usb hardware properties and usb driver config,
also resolve a compile issue in debug.c after the API change.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/chipidea/ci.h
drivers/usb/chipidea/debug.c

index 6d6200e37b71e02b0e0d4a67cdd35f160f61de3b..f243f0b431c33e40e5b8130901dbb3cae9daf2e4 100644 (file)
@@ -406,8 +406,11 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
 static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
 {
 #ifdef CONFIG_USB_OTG_FSM
+       struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
+
        return ci->is_otg && ci->roles[CI_ROLE_HOST] &&
-                                       ci->roles[CI_ROLE_GADGET];
+               ci->roles[CI_ROLE_GADGET] && (otg_caps->srp_support ||
+               otg_caps->hnp_support || otg_caps->adp_support);
 #else
        return false;
 #endif
index 5b7061a331038d36ad20b7ec3c05b2ab1f8b3efc..3869c6d755156cf5fc00c3cee26e5f39a9a3e92f 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/usb/phy.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/otg-fsm.h>
+#include <linux/usb/chipidea.h>
 
 #include "ci.h"
 #include "udc.h"