23 Feb, 2017
40 commits
-
If the otg work had been queued, current code will disable irq again
but the otg work will be done only once, so the irq enable and disable
cannot be balanced, this patch is to fix this.Signed-off-by: Li Jun
(cherry picked from commit 0d5c0888eaec17289e40968d7d15b92b781ed34f) -
The current condition may not true even we have driven vbus on already.
The vbus drive operation may be async, eg through i2c gpio expendor,
so the vbus may not be valid when we unload usb module.We meet this issue when we do fast load/unload usb module test.
Signed-off-by: Peter Chen
(cherry picked from commit c0cdff8472c38e0fc39c597148d5534a5e9cc9b1) -
While A device as peripheral ends session by a_bus_drop, it will go
back to host role by transition to a_wait_vfall state, then ehci
host driver may access portsc status after controller enters suspend
, this will result in system hang since its clock is gated off.
This patch use existing autosuspend to delay the controller suspend
if it comes to a_wait_vfall state.Signed-off-by: Li Jun
(cherry picked from commit b140fa6803ef6ececec17e435212a960a3169cc2) -
With commit "95b62fe MLK-10750 usb: chipidea: otg: remove otg fsm
before destroy gdaget and host", the otg fsm will be removed first,
but when the host is removing, it will trigger pcd interrupt, and otg
work is still queued to ci_otg workqueue(otg state is OTG_STATE_A_HOST),
but at that time, ci_otg workqueue has been destroyed.In this commit, we make sure the otg work is not queued if ci->wq is NULL,
and keep otg state is OTG_STATE_UNDEFINED after otg fsm has been removed.The NULL pointer deference error like belows:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = a873c000
[00000000] *pgd=a90f9831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Modules linked in: usb_f_ecm u_ether libcomposite configfs ci_hdrc_imx(-) ci_hdrc udc_core ehci_hcd mxc_vadc mx6s_capture mxc_dcic ov5640_camera usbmisc_imx phy_mxs_usb evbug [last unloaded: usb_f_rndis]
CPU: 0 PID: 162 Comm: udevd Not tainted 3.14.38-02187-g5639985-dirty #160
task: a863e880 ti: a872e000 task.ti: a872e000
PC is at __queue_work+0x68/0x268
LR is at __queue_work+0x68/0x268
pc : [] lr : [] psr: 600e0193
sp : a872fed0 ip : 00000000 fp : 00000000
r10: 00000004 r9 : a872e000 r8 : 0000004b
r7 : 80e4c804 r6 : a9295000 r5 : a87f8294 r4 : 00000000
r3 : a80690e0 r2 : 00000000 r1 : a8069108 r0 : a8003400
Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c53c7d Table: a873c04a DAC: 00000015
Process udevd (pid: 162, stack limit = 0xa872e238)
Stack: (0xa872fed0 to 0xa8730000)
fec0: 00ff3d34 80743750 00000000 600e0193
fee0: a87f8294 a9295000 00000004 0000004b a8008900 80eb51ff 00ff3d34 800452a8
ff00: 00000000 a87f8010 00000000 00000000 00000000 7f060ac0 a8dfced0 a87f8010
ff20: 00002e20 7f059730 a8e7e2c0 a800895c 00000000 8006c1b4 80e46080 80e40458
ff40: a8008900 a800895c a8e7e2c0 c0802100 00fc40e8 00000000 00000048 8006c320
ff60: a8008900 a800895c 00000000 8006f1c4 8006f140 0000004b 0000004b 8006b92c
ff80: 80e40e54 8000f9cc c080210c 80e4c970 a872ffb0 8000856c 00fc4308 76d9c890
ffa0: 600e0010 ffffffff 7edef480 800130bc 00fc4308 00ff3d70 00000000 000000ff
ffc0: 00000671 00000000 00ff3b90 7edef480 00fc40e8 00000000 00000048 00ff3d34
ffe0: 000321b8 7edef140 000240a0 76d9c890 600e0010 ffffffff abf5e821 abf5ec21
[] (__queue_work) from [] (queue_work_on+0x48/0x54)
[] (queue_work_on) from [] (ci_otg_fsm_irq+0x108/0x310 [ci_hdrc])
[] (ci_otg_fsm_irq [ci_hdrc]) from [] (ci_irq+0x94/0x158 [ci_hdrc])
[] (ci_irq [ci_hdrc]) from [] (handle_irq_event_percpu+0x50/0x180)
[] (handle_irq_event_percpu) from [] (handle_irq_event+0x3c/0x5c)
[] (handle_irq_event) from [] (handle_fasteoi_irq+0x84/0x14c)
[] (handle_fasteoi_irq) from [] (generic_handle_irq+0x2c/0x3c)
[] (generic_handle_irq) from [] (handle_IRQ+0x40/0x90)
[] (handle_IRQ) from [] (gic_handle_irq+0x2c/0x5c)
[] (gic_handle_irq) from [] (__irq_usr+0x3c/0x60)
Exception stack(0xa872ffb0 to 0xa872fff8)
ffa0: 00fc4308 00ff3d70 00000000 000000ff
ffc0: 00000671 00000000 00ff3b90 7edef480 00fc40e8 00000000 00000048 00ff3d34
ffe0: 000321b8 7edef140 000240a0 76d9c890 600e0010 ffffffff
Code: e5964084 e0844003 e1a00005 ebfffa14 (e5943000)
---[ end trace 53dc25e918ff7216 ]---
Kernel panic - not syncing: Fatal exception in interruptSigned-off-by: Peter Chen
(cherry picked from commit c5b8111e4178387e1a6e9c700fdf887a944a5129) -
Current code just do not do reusme signaling for clear suspend feature if it's
a OTG port with b_hnp_enable set, this result in OTG host cannot clear suspend
and resume OTG device after system resume from sleep, then host will disconnect
the OTG B-device and enumerate it again. To make OTG A-device in host state can
do clear feature of suspend like an usual host, and also be compatible legacy
OTG device, this patch adds another condition to check if OTG FSM driver is used
,as in OTG FSM driver, we need not do HNP in that case.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit f92731f787ca00ef8cd0ab9d591e4e24d5a40cc4)
(cherry picked from commit 92f5f68e853713e1179c0e30c1e84456ba11302e) -
While system resume, the connected udev as B-device may not has been resumed,
if HNP polling request is sent to it, HNP polling may fail, this patch adds
check of the udev state to make sure it finished resume and to be configured
state before sending host request message, otherwise try next HNP polling
request.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 2cff5eb7bd4feb70cd28ac4655e7433e57a17938)
(cherry picked from commit b6eea060a3760bdb24d1514a5130a346daba81c9) -
This patch is to clear the flag b_conn when turns off vbus to end a session.
when otg fsm is a_host -> a_suspend -> a_wait_vfall -> a_idle, current otg
fsm implementation does not handle disconnect event since the disconnection
does not happen while a_host state, so the b_conn is still set when in a_idle,
this patch clear b_conn flag after turn off vbus.Signed-off-by: Li Jun
(cherry picked from commit 043b79264051454de18488cb746ee617d86f3568)
(cherry picked from commit 7476c27df7a8bbc66f2269804cac58319fecf3d2) -
If it's A host and b_hnp_enable is set, or B host, we can do HNP polling
because B host will not check OTG descriptor and set b_hnp_enable flag
when enumeration.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 6148c9df6d1c68dfc91cfe274101058c8edf979b)
(cherry picked from commit 8dbe217d14726d5950e91de9d98e401100357a21) -
500ms is enough for vbus fall to VOTG_VBUS_LKG(0.7v, OTG device or EH
Leakage Voltage).Signed-off-by: Li Jun
(cherry picked from commit 41295ac496aa7697585e65223797e0cb4e5fb153)
(cherry picked from commit 56a84fbabed530150787cad4f98aad414a0fee57) -
This patch is to fix one OTG HNP timing requirement, TA_BIDL_ADIS should be
in range of 155ms~200ms per OTG spec 2.0 reverion 1.1a.Signed-off-by: Li Jun
(cherry picked from commit a6de1be200984b01d784f6558229adbb67fcb380)
(cherry picked from commit a94422371328c620f4b37520868ad3f96ec2e165) -
Show 'Device no response' message if A-device fails to connect as a peripheral.
Signed-off-by: Li Jun
(cherry picked from commit 134a56ed85141acfa86ba0d827f654f7716405f2) -
If b device does not detect vbus on after TB_SRP_FAIL of data pulse,
b device should show 'Device no response' message.Signed-off-by: Li Jun
(cherry picked from commit 079e1cb81b6259cb4a5e651e1c02f4c3b58a20ed) -
When a host start a session and wait b device to connnect within
TA_WAIT_BCON, if failed, should show a message 'Device no response'
according to otg and EH compliance plan version 1.2 section 6.7.22Signed-off-by: Li Jun
(cherry picked from commit 1762592ead672d27b281df8becf90f8c7d7fe61c)
(cherry picked from commit f1f68bc5f62848382646599c3609ad797bf3b5a5) -
According to "USB On-The-Go and Embedded Host Automated Compliance Plan Version
1.2", chapter 6.7.23, unknown Device Not Supporting HNP:'Unsupported Device';
chapter 6.7.24 unknown Device Supporting HNP: 'Device No Response'Signed-off-by: Li Jun
(cherry picked from commit 3fb9b462769d44073078f3b29fe68e214896ea9e) -
This patch is clearing b_bus_req input to be 0 when entering b_peripheral state.
b_bus_req is only TRUE when b device wants to use the bus and switch to be host
role.Signed-off-by: Li Jun
(cherry picked from commit eb610e73aa38bbb45aed6a79265cd79fe80cdd05)
(cherry picked from commit 427b0f80a51c50629131090c6f8b82d747fb7d24) -
This patch is clearing a_conn flag when b device leave b_host state.
Signed-off-by: Li Jun
(cherry picked from commit e511cc08879fa97035900ae8626051e473f30cd9)
(cherry picked from commit e293fb467244e7068bd67e6c37a485b99944bbcf) -
This patch changes bus reset time for B host enumuration, from entering B host
to the time clear USB_PORT_FEAT_C_CONNECTION, a random time after B host detect
port change for A peripheral connection may not work.Signed-off-by: Li Jun
(cherry picked from commit b87d3bb0672ebcfb29c7db8708c586b2d38558d1)
(cherry picked from commit f3ec1858d5293de28476996a59287b7adb8e9cd2) -
This patch adds host port reset implementation for HNP timing requirement,
which will be called when B host starts enumuration.Signed-off-by: Li Jun
(cherry picked from commit 5a63aca9c698a2eca09473c675ad2c40a62a27d1) -
This patch replaces b_hnp_enable with a_set_b_hnp_en to comply with state diagram
of USB and EH spec.Signed-off-by: Li Jun
(cherry picked from commit 4734ed1f813959a7544ad744d60ab119efb04ba9)
(cherry picked from commit 853e4e0a2c59f034b177eebd3e7254efc8feffd4) -
This patch updates condition from a_host to a_suspend according to On-The-Go
and Embedded Host Supplement to the USB Revision 2.0 Specification Revision
2.0 version 1.1a.Signed-off-by: Li Jun
(cherry picked from commit f3acf74150683d4555c82ad32b9c669d8a0a7fb5)
(cherry picked from commit a938eb1ccabe9213c0b232d45da2caeb75f8b9fe) -
Use a_set_b_hnp_en to identify if a host can succeed to set b_hnp_enable
for B device, use b_hnp_enable flag to identify if the connected OTG device
is HNP capable. So if the connected otg device is HNP capable but b_hnp_enable
is not set for A host, the host which support HNP polling should continue
enumeration to see if the B device can talk to it later by hnp polling.Signed-off-by: Li Jun
(cherry picked from commit b715d0773eea212a25d6b8c5d94530e12935fdaf)
(cherry picked from commit 454369742ce4dec01d89c946a28c3069fc23bbea) -
This patch enables hnp_polling flag for chipidea host driver in otg fsm mode.
Signed-off-by: Li Jun
(cherry picked from commit acb43a932263edd9b80c6d6d9ee858176c201542)
(cherry picked from commit 9e75e851370b62319fec4200b68cfd3465e12cfe) -
This patch adds a flag hnp_polling to indicate if HNP polling is supported.
Signed-off-by: Li Jun
(cherry picked from commit b19d4b1110fe1fb2ec3141233781a1e016c9a9cf)
(cherry picked from commit cad8ae2986ab0b70d0f13b96c98f340564213d4c) -
If a HNP capable device STALL b_hnp_enable set feature request, A device
as host should not break otg device enumeration, because this set feature
failure only indicates the B device does not want to be host role for the
moment, A device as host talk to it should be okay.see charpter 6.2.2.2 of OTG and EH 2.0:
"If the a_hnp_support feature is set, but the b_hnp_enable feature is not set,
then it is likely that b_hnp_enable will be set later when the A-device is
finished using the bus."Signed-off-by: Li Jun
(cherry picked from commit 51317577d16034ba151da8d502319f4befb91278)
(cherry picked from commit 3d5d5139b3aef654e8004a2ad9ce757af50aee57) -
Since legacy OTG test device which is only compliant with OTG supplement version
1.3 or earlier, cannot support HNP polling, so directly start role switch.Signed-off-by: Li Jun
(cherry picked from commit 688bbca155159978cd520923f2c3029c7778fa9c)
(cherry picked from commit 6f9edab20e2dd8794e46a0b9129c8694e81d064b) -
This patch clears otg_hnp_reqd feature related flags when the HNP test ends.
There are two otg fsm paths to end this feature request:
- b_peripheral --> b_wait_acon --> b_idle: we clear them when entering b_idle;
- b_peripheral --> b_wait_acon --> b_host --> b_peripheral : we clear them
when leaving b_host.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 39d25f04ed047e15f23b44e8465ce46257547df7)
(cherry picked from commit f92c4e5794a278946d3f4e7c8bc30e3e43a80c28) -
This patch implements a timer for B host to start host role switch back to A
device.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 139bcc46841f73199bdc3ca308e46a5af3dd2fc1)
(cherry picked from commit d1c81fc3fa2f8cc141d688b6f627ffa6ca4a7204) -
After B device as host enumerates A peripheral and sets configuration,
B host should start to hand host role back to A device when this timer
expires.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 3f4a8c8a20ef69721f9e7886b8d245036d41d91a)
(cherry picked from commit 72b535f92ea078d8c3bd73186763bcb2f39106bb) -
This patch adds otg_hnp_reqd set feature request from A host for chipidea udc
driver.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 450d4a1eb40ec4284661c1130bdcc4f4d2e6c527)
(cherry picked from commit 03f3f886029fa8f25dde34fcfeb28589ead0064f) -
This patch adds flag otg_hnp_reqd in struct otg_fsm to indicate A device
as host wants to start HNP sequence.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 92382e06c6902731b05dcbb0db4f0ebfa486969f)
(cherry picked from commit 8e3f26a58f995711a81b401af26fbe5ed12e17f4) -
This patch adds otg_hnp_reqd wIndex high byte value for otg test mode.
Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit c334dc80bc2672aab012cad6926d819feaf4634d)
(cherry picked from commit dd95b40fa19e522353b548554f55e8c77ac9bdfe) -
This patch adds a timer for chipidea otg fsm driver to start data pulse
after A host ends the session.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 35e92b59080b58925c3b96e36511056cb51d4a00)
(cherry picked from commit eeded24ce2d20b1c19d5c666e916f41995cf2385) -
This patch adds otg_srp_reqd set feature request from A host for chipidea
udc driver.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 5edca27c518e8a69accb429c946c19243e156656)
(cherry picked from commit 14ac2f1f74ce0b02e03296472e7d170c45a31f29) -
This patch adds flag otg_srp_reqd in struct otg_fsm to indicate A device
as host wants B-UUT to do SRP once it ends the session.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 8e5f1b6b12ec77ec591909b09727049ffff37b9c)
(cherry picked from commit 7eaf8cf8ff375917e9972cca69bcecd6d807e6db) -
This patch adds otg_srp_reqd wIndex high byte value for otg test mode.
Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 34660f7aa14972630622406b9dbfc7a106d8d15d)
(cherry picked from commit c5128f9bafaa37a8e63989032372a5ff36dc82c4) -
When the connected otg test device disconnects before test maintain timer
expires, A device should end the session if otg_vbus_off is set; and do
a_wait_bcon if otg_vbus_off is not set.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 204fa72fe4e2be468fe61f1ede555e072610c932)
(cherry picked from commit 202ce199bd29093d20506a950748acd5323e76fa) -
This patch implements otg test device session maintain timer, if the timer
expires, A device as host should end the session, and clear tst_maint flag
when turn off vbus.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 9d3bd049aef442f11dce77226a0ca09893a6656b) -
If B device set host request flag before test maintain timer expires, remove
the timer and clear test maintain session flag, do HNP as a normal OTG device.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit d914c80921652419037d935f14545fe87f74a71c)
(cherry picked from commit 243c0fcf492748219f4c581203b9bccb078a61d8) -
This patch adds 2 variables: tst_maint and otg_vbus_off, tst_maint is to check if
current session for test device; otg_vbus_off is to notify if A device need turn
off vbus immediately after B device disconnects.
The otg test device handling is added into ehset driver, for that device,
A-device should start a timer for maintain the session, and set otg_vbus_off
flag according to its bcdDevice value.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit 78a2c14bdea4b8e334c7e0afad074b61b71193cb)
(cherry picked from commit b854141cc5a7150751e7f7fd2dfb10a415cfea10) -
This patch add otg test device with VID(0x1a0a) and PID(0x0200) into otg and
EH TPL.Acked-by: Peter Chen
Signed-off-by: Li Jun
(cherry picked from commit b88ee5e2cbf55aaed3b6c5dd0aff7f826f9e357d)
(cherry picked from commit 8c11515f82876e69aa14e1c31fcb5031cf4edfcc)