1
0
Fork 0
Commit Graph

18628 Commits (redonkable)

Author SHA1 Message Date
Steinar Bakkemo 64a4289cf6 usbotg-bsp: improve vbus glitch detection/primary charger detection
Due to the USB-C connector introducing a slight delay between the detection of
a stable VBUS and the data lines making contact, the delay after setting the
USB PHY into charger detection mode before reading the detection status had to
be increased from 1 ms to 500 ms, enabling the user to use 500 ms to insert the
USB-C connector fully into the device and still get a positive CDP/DCP port
detection, enabling higher charge current where this is offered.
2020-10-08 20:41:27 +02:00
Steinar Bakkemo 8ae4524e0c chipidea-udc: disable static vbus max current defined in kernel gadget config 2020-10-08 20:41:25 +02:00
Steinar Bakkemo 8317515b62 chipidea: cleanup/remove debug code 2020-10-08 20:07:11 +02:00
Steinar Bakkemo 5e2d8da943 chipidea: convert printk's to dev_dbg 2020-10-08 19:52:42 +02:00
Steinar Bakkemo 32bea6bc06 chipidea: add of property 'flip-extcon-order' fliping VID/VBUS in extcon def. 2020-10-08 19:25:46 +02:00
Steinar Bakkemo 209844546b chipidea: change expected extcon phandle order (only emulate VID and not VBUS)
Add devicetree connection from usbotg1 to otgcontrol, which then will receive
VID status from otgcontrol based on SW control (no physical signal in connector)
2020-10-08 19:25:46 +02:00
Steinar Bakkemo 6f49239778 chipidea: add excton debug for otgcontrol debug/verification 2020-10-08 01:38:41 +02:00
Steinar Bakkemo 8ee4e3dbf0 usb-gadget: set VID/PID for the USB/RNDIS driver
Use an existing VID/PID recognized on Windows platforms by default
2020-10-08 01:32:59 +02:00
Marc Zyngier 40789e4547 Revert "xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue"
This reverts commit 8466489ef5.

Now that we can properly reset the uPD72020x without a hard PCI reset,
let's get rid of the existing quirks.

Tested-by: Domenico Andreoli <domenico.andreoli@linux.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Tested-by: Faiz Abbas <faiz_abbas@ti.com>
Tested-by: Domenico Andreoli <domenico.andreoli@linux.com>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c2ef60fea2)
2018-12-18 10:14:17 +08:00
Peter Chen f61f2b7294 MLK-20346 usb: chipidea: change power_lost workqueue as freezable
Like commit d144dfea8a ("usb: chipidea: otg: change workqueue
ci_otg as freezable"), the power_lost work item may try to remove
hcd if controller is powered off during the system suspend, and
the similar deadlock happens, see below dumps.

Meanwhile, with this change, we need to disable USB interrupt
during the work item runs (after driver resume has finished),
otherwise, USB transfer will be timeout (5s) due to USB interrupt
is disabled and IAA watchdog is still not ready at that time.

Workqueue: events ci_power_lost_work
Call trace:
[<ffff000008085c44>] __switch_to+0x8c/0xd0
[<ffff000008d7bbf4>] __schedule+0x19c/0x5d8
[<ffff000008d7c068>] schedule+0x38/0xa0
[<ffff000008d7f3b4>] schedule_timeout+0x19c/0x338
[<ffff000008d7cc10>] wait_for_common+0xa0/0x148
[<ffff000008d7cccc>] wait_for_completion+0x14/0x20
[<ffff0000080e6040>] flush_work+0xd8/0x1f0
[<ffff0000080e61f4>] flush_delayed_work+0x3c/0x48
[<ffff0000081ae1c8>] wb_shutdown+0x90/0xd0
[<ffff0000081ae688>] bdi_unregister+0x58/0x1c0
[<ffff000008413a60>] del_gendisk+0x218/0x228
[<ffff00000871683c>] sd_remove+0x64/0xc0
[<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0
[<ffff0000086b6f9c>] device_release_driver+0x14/0x20
[<ffff0000086b5d40>] bus_remove_device+0xc8/0x108
[<ffff0000086b2a08>] device_del+0x1f8/0x300
[<ffff0000087049ec>] __scsi_remove_device+0xec/0x128
[<ffff000008702c70>] scsi_forget_host+0x70/0x78
[<ffff0000086f7ee8>] scsi_remove_host+0xa0/0x140
[<ffff0000088e0588>] usb_stor_disconnect+0x50/0xc0
[<ffff00000887eab8>] usb_unbind_interface+0x78/0x280
[<ffff0000086b6eec>] device_release_driver_internal+0x154/0x1f0
[<ffff0000086b6f9c>] device_release_driver+0x14/0x20
[<ffff0000086b5d40>] bus_remove_device+0xc8/0x108
[<ffff0000086b2a08>] device_del+0x1f8/0x300
[<ffff00000887c364>] usb_disable_device+0xa4/0x210
[<ffff000008872cfc>] usb_disconnect+0x7c/0x240
[<ffff000008872e40>] usb_disconnect+0x1c0/0x240
[<ffff000008878e10>] usb_remove_hcd+0xc0/0x1d8
[<ffff0000088e7bac>] host_stop+0x34/0x90
[<ffff0000088e4088>] ci_handle_id_switch+0x70/0x1d0
[<ffff0000088e3038>] ci_power_lost_work+0x90/0xa8
[<ffff0000080e7100>] process_one_work+0x1e0/0x340
[<ffff0000080e72b0>] worker_thread+0x50/0x458
[<ffff0000080ed32c>] kthread+0xfc/0x128
[<ffff000008084eb8>] ret_from_fork+0x10/0x18

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit d217dacbe793641497b38f48d063a6332242e8a9)
2018-11-20 15:13:06 +08:00
Peter Chen cebcf94b7a MLK-20343 usb: chipidea: udc: using structure ci_hdrc device for runtime PM
At current code, it doesn't maintain ci->gadget.dev's runtime PM
status well. Eg, after system resume, call pm_runtime_put_sync for
ci->dev will cause ci->dev's runtime suspend is called if its
power.usage is 0 even the power.usage is 1 for its child ci->gadget.dev.
at that time. It causes the oops this ticket describes that visiting
clock without AHB clock.

To fix this issue, we use ci_hdrc device instead of ci->gadget.dev
for runtime PM APIs at udc driver, in the way, we handle runtime
PM APIs for single device structure.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit d436b3a0a81b073b195d0ad29e7a4f39a1a532f3)
2018-11-20 15:13:06 +08:00
Li Jun 3b41f3a86a MLK-20177-3 usb: chipidea: imx: disable stream mode for imx8mm
Add CI_HDRC_DISABLE_DEVICE_STREAMING flag for iMX8mm usb device mode.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2018-11-02 18:33:25 +08:00
Peter Chen f294866e53 MLK-20158-3 usb: phy: mxs: add wakeup enable for imx7ulp
This wakeup setting can enable USB wakeup function even the
controller's power is lost, and both A7 and M4 are in VLLS mode.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-11-02 16:42:09 +08:00
Peter Chen a52fedcf87 MLK-20158-1 usb: chipidea: ci_hdrc_imx: restore pinctrl
The pinctrl setting may lost during the system suspend
(eg, imx7ulp), we need to restore it after system resume.
Meanwhile, some platforms may need to set special pinctrl
for power comsumption.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-11-02 16:42:08 +08:00
Li Jun b3b9a278d0 MLK-19240 usb: chipidea: udc: keep suspended after charger detection
If the otg port is only for charging, we don't need keep the usb
port active, so let's keep it suspended after charger detection.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2018-10-30 09:44:47 +08:00
Peter Chen a8f37d55a7 MLK-20045-2 usb: chipidea: usbmisc_imx: delete the HSIC operation for imx7d
For imx7d, no software operation is needed for HSIC controller, so delete
related operation.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 16:32:03 +08:00
Peter Chen 7a5ee9056a MLK-20045-1 usb: chipidea: usbmisc_imx: using different .init for imx7ulp
imx7ulp uses different USB PHY with imx7d (MXS PHY vs PICO PHY), so the
features are supported by non-core register are a little different.
For example, autoresume feature is supported by all controllers for
imx7ulp, but for imx7d, it is only supported by non-HSIC controller.

Since imx7d has dedicated .init function, so the flag for imx7d PHY
(picophy) can be deleted.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 16:31:49 +08:00
Peter Chen 2ad3a74705 MLK-20011-2 usb: chipidea: delete DP pullup for secondary charger detection
Since the DP pullup can be finished at glue layer, we can delete
it at common code, but we still need to keep DP pulldown operation
since the DP may have already pulled up before.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen fb089deaf9 MLK-20011-1 usb: chipidea: imx: using non-core register to pull up DP
For Samsung PHY SoCs (imx7d/imx845), we used core register usbcmd.rs
to pull up DP to finish the pre-condition for secondary USB charger
detection before. In fact, there are some non-core registers can
fulfill the same task, in that way, we could not touch the common
chipidea registers.

Meanwhile, we delete the secondary charger detection operation and
clean up related code.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Baolin Wang 4d0e4dfaf0 usb: phy: Factor out the usb charger initialization
Factor out the guts of usb charger initialization into usb_charger_init()
function, to make the usb_add_extcon() only do the extcon related things.
Meanwhile we also should initialize the USB charger before registering
the extcon device, in case the extcon notification was issued earlier than
usb charger initialization.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-29 11:10:38 +08:00
Fabio Estevam 81cb72a5c3 usb: phy: mxs: Staticize mxs_charger_secondary_detection()
mxs_charger_secondary_detection() is only used in this file, so make
it static.

This fixes the following sparse warning:

drivers/usb/phy/phy-mxs-usb.c:581:23: warning: symbol 'mxs_charger_secondary_detection' was not declared. Should it be static?

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2018-10-29 11:10:38 +08:00
Peter Chen 822eb0fe8b MLK-19850-6 usb: chipidea: introduce flag for enable USB PHY charger detection
Some platforms may want to use USB PHY charger detection function
when VBUS is there, add one flag for it. The user can enable it
at firmware.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 28200a49f3 MLK-19850-5 usb: chipidea: imx: using USB PHY charger structure for detection
We can assign the charger detection results for common USB PHY
structure directly now, so delete the imx usb charger structure.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 0fd3d3881e MLK-19850-4 usb: chipidea: udc: using USB PHY charger framework for detection
Some platforms (eg, imx6/imx7ulp/imx8qm) which implements charger
detection at USB PHY driver can use framework directly. Other
platforms (eg, imx7d/imx845) which do not implement charger detection
at their USB PHY driver, just assign the charger detection results
for usb_phy structure.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen f9e7bb437e MLK-19850-1 usb: phy: mxs: add DCD implementation
The DCD is a hardware IP in USB PHY which is used for USB charger
detection, we use polling method for charger detection in this
design to avoid unknown USB PHY interrupt. Currently, the
imx8qm, imx8qxp and imx7ulp have DCD module.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Li Jun b6e17b7a25 usb: phy: mxs: add usb charger type detection
mxs phy has data pin contact and usb charger detector blocks which
can be controlled by software to detect charger type for SDP, CDP and
DCP.

Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Mathias Nyman ab62c8dbd9 MLK-19601-2 xhci: handle port status events for removed USB3 hcd
At xhci removal the USB3 hcd (shared_hcd) is removed before the primary
USB2 hcd. Interrupts for port status changes may still occur for USB3
ports after the shared_hcd is freed, causing  NULL pointer dereference.

Check if xhci->shared_hcd is still valid before handing USB3 port events

Cc: <stable@vger.kernel.org>
Reported-by: Peter Chen <peter.chen@nxp.com>
Tested-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 0404e11ef5 MLK-19601-1 xhci: Fix leaking USB3 shared_hcd at xhci removal
(Merged upstream reviewing patch, and add cdns support -- Peter Chen)

Ensure that the shared_hcd pointer is valid when calling usb_put_hcd()

The shared_hcd is removed and freed in xhci by first calling
usb_remove_hcd(xhci->shared_hcd), and later
usb_put_hcd(xhci->shared_hcd)

Afer commit fe190ed0d6 ("xhci: Do not halt the host until both HCD have
disconnected their devices.") the shared_hcd was never properly put as
xhci->shared_hcd was set to NULL before usb_put_hcd(xhci->shared_hcd) was
called.

shared_hcd (USB3) is removed before primary hcd (USB2).
While removing the primary hcd we might need to handle xhci interrupts
to cleanly remove last USB2 devices, therefore we need to set
xhci->shared_hcd to NULL before removing the primary hcd to let xhci
interrupt handler know shared_hcd is no longer available.

xhci-plat.c, cdns/host.c first create both their hcd's before
adding them. so to keep the correct reverse removal order use a temporary
shared_hcd variable for them.
For more details see commit 4ac53087d6 ("usb: xhci: plat: Create both
HCDs before adding them")

Fixes: fe190ed0d6 ("xhci: Do not halt the host until both
	       	HCD have disconnected their devices.")
Cc: Joel Stanley <joel@jms.id.au>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Jianguo Sun <sunjianguo1@huawei.com>
Cc: <stable@vger.kernel.org>
Tested-by: Peter Chen <peter.chen@nxp.com>
Tested-by: Jack Pham <jackp@codeaurora.org>
Reported-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 2ea5977610 MLK-19442-1 usb: host: xhci: export xhci_bus_suspend
It may be used by xhci platform driver, fixed below error when
building xhci as module.

ERROR: "xhci_bus_suspend" [drivers/usb/cdns3/cdns3.ko] undefined!
linux-imx/scripts/Makefile.modpost:92: recipe for target '__modpost' failed
make[2]: *** [__modpost] Error 1
linux-imx/Makefile:1231: recipe for target 'modules' failed
make[1]: *** [modules] Error 2

Reported-by: Bruce Zhang <bo.zhang@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen b4fe05937e MLK-18935 usb: host: xhci-plat: add platform TPL support
The TPL support is used to identify targeted devices during
EH2.0 and EH3.0 certification test.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
(cherry picked from commit a2525e0c5f3ad5e07f91e65fef7eb02c32d69c70)
2018-10-29 11:10:38 +08:00
Peter Chen 3e022864d4 MLK-19258-7 usb: chipidea: imx: add two picophy parameters tuning implementation
These two parameters are used to improve USB signal for board level,
in this commit, we read it from the dtb, and write to related register
during the initialization.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 45b8ac18aa MLK-19258-3 usb: cdns3: core: change the MODULE_ALIAS
To reflect it is a USB driver.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 21c2676698 MLK-18794-3 usb: cdns3: change the definition of PowerState at XECP_PM_PMCSR
When the USB port goes to suspend, PowerState should set to "D1"
(the D2 and D3hot are not supported now); PowerState should set to
"D0" when the USB port goes to resume.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 06607acba0 MLK-18794-2 usb: cdns: improve the suspend routine for xhci host
The controller needs to set CFG_RXDET_P3_EN within 100ms after
USB3 port is set to U3, but when there is a USB3 HUB in port, the
USB2 port bus suspend may take more than 100ms to finish, it causes
disconnection and PHY can't enter low power mode in system suspend
routine.

To fix this issue, we implement the platform .bus_suspend, and set
CFG_RXDET_P3_EN just after xhci_bus_suspend. The LPM_2_STB_SWITCH_EN
only needs to be set one time, and OTG_STB_CLK_SWITCH_EN isn't needed
to set for host/device mode according to IC engineer's sugguestion.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen c3708b997a MLK-18794-1 usb: host: xhci: add .bus_suspend override
Some platforms (eg: Cadence USB3) have special requirements to add
platform USB register setting between xhci_bus_suspend and
platform USB controller suspend routine. Eg, The Cadence USB3 needs
RX detect clock switch from 24Mhz to 32Khz within 100ms after set
port to U3, but sometimes, for USB3 HUB connection, the USB2
bus suspend will cost more than 100ms, and introduce the disconnection
before the PHY enters low power mode, then the state is in mess from
controller side.

So in this commit, we introduce .bus_suspend for xhci_driver_overrides
for above use cases.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Li Jun 27a64bb9ca MLK-19254 usb: cdns3: gadget: set gadget state to be USB_STATE_NOTATTACHED after stop
Update gadget state to be USB_STATE_NOTATTACHED after stop gaget.

Signed-off-by: Li Jun <jun.li@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 482774fe46 MLK-19153-2 usb: host: xhci: do not return error status for URB
Current XHCI implementation does not consider completion interrupt
for SETUP packet standalone, so it will show warning message
and return error status for URB. In fact, it can support it. In
this commit, we change warning message as debug message and set
status as zero for URB.

Support completion interrupt for SETUP packet is needed for USB EH2.0
SINGLE_STEP_SET_FEATURE Test.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 0fc059ab3d MLK-18922-2 usb: dwc3: add OTG capabilities handling
During the USB certification CV9 test, if we report OTG descriptor
to test suite, it will require doing OTG test, but in fact, it does
not support OTG-compliance in dwc3 driver.

For one Image configuration, it may choose CONFIG_USB_OTG, in order to
skip OTG descriptor, we need to set gadget->is_otg as false for
non OTG-compliance hardware. Due to dwc3 IP supports OTG-compliance,
the user can add "hnp-disable", "srp-disable" and "adp-disable"
at firmware to disable OTG features (skip OTG descriptor). This
patch does NOT affect current configuration descriptors.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen c8eb7d2dff MLK-18817 usb: cdns3: gadget: add mutex for role_start and role_stop
The usb_add_hcd and usb_remove_hcd can't be called together, otherwise,
there is oops like below. To fix it, we add mutex to avoid calling
role_start and role_stop at the same time.

[3.336786] Can't support > 32 bit dma.
[3.340676]  xhci-cdns3: xHCI Host Controller
[3.345052]  xhci-cdns3: new USB bus registered, assigned bus number 1
[3.363462]  xhci-cdns3: hcc params 0x200073c8 hci version 0x100 quirks 0x60010010
[3.374555] hub 1-0:1.0: USB hub found
[3.378349] hub 1-0:1.0: 1 port detected
[3.382573]  xhci-cdns3: xHCI Host Controller
[3.386948]  xhci-cdns3: new USB bus registered, assigned bus number 2
[3.387707] cdns-usb3 5b110000.cdns3: current role is 0, switch to 1
[3.387711]  xhci-cdns3: remove, state 0
[3.387721] Unable to handle kernel NULL pointer dereference at virtual address 000000d8
[3.387723] pgd = ffff0000095f5000
[3.387731] [000000d8] *pgd=00000008bfffe003, *pud=00000008bfffd003, *pmd=0000000000000000
[3.387735] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[3.387739] Modules linked in:
[3.387746] CPU: 0 PID: 745 Comm: kworker/0:1 Not tainted 4.9.88-05224-geb65e0981da1 #2087
[3.387748] Hardware name: Freescale i.MX8QXP MEK (DT)
[3.387765] Workqueue: events_freezable cdns3_role_switch
[3.387768] task: ffff80083a1d7080 task.stack: ffff80083aa5c000
[3.387775] PC is at sysfs_remove_group+0x18/0x98
[3.387781] LR is at usb_remove_hcd+0x58/0x200
[3.387784] pc : [<ffff000008265688>] lr : [<ffff00000885ac28>] pstate: 80000145
[3.387786] sp : ffff80083aa5fc70
[3.387791] x29: ffff80083aa5fc70 x28: 0000000000000000
[3.387795] x27: 0000000000000000 x26: ffff0000093cb2a8
[3.387800] x25: ffff000009506191 x24: ffff80083ff37280
[3.387804] x23: ffff80083b1b0138 x22: ffff80083b238000
[3.387809] x21: ffff80083b238000 x20: ffff0000094a1610
[3.387813] x19: ffff80083b1b0000 x18: 0000000000000020
[3.387817] x17: 0000000000000001 x16: 0000000000000019
[3.387822] x15: ffffffffffffffff x14: 00000000fffffff0
[3.387827] x13: ffff0000095a2068 x12: ffff0000093ce600
[3.387831] x11: ffff0000093ce000 x10: ffff00000959f000
[3.387836] x9 : 0000000000000000 x8 : ffff80083fe4244c
[3.387840] x7 : 0000000000000000 x6 : 0000000007cb5702
[3.387844] x5 : 00ffffffffffffff x4 : 0000000000000000
[3.387848] x3 : 0000000000000140 x2 : 00000000000008a6
[3.387852] x1 : 0000000000000000 x0 : 00000000000000a8
[3.387853]
[3.387856] Process kworker/0:1 (pid: 745, stack limit = 0xffff80083aa5c020)
[3.387860] Stack: (0xffff80083aa5fc70 to 0xffff80083aa60000)
[3.387865] fc60:                                   ffff80083aa5fca0 ffff00000885ac28
[3.387870] fc80: ffff80083b1b0000 ffff0000094a1000 ffff80083b238000 0000000000000000
[3.387875] fca0: ffff80083aa5fcf0 ffff00000889c5c8 ffff80083b1bf400 ffff80083b23e018
[3.387880] fcc0: ffff80083b238000 ffff80083b238000 ffff80083ff3bb00 ffff80083a1d7080
[3.387885] fce0: ffff000008ccc25c 0000000000000000 ffff80083aa5fd20 ffff000008897130
[3.387890] fd00: ffff80083b23e018 0000000000000001 0000000000000000 0000000000000000
[3.387895] fd20: ffff80083aa5fd50 ffff0000088972ec ffff80083b23e0d0 0000000000000000
[3.387901] fd40: ffff80083b23e018 ffff000008ccc25c ffff80083aa5fd80 ffff0000080dbc38
[3.387906] fd60: 0000000000000000 ffff80083ac3a600 ffff80083b23e0d0 ffff0000093b6000
[3.387911] fd80: ffff80083aa5fdc0 ffff0000080dbe40 ffff80083ac3a600 ffff80083ff37280
[3.387916] fda0: ffff80083ff37280 ffff80083ac3a630 ffff80083ff372a0 ffff0000093b6000
[3.387921] fdc0: ffff80083aa5fe20 ffff0000080e1c78 ffff80083a0fee80 ffff80083aa5c000
[3.387926] fde0: ffff00000908e2c8 ffff80083ac3a600 ffff0000080dbdf0 0000000000000000
[3.387931] fe00: 0000000000000000 0000000000000000 0000000000000000 ffff80083ac3a600
[3.387936] fe20: 0000000000000000 ffff000008083820 ffff0000080e1b98 ffff80083a0fee80
[3.387941] fe40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387946] fe60: ffff80083aa5fea0 0000000000000000 ffff0000080e1b98 ffff80083ac3a600
[3.387951] fe80: 0000000000000000 0000000000000000 ffff80083aa5fe90 ffff80083aa5fe90
[3.387956] fea0: 0000000000000000 ffff000000000000 ffff80083aa5feb0 ffff80083aa5feb0
[3.387960] fec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387965] fee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387970] ff00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387974] ff20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387979] ff40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387983] ff60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387988] ff80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387992] ffa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[3.387997] ffc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000
[3.388002] ffe0: 0000000000000000 0000000000000000 fefffac7ef9fea6e f6ef6c26eeee7272
[3.388004] Call trace:
[3.388008] Exception stack(0xffff80083aa5faa0 to 0xffff80083aa5fbd0)
[3.388013] faa0: ffff80083b1b0000 0000ffffffffffff ffff80083aa5fc70 ffff000008265688
[3.388019] fac0: ffff80083b238000 ffff80083b238000 ffff80083b1b0138 ffff80083ff37280
[3.388024] fae0: ffff000009506191 ffff0000093cb2a8 0000000000000000 ffff80083aa5fcb0
[3.388029] fb00: ffff80083aa5fc20 ffff80083aa5fc20 ffff80083aa5fbf0 00000000ffffffd8
[3.388034] fb20: ffff000009506191 ffff0000093cb2a8 0000000000000000 ffff80083a11f408
[3.388038] fb40: 00000000000000a8 0000000000000000 00000000000008a6 0000000000000140
[3.388043] fb60: 0000000000000000 00ffffffffffffff 0000000007cb5702 0000000000000000
[3.388048] fb80: ffff80083fe4244c 0000000000000000 ffff00000959f000 ffff0000093ce000
[3.388054] fba0: ffff0000093ce600 ffff0000095a2068 00000000fffffff0 ffffffffffffffff
[3.388057] fbc0: 0000000000000019 0000000000000001
[3.388061] [<ffff000008265688>] sysfs_remove_group+0x18/0x98
[3.388066] [<ffff00000885ac28>] usb_remove_hcd+0x58/0x200
[3.388072] [<ffff00000889c5c8>] cdns3_host_stop+0x38/0xa0
[3.388077] [<ffff000008897130>] cdns3_do_role_switch+0x58/0x188
[3.388082] [<ffff0000088972ec>] cdns3_role_switch+0x8c/0xa0
[3.388089] [<ffff0000080dbc38>] process_one_work+0x1c8/0x380
[3.388094] [<ffff0000080dbe40>] worker_thread+0x50/0x4c0
[3.388099] [<ffff0000080e1c78>] kthread+0xe0/0xf8
[3.388104] [<ffff000008083820>] ret_from_fork+0x10/0x30

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 4a4232458c MLK-18609-8 usb: cdns3: gadget: do not support multiple requests for ep0
Current code does not support queuing multiple requests for ep0, return
-EOPNOTSUPP if that happens.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 53585b704e MLK-18609-7 usb: cdns3: gadget: only unmap buffer for demand request
We only unmap the request which is demanded from the gadget driver.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 79589b75db MLK-18609-6 usb: cdns3: gadget: need to prepare setup packet after status
We need to prepare setup packet no matter configuration is set or
not.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen ffdb7a0aac MLK-18609-5 usb: cdns3: gadget: implement setup status completion properly
For CDNS3 gadget, there is NO setup status completion interrupt, but
software has related request and completion handler for EP0 setup
status. In previous design, it executes ->completion before .ep0_queue
back, and causes cdev->setup_pending and cdev->os_desc_pending
incorrect, the dequeue is executed wrongly.

In this commit, we postpone ->comletion to workqueue or the next
EP0 interrupt, it makes sure the ->completion is executed after
.ep0_queue.

[  220.785184] android_work: did not send uevent (0 0           (null))
[  220.792651] Bad mode in Error handler detected on CPU2, code 0xbf000002 -- SError
06-28 02:47:13.145  3946  3946 I zygote64: Deoptimizing void com.android.systemui.statusbar.stack.NotificationStackScrollLayout.updateContentHeight() due to JIT inline cache
[  220.815371] Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP
[  220.821312] Modules linked in:
[  220.824389] CPU: 2 PID: 1 Comm: init Not tainted 4.9.105-644221-ga78d348 #8
[  220.831362] Hardware name: Freescale i.MX8QXP MEK (DT)
[  220.836504] task: ffff80083a0e0000 task.stack: ffff80083a0e8000
[  220.842431] PC is at 0x4ec908
[  220.845398] LR is at 0x454a30
[  220.848363] pc : [<00000000004ec908>] lr : [<0000000000454a30>] pstate: 40000000
[  220.855762] sp : 0000ffffe0c35ca0
[  220.859072] x29: 0000ffffe0c35cc0 x28: 00000000ffffffff
[  220.864397] x27: 00000000ffffffff x26: 0000000000000001
[  220.869722] x25: 0000ffff7f6446a9 x24: 000000000057da40
[  220.875047] x23: 0000000000088241 x22: 0000ffff7f6446c0
[  220.880373] x21: 0000ffff7f6446c1 x20: 0000000000000009
[  220.885698] x19: 0000000000000004 x18: 00000000020f06cc
[  220.891024] x17: aaaaaaaaaaaaaaab x16: 0000000000000000
[  220.896349] x15: 000000000000005c x14: 0000000000000000
[  220.901675] x13: 4344552f31672f74 x12: 0000ffffe0c35c88
[  220.907000] x11: 0000ffffe0c35cd0 x10: 0000000000000004
[  220.912325] x9 : 0000000000000000 x8 : 0000000000000040
[  220.917651] x7 : 7f7f7f7f7f7f7f7f x6 : 655e666d68736860
[  220.922976] x5 : 0000000000000000 x4 : 0000000000000000
[  220.928302] x3 : 0000000000000180 x2 : 0000000000000004
[  220.933627] x1 : 0000ffff7f6446c1 x0 : 0000000000000004
[  220.938952]
[  220.940440] Process init (pid: 1, stack limit = 0xffff80083a0e8000)

Reported-by: Andy Tian <yang.tian@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 20e7a46875 MLK-18609-4 usb: cdns3: gadget: refine de-init process
- The gadget speed should be reset to USB_SPEED_UNKNOWN at any de-init
  process
- The TRB buffer should be free when the gadget is removed

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen f4e05469f6 MLK-18609-3 usb: cdns3: gadget: refine the memory allocation function
Move all memory allocation to usb_ss_allocate_trb_pool and align with
usb_ss_free_trb_pool.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen c0984db6da MLK-18609-2 usb: cdns3: gadget: flush fifo only controller is started
Some gadget drivers may dequeue its request very late, eg, after
the controller is stopped, at this situation, visiting related
register will cause abort. See below oops from android use case:

[ 1676.773258] android_work: sent uevent USB_STATE=CONFIGURED
[ 1676.788278] mtp_open
[ 1850.542145] android_work: sent uevent USB_STATE=DISCONNECTED
[ 1850.545311] mtp_release
[ 1852.050358] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (init.freescale.usb.rc:45)
[ 1852.061224] init: processing action (sys.usb.config=none && sys.usb.configfs=1) from (/init.usb.configfs.rc:1)
[ 1852.074316] android_work: did not send uevent (0 0           (null))
[ 1852.080893] Unhandled fault: synchronous external abort (0x96000210) at 0xffff000016a90028
[ 1852.089186] Internal error: : 96000210 [#1] PREEMPT SMP
[ 1852.094422] Modules linked in:
[ 1852.097491] CPU: 0 PID: 1 Comm: init Not tainted 4.9.105-00010-g30f2a53-dirty #4
[ 1852.104889] Hardware name: Freescale i.MX8QXP MEK (DT)
[ 1852.110031] task: ffff80083a0e0000 task.stack: ffff80083a0e8000
[ 1852.115966] PC is at wait_reg_bit.constprop.13+0x24/0xb4
[ 1852.121286] LR is at usb_ss_gadget_ep_dequeue+0x110/0x164
[ 1852.126685] pc : [<ffff00000894c2d0>] lr : [<ffff00000894ccf4>] pstate: a00001c5
[ 1852.134085] sp : ffff80083a0ebc30
[ 1852.137395] x29: ffff80083a0ebc30 x28: ffff80083a0e0000
[ 1852.142720] x27: ffff000008ec3000 x26: 0000000000000000
[ 1852.148046] x25: ffff80083a0ebeb0 x24: ffff80083b751000
[ 1852.153371] x23: 0000000000000080 x22: 0000000000000000
[ 1852.158696] x21: ffff000016a90028 x20: ffff80083b6e7e18
[ 1852.164022] x19: ffff8000507fb580 x18: 000000000042d1e0
[ 1852.169348] x17: aaaaaaaaaaaaaaab x16: ffff0000082678fc
[ 1852.174673] x15: ffffffffffffffff x14: 2020202020202020
[ 1852.179998] x13: 2020203020302820 x12: 746e657665752064
[ 1852.185324] x11: ffff80083ff2ee40 x10: ffff80083b708870
[ 1852.190649] x9 : 0000000040000000 x8 : 0000000000210d00
[ 1852.195974] x7 : 0000000000000005 x6 : ffff80083b708871
[ 1852.201300] x5 : ffff00000894c084 x4 : 0000000000000000
[ 1852.206627] x3 : 0000000000000000 x2 : 0000000000000080
[ 1852.211951] x1 : ffff000016a90028 x0 : ffff80083b751000
[ 1852.217278]
[ 1852.217278] SP: 0xffff80083a0ebbb0:
[ 1852.222245] bbb0  00000000 00000000 00000080 00000000 3b751000 ffff8008 3a0ebeb0 ffff8008
[ 1852.230498] bbd0  00000000 00000000 08ec3000 ffff0000 3a0e0000 ffff8008 3a0ebc30 ffff8008
[ 1852.238751] bbf0  0894ccf4 ffff0000 3a0ebc30 ffff8008 0894c2d0 ffff0000 a00001c5 00000000
[ 1852.247004] bc10  3a0ebeb0 ffff8008 3b6e6418 ffff8008 ffffffff 0000ffff 80080007 00000001
[ 1852.255257] bc30  3a0ebc70 ffff8008 0894ccf4 ffff0000 507fb580 ffff8000 3b6e7e18 ffff8008
[ 1852.263510] bc50  00000000 00000000 00000140 00000000 3b7517d0 ffff8008 3b751000 ffff8008
[ 1852.271764] bc70  3a0ebcb0 ffff8008 0898ef58 ffff0000 3b537490 ffff8008 09a4a5a8 ffff0000
[ 1852.280017] bc90  3b6e7e18 ffff8008 507fb580 ffff8000 00000004 00000000 aee44671 0000ffff
[ 1852.288272]
[ 1852.288272] X0: 0xffff80083b750f80:
[ 1852.293240] 0f80  6cfdc6bf fee6fc67 76effaff d777e7fe 5ff67667 e7eef7ff 7fff75fc 6f7d7fff
[ 1852.301492] 0fa0  7d7ef6f6 f23feefb 7ffff7ee f7de7e72 eeb47f7e 4bff73f4 fe367677 3ef573ed
[ 1852.309745] 0fc0  674eb7e7 76f94767 f6ff66e7 eabe66ee fef663df fe7764e7 66ee2e64 febf7bcc
[ 1852.317998] 0fe0  ef7f35ff f7ef6f6c 4cded7ee 76fffb77 f7f3765d ff8f7efb e5ee6ce7 bfe5e7ff
[ 1852.326252] 1000  3a657c10 ffff8008 3b6e7f00 ffff8008 09341970 ffff0000 3b751388 ffff8008
[ 1852.334505] 1020  3a657c28 ffff8008 3a657c20 ffff8008 3a1b8000 ffff8008 098f9d10 ffff0000
[ 1852.342758] 1040  3b70b5a0 ffff8008 00000006 00000003 00000000 00000000 00000000 00000000
[ 1852.351011] 1060  00000001 00000000 3b751068 ffff8008 3b751068 ffff8008 00000000 00000000
[ 1852.359268]
[ 1852.359268] X6: 0xffff80083b7087f1:
[ 1852.364234] 87f0  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 1852.372487] 8810  3b708810 ffff8008 3b708810 ffff8008 00000000 00000000 00000000 00000000
[ 1852.380740] 8830  01ea01ea 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.388993] 8850  3b708850 ffff8008 3b708850 ffff8008 00000004 00000003 00000002 00000000
[ 1852.397246] 8870  00000001 00010001 00000000 00000000 00320032 00000000 3b708888 ffff8008
[ 1852.405499] 8890  3b708888 ffff8008 00000001 00000000 00000000 00000000 3bd5e300 ffff8008
[ 1852.413752] 88b0  34157200 ffff8008 35173c00 ffff8008 35173c1c ffff8008 00000074 00000003
[ 1852.422005] 88d0  00000003 00000005 00000001 00000000 00000000 00000000 3b76e5b0 ffff8008
[ 1852.430258] 88f0  3b76e5b0 ffff8008 3b76e5b0 ffff8008 0000000f 00820100 00000000 00000000
[ 1852.438514]
[ 1852.438514] X10: 0xffff80083b7087f0:
[ 1852.443570] 87f0  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[ 1852.451821] 8810  3b708810 ffff8008 3b708810 ffff8008 00000000 00000000 00000000 00000000
[ 1852.460074] 8830  01ea01ea 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.468327] 8850  3b708850 ffff8008 3b708850 ffff8008 00000004 00000003 00000002 00000000
[ 1852.476580] 8870  00000001 00010001 00000000 00000000 00320032 00000000 3b708888 ffff8008
[ 1852.484833] 8890  3b708888 ffff8008 00000001 00000000 00000000 00000000 3bd5e300 ffff8008
[ 1852.493086] 88b0  34157200 ffff8008 35173c00 ffff8008 35173c1c ffff8008 00000074 00000003
[ 1852.501340] 88d0  00000003 00000005 00000001 00000000 00000000 00000000 3b76e5b0 ffff8008
[ 1852.509595]
[ 1852.509595] X11: 0xffff80083ff2edc0:
[ 1852.514649] edc0  00000000 00000000 00100000 00000000 00000000 00000000 0003b33d 00000000
[ 1852.522902] ede0  000be6cc 00000000 00100000 00000000 00000000 00000000 00000001 00000001
[ 1852.531155] ee00  00000000 00000000 caabd6a1 0000000c 00000000 00000000 00000000 00000000
[ 1852.539408] ee20  3a0e0080 ffff8008 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.547661] ee40  392570e9 000001af 0239e900 00000000 0185fbb6 00000295 000002f9 00000000
[ 1852.555914] ee60  00000211 00000000 0182c397 00000000 0000020d 00000000 00000000 00000000
[ 1852.564167] ee80  00000001 00000000 00000052 00000000 0000001c 00000000 000002f9 00000000
[ 1852.572421] eea0  0005eb9a 00000001 00000000 00000000 3ff2ed80 ffff8008 00000001 00000000
[ 1852.580679]
[ 1852.580679] X19: 0xffff8000507fb500:
[ 1852.585730] b500  00000001 00000000 0994b2b0 ffff0000 00000000 00000000 00000000 00000000
[ 1852.593983] b520  507fb520 ffff8000 507fb520 ffff8000 507fb560 ffff8000 00000002 00000000
[ 1852.602236] b540  00002441 00000000 00000001 00000000 d54b3f06 00000175 00000000 00000000
[ 1852.610489] b560  00010001 00000000 3b413200 ffff8008 0000c4f8 00000000 00000000 00000000
[ 1852.618742] b580  3b76d800 ffff8008 00000000 00000000 fe5db800 00000000 00000000 00000000
[ 1852.626995] b5a0  00000000 00000000 00000000 00000000 08989814 ffff0000 3b537430 ffff8008
[ 1852.635249] b5c0  00000000 00000000 00000000 00000000 ffffff98 00000022 00000000 00000000
[ 1852.643502] b5e0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.651758]
[ 1852.651758] X20: 0xffff80083b6e7d98:
[ 1852.656812] 7d98  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.665064] 7db8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.673317] 7dd8  00000000 00000000 00000000 00000000 00000000 00000000 316e6163 00000000
[ 1852.681570] 7df8  00000000 00000000 3b6e7b00 ffff8008 3b7512a8 ffff8008 0874a428 ffff0000
[ 1852.689823] 7e18  3b537430 ffff8008 3b6e7e98 ffff8008 08fe1788 ffff0000 00000000 00000000
[ 1852.698077] 7e38  00000000 00000000 00000031 02000100 00000200 00000004 09917320 ffff0000
[ 1852.706330] 7e58  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1852.714583] 7e78  00000000 00000000 00000000 00000000 00000000 00000000 3b751000 ffff8008
[ 1852.722839]
[ 1852.722839] X24: 0xffff80083b750f80:
[ 1852.727892] 0f80  6cfdc6bf fee6fc67 76effaff d777e7fe 5ff67667 e7eef7ff 7fff75fc 6f7d7fff
[ 1852.736147] 0fa0  7d7ef6f6 f23feefb 7ffff7ee f7de7e72 eeb47f7e 4bff73f4 fe367677 3ef573ed
[ 1852.744398] 0fc0  674eb7e7 76f94767 f6ff66e7 eabe66ee fef663df fe7764e7 66ee2e64 febf7bcc
[ 1852.752652] 0fe0  ef7f35ff f7ef6f6c 4cded7ee 76fffb77 f7f3765d ff8f7efb e5ee6ce7 bfe5e7ff
[ 1852.760905] 1000  3a657c10 ffff8008 3b6e7f00 ffff8008 09341970 ffff0000 3b751388 ffff8008
[ 1852.769158] 1020  3a657c28 ffff8008 3a657c20 ffff8008 3a1b8000 ffff8008 098f9d10 ffff0000
[ 1852.777411] 1040  3b70b5a0 ffff8008 00000006 00000003 00000000 000 00000000 00000000 00000000
[ 1852.919573] 0040  00000001 00000000 00000034 00000000 0005eb90 00000001 3a905400 ffff8008
52.949389] bbd0  00000000 00000000 08ec3000 ffff0000 3a0e0000 ffff8008 3a0ebc30 ffff8008
[ 1852.957642] bbf0  0894ccf4 ffff3b6e7e18 ffff8008
[ 1852.982401] bc50  00000000 00000000 00000140 00000000 3b7517d0 ffff8008 3b751000 ffff8008
[ 1852.990600140
[ 1853.036348] bc60: ffff80083b7517d0 ffff80083b751000 ffff80083a0ebcb0 ffff00000898ef58
[ 1853.044183] bc80: ffff80083b537490 ffff000009a4a5a8 ffff80083b6e7e18 ffff8000507fb580
[ 1853.052019] bca0: 0000000000000004 0000ffffaee44671 ffff80083a0ebce0 ffff00000898b4f0
[ 1853.059855] bcc0: ffff80083b537490 ffff000009a4a5a8 ffff80083b537490 ffff80083b537430
[ 1853.067691] bce0: ffff80083a0ebd10 ffff00000898d280 ffff80083b537430 ffff000009a4a5a8
[ 1853.075528] bd00: ffff80083b751310 ffff00000991e000 ffff80083a0ebd40 ffff000008990b10
[ 1853.083364] bd20: ffff80083b6fa000 ffff00000991ea48 ffff80083b537350 ffff00000991ea48
[ 1853.091200] bd40: ffff80083a0ebd60 ffff000008990c00 ffff80083b6fa000 ffff00000898e86c
[ 1853.099036] bd60: ffff80083a0ebd90 ffff00000898e8bc ffff800066af6f80 ffff80083b537000
[ 1853.106872] bd80: 0000000000000000 ffff80083b5372a8 ffff80083a0ebdd0 ffff0000082db924
[ 1853.114708] bda0: 0000000000000004 ffff800066af6d80 0000000000000000 ffff800066af6da0
[ 1853.122544] bdc0: ffff8000674aeb00 0000000000000004 ffff80083a0ebe30 ffff0000082507c8
[ 1853.130382] bde0: 0000000000000004 ffff8000674aeb00 0000000000000000 ffff80083a0ebeb0
[ 1853.138216] be00: 0000ffffaee44671 0000000000000015 0000000000000123 0000000000000040
[ 1853.146052] be20: 0000000000000004 0000000000000004 ffff80083a0ebe70 ffff000008251c7c
[ 1853.153889] be40: ffff8000674aeb00 ffff8000674aeb00 ffff000009838000 00000000004ec908
[ 1853.161724] be60: 0000000040000000 0000800836a09000 0000000000000000 ffff000008083780
[ 1853.169561] be80: ffffffffffffff1d 0000800836a09000 ffffffffffffffff 00000000004ec908
[ 1853.177396] bea0: 0000ffffaee44671 0000000000000004 0000000000000000 0000000000040969
[ 1853.185233] bec0: 0000000000000009 0000ffffaee44671 0000000000000004 0000000000000180
[ 1853.193069] bee0: 0000000000000000 0000000000000000 655e666d68736860 7f7f7f7f7f7f7f7f
[ 1853.200905] bf00: 0000000000000040 0000000000000000 0000000000000004 0000ffffffa57620
[ 1853.208742] bf20: 0000ffffffa575d8 4344552f31672f74 0000000000000000 000000000000005c
[ 1853.216577] bf40: 0000000000000000 000000000000000d 0000000052841d82 0000000000000004
[ 1853.224416] bf60: 0000000000000009 0000ffffaee44671 0000ffffaee44670 0000000000088241
[ 1853.232250] bf80: 000000000057da40 0000ffffaee44659 0000000000000001 00000000ffffffff
[ 1853.240086] bfa0: 00000000ffffffff 0000ffffffa57610 0000000000454a30 0000ffffffa575f0
[ 1853.247922] bfc0: 00000000004ec908 0000000040000000 0000000000000009 0000000000000040
[ 1853.255758] bfe0: 0000000000000000 0000000000000000 a62044020608c465 1224422020842444
[ 1853.263592] Call trace:
[ 1853.266035] Exception stack(0xffff80083a0eba40 to 0xffff80083a0ebb70)
[ 1853.272482] ba40: ffff8000507fb580 0000ffffffffffff ffff80083a0ebc30 ffff00000894c2d0
[ 1853.280320] ba60: 00000000a00001c5 ffff00000810a7dc ffff80083a0e0080 0000000000000007
[ 1853.288154] ba80: ffff800800000000 ffff000016a90028 0000000000000000 ffff80083a001e00
[ 1853.295990] baa0: ffff80083a0e0000 ffff80083a0e0000 000000018020001f 0000000100200020
[ 1853.303828] bac0: ffff80083a0ebbe0 ffff00000822fda8 ffff7e00019dc9c0 ffff00000894c084
[ 1853.311663] bae0: ffff80083a0ebc00 ffff00000822fda8 ffff7e000153f0c0 0000000000040969
[ 1853.319498] bb00: ffff80083b751000 ffff000016a90028 0000000000000080 0000000000000000
[ 1853.327334] bb20: 0000000000000000 ffff00000894c084 ffff80083b708871 0000000000000005
[ 1853.335170] bb40: 0000000000210d00 0000000040000000 ffff80083b708870 ffff80083ff2ee40
[ 1853.343005] bb60: 746e657665752064 2020203020302820
[ 1853.347892] [<ffff00000894c2d0>] wait_reg_bit.constprop.13+0x24/0xb4
[ 1853.354248] [<ffff00000894ccf4>] usb_ss_gadget_ep_dequeue+0x110/0x164
[ 1853.360696] [<ffff00000898ef58>] usb_ep_dequeue+0x24/0xd8
[ 1853.366098] [<ffff00000898b4f0>] composite_dev_cleanup+0xe8/0x104
[ 1853.372197] [<ffff00000898d280>] configfs_composite_unbind+0x3c/0x5c
[ 1853.378556] [<ffff000008990b10>] usb_gadget_remove_driver+0x44/0x74
[ 1853.384830] [<ffff000008990c00>] usb_gadget_unregister_driver+0xc0/0xf0

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen ffa2804f24 MLK-18609-1 usb: cdns3: gadget: add ep0 request to list
It is necessary to add ep0 request for its ep request list,
ep0 request may need to be dequeued when remove gadget driver,
see composite_dev_cleanup for detail.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Li Jun 8e1113d7d9 MLK-18685 usb: cdns3: gadget: balance spin lock if map request fails
spin_unlock_irqrestore is missing if usb_gadget_map_request_by_dev
fails.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2018-10-29 11:10:38 +08:00
Li Jun 8ad43aefeb MLK-18656 usb: cdns3: gdaget: add hanlding of request->zero for non-EP0
In case a ZLP is required to finish the transfer, this patch implements it
by adding a request with a preallocated buffer, which is shared with all
EPs, please be noted this patch is only for non-EP0, ZLP for EP0 will be
added later.

Reported-by: Andy Tian <yang.tian@nxp.com>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2018-10-29 11:10:38 +08:00
Peter Chen 2e8b0ad6d4 MLK-18319-3 usb: cdns3: gadget: Typo cleanup
Typo cleanup.

Reviewed-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00