diff options
author | Li Jun <b47624@freescale.com> | 2014-10-16 22:18:00 +0800 |
---|---|---|
committer | Nitin Garg <nitin.garg@nxp.com> | 2016-01-14 10:57:01 -0600 |
commit | 08120ce5a96875f6bf0c9888cc851f8d01e0f211 (patch) | |
tree | ba9f7474378cc26b6456e1d7e012cefd71843c67 | |
parent | 2727256801445765d6d68abd442c2dd1ade713d5 (diff) |
MLK-9618-7 usb: chipidea: otg: delay turn on vbus when detecting data pulse
This patch adds a timer to delay turn on vbus after detecting data pulse
from B-device, this is required by OTG SRP timing.
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit f02ee3e93715c41f5b1e11140f36e350c7ed4d6b)
-rw-r--r-- | drivers/usb/chipidea/core.c | 9 | ||||
-rw-r--r-- | drivers/usb/chipidea/otg_fsm.c | 12 | ||||
-rw-r--r-- | drivers/usb/chipidea/otg_fsm.h | 2 | ||||
-rw-r--r-- | include/linux/usb/otg-fsm.h | 1 |
4 files changed, 16 insertions, 8 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 5d976b16f7a4..1bdce1efd588 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -1013,13 +1013,10 @@ static void ci_otg_fsm_wakeup_by_srp(struct ci_hdrc *ci) { if ((ci->fsm.otg->state == OTG_STATE_A_IDLE) && (ci->fsm.a_bus_drop == 1) && (ci->fsm.a_bus_req == 0)) { - if (!hw_read_otgsc(ci, OTGSC_ID)) { - ci->fsm.a_srp_det = 1; - ci->fsm.a_bus_drop = 0; - } else { + if (!hw_read_otgsc(ci, OTGSC_ID)) + otg_add_timer(&ci->fsm, A_DP_END); + else ci->fsm.id = 1; - } - ci_otg_queue_work(ci); } } diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index d48cb980c5cd..a0d775a59b4e 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c @@ -206,6 +206,7 @@ static unsigned otg_timer_ms[] = { 0, TB_DATA_PLS, TB_SSEND_SRP, + TA_DP_END, }; /* @@ -345,6 +346,13 @@ static int b_ssend_srp_tmout(struct ci_hdrc *ci) return 1; } +static int a_dp_end_tmout(struct ci_hdrc *ci) +{ + ci->fsm.a_bus_drop = 0; + ci->fsm.a_srp_det = 1; + return 0; +} + /* * Keep this list in the same order as timers indexed * by enum otg_fsm_timer in include/linux/usb/otg-fsm.h @@ -361,6 +369,7 @@ static int (*otg_timer_handlers[])(struct ci_hdrc *) = { NULL, /* A_WAIT_ENUM */ b_data_pls_tmout, /* B_DATA_PLS */ b_ssend_srp_tmout, /* B_SSEND_SRP */ + a_dp_end_tmout, /* A_DP_END */ }; /* @@ -738,8 +747,7 @@ irqreturn_t ci_otg_fsm_irq(struct ci_hdrc *ci) if (otg_int_src) { if (otg_int_src & OTGSC_DPIS) { hw_write_otgsc(ci, OTGSC_DPIS, OTGSC_DPIS); - fsm->a_srp_det = 1; - fsm->a_bus_drop = 0; + ci_otg_add_timer(ci, A_DP_END); } else if (otg_int_src & OTGSC_IDIS) { hw_write_otgsc(ci, OTGSC_IDIS, OTGSC_IDIS); if (fsm->id == 0) { diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h index bf3575e0f413..6f0598ea3ca8 100644 --- a/drivers/usb/chipidea/otg_fsm.h +++ b/drivers/usb/chipidea/otg_fsm.h @@ -43,6 +43,8 @@ * for safe */ +#define TA_DP_END (200) + /* * B-device timing constants */ diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h index 1dd80f6f41ee..a7894631f593 100644 --- a/include/linux/usb/otg-fsm.h +++ b/include/linux/usb/otg-fsm.h @@ -55,6 +55,7 @@ enum otg_fsm_timer { A_WAIT_ENUM, B_DATA_PLS, B_SSEND_SRP, + A_DP_END, NUM_OTG_FSM_TIMERS, }; |