Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Li Jun and committed by
Felipe Balbi
4a757547 9c527f49

+12 -2
+10 -2
drivers/usb/chipidea/otg_fsm.c
··· 209 209 TA_AIDL_BDIS, 210 210 TB_ASE0_BRST, 211 211 TA_BIDL_ADIS, 212 + TB_AIDL_BDIS, 212 213 TB_SE0_SRP, 213 214 TB_SRP_FAIL, 214 215 0, ··· 321 320 return 0; 322 321 } 323 322 323 + static int b_aidl_bdis_tmout(struct ci_hdrc *ci) 324 + { 325 + ci->fsm.a_bus_suspend = 1; 326 + return 0; 327 + } 328 + 324 329 static int b_se0_srp_tmout(struct ci_hdrc *ci) 325 330 { 326 331 ci->fsm.b_se0_srp = 1; ··· 371 364 a_aidl_bdis_tmout, /* A_AIDL_BDIS */ 372 365 b_ase0_brst_tmout, /* B_ASE0_BRST */ 373 366 a_bidl_adis_tmout, /* A_BIDL_ADIS */ 367 + b_aidl_bdis_tmout, /* B_AIDL_BDIS */ 374 368 b_se0_srp_tmout, /* B_SE0_SRP */ 375 369 b_srp_fail_tmout, /* B_SRP_FAIL */ 376 370 NULL, /* A_WAIT_ENUM */ ··· 663 655 break; 664 656 case OTG_STATE_B_PERIPHERAL: 665 657 if ((intr_sts & USBi_SLI) && port_conn && otg_bsess_vld) { 666 - fsm->a_bus_suspend = 1; 667 - ci_otg_queue_work(ci); 658 + ci_otg_add_timer(ci, B_AIDL_BDIS); 668 659 } else if (intr_sts & USBi_PCI) { 660 + ci_otg_del_timer(ci, B_AIDL_BDIS); 669 661 if (fsm->a_bus_suspend == 1) 670 662 fsm->a_bus_suspend = 0; 671 663 }
+2
drivers/usb/chipidea/otg_fsm.h
··· 62 62 /* SSEND time before SRP */ 63 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 67 #if IS_ENABLED(CONFIG_USB_OTG_FSM) 66 68 67 69 int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci);