aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2016-02-18 21:04:49 -0500
committerFelipe Balbi <balbi@kernel.org>2016-03-04 08:14:38 -0500
commit4a75754751a02cd12cd598e02ded226c3ea2fc23 (patch)
tree959bbcad625befb91233326b172156f05451c741 /drivers/usb/chipidea
parent9c527f49a7312450923222941ff50e5940004e97 (diff)
usb: chipidea: otg: add A idle to B disconnect timer
B-device detects that bus is idle for more than TB_AIDL_BDIS min and begins HNP by turning off pullup on DP, this allows the bus to discharge to the SE0 state. This timer was missed and failed with PET test: 6.8.5 B-UUT HNP of USB OTG and EH automated compliance plan v1.2, this patch is to fix this timing issue. Acked-by: Peter Chen <peter.chen@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/otg_fsm.c12
-rw-r--r--drivers/usb/chipidea/otg_fsm.h2
2 files changed, 12 insertions, 2 deletions
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 9a963a749467..de8e22ec3902 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -209,6 +209,7 @@ static unsigned otg_timer_ms[] = {
209 TA_AIDL_BDIS, 209 TA_AIDL_BDIS,
210 TB_ASE0_BRST, 210 TB_ASE0_BRST,
211 TA_BIDL_ADIS, 211 TA_BIDL_ADIS,
212 TB_AIDL_BDIS,
212 TB_SE0_SRP, 213 TB_SE0_SRP,
213 TB_SRP_FAIL, 214 TB_SRP_FAIL,
214 0, 215 0,
@@ -320,6 +321,12 @@ static int a_bidl_adis_tmout(struct ci_hdrc *ci)
320 return 0; 321 return 0;
321} 322}
322 323
324static int b_aidl_bdis_tmout(struct ci_hdrc *ci)
325{
326 ci->fsm.a_bus_suspend = 1;
327 return 0;
328}
329
323static int b_se0_srp_tmout(struct ci_hdrc *ci) 330static int b_se0_srp_tmout(struct ci_hdrc *ci)
324{ 331{
325 ci->fsm.b_se0_srp = 1; 332 ci->fsm.b_se0_srp = 1;
@@ -364,6 +371,7 @@ static int (*otg_timer_handlers[])(struct ci_hdrc *) = {
364 a_aidl_bdis_tmout, /* A_AIDL_BDIS */ 371 a_aidl_bdis_tmout, /* A_AIDL_BDIS */
365 b_ase0_brst_tmout, /* B_ASE0_BRST */ 372 b_ase0_brst_tmout, /* B_ASE0_BRST */
366 a_bidl_adis_tmout, /* A_BIDL_ADIS */ 373 a_bidl_adis_tmout, /* A_BIDL_ADIS */
374 b_aidl_bdis_tmout, /* B_AIDL_BDIS */
367 b_se0_srp_tmout, /* B_SE0_SRP */ 375 b_se0_srp_tmout, /* B_SE0_SRP */
368 b_srp_fail_tmout, /* B_SRP_FAIL */ 376 b_srp_fail_tmout, /* B_SRP_FAIL */
369 NULL, /* A_WAIT_ENUM */ 377 NULL, /* A_WAIT_ENUM */
@@ -655,9 +663,9 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci)
655 break; 663 break;
656 case OTG_STATE_B_PERIPHERAL: 664 case OTG_STATE_B_PERIPHERAL:
657 if ((intr_sts & USBi_SLI) && port_conn && otg_bsess_vld) { 665 if ((intr_sts & USBi_SLI) && port_conn && otg_bsess_vld) {
658 fsm->a_bus_suspend = 1; 666 ci_otg_add_timer(ci, B_AIDL_BDIS);
659 ci_otg_queue_work(ci);
660 } else if (intr_sts & USBi_PCI) { 667 } else if (intr_sts & USBi_PCI) {
668 ci_otg_del_timer(ci, B_AIDL_BDIS);
661 if (fsm->a_bus_suspend == 1) 669 if (fsm->a_bus_suspend == 1)
662 fsm->a_bus_suspend = 0; 670 fsm->a_bus_suspend = 0;
663 } 671 }
diff --git a/drivers/usb/chipidea/otg_fsm.h b/drivers/usb/chipidea/otg_fsm.h
index 262d6ef8df7c..6366fe398ba6 100644
--- a/drivers/usb/chipidea/otg_fsm.h
+++ b/drivers/usb/chipidea/otg_fsm.h
@@ -62,6 +62,8 @@
62/* SSEND time before SRP */ 62/* SSEND time before SRP */
63#define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */ 63#define TB_SSEND_SRP (1500) /* minimum 1.5 sec, section:5.1.2 */
64 64
65#define TB_AIDL_BDIS (20) /* 4ms ~ 150ms, section 5.2.1 */
66
65#if IS_ENABLED(CONFIG_USB_OTG_FSM) 67#if IS_ENABLED(CONFIG_USB_OTG_FSM)
66 68
67int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci); 69int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);