diff options
| author | Li Jun <jun.li@freescale.com> | 2015-01-27 15:01:57 +0800 |
|---|---|---|
| committer | Li Jun <jun.li@freescale.com> | 2015-01-28 11:08:36 +0800 |
| commit | 861497c86217c403ec075ad209ca16b35949c942 (patch) | |
| tree | cff2c05cad99dc1ad82e3650fae2f4efb479af01 | |
| parent | c7c554fdcd714d0a858e12d7bdca316c509c1197 (diff) | |
MLK-10101-3 usb: chipidea: otg: enable BSV irq when OTG B-device in host mode
When B-device in host mode, if Vbus is off by A-device or A-device is removed,
B-device should update charger status correctly. This patch enables BSV irq
for B-device in all states, so the charger connection and removal can be early
handled by BSV change irq.
Signed-off-by: Li Jun <jun.li@freescale.com>
| -rw-r--r-- | drivers/usb/chipidea/udc.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 1f46ba09f0bb..68fe3bf356a5 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1938,8 +1938,12 @@ void ci_hdrc_gadget_connect(struct usb_gadget *gadget, int is_active) static int udc_id_switch_for_device(struct ci_hdrc *ci) { - if (ci->is_otg) - /* Clear and enable BSV irq */ + if (!ci->is_otg) + return 0; + + /* Clear and enable BSV irq for peripheral or OTG B-device */ + if (!ci_otg_is_fsm_mode(ci) || + ci->fsm.otg->state <= OTG_STATE_B_HOST) hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE, OTGSC_BSVIS | OTGSC_BSVIE); @@ -1948,11 +1952,14 @@ static int udc_id_switch_for_device(struct ci_hdrc *ci) static void udc_id_switch_for_host(struct ci_hdrc *ci) { + if (!ci->is_otg) + return; /* - * host doesn't care B_SESSION_VALID event + * Host or OTG A-device doesn't care B_SESSION_VALID event * so clear and disbale BSV irq */ - if (ci->is_otg) + if (!ci_otg_is_fsm_mode(ci) || + ci->fsm.otg->state > OTG_STATE_B_HOST) hw_write_otgsc(ci, OTGSC_BSVIE | OTGSC_BSVIS, OTGSC_BSVIS); } |
