These states are not all otg specific, and they stands for
general usb state.

Signed-off-by: Peter Chen <[email protected]>
---
 drivers/usb/otg/isp1301_omap.c |    4 ++--
 drivers/usb/otg/otg.c          |   12 +++++++-----
 drivers/usb/otg/otg_fsm.c      |    6 +++---
 include/linux/usb/msm_hsusb.h  |    2 +-
 include/linux/usb/otg.h        |    4 ++--
 include/linux/usb/phy.h        |   18 ++++++++++--------
 6 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index 7a88667..3169b0e 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -415,7 +415,7 @@ dump_regs(struct isp1301 *isp, const char *label)
 
 static void check_state(struct isp1301 *isp, const char *tag)
 {
-       enum usb_otg_state      state = OTG_STATE_UNDEFINED;
+       enum usb_state  state = OTG_STATE_UNDEFINED;
        u8                      fsm = omap_readw(OTG_TEST) & 0x0ff;
        unsigned                extra = 0;
 
@@ -951,7 +951,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 {
        struct usb_otg          *otg = isp->phy.otg;
        u8                      isp_stat, isp_bstat;
-       enum usb_otg_state      state = isp->phy.state;
+       enum usb_state  state = isp->phy.state;
 
        if (stat & INTR_BDIS_ACON)
                pr_debug("OTG:  BDIS_ACON, %s\n", state_name(isp));
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index a30c041..4a91b18 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -201,7 +201,7 @@ void usb_remove_phy(struct usb_phy *x)
 }
 EXPORT_SYMBOL(usb_remove_phy);
 
-const char *otg_state_string(enum usb_otg_state state)
+const char *otg_state_string(enum usb_state state)
 {
        switch (state) {
        case OTG_STATE_A_IDLE:
@@ -214,8 +214,6 @@ const char *otg_state_string(enum usb_otg_state state)
                return "a_host";
        case OTG_STATE_A_SUSPEND:
                return "a_suspend";
-       case OTG_STATE_A_PERIPHERAL:
-               return "a_peripheral";
        case OTG_STATE_A_WAIT_VFALL:
                return "a_wait_vfall";
        case OTG_STATE_A_VBUS_ERR:
@@ -226,10 +224,14 @@ const char *otg_state_string(enum usb_otg_state state)
                return "b_srp_init";
        case OTG_STATE_B_PERIPHERAL:
                return "b_peripheral";
-       case OTG_STATE_B_WAIT_ACON:
-               return "b_wait_acon";
+#ifdef CONFIG_USB_OTG
+       case OTG_STATE_A_PERIPHERAL:
+               return "a_peripheral";
        case OTG_STATE_B_HOST:
                return "b_host";
+       case OTG_STATE_B_WAIT_ACON:
+               return "b_wait_acon";
+#endif
        default:
                return "UNDEFINED";
        }
diff --git a/drivers/usb/otg/otg_fsm.c b/drivers/usb/otg/otg_fsm.c
index ade131a..e6c115b 100644
--- a/drivers/usb/otg/otg_fsm.c
+++ b/drivers/usb/otg/otg_fsm.c
@@ -65,7 +65,7 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
 static int state_changed;
 
 /* Called when leaving a state.  Do state clean up jobs here */
-void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
+void otg_leave_state(struct otg_fsm *fsm, enum usb_state old_state)
 {
        switch (old_state) {
        case OTG_STATE_B_IDLE:
@@ -114,7 +114,7 @@ void otg_leave_state(struct otg_fsm *fsm, enum 
usb_otg_state old_state)
 }
 
 /* Called when entering a state */
-int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
+int otg_set_state(struct otg_fsm *fsm, enum usb_state new_state)
 {
        state_changed = 1;
        if (fsm->otg->phy->state == new_state)
@@ -228,7 +228,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state 
new_state)
 /* State change judgement */
 int otg_statemachine(struct otg_fsm *fsm)
 {
-       enum usb_otg_state state;
+       enum usb_state state;
        unsigned long flags;
 
        spin_lock_irqsave(&fsm->lock, flags);
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 22a396c..4210837 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -133,7 +133,7 @@ struct msm_otg_platform_data {
        enum otg_control_type otg_control;
        enum usb_mode_type default_mode;
        enum msm_usb_phy_type phy_type;
-       void (*setup_gpio)(enum usb_otg_state state);
+       void (*setup_gpio)(enum usb_state state);
        char *pclk_src_name;
 };
 
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index e8a5fe8..556f33c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -37,9 +37,9 @@ struct usb_otg {
 };
 
 #ifdef CONFIG_USB_OTG_UTILS
-extern const char *otg_state_string(enum usb_otg_state state);
+extern const char *otg_state_string(enum usb_state state);
 #else
-static inline const char *otg_state_string(enum usb_otg_state state)
+static inline const char *otg_state_string(enum usb_state state)
 {
        return NULL;
 }
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 45e2235..c0c24d4 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -27,8 +27,8 @@ enum usb_phy_type {
        USB_PHY_TYPE_USB3,
 };
 
-/* OTG defines lots of enumeration states before device reset */
-enum usb_otg_state {
+/* USB working states */
+enum usb_state {
        OTG_STATE_UNDEFINED = 0,
 
        /* single-role peripheral, and dual-role default-b */
@@ -36,19 +36,21 @@ enum usb_otg_state {
        OTG_STATE_B_SRP_INIT,
        OTG_STATE_B_PERIPHERAL,
 
-       /* extra dual-role default-b states */
-       OTG_STATE_B_WAIT_ACON,
-       OTG_STATE_B_HOST,
-
        /* dual-role default-a */
        OTG_STATE_A_IDLE,
        OTG_STATE_A_WAIT_VRISE,
        OTG_STATE_A_WAIT_BCON,
        OTG_STATE_A_HOST,
        OTG_STATE_A_SUSPEND,
-       OTG_STATE_A_PERIPHERAL,
        OTG_STATE_A_WAIT_VFALL,
        OTG_STATE_A_VBUS_ERR,
+
+#ifdef CONFIG_USB_OTG
+       /* dual-role states */
+       OTG_STATE_B_WAIT_ACON,
+       OTG_STATE_B_HOST,
+       OTG_STATE_A_PERIPHERAL,
+#endif
 };
 
 struct usb_phy;
@@ -68,7 +70,7 @@ struct usb_phy {
        unsigned int             flags;
 
        enum usb_phy_type       type;
-       enum usb_otg_state      state;
+       enum usb_state  state;
        enum usb_phy_events     last_event;
 
        struct usb_otg          *otg;
-- 
1.7.0.4


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

Reply via email to