linux.git
7 years agoMLK-11345 ARM: dts: imx7d-12x12-lpddr3-arm2: correct lcdif pinctrl settings
Fancy Fang [Tue, 11 Aug 2015 07:16:00 +0000 (15:16 +0800)]
MLK-11345 ARM: dts: imx7d-12x12-lpddr3-arm2: correct lcdif pinctrl settings

Correct the lcdif pinctrl settings to make it work
correctly.

Signed-off-by: Fancy Fang <chen.fang@freescale.com>
7 years agoMLK-11342 cpufreq: imx: remove a duplicated pm notify
Bai Ping [Tue, 11 Aug 2015 10:48:03 +0000 (18:48 +0800)]
MLK-11342 cpufreq: imx:  remove a duplicated pm notify

remove a duplicated pm notify.

Signed-off-by: Bai Ping <b51503@freescale.com>
7 years agoMLK-11272 usb: chipidea: otg: data pulse detection work around for imx7d
Li Jun [Wed, 22 Jul 2015 05:59:50 +0000 (13:59 +0800)]
MLK-11272 usb: chipidea: otg: data pulse detection work around for imx7d

i.MX7D has a silicon issue on full speed termination after A device ends
a session, which causes it can not detect data pulse from B device if
A device isn't in low power mode, this patch work around it by override
Termsel bit to be 1 for FS mode termination. After A device detects data
pulse or turns on vbus, this override will be cleared and disabled.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 1ec37968c892efbb1925784446a75d35e8bda228)

7 years agoMLK-11319-5 usb: chipidea: usbmisc_imx: add imx7d usb charger detection support
Li Jun [Mon, 10 Aug 2015 08:35:08 +0000 (16:35 +0800)]
MLK-11319-5 usb: chipidea: usbmisc_imx: add imx7d usb charger detection support

Adds imx7d usb charger detection support.

Signed-off-by: Li Jun <jun.li@freescale.com>
7 years agoMLK-11123-31 ARM: dts: disable otg features for imx7d-sdb board
Li Jun [Fri, 3 Jul 2015 06:14:00 +0000 (14:14 +0800)]
MLK-11123-31 ARM: dts: disable otg features for imx7d-sdb board

Disable all otg features for otg1 port of imx7d-sdb board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 3c59511b7eac99da8c9bd373b82ddcbf61d1ef8a)

7 years agoMLK-11123-30 ARM: dts: disable otg features for imx7d-12x12-lpddr3-arm2 board
Li Jun [Fri, 3 Jul 2015 06:13:30 +0000 (14:13 +0800)]
MLK-11123-30 ARM: dts: disable otg features for imx7d-12x12-lpddr3-arm2 board

Disable all otg features for otg1 port of imx7d-12x12-lpddr3-arm2 board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 8d19fb5979522032cf4d96909d609aceac0dde85)

7 years agoMLK-11123-28 ARM: dts: disable otg features for imx6sx-sdb board
Li Jun [Fri, 3 Jul 2015 06:12:25 +0000 (14:12 +0800)]
MLK-11123-28 ARM: dts: disable otg features for imx6sx-sdb board

Disable all otg features for otg1 port of imx6sx-sdb board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit e8d32c2cc5daab7e22f6190a02c88981aa14df7e)

7 years agoMLK-11123-27 ARM: dts: add usb support for for imx6sx-sabreauto board
Li Jun [Fri, 3 Jul 2015 06:11:53 +0000 (14:11 +0800)]
MLK-11123-27 ARM: dts: add usb support for for imx6sx-sabreauto board

Add usb otg1 and otg2 port for imx6sx-sabreauto board, and disable all otg
features for otg1 port of imx6sx-sabreauto board, then the otg port can only
do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
7 years agoMLK-11123-24 ARM: dts: disable otg features for imx6sl-evk board
Li Jun [Fri, 3 Jul 2015 06:09:48 +0000 (14:09 +0800)]
MLK-11123-24 ARM: dts: disable otg features for imx6sl-evk board

Disable all otg features for otg1 port of imx6sl-evk board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 855c996b52317760e114e7884810a0b438b6e3ee)

7 years agoMLK-11123-23 ARM: dts: disable otg features for imx6qdl-sabresd board
Li Jun [Fri, 3 Jul 2015 06:09:08 +0000 (14:09 +0800)]
MLK-11123-23 ARM: dts: disable otg features for imx6qdl-sabresd board

Disable all otg features for otg1 port of imx6qdl-sabresd board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 71ed636ea10843cc2aac46711adf2350a34fa7b0)

7 years agoMLK-11123-22 ARM: dts: disable otg features for imx6qdl-sabreauto board
Li Jun [Fri, 3 Jul 2015 06:08:21 +0000 (14:08 +0800)]
MLK-11123-22 ARM: dts: disable otg features for imx6qdl-sabreauto board

Disable all otg features for otg1 port of imx6qdl-sabreauto board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit b4082a9456f735b664fd125e2e6964963ac9c8d0)

7 years agoMLK-11123-21 ARM: dts: disable otg features for imx6qdl-sabrelite board
Li Jun [Mon, 10 Aug 2015 07:35:45 +0000 (15:35 +0800)]
MLK-11123-21 ARM: dts: disable otg features for imx6qdl-sabrelite board

Disable all otg features for otg1 port of imx6q-sabrelite board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
7 years agoMLK-11123-20 ARM: dts: disable otg features for imx6q-arm2 board
Li Jun [Fri, 3 Jul 2015 06:03:53 +0000 (14:03 +0800)]
MLK-11123-20 ARM: dts: disable otg features for imx6q-arm2 board

Disable all otg features for otg1 port of imx6q-arm2 board, then
the otg port can only do role swtich by ID pin state.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 70c4fe93ac7064f5128ae2275b766fb00c4cd6ef)

7 years agoMLK-11269-2 usb: chipidea: host: avoid check PORT_SUSPEND wrongly
Peter Chen [Tue, 21 Jul 2015 06:41:59 +0000 (14:41 +0800)]
MLK-11269-2 usb: chipidea: host: avoid check PORT_SUSPEND wrongly

At some situations, the ehci_bus_suspend may not set PORT_SUSPEND
due to port is not enabled, so add flag ehci->bus_suspended to
check if ehci_bus_suspend set PORT_SUSPEND or not.

We see "ci_hdrc ci_hdrc.0: timeout waiting for SUSPEND" wrongly when
plug in an unsupported usb device, in that case, the PORT_PE is cleared
and bus_suspend is called.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 82cfe6c31ee55e5aab1a057a5aaf853b7bb6cd07)
(cherry picked from commit a4fe7e55e84944962d6a7be7bd404865d376811e)

7 years agoMLK-11269-1 ARM: imx_v7_defconfig: update USB certification configurations
Peter Chen [Tue, 21 Jul 2015 05:32:23 +0000 (13:32 +0800)]
MLK-11269-1 ARM: imx_v7_defconfig: update USB certification configurations

- Add CONFIG_USB_OTG_WHITELIST and CONFIG_USB_HCD_TEST_MODE
- Change CONFIG_USB_EHSET_TEST_FIXTURE from 'm' to 'y'

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 40f0d728339fb460a108bc8b133207dd5a17dda8)
(cherry picked from commit d6d4e687fb65cddf3343806424e51e9fdc31c140)

7 years agoMLK-11183-2 usb: chipidea: otg: disable otg interrupt before flush_workqueue
Peter Chen [Thu, 2 Jul 2015 01:41:04 +0000 (09:41 +0800)]
MLK-11183-2 usb: chipidea: otg: disable otg interrupt before flush_workqueue

We do not want (care) the interrupt during we remove the otg function,
so move it beforehand.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 9ae22c687fd161dfff2e81512b50143fa154b9bb)

7 years agoMLK-11183-1 usb: chipidea: host: fix NULL pointer problem for fast load/unload module
Peter Chen [Thu, 2 Jul 2015 01:41:03 +0000 (09:41 +0800)]
MLK-11183-1 usb: chipidea: host: fix NULL pointer problem for fast load/unload module

The interrupt may occur (due to remove process may block interrupt)
after we remove hcd, in that case, we should not call hcd's interrupt
handler, otherwise, below NULL pointer dereference will occur, the reason
for this is we call free_irq later than hcd's. So after hcd has been
removed, we should not call hcd interrupt handler.

ci_hdrc ci_hdrc.0: remove, state 1
usb usb1: USB disconnect, device number 1
ci_hdrc ci_hdrc.0: USB bus 1 deregistered
[<800691e8>] (handle_irq_event) from [<8006c02c>] (handle_fasteoi_irq+0x84/0x14c)
[<8006c02c>] (handle_fasteoi_irq) from [<800687f4>] (generic_handle_irq+0x2c/0x3c)
[<800687f4>] (generic_handle_irq) from [<8000ed4c>] (handle_IRQ+0x40/0x90)
[<8000ed4c>] (handle_IRQ) from [<8000856c>] (gic_handle_irq+0x2c/0x5c)
[<8000856c>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0x80db1f18 to 0x80db1f60)
1f00: 80db1f60 3b9aca00
1f20: 06f86934 0000000d 80dbe1c8 80dbe1c8 ee71e0d0 00000000 06f5bb01 0000000d
1f40: 80db0000 00000000 00000017 80db1f60 00000009 8049c19c 000d0013 ffffffff
[<80012240>] (__irq_svc) from [<8049c19c>] (cpuidle_enter_state+0x54/0xe4)
[<8049c19c>] (cpuidle_enter_state) from [<8049c2e0>] (cpuidle_idle_call+0xb4/0x14c)
[<8049c2e0>] (cpuidle_idle_call) from [<8000f07c>] (arch_cpu_idle+0x8/0x44)
[<8000f07c>] (arch_cpu_idle) from [<8006876c>] (cpu_startup_entry+0x100/0x14c)
[<8006876c>] (cpu_startup_entry) from [<80d52b10>] (start_kernel+0x350/0x35c)
--[ end trace 1160f590a7b228b3 ]--
Unable to handle kernel NULL pointer dereference at virtual address 000000b0
pgd = 80004000
[000000b0] *pgd=00000000
Internal error: Oops: 17 1 PREEMPT SMP ARM
Modules linked in: ci_hdrc_imx usbmisc_imx ci_hdrc udc_core ehci_hcd phy_mxs_usb mxc_v4l2_capture ipu_bg_overlay_sdc ipu_still ipu_prp_enc adv7180_tvin ipu_csi_enc v4l2_int_device ipu_fg_overlay_sdc mxc_mlb mxc_dcic evbug [last unloaded: phy_mxs_usb]
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 3.14.38-usb-host-otg-02047-ga4dec77 #13
task: 80dbbae8 ti: 80db0000 task.ti: 80db0000
PC is at usb_hcd_irq+0x4/0x38
LR is at handle_irq_event_percpu+0x50/0x180
pc : [<8040eed8>] lr : [<8006907c>] psr: a00d0193
sp : 80db1e98 ip : fffffffa fp : 00000000
r10: 80e1f13f r9 : d8009900 r8 : 0000004b
r7 : 00000000 r6 : 00000000 r5 : d800995c r4 : d8f2dec0
r3 : d2234010 r2 : d2234010 r1 : 00000000 r0 : 0000004b
Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c53c7d Table: 6920004a DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0x80db0238)
Stack: (0x80db1e98 to 0x80db2000)
1e80: d2234010 8006907c
1ea0: 0000004b ee71da00 d8009900 d800995c d8f2dec0 f4a00100 06f5bb01 0000000d
1ec0: 80db0000 800691e8 d8009900 d800995c 00000000 8006c02c 8006bfa8 0000004b
1ee0: 0000004b 800687f4 80dace54 8000ed4c f4a0010c 80db8970 80db1f18 8000856c
1f00: 00000009 8049c19c 000d0013 ffffffff 80db1f4c 80012240 80db1f60 3b9aca00
1f20: 06f86934 0000000d 80dbe1c8 80dbe1c8 ee71e0d0 00000000 06f5bb01 0000000d
1f40: 80db0000 00000000 00000017 80db1f60 00000009 8049c19c 000d0013 ffffffff
1f60: 06f86934 0000000d 80dc4a54 ee71e0d0 80db8574 ee71e0d0 00000000 00000000
1f80: 00000000 80e797f8 80dbe1c8 8049c2e0 00000000 80db0000 80db8574 806fe48c
1fa0: 80db0038 80e1f13d 80e1f13d 8000f07c 00000000 8006876c ffffffff 80d52b10
1fc0: ffffffff ffffffff 80d5258c 00000000 00000000 80d9ef30 00000000 10c53c7d
1fe0: 80db84fc 80d9ef2c 80dbcb80 1000406a 412fc09a 10008074 00000000 00000000
[<8040eed8>] (usb_hcd_irq) from [<8006907c>] (handle_irq_event_percpu+0x50/0x180)
[<8006907c>] (handle_irq_event_percpu) from [<800691e8>] (handle_irq_event+0x3c/0x5c)
[<800691e8>] (handle_irq_event) from [<8006c02c>] (handle_fasteoi_irq+0x84/0x14c)
[<8006c02c>] (handle_fasteoi_irq) from [<800687f4>] (generic_handle_irq+0x2c/0x3c)
[<800687f4>] (generic_handle_irq) from [<8000ed4c>] (handle_IRQ+0x40/0x90)
[<8000ed4c>] (handle_IRQ) from [<8000856c>] (gic_handle_irq+0x2c/0x5c)
[<8000856c>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0x80db1f18 to 0x80db1f60)
1f00: 80db1f60 3b9aca00
1f20: 06f86934 0000000d 80dbe1c8 80dbe1c8 ee71e0d0 00000000 06f5bb01 0000000d
1f40: 80db0000 00000000 00000017 80db1f60 00000009 8049c19c 000d0013 ffffffff
[<80012240>] (__irq_svc) from [<8049c19c>] (cpuidle_enter_state+0x54/0xe4)
[<8049c19c>] (cpuidle_enter_state) from [<8049c2e0>] (cpuidle_idle_call+0xb4/0x14c)
[<8049c2e0>] (cpuidle_idle_call) from [<8000f07c>] (arch_cpu_idle+0x8/0x44)
[<8000f07c>] (arch_cpu_idle) from [<8006876c>] (cpu_startup_entry+0x100/0x14c)
[<8006876c>] (cpu_startup_entry) from [<80d52b10>] (start_kernel+0x350/0x35c)
Code: 11a002a0 03a00001 e12fff1e e92d4008 (e59130b0)
--[ end trace 1160f590a7b228b4 ]--
Kernel panic - not syncing: Fatal exception in interrupt
CPU2: stopping
CPU: 2 PID: 1483 Comm: modprobe Tainted: G D W 3.14.38-usb-host-otg-02047-ga4dec77 #13
[<80014a68>] (unwind_backtrace) from [<80011758>] (show_stack+0x10/0x14)
[<80011758>] (show_stack) from [<806f5fe8>] (dump_stack+0x7c/0xbc)
[<806f5fe8>] (dump_stack) from [<800139f0>] (handle_IPI+0x144/0x158)
[<800139f0>] (handle_IPI) from [<80008598>] (gic_handle_irq+0x58/0x5c)
[<80008598>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0xd96c5dc0 to 0xd96c5e08)
5dc0: d800995c 0000004b 00000000 00072004 d8f2dec0 d8009900 d800995c 0000004b
5de0: d800995c a00f0013 00000000 010f2280 fffffffa d96c5e08 00000000 8006926c
5e00: 000f0013 ffffffff
[<80012240>] (__irq_svc) from [<8006926c>] (synchronize_irq+0x18/0xa8)
[<8006926c>] (synchronize_irq) from [<800696dc>] (__free_irq+0xfc/0x1c4)
[<800696dc>] (__free_irq) from [<80069838>] (free_irq+0x4c/0xa4)
[<80069838>] (free_irq) from [<8034b760>] (release_nodes+0x16c/0x1cc)
[<8034b760>] (release_nodes) from [<803487ec>] (__device_release_driver+0x78/0xcc)
[<803487ec>] (__device_release_driver) from [<8034885c>] (device_release_driver+0x1c/0x28)
[<8034885c>] (device_release_driver) from [<8034827c>] (bus_remove_device+0xdc/0x108)
[<8034827c>] (bus_remove_device) from [<80345788>] (device_del+0x100/0x1a4)
[<80345788>] (device_del) from [<8034a218>] (platform_device_del+0x18/0x9c)
[<8034a218>] (platform_device_del) from [<8034a2a8>] (platform_device_unregister+0xc/0x20)
[<8034a2a8>] (platform_device_unregister) from [<7f61932c>] (ci_hdrc_remove_device+0xc/0x20 [ci_hdrc])
[<7f61932c>] (ci_hdrc_remove_device [ci_hdrc]) from [<7f631260>] (ci_hdrc_imx_remove+0x2c/0xdc [ci_hdrc_imx])
[<7f631260>] (ci_hdrc_imx_remove [ci_hdrc_imx]) from [<8034a350>] (platform_drv_remove+0x18/0x30)
[<8034a350>] (platform_drv_remove) from [<803487e4>] (__device_release_driver+0x70/0xcc)
[<803487e4>] (__device_release_driver) from [<80348ef4>] (driver_detach+0xac/0xb0)
[<80348ef4>] (driver_detach) from [<803484e4>] (bus_remove_driver+0x4c/0xa0)
[<803484e4>] (bus_remove_driver) from [<80084158>] (SyS_delete_module+0x11c/0x17c)
[<80084158>] (SyS_delete_module) from [<8000e460>] (ret_fast_syscall+0x0/0x30)
CPU3: stopping
CPU: 3 PID: 0 Comm: swapper/3 Tainted: G D W 3.14.38-usb-host-otg-02047-ga4dec77 #13
[<80014a68>] (unwind_backtrace) from [<80011758>] (show_stack+0x10/0x14)
[<80011758>] (show_stack) from [<806f5fe8>] (dump_stack+0x7c/0xbc)
[<806f5fe8>] (dump_stack) from [<800139f0>] (handle_IPI+0x144/0x158)
[<800139f0>] (handle_IPI) from [<80008598>] (gic_handle_irq+0x58/0x5c)
[<80008598>] (gic_handle_irq) from [<80012240>] (__irq_svc+0x40/0x70)
Exception stack(0xd80b1f50 to 0xd80b1f98)
1f40: d80b1f98 3b9aca00 256aed09 0000000d
1f60: 80dbe1c8 80dbe1c8 ee7360d0 00000000 25477984 0000000d d80b0000 00000000
1f80: 00000017 d80b1f98 00000009 8049c19c 00070013 ffffffff
[<80012240>] (__irq_svc) from [<8049c19c>] (cpuidle_enter_state+0x54/0xe4)
[<8049c19c>] (cpuidle_enter_state) from [<8049c2e0>] (cpuidle_idle_call+0xb4/0x14c)
[<8049c2e0>] (cpuidle_idle_call) from [<8000f07c>] (arch_cpu_idle+0x8/0x44)
[<8000f07c>] (arch_cpu_idle) from [<8006876c>] (cpu_startup_entry+0x100/0x14c)
[<8006876c>] (cpu_startup_entry) from [<10008624>] (0x10008624)
CPU1: stopping

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 402f2d38e22007e931dc3dd52a69c0fed88452bf)

7 years agoMLK-11183 usb: chipidea: otg: complete state machine before cancel hrtimer
Li Jun [Thu, 2 Jul 2015 00:13:39 +0000 (08:13 +0800)]
MLK-11183 usb: chipidea: otg: complete state machine before cancel hrtimer

When do usb driver module load and unload loop test for A-device, the
hrtimer may be cancelled during otg state machine running, so after
the hrtimer is cancelled, the otg state machine may start it again by
adding a new timer, this will cause the hrtimer will be active after
its function memory is freed by module unload. This patch is to fix it
by trying to hold the fsm mutex lock before setting otg state to be
undefined, then otg hrtimer will be cancelled after current otg fsm
transition completes, and no new timer will be added.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 8c3ab4f22bc34675aeb8f9c62e69b450a179be0f)
(cherry picked from commit 95c8590c5232eeb9d054ac7504455a90a133f05a)

7 years agoMLK-11147 usb: chipidea: otg: keep irq enabled if otg work had been queued
Li Jun [Tue, 23 Jun 2015 02:46:44 +0000 (10:46 +0800)]
MLK-11147 usb: chipidea: otg: keep irq enabled if otg work had been queued

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 <b47624@freescale.com>
(cherry picked from commit 0d5c0888eaec17289e40968d7d15b92b781ed34f)

7 years agoMLK-11151 usb: chipidea: otg: drive vbus off if fsm.drv_vbus is true
Peter Chen [Tue, 23 Jun 2015 08:04:57 +0000 (16:04 +0800)]
MLK-11151 usb: chipidea: otg: drive vbus off if fsm.drv_vbus is true

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 <peter.chen@freescale.com>
(cherry picked from commit c0cdff8472c38e0fc39c597148d5534a5e9cc9b1)

7 years agoMLK-11132 usb: chipidea: otg: delay suspend for a_wait_vfall
Li Jun [Fri, 19 Jun 2015 09:18:48 +0000 (17:18 +0800)]
MLK-11132 usb: chipidea: otg: delay suspend for a_wait_vfall

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 <jun.li@freescale.com>
(cherry picked from commit b140fa6803ef6ececec17e435212a960a3169cc2)

7 years agoMLK-10994-5 usb: chipidea: otg: fix NULL pointer dereference when unload module
Peter Chen [Wed, 3 Jun 2015 11:36:29 +0000 (19:36 +0800)]
MLK-10994-5 usb: chipidea: otg: fix NULL pointer dereference when unload module

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 : [<80045060>]    lr : [<80045060>]    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
[<80045060>] (__queue_work) from [<800452a8>] (queue_work_on+0x48/0x54)
[<800452a8>] (queue_work_on) from [<7f060ac0>] (ci_otg_fsm_irq+0x108/0x310 [ci_hdrc])
[<7f060ac0>] (ci_otg_fsm_irq [ci_hdrc]) from [<7f059730>] (ci_irq+0x94/0x158 [ci_hdrc])
[<7f059730>] (ci_irq [ci_hdrc]) from [<8006c1b4>] (handle_irq_event_percpu+0x50/0x180)
[<8006c1b4>] (handle_irq_event_percpu) from [<8006c320>] (handle_irq_event+0x3c/0x5c)
[<8006c320>] (handle_irq_event) from [<8006f1c4>] (handle_fasteoi_irq+0x84/0x14c)
[<8006f1c4>] (handle_fasteoi_irq) from [<8006b92c>] (generic_handle_irq+0x2c/0x3c)
[<8006b92c>] (generic_handle_irq) from [<8000f9cc>] (handle_IRQ+0x40/0x90)
[<8000f9cc>] (handle_IRQ) from [<8000856c>] (gic_handle_irq+0x2c/0x5c)
[<8000856c>] (gic_handle_irq) from [<800130bc>] (__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 interrupt

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit c5b8111e4178387e1a6e9c700fdf887a944a5129)

7 years agoMLK-10051-1 usb: host: don't break clear suspend feature if otg fsm is used
Li Jun [Wed, 24 Dec 2014 10:23:04 +0000 (18:23 +0800)]
MLK-10051-1 usb: host: don't break clear suspend feature if otg fsm is used

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit f92731f787ca00ef8cd0ab9d591e4e24d5a40cc4)
(cherry picked from commit 92f5f68e853713e1179c0e30c1e84456ba11302e)

7 years agoMLK-9897-2 usb: otg-fsm: check B-device state before sending polling request
Li Jun [Tue, 25 Nov 2014 04:08:48 +0000 (12:08 +0800)]
MLK-9897-2 usb: otg-fsm: check B-device state before sending polling request

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 2cff5eb7bd4feb70cd28ac4655e7433e57a17938)
(cherry picked from commit b6eea060a3760bdb24d1514a5130a346daba81c9)

7 years agoMLK-9824-1 usb: chipidea: otg: clear b_conn when ends session
Li Jun [Tue, 11 Nov 2014 05:23:41 +0000 (13:23 +0800)]
MLK-9824-1 usb: chipidea: otg: clear b_conn when ends session

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 <b47624@freescale.com>
(cherry picked from commit 043b79264051454de18488cb746ee617d86f3568)
(cherry picked from commit 7476c27df7a8bbc66f2269804cac58319fecf3d2)

7 years agoMLK-9794-3 usb: common: otg: HNP polling condition update for b host
Li Jun [Tue, 4 Nov 2014 12:42:16 +0000 (20:42 +0800)]
MLK-9794-3 usb: common: otg: HNP polling condition update for b host

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 6148c9df6d1c68dfc91cfe274101058c8edf979b)
(cherry picked from commit 8dbe217d14726d5950e91de9d98e401100357a21)

7 years agoMLK-9618-10 usb: chipidea: otg: change TA_WAIT_VFAL to be 500ms
Li Jun [Thu, 16 Oct 2014 14:18:03 +0000 (22:18 +0800)]
MLK-9618-10 usb: chipidea: otg: change TA_WAIT_VFAL to be 500ms

500ms is enough for vbus fall to VOTG_VBUS_LKG(0.7v, OTG device or EH
Leakage Voltage).

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 41295ac496aa7697585e65223797e0cb4e5fb153)
(cherry picked from commit 56a84fbabed530150787cad4f98aad414a0fee57)

7 years agoMLK-9618-9 usb: chipidea: otg: change TA_BIDL_ADIS to be 160ms
Li Jun [Thu, 16 Oct 2014 14:18:02 +0000 (22:18 +0800)]
MLK-9618-9 usb: chipidea: otg: change TA_BIDL_ADIS to be 160ms

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 <b47624@freescale.com>
(cherry picked from commit a6de1be200984b01d784f6558229adbb67fcb380)
(cherry picked from commit a94422371328c620f4b37520868ad3f96ec2e165)

7 years agoMLK-9618-6 usb: chipidea: otg: show message for b host HNP fails
Li Jun [Mon, 4 May 2015 02:56:59 +0000 (10:56 +0800)]
MLK-9618-6 usb: chipidea: otg: show message for b host HNP fails

Show 'Device no response' message if A-device fails to connect as a peripheral.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 134a56ed85141acfa86ba0d827f654f7716405f2)

7 years agoMLK-9618-5 usb: chipidea: otg: show message device no response for SRP fail
Li Jun [Mon, 4 May 2015 02:54:20 +0000 (10:54 +0800)]
MLK-9618-5 usb: chipidea: otg: show message device no response for SRP fail

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 <b47624@freescale.com>
(cherry picked from commit 079e1cb81b6259cb4a5e651e1c02f4c3b58a20ed)

7 years agoMLK-9618-4 usb: chipidea: otg: show message for a_wait_bcon time out
Li Jun [Thu, 16 Oct 2014 14:17:57 +0000 (22:17 +0800)]
MLK-9618-4 usb: chipidea: otg: show message for a_wait_bcon time out

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.22

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 1762592ead672d27b281df8becf90f8c7d7fe61c)
(cherry picked from commit f1f68bc5f62848382646599c3609ad797bf3b5a5)

7 years agoMLK-9617-19 usb: otg: test: show warning message for unsupported otg test dev
Li Jun [Thu, 16 Oct 2014 14:17:56 +0000 (22:17 +0800)]
MLK-9617-19 usb: otg: test: show warning message for unsupported otg test dev

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 <b47624@freescale.com>
(cherry picked from commit 3fb9b462769d44073078f3b29fe68e214896ea9e)

7 years agoMLK-9617-17 usb: common: otg: clear b_bus_req in b_peripheral state
Li Jun [Thu, 16 Oct 2014 14:17:54 +0000 (22:17 +0800)]
MLK-9617-17 usb: common: otg: clear b_bus_req in b_peripheral state

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 <b47624@freescale.com>
(cherry picked from commit eb610e73aa38bbb45aed6a79265cd79fe80cdd05)
(cherry picked from commit 427b0f80a51c50629131090c6f8b82d747fb7d24)

7 years agoMLK-9617-16 usb: common: otg: clear a_conn flag when leaves b host
Li Jun [Thu, 16 Oct 2014 14:17:53 +0000 (22:17 +0800)]
MLK-9617-16 usb: common: otg: clear a_conn flag when leaves b host

This patch is clearing a_conn flag when b device leave b_host state.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit e511cc08879fa97035900ae8626051e473f30cd9)
(cherry picked from commit e293fb467244e7068bd67e6c37a485b99944bbcf)

7 years agoMLK-9617-13 usb: core: otg: do quick bus reset after clear connection change
Li Jun [Thu, 16 Oct 2014 14:17:50 +0000 (22:17 +0800)]
MLK-9617-13 usb: core: otg: do quick bus reset after clear connection change

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 <b47624@freescale.com>
(cherry picked from commit b87d3bb0672ebcfb29c7db8708c586b2d38558d1)
(cherry picked from commit f3ec1858d5293de28476996a59287b7adb8e9cd2)

7 years agoMLK-9618-3 usb: chipidea: host: add port reset for USB OTG HNP
Li Jun [Thu, 16 Oct 2014 14:17:49 +0000 (22:17 +0800)]
MLK-9618-3 usb: chipidea: host: add port reset for USB OTG HNP

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 <b47624@freescale.com>
(cherry picked from commit 5a63aca9c698a2eca09473c675ad2c40a62a27d1)

7 years agoMLK-9617-11 usb: common: otg: use a_set_b_hnp_en instead of b_hnp_enable
Li Jun [Mon, 29 Sep 2014 02:22:52 +0000 (10:22 +0800)]
MLK-9617-11 usb: common: otg: use a_set_b_hnp_en instead of b_hnp_enable

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 <b47624@freescale.com>
(cherry picked from commit 4734ed1f813959a7544ad744d60ab119efb04ba9)
(cherry picked from commit 853e4e0a2c59f034b177eebd3e7254efc8feffd4)

7 years agoMLK-9617-10 usb: common: otg: update condition from a_host to a_suspend
Li Jun [Sat, 27 Sep 2014 14:34:58 +0000 (22:34 +0800)]
MLK-9617-10 usb: common: otg: update condition from a_host to a_suspend

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 <b47624@freescale.com>
(cherry picked from commit f3acf74150683d4555c82ad32b9c669d8a0a7fb5)
(cherry picked from commit a938eb1ccabe9213c0b232d45da2caeb75f8b9fe)

7 years agoMLK-9617-9 usb: core: hub: use a_set_b_hnp_en and b_hnp_en for otg fsm mode
Li Jun [Fri, 10 Oct 2014 07:34:39 +0000 (15:34 +0800)]
MLK-9617-9 usb: core: hub: use a_set_b_hnp_en and b_hnp_en for otg fsm mode

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 <b47624@freescale.com>
(cherry picked from commit b715d0773eea212a25d6b8c5d94530e12935fdaf)
(cherry picked from commit 454369742ce4dec01d89c946a28c3069fc23bbea)

7 years agoMLK-9618-3 usb: chipidea: otg: enable hnp_pollinig flag
Li Jun [Mon, 29 Sep 2014 02:32:00 +0000 (10:32 +0800)]
MLK-9618-3 usb: chipidea: otg: enable hnp_pollinig flag

This patch enables hnp_polling flag for chipidea host driver in otg fsm mode.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit acb43a932263edd9b80c6d6d9ee858176c201542)
(cherry picked from commit 9e75e851370b62319fec4200b68cfd3465e12cfe)

7 years agoMLK-9617-7 usb: otg: add hnp_polling flag in struct otg_fsm
Li Jun [Mon, 29 Sep 2014 02:04:45 +0000 (10:04 +0800)]
MLK-9617-7 usb: otg: add hnp_polling flag in struct otg_fsm

This patch adds a flag hnp_polling to indicate if HNP polling is supported.

Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit b19d4b1110fe1fb2ec3141233781a1e016c9a9cf)
(cherry picked from commit cad8ae2986ab0b70d0f13b96c98f340564213d4c)

7 years agoMLK-9617-6 usb: core: otg: do not break otg device enumeration
Li Jun [Sat, 27 Sep 2014 14:23:39 +0000 (22:23 +0800)]
MLK-9617-6 usb: core: otg: do not break otg device enumeration

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 <b47624@freescale.com>
(cherry picked from commit 51317577d16034ba151da8d502319f4befb91278)
(cherry picked from commit 3d5d5139b3aef654e8004a2ad9ce757af50aee57)

7 years agoMLK-9617-4 usb: common: otg: test: do HNP for legacy otg test device
Li Jun [Mon, 29 Sep 2014 02:47:41 +0000 (10:47 +0800)]
MLK-9617-4 usb: common: otg: test: do HNP for legacy otg test device

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 <b47624@freescale.com>
(cherry picked from commit 688bbca155159978cd520923f2c3029c7778fa9c)
(cherry picked from commit 6f9edab20e2dd8794e46a0b9129c8694e81d064b)

7 years agoMLK-9638-6 usb: common: otg: test: clear otg_hnp_reqd flag when it's invalid
Li Jun [Sat, 27 Sep 2014 13:33:29 +0000 (21:33 +0800)]
MLK-9638-6 usb: common: otg: test: clear otg_hnp_reqd flag when it's invalid

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 39d25f04ed047e15f23b44e8465ce46257547df7)
(cherry picked from commit f92c4e5794a278946d3f4e7c8bc30e3e43a80c28)

7 years agoMLK-9638-5 usb: chipidea: otg: test: timer for B host hands host role back
Li Jun [Sat, 27 Sep 2014 13:44:36 +0000 (21:44 +0800)]
MLK-9638-5 usb: chipidea: otg: test: timer for B host hands host role back

This patch implements a timer for B host to start host role switch back to A
device.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 139bcc46841f73199bdc3ca308e46a5af3dd2fc1)
(cherry picked from commit d1c81fc3fa2f8cc141d688b6f627ffa6ca4a7204)

7 years agoMLK-9638-4 usb: ehset: test: start timer for B host switch role back
Li Jun [Sat, 27 Sep 2014 13:13:42 +0000 (21:13 +0800)]
MLK-9638-4 usb: ehset: test: start timer for B host switch role back

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 3f4a8c8a20ef69721f9e7886b8d245036d41d91a)
(cherry picked from commit 72b535f92ea078d8c3bd73186763bcb2f39106bb)

7 years agoMLK-9638-3 usb: chipidea: udc: test: handle otg_hnp_req set feature request
Li Jun [Sat, 27 Sep 2014 13:03:55 +0000 (21:03 +0800)]
MLK-9638-3 usb: chipidea: udc: test: handle otg_hnp_req set feature request

This patch adds otg_hnp_reqd set feature request from A host for chipidea udc
driver.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 450d4a1eb40ec4284661c1130bdcc4f4d2e6c527)
(cherry picked from commit 03f3f886029fa8f25dde34fcfeb28589ead0064f)

7 years agoMLK-9638-2 usb: otg: test: add otg_hnp_reqd flag in struct otg_fsm
Li Jun [Sat, 27 Sep 2014 13:07:48 +0000 (21:07 +0800)]
MLK-9638-2 usb: otg: test: add otg_hnp_reqd flag in struct otg_fsm

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 92382e06c6902731b05dcbb0db4f0ebfa486969f)
(cherry picked from commit 8e3f26a58f995711a81b401af26fbe5ed12e17f4)

7 years agoMLK-9638-1 usb: test: define otg_hnp_reqd wIndex byte value
Li Jun [Sat, 27 Sep 2014 12:48:23 +0000 (20:48 +0800)]
MLK-9638-1 usb: test: define otg_hnp_reqd wIndex byte value

This patch adds otg_hnp_reqd wIndex high byte value for otg test mode.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit c334dc80bc2672aab012cad6926d819feaf4634d)
(cherry picked from commit dd95b40fa19e522353b548554f55e8c77ac9bdfe)

7 years agoMLK-9637-4 usb: chipidea: otg: test: add otg_srp_reqd timer for start srp
Li Jun [Sat, 27 Sep 2014 12:19:30 +0000 (20:19 +0800)]
MLK-9637-4 usb: chipidea: otg: test: add otg_srp_reqd timer for start srp

This patch adds a timer for chipidea otg fsm driver to start data pulse
after A host ends the session.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 35e92b59080b58925c3b96e36511056cb51d4a00)
(cherry picked from commit eeded24ce2d20b1c19d5c666e916f41995cf2385)

7 years agoMLK-9637-3 usb: chipidea: udc: test: handle otg_srp_reqd set feature request
Li Jun [Sat, 27 Sep 2014 12:10:43 +0000 (20:10 +0800)]
MLK-9637-3 usb: chipidea: udc: test: handle otg_srp_reqd set feature request

This patch adds otg_srp_reqd set feature request from A host for chipidea
udc driver.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 5edca27c518e8a69accb429c946c19243e156656)
(cherry picked from commit 14ac2f1f74ce0b02e03296472e7d170c45a31f29)

7 years agoMLK-9637-2 usb: otg: test: add otg_srp_reqd flag in otg_fsm
Li Jun [Sat, 27 Sep 2014 11:49:56 +0000 (19:49 +0800)]
MLK-9637-2 usb: otg: test: add otg_srp_reqd flag in otg_fsm

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 8e5f1b6b12ec77ec591909b09727049ffff37b9c)
(cherry picked from commit 7eaf8cf8ff375917e9972cca69bcecd6d807e6db)

7 years agoMLK-9637-1 usb: test: define otg_srp_reqd wIndex byte value
Li Jun [Sat, 27 Sep 2014 11:43:08 +0000 (19:43 +0800)]
MLK-9637-1 usb: test: define otg_srp_reqd wIndex byte value

This patch adds otg_srp_reqd wIndex high byte value for otg test mode.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 34660f7aa14972630622406b9dbfc7a106d8d15d)
(cherry picked from commit c5128f9bafaa37a8e63989032372a5ff36dc82c4)

7 years agoMLK-9606-5 usb: chipidea: otg: test: end test session if otg_vbus_off is set
Li Jun [Wed, 24 Sep 2014 06:46:00 +0000 (14:46 +0800)]
MLK-9606-5 usb: chipidea: otg: test: end test session if otg_vbus_off is set

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 204fa72fe4e2be468fe61f1ede555e072610c932)
(cherry picked from commit 202ce199bd29093d20506a950748acd5323e76fa)

7 years agoMLK-9606-4 usb: chipidea: otg: test: tst_maint timer implementation
Li Jun [Wed, 24 Sep 2014 06:35:31 +0000 (14:35 +0800)]
MLK-9606-4 usb: chipidea: otg: test: tst_maint timer implementation

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 9d3bd049aef442f11dce77226a0ca09893a6656b)

7 years agoMLK-9606-3 usb: otg: test: remove test maintain timer if HNP happens
Li Jun [Wed, 24 Sep 2014 06:17:29 +0000 (14:17 +0800)]
MLK-9606-3 usb: otg: test: remove test maintain timer if HNP happens

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit d914c80921652419037d935f14545fe87f74a71c)
(cherry picked from commit 243c0fcf492748219f4c581203b9bccb078a61d8)

7 years agoMLK-9606-2 usb: otg: test: start tst_maint timer and set otg_vbus_off flag
Li Jun [Wed, 24 Sep 2014 06:05:30 +0000 (14:05 +0800)]
MLK-9606-2 usb: otg: test: start tst_maint timer and set otg_vbus_off flag

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 <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 78a2c14bdea4b8e334c7e0afad074b61b71193cb)
(cherry picked from commit b854141cc5a7150751e7f7fd2dfb10a415cfea10)

7 years agoMLK-9606-1 usb: otg: test: add otg test device into otg and EH TPL
Li Jun [Wed, 24 Sep 2014 05:31:19 +0000 (13:31 +0800)]
MLK-9606-1 usb: otg: test: add otg test device into otg and EH TPL

This patch add otg test device with VID(0x1a0a) and PID(0x0200) into otg and
EH TPL.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit b88ee5e2cbf55aaed3b6c5dd0aff7f826f9e357d)
(cherry picked from commit 8c11515f82876e69aa14e1c31fcb5031cf4edfcc)

7 years agoMLK-9618-2 usb: chipidea: otg: update is_b_host flag when setup&stop host
Li Jun [Thu, 18 Sep 2014 14:59:40 +0000 (22:59 +0800)]
MLK-9618-2 usb: chipidea: otg: update is_b_host flag when setup&stop host

This patch sets and clear is_b_host flag of usb_bus when start and stop host in
chipidea host driver.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit c164e65922235efcacc3743a9719adc7a9ef7413)
(cherry picked from commit f21e960aba9618c527650cfe3a69cc3ea583ac2a)

7 years agoMLK-9829 usb: core: print suggested message if failed to get device descriptor
Li Jun [Wed, 12 Nov 2014 07:16:33 +0000 (15:16 +0800)]
MLK-9829 usb: core: print suggested message if failed to get device descriptor

This is required for USB OTG and EH compliance test 6.7.22(A-UUT “Device No
Response” for connection timeout). When the connected usb device(PET) does
not response to transactions, host will fail to get device descriptor.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 86d0bd661ecbbdf97dd9a8ddbaf0d3811de7f39e)
(cherry picked from commit 858af83637291d2ececfc7b2b4b17e3a371b53f3)

7 years agoMLK-10718 usb: chipidea: udc: disable BSV irq when otg from undefined to a_idle
Li Jun [Tue, 28 Apr 2015 06:41:36 +0000 (14:41 +0800)]
MLK-10718 usb: chipidea: udc: disable BSV irq when otg from undefined to a_idle

After device power up, insert usb OTG ID cable, otg fsm from undefined state
to a_idle, the BSV cannot be disabled, this will result BSV irq generated but
which is actually only for B device.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit bf6a1cdaef68125cc10240f174019e2646ebaa24)

7 years agoMLK-10783-7 doc: dt-binding: mxs-phy: add compatible string "fsl,imx6ul-usbphy"
Peter Chen [Thu, 30 Apr 2015 05:49:41 +0000 (13:49 +0800)]
MLK-10783-7 doc: dt-binding: mxs-phy: add compatible string "fsl,imx6ul-usbphy"

add compatible string "fsl,imx6ul-usbphy"

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 45583aa93ee7d3f8e930854603121f7facdcffb9)

7 years agoMLK-10783-6 doc: dt-binding: usbmisc_imx: add compatible string "fsl,imx6ul-usbmisc"
Peter Chen [Thu, 30 Apr 2015 05:47:17 +0000 (13:47 +0800)]
MLK-10783-6 doc: dt-binding: usbmisc_imx: add compatible string "fsl,imx6ul-usbmisc"

Add compatible string "fsl,imx6ul-usbmisc"

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 2bccb52eba125db06a7a7da5342d41c9f664d2d7)

7 years agoMLK-10783-5 usb: phy: mxs: add "fsl,imx6ul-usbphy" compatible string
Peter Chen [Thu, 30 Apr 2015 03:43:13 +0000 (11:43 +0800)]
MLK-10783-5 usb: phy: mxs: add "fsl,imx6ul-usbphy" compatible string

Add "fsl,imx6ul-usbphy" compatible string

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit dba30c6e41a9380b41715eca54792bfaa64693d0)

7 years agoMLK-10750 usb: chipidea: otg: remove otg fsm before destory gdaget and host
Li Jun [Tue, 28 Apr 2015 11:56:35 +0000 (19:56 +0800)]
MLK-10750 usb: chipidea: otg: remove otg fsm before destory gdaget and host

If unload ci_hdrc driver while otg fsm is running as A-device, we should
firstly clean otg fsm and stop all otg fsm timers before destroy gadget
and host.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 95b62fe02aee5d2a83a9eb60816ee7cfc16708e8)

7 years agoMLK-10510-3 usb: chipidea: usbmisc_imx: add power lost check for i.MX7D
Li Jun [Mon, 30 Mar 2015 05:19:42 +0000 (13:19 +0800)]
MLK-10510-3 usb: chipidea: usbmisc_imx: add power lost check for i.MX7D

Add power lost check implementation for i.MX7D.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 59102c3b9756923f1c8cdba8bcab7b8611685321)

7 years agoMLK-10490 usb: chipidea: otg_fsm: update b_sess_vld after changes to be b_idle
Li Jun [Fri, 27 Mar 2015 06:46:20 +0000 (14:46 +0800)]
MLK-10490 usb: chipidea: otg_fsm: update b_sess_vld after changes to be b_idle

In a corner case: system suspend with usb device connected on OTG port, then
remove usb device and connect OTG port to PC, and then resume the system,
OTG cannot be enumrated by PC. Reason is there is no BSV irq generated after
resume, so b_sess_vld cannot be updated and otg fsm state keeps in b_idle state
with vbus on, this patch force a update of b_sess_vld flag according to OTGSC
BSV status.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 0c1a70a95e4f8ef069e4a9809a447a39f36d0628)

7 years agoMLK-10394 usb: chipidea: otg_fsm: turn off vbus when remove driver
Li Jun [Tue, 10 Mar 2015 07:26:46 +0000 (15:26 +0800)]
MLK-10394 usb: chipidea: otg_fsm: turn off vbus when remove driver

Currently if remove controller driver while vbus is on, vbus turn off
is missing, thus next time loading controller driver will turn on vbus
again but will not generate AVV irq, finally otg fsm state is mess and
cannot work as host correctly.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit c810ab9697dd912ba2a928659879ace188d31c10)

7 years agoMLK-10387-2 ARM: imx7d-sdb: add USB support
Peter Chen [Mon, 9 Mar 2015 06:04:09 +0000 (14:04 +0800)]
MLK-10387-2 ARM: imx7d-sdb: add USB support

Add USB support for both USBOTG1 and USBOTG2.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 8b6ae9b5ca581dce29ccfc0640bf020bba5b55b4)

7 years agoMLK-10364 ARM: imx_v7_defconfig: enable OTG FSM for usb driver
Li Jun [Wed, 4 Mar 2015 02:24:32 +0000 (10:24 +0800)]
MLK-10364 ARM: imx_v7_defconfig: enable OTG FSM for usb driver

Enable CONFIG_USB_OTG_FSM, which selects USB_OTG, then we have unified
menuconfig to support OTG port all usages: device-only ,host-only, role
switch by ID pin detection, standard USB OTG HNP&SRP.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit a5dca04d32b827ec952585fe709d910a643ccb42)

7 years agoMLK-9963 usb: chipidea: otg: remove b_bus_suspend flag update
Li Jun [Fri, 5 Dec 2014 06:35:09 +0000 (14:35 +0800)]
MLK-9963 usb: chipidea: otg: remove b_bus_suspend flag update

Remove b_bus_suspend flag update in otg fsm driver since it's not
used.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 235e741160c2b2899806a46439c0e1b4b7073eb5)
(cherry picked from commit 67d40f1e3ee92d9a69211df0e5002886155cc071)

7 years agoMLK-10282-5 clk: imx7d: add USB clock information
Peter Chen [Sat, 28 Feb 2015 00:43:56 +0000 (08:43 +0800)]
MLK-10282-5 clk: imx7d: add USB clock information

Add USB clock information, the pll_usb_main_clk is USB_PLL at CCM
which is the output of USBOTG2 PHY.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 5abb3c7e2ce78dcf5d37e5435abed992841d63f2)

7 years agoMLK-10282-3 ARM: imx7d-12x12-arm2: enable usbotg1 and usbotg2
Li Jun [Fri, 7 Aug 2015 14:20:25 +0000 (22:20 +0800)]
MLK-10282-3 ARM: imx7d-12x12-arm2: enable usbotg1 and usbotg2

Enable usbotg1 and usbotg2

Signed-off-by: Peter Chen <peter.chen@freescale.com>
7 years agoMLK-10243 usb: chipidea: udc: enable and disable BSV irq only for ID change
Li Jun [Wed, 11 Feb 2015 10:32:33 +0000 (18:32 +0800)]
MLK-10243 usb: chipidea: udc: enable and disable BSV irq only for ID change

Since BSV irq is only used for B-device, this patch correct the setting of
BSVIE of otgsc only for case of ID change, that is:
- In otg fsm mode, ID change from 0 to 1 means otg state from A_IDLE to
  B_IDLE; ID change from 1 to 0 means otg state from B_IDLE to A_IDLE, so
  only disable BSVIE if the current state is B_IDLE(to be update to A_IDLE),
  only enable BSVIE if the current state is A_IDLE(to be update to B_IDLE).
- In non-otg-fsm mode, it's already correct.

This fix the bug of MLK-10243.

Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 8153cb550a007e1cd62dd4f043330c694cf62f23)

7 years agoMLK-10202-2 doc: usb: mxs-phy: add tx-d-cal property
Peter Chen [Wed, 4 Feb 2015 08:20:33 +0000 (16:20 +0800)]
MLK-10202-2 doc: usb: mxs-phy: add tx-d-cal property

Add tx-d-cal property

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit ebb97b3d3ca99516d3daac09813ae480de2adffe)

7 years agoMLK-10202-1 ARM: imx6sx-sdb: add tx-d-cal property for usbphy
Peter Chen [Wed, 4 Feb 2015 08:18:26 +0000 (16:18 +0800)]
MLK-10202-1 ARM: imx6sx-sdb: add tx-d-cal property for usbphy

It is used to improve signal quality for board.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit a944c36f13b6a9d3eca073516416255e9160210e)

7 years agoMLK-10170 usb: phy: mxs: keep USBPHY2's clk always on
Peter Chen [Tue, 3 Feb 2015 08:13:31 +0000 (16:13 +0800)]
MLK-10170 usb: phy: mxs: keep USBPHY2's clk always on

Per IC engineer request, we need to keep USBPHY2's clk always on,
in this way, the USBPHY2 (PLL7) power can be controlled by
hardware suspend signal totally. It is benefit of USB remote wakeup
case which needs the resume signal be sent out as soon as
possible (without software interfere).

It is intended to fix the issue which this ticket describes, the
reason for this issue is the host does not send resume in time.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 98888b352377f9ebaee03bedce8c239691f45262)

7 years agoMLK-10196-4 usb: phy: mxs: Using regulator phy-3p0
Peter Chen [Tue, 3 Feb 2015 02:10:53 +0000 (10:10 +0800)]
MLK-10196-4 usb: phy: mxs: Using regulator phy-3p0

It is one of PHY's power, and we need to enable it to keep signal
quality good, and pass eye diagram test.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 3a8670ee7ff698521369e8292bba7ef288a12335)

7 years agoMLK-10196-3 regulator: anatop: Add non core enable/disable
Peter Chen [Tue, 3 Feb 2015 02:09:33 +0000 (10:09 +0800)]
MLK-10196-3 regulator: anatop: Add non core enable/disable

Add non core enable/disable API.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 38681ee653cb75fa1839547414c7780c4f3a7c00)

7 years agoMLK-10196-2 doc: anatop-regulator: add anatop-enable-bit property
Peter Chen [Mon, 2 Feb 2015 08:35:00 +0000 (16:35 +0800)]
MLK-10196-2 doc: anatop-regulator: add anatop-enable-bit property

It is optional, and only for 3p0, 2p5, and 1p1.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 46f1841de3e50e4f502478d341674bb1f01a48fc)

7 years agoMLK-11340-42 usb: chipidea: usb vbus glitch check logic change
Li Jun [Wed, 10 Sep 2014 09:49:33 +0000 (17:49 +0800)]
MLK-11340-42 usb: chipidea: usb vbus glitch check logic change

This patch changes the vbus glitch check to cover usb otg certification
case, so the possible cases of vbus rise:
- USB vbus can reach AVV(4.4v), valid vbus.
- USB vbus keeps above BSV(0.8v) but lower than AVV(4.4v) for
  more than 300ms, we think it's valid vbus event, this can meet
  usb otg certificataion case(B device can do connection in 1s when
  vbus is 4.0v).
- USB vbus cannot be kept above BSV(0.8v) for more than 300ms,
  it's a vbus glitch.
In case of vbus drop: if the vbus on flag is not set, it's a vbus glitch,
otherwise it's a valid vbus drop event.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit de5ab444839b6d1492d697256ea2b8a1dcaffc62)
(cherry picked from commit 83788415169cfa1555dd348a9ff03deb66b08bad)

7 years agoMLK-11340-41 usb: chipidea: add vbus glitch handling
Li Jun [Fri, 20 Jun 2014 07:52:14 +0000 (15:52 +0800)]
MLK-11340-41 usb: chipidea: add vbus glitch handling

We add vbus glitch handling for both BSV rise and drop interruptes.
If it is a vbus glitch (higher than BSV but cannot reach AVV), ignore it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 827f2fe71e6222882930db7e89460087cb3bce5b)
(cherry picked from commit 4f9cefe4cf4bb093c8c1766409320dc86dd9a596)

7 years agoMLK-10101-5 usb: chipidea: otg: init otg_fsm of usb_bus while start host
Li Jun [Tue, 27 Jan 2015 09:26:48 +0000 (17:26 +0800)]
MLK-10101-5 usb: chipidea: otg: init otg_fsm of usb_bus while start host

Set otg_fsm of usb_bus to be ci->fsm while start host.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 65efc6c5f3936b254a77cf02478d1268585def84)

7 years agoMLK-10101-4 usb: add otg_fsm pointer in usb_bus
Li Jun [Tue, 27 Jan 2015 09:11:14 +0000 (17:11 +0800)]
MLK-10101-4 usb: add otg_fsm pointer in usb_bus

Add otg_fsm pointer in struct of usb_bus for access otg_fsm via bus.
Original way was to put it in usb_otg, then usb host can access otg_fsm
via hcd->usb_phy->otg->fsm, since usb_phy will not be the future direction,
instead phy is preferred, so this way may not work. It's more direct and
simple to put it in usb_bus.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit c118afccbbb1c78938c649ee72758213c22cf489)

7 years agoMLK-9618-1 doc: usb: chipidea: select gadget drivers for otg compliance test
Li Jun [Sun, 28 Sep 2014 05:55:01 +0000 (13:55 +0800)]
MLK-9618-1 doc: usb: chipidea: select gadget drivers for otg compliance test

This patch adds guide for selecting available gadget drivers for otg and EH
compliance tests.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit 520cac9e4fe938887dd45b5b4df6c8e35e125a59)
(cherry picked from commit 6534fab0bd77be544629ac04d4b8bb677d0a3aec)

7 years agoMLK-11340-39 usb: chipidea: otg: clear b_bus_req when vbus is off
Li Jun [Mon, 22 Sep 2014 08:19:59 +0000 (16:19 +0800)]
MLK-11340-39 usb: chipidea: otg: clear b_bus_req when vbus is off

In case of b_peripheral --> b_wait_acon --> b_idle due to vbus off
in b_wait_acon state, b_bus_req cannot be cleared in b_idle state,
which result in b device will do data pulse because b_bus_req is set.
This patch fix this issue by clear the input variable b_bus_req when
vbus is off.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <b47624@freescale.com>
(cherry picked from commit bc600546bf9193f1a39186ad4c07a5fd497c7bfd)
(cherry picked from commit c0ea9bfcd948e2d79ea77d22756550f498281cbb)

7 years agoMLK-10101-3 usb: chipidea: otg: enable BSV irq when OTG B-device in host mode
Li Jun [Tue, 27 Jan 2015 07:01:57 +0000 (15:01 +0800)]
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>
(cherry picked from commit eb7c192ce6ce077471dfdcdc4eb6cc9da4a7c01a)

7 years agoMLK-10132-4 usb: chipidea: imx: disable usb wakeup in probe
Li Jun [Tue, 27 Jan 2015 02:25:25 +0000 (10:25 +0800)]
MLK-10132-4 usb: chipidea: imx: disable usb wakeup in probe

Disable usb wakeup as initial setting in probe.

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit bf54f23766bcebd781f1c09bd68bc00d790160c8)

7 years agoMLK-11340-38 usb: chipidea: imx: enable different wakeup setting
Peter Chen [Fri, 3 Jan 2014 05:45:30 +0000 (13:45 +0800)]
MLK-11340-38 usb: chipidea: imx: enable different wakeup setting

We have different wakeup setting for different roles:
For peripheral-only mode, we may only enable vbus wakeup.
The Micro-AB cable should not be considered as wakeup source.
For host-only mode, the ID change or vbus change should not be
considered as wakeup source.
For OTG mode, all wakeup setting should be considered as wakeup
source.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 632e2eda5d071781479e0e0a80496c9a198d614f)

7 years agoMLK-11340-37 usb: chipidea: add query_available_role interface
Peter Chen [Fri, 3 Jan 2014 05:42:56 +0000 (13:42 +0800)]
MLK-11340-37 usb: chipidea: add query_available_role interface

The glue layer may need to know current available role, add
ci_hdrc_query_available_role for that.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 5c340402131ca6eacaeb122deb1ee59bcea2778c)

7 years agoMLK-9785-1 usb: host: ehci-hcd: enable park mode
Peter Chen [Tue, 4 Nov 2014 12:46:15 +0000 (20:46 +0800)]
MLK-9785-1 usb: host: ehci-hcd: enable park mode

Enable park mode will improve the performance a lot at USB ethernet use
case, but a little at USB mass storage use case, and it is not harm from
the tests. Below the performance comparison at imx6sl:

USB Ethernet (Mbps)
Default Enable Park
TX 192 262
RX 262 290

USB Mass Storage (MB/s)
Read 21.8 22.9
Write 19.5 22.8

This patch is used for freescale internal.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit b2289a78958859cff37508e4db0314463f33c2e0)

7 years agoMLK-11340-36 usb: chipidea: udc: don't do hardware access if gadget has stopped
Peter Chen [Tue, 26 Nov 2013 05:33:21 +0000 (13:33 +0800)]
MLK-11340-36 usb: chipidea: udc: don't do hardware access if gadget has stopped

After _gadget_stop_activity is executed, we can consider the hardware
operation for gadget has finished, and the udc can be stopped and enter
low power mode. So, any later hardware operations (from usb_ep_ops APIs
or usb_gadget_ops APIs) should be considered invalid, any deinitializatons
has been covered at _gadget_stop_activity.

I meet this problem when I plug out usb cable from PC (using g_mass_storage),
my callstack like: vbus interrupt->.vbus_session->composite_disconnect
->pm_runtime_put_sync(&_gadget->dev), the composite_disconnect will
call fsg_disable, but fsg_disable calls usb_ep_disable using async way,
there are register accesses for usb_ep_disable. So sometimes, I get system
hang due to visit register without clock, sometimes not.

The Linux Kernel USB maintainer Alan Stern suggests this kinds of solution.
See: http://marc.info/?l=linux-usb&m=138541769810983&w=2.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit ac760d29366f19eb1a4d4c37899b33019570a447)
(cherry picked from commit c246b1f129daa7f15fc88849ef2d04db54935c67)

7 years agoMLK-10086-5 usb: chipidea: imx: define quirk CI_HDRC_IMX_EHCI_QUIRK
Peter Chen [Mon, 26 Jan 2015 05:05:45 +0000 (13:05 +0800)]
MLK-10086-5 usb: chipidea: imx: define quirk CI_HDRC_IMX_EHCI_QUIRK

Define quirk CI_HDRC_IMX_EHCI_QUIRK for necessary platforms.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit e72ee6d6f76214034c99a6435b47e125476399bd)

7 years agoMLK-10086-4 usb: chipidea: imx: add HSIC support
Li Jun [Tue, 20 Jan 2015 08:03:37 +0000 (16:03 +0800)]
MLK-10086-4 usb: chipidea: imx: add HSIC support

Add imx6 HSIC support

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 0cebf3e28ec0b7e47a45d16aa2237b819746b494)

7 years agoMLK-11340-35 usb: chipidea: host: add ehci quirk for imx controller
Peter Chen [Sun, 29 Sep 2013 02:52:43 +0000 (10:52 +0800)]
MLK-11340-35 usb: chipidea: host: add ehci quirk for imx controller

When the port goes to suspend or finishes resme, it needs to
notify PHY, it is not a standard EHCI operation, so we add a
quirk for it.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 4ffe8d85d4eed813b43cbd37e5241a8a0069021d)

7 years agoMLK-10086-3 usb: phy-nop: add the implementation of .set_suspend
Li Jun [Tue, 20 Jan 2015 08:03:38 +0000 (16:03 +0800)]
MLK-10086-3 usb: phy-nop: add the implementation of .set_suspend

Add clock enable/disable at .set_suspend if the PHY has
suspend requirement, it can be benefit of power saving for
phy and the whole system (parent clock may also be disabled).

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 6c2f853799899c37ee2f733cafd58f1b2dc1f37f)

7 years agoMLK-10086-2 ARM: imx6: add dts entries for hsic controller
Li Jun [Tue, 20 Jan 2015 08:03:36 +0000 (16:03 +0800)]
MLK-10086-2 ARM: imx6: add dts entries for hsic controller

- Add usbphy_nop, hsic uses nop phy driver
- Add anatop phandle, hsic needs to access anatop register to
change osc clock for different boards
- Add phy_type, hsic needs to config PHY parameters at portsc
- For imx6q-arm2 board, hsic has pin conflict with ethernet, we create a
  dedicated dts(imx6q-arm2-hsic.dts) for it with ethernet disabled, besides
  please make sure keep the line of data and strobe unchanged between board
  boots up and enable hsic controller.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit 2f8a266d271874cd398d14556752ab4ab0be27ba)

7 years agoMLK-10086-1 usb: doc: ci-hdrc-imx: update for hsic controller
Li Jun [Tue, 20 Jan 2015 08:03:35 +0000 (16:03 +0800)]
MLK-10086-1 usb: doc: ci-hdrc-imx: update for hsic controller

Update for HSIC controller

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit c68e2fee7a6e321db9bb56b42853fe90a4e398ee)

7 years agoMLK-10132-3 usb: chipidea: udc: do not enter low power mode if vbus on
Li Jun [Fri, 23 Jan 2015 10:35:35 +0000 (18:35 +0800)]
MLK-10132-3 usb: chipidea: udc: do not enter low power mode if vbus on

This patch is to prevent usb entering low power mode if vbus is on even gadget
driver is not binded, by holding the PM count of ci->dev.
So, there are 3 pm usage_count status:
- ci->dev: 1 ci->gadget.dev: 1
  Device mode with gadget driver binded and vbus on.
- ci->dev: 1 ci->gadget.dev: 0
  USB vbus on but gadget driver not binded.
- ci->dev: 0 ci->gadget.dev: 1
  USB OTG FSM is in a_peripheral mode.
Above 2 device's pm usage_count hold by ci otg(ci->dev) and usb gadget
(ci->gadget.dev).

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 673c6bf1b3aa0b1b698569b9259712b0e765be32)

7 years agoMLK-9831-1 usb: chipidea: udc: refine ci_udc_start
Li Jun [Thu, 25 Dec 2014 09:34:01 +0000 (17:34 +0800)]
MLK-9831-1 usb: chipidea: udc: refine ci_udc_start

Use ci_hdrc_gadget_connect() API directly if vbus is on.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 918d4837d8e7c3c3c862a9deb8d2cc86c3d2334a)