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

usb: chipidea: otg: remove unnecessary B_SESS_VLD timer

Since BSV irq is enabled for B-device all the time, so B_SESS_VLD timer
is not required, and also no need to check BSV status when B_ASE0_BRST
timer timeout.

Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Li Jun and committed by
Greg Kroah-Hartman
01ecd156 963719c8

+1 -33
+1 -30
drivers/usb/chipidea/otg_fsm.c
··· 320 320 ci_otg_queue_work(ci); 321 321 } 322 322 323 - static void b_ase0_brst_tmout_func(void *ptr, unsigned long indicator) 324 - { 325 - struct ci_hdrc *ci = (struct ci_hdrc *)ptr; 326 - 327 - set_tmout(ci, indicator); 328 - if (!hw_read_otgsc(ci, OTGSC_BSV)) 329 - ci->fsm.b_sess_vld = 0; 330 - 331 - ci_otg_queue_work(ci); 332 - } 333 - 334 323 static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) 335 324 { 336 325 struct ci_hdrc *ci = (struct ci_hdrc *)ptr; ··· 329 340 /* only vbus fall below B_sess_vld in b_idle state */ 330 341 if (ci->fsm.otg->state == OTG_STATE_B_IDLE) 331 342 ci_otg_queue_work(ci); 332 - } 333 - 334 - static void b_sess_vld_tmout_func(void *ptr, unsigned long indicator) 335 - { 336 - struct ci_hdrc *ci = (struct ci_hdrc *)ptr; 337 - 338 - /* Check if A detached */ 339 - if (!(hw_read_otgsc(ci, OTGSC_BSV))) { 340 - ci->fsm.b_sess_vld = 0; 341 - ci_otg_add_timer(ci, B_SSEND_SRP); 342 - ci_otg_queue_work(ci); 343 - } 344 343 } 345 344 346 345 static void b_data_pulse_end(void *ptr, unsigned long indicator) ··· 382 405 return -ENOMEM; 383 406 384 407 ci->fsm_timer->timer_list[B_ASE0_BRST] = 385 - otg_timer_initializer(ci, &b_ase0_brst_tmout_func, TB_ASE0_BRST, 408 + otg_timer_initializer(ci, &set_tmout_and_fsm, TB_ASE0_BRST, 386 409 (unsigned long)&fsm->b_ase0_brst_tmout); 387 410 if (ci->fsm_timer->timer_list[B_ASE0_BRST] == NULL) 388 411 return -ENOMEM; ··· 408 431 ci->fsm_timer->timer_list[B_DATA_PLS] = 409 432 otg_timer_initializer(ci, &b_data_pulse_end, TB_DATA_PLS, 0); 410 433 if (ci->fsm_timer->timer_list[B_DATA_PLS] == NULL) 411 - return -ENOMEM; 412 - 413 - ci->fsm_timer->timer_list[B_SESS_VLD] = otg_timer_initializer(ci, 414 - &b_sess_vld_tmout_func, TB_SESS_VLD, 0); 415 - if (ci->fsm_timer->timer_list[B_SESS_VLD] == NULL) 416 434 return -ENOMEM; 417 435 418 436 return 0; ··· 643 671 fsm->a_conn = 0; 644 672 fsm->b_bus_req = 0; 645 673 ci_otg_queue_work(ci); 646 - ci_otg_add_timer(ci, B_SESS_VLD); 647 674 } 648 675 break; 649 676 case OTG_STATE_A_PERIPHERAL:
-3
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_SESS_VLD (1000) 66 - 67 65 enum ci_otg_fsm_timer_index { 68 66 /* 69 67 * CI specific timers, start from the end ··· 69 71 */ 70 72 B_DATA_PLS = NUM_OTG_FSM_TIMERS, 71 73 B_SSEND_SRP, 72 - B_SESS_VLD, 73 74 74 75 NUM_CI_OTG_FSM_TIMERS, 75 76 };