1
0
Fork 0
Commit Graph

603 Commits (761cab513d5e9079ec8ace48ab05d84b0083653b)

Author SHA1 Message Date
Andrey Zhizhikin 761cab513d This is the 5.4.89 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl/99ZgACgkQONu9yGCS
 aT609BAAg3AcT6t2WQFfY0LZwaT4u8Y7mg7gx2995vDhzWOei/o6AasogDpnv+ey
 fDIu0NwMTK73K5bDSas5pWirEi/+eCk1S0xxg8rLkHgHOYJD7z6Ktq5DlNv5nfNN
 KUl1jnEcZznk4Y3ogxDwJTHmXVCRZAlckn46YiCpYKZeZbA/IqHlzzle9Dwd3eLN
 ElZN6Vdq5vagJOxTuFAEdHLy8mxIWySN0Kh6Ac0VKaaxLbE3GsXXEUtin7nLe/nj
 19/98ije7vQaTUNdqMSu5FIQsZGHg+XNji7EGLvmF/nITEUdwzIWuMsP5/ArVpJn
 rjnmz2J3IuQix7X08PGcde/0T1scXxnspOrQyVnMgGEl9J/5NpewrIItGZGt3H0u
 /fTvohGXx1nvaavDii3u7/y+s038v9HeP9Br6ISlprwZP8Pg4arm0sPQ2aHbPQ1v
 GQZSqat6hOm8DvpkLr0mO4w/+RYgRaVLRCIf8jWoStPvS/pm4APaDvYPAjZdqPRm
 xPSOa9Irvg0UaiwIxiXJdPBvFELvUHexpSxTNGQWsXdNHfMROnK+B4c3MScbDVt8
 vevIh3PVYqENW5Nsn7mSwdWPRzmNaouW/2fWqYjCWxhaSGfqweOz/JawHrwuTTQj
 GRdTgEn9w6o3uj8hQIt7c0+QfGLSvZlHfyvl7JYk/cV6SoofI40=
 =0wHl
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdQaENiSDAlGTDEbB7G51OISzHs0FAl/+FjUACgkQ7G51OISz
 Hs1oTxAAnXqdA+W4GsMTJYy8tN5PPGFh2yKAyrgfpsHVF8iHHWSDPZXD4x4w8p18
 NOk5lzfGYQD9KeJfqQmW3exvdSRzOBbff1F+tTtSwxG5VHTvZQeqqHCPO7ba9e5O
 b4A+lv3t4Oy+8F88NSdY32KEA9y6W1mZ3O4sojB1R48yBckIRGSbYZgLq7Zcd/2B
 /pEuDeG1PkXmz+vXKhNKIohfddXngxcv5B41bv+YuyzBdAcs44sks9tEh9ZzhppC
 zRal9uVMlIIF3OJSIYZ9mQDp70zZuirmN/Jf/4RQ2vNqBwvR1KbLH4EyCvFRZmDk
 7xrGBTLn99hM4Rw62JWzEWMCMD8BRfZegsBtXNO2UEg0VWOZONPDRlo2RVKbOVDm
 cFykPWCs32PuFa5Ys75clt2uL3Y2sw9SnAQUOLiMoWTdccsCP9HCXvMQPs+QlVWQ
 Y+W96naQzbt3Ri55t+mQ+esKmq65KEq1qdbU1dfd412Y+gME/2DCEdHSLL3vwu1M
 aeYBJOre93xKLIwZ0izmPuDnVI5FHqBzd6ZLGHEvnra0/uJuDJ3j2J7L9NPFL0D9
 s0+WjZImfh3E8kYDAJgCEftk3UadxewLtF6Y65KxpQB7mytR5SPSnv06fK9W5Lgf
 l/Fk5xWKcIltjPBjh6df0FMyhFCSH2IOCIFn5W44xglaWl937HI=
 =MeY4
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.89' into 5.4-2.2.x-imx

This is the 5.4.89 stable release

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2021-01-12 21:35:46 +00:00
Yu Kuai ea472d8391 usb: chipidea: ci_hdrc_imx: add missing put_device() call in usbmisc_get_init_data()
commit 83a43ff80a upstream.

if of_find_device_by_node() succeed, usbmisc_get_init_data() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling for this function implementation.

Fixes: ef12da914e ("usb: chipidea: imx: properly check for usbmisc")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201117011430.642589-1-yukuai3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-12 20:16:18 +01:00
Andrey Zhizhikin 8c8c2d4715 This is the 5.4.86 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl/sW9MACgkQONu9yGCS
 aT5SwBAAo6dgHqwmPfuf98/8oVeVqTxcmE7GpzpVRH2+yI7Zwk2ez29tAflcM7lT
 LKtR2WFGAxoCL4DUKXeO7Ubwpue5NoBIsJ8/dAYBesojps3WDaFGL55PvJLWwFJ7
 5gPtPzynITaqIC1JCFcrJ7OTp7REiCUZRc1CJXJINWAYL1VbEbH8pH904xfFcivy
 XnNyL9UiWp1lSB8oF3CRJOaK5M5gY1+wdCFaLVqQn306XDEM8PvZK4G3at/jXWgH
 jQjArdtC8M8NwjyTwtqW9JAMV+6CD0/HXk0QboTZg6yiaRrtUsfzMqJ1cvhKcQgO
 kLE3rwdnr3/MxuzSnGWbswflG2WCutoah58g0uN8H0nCiui5mKN6x5K+emgDZIoO
 ndDnh+/5OE247EK+3CGn/0N8i/fOymrLAnLL4wCXVdlQLMCalnL37ibdfGbAptXi
 N3GOGZ2iEglvTsEr5w0r86+AzNskm5EqA7mFGFiAyf9viR2xwYk3RrWf2ZyMRos2
 2S7mKcZmw7voDu2TIDIhqydToBKxmYI/mUn3mFFme1h3lwzM3zYG1aovVLfd5NkY
 Gx5E/CA/ut/3n0u/dXJ8SxEitBWkqImp5UdYcElQNxQoXnVU4yKmjf6dDL9Wqh+1
 ujCiaCUJd3PY0uXXIb6RWWGs2VaL4xiEnk+ZBm0VI9WEUWksSx0=
 =jnmv
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdQaENiSDAlGTDEbB7G51OISzHs0FAl/yR4IACgkQ7G51OISz
 Hs2KfA//e3jp0Ah8krkhVUDaiKJ6cWwt3PyEyEuASV+KB7bf8dW25E98jEriBTBX
 kEgmy8ZWJqcDvxP7JWshmjSu6y7IfzFhrNMt3Fsd3ZsQz7nUprzokufnUSMcoNeu
 vXYtJHslunsxnUVOzy/iCAjb0KU7zS5lYxxITAGth1vgEM5QySXcBZx8yWrGxNt+
 Hk5Rc4hQlogmh4Mi1t9VoHOafy5smitOwVGtcl8oPiDCkoConXtBvNQgFkncBZWf
 0EOXiulRkWeo/KXMVrdVy8J1IzWjQDDM1/JDY/Xx6scLnBBCJ002Yfv/HpL/toAM
 K5/dYJmRktlsCaKFd14uMTAnEqhjnDyPtxntOa0Z4YExfOGwum/SmOMvQyCGLOJg
 eF5HejriqRfK2bRBpYO92aXdwmBSuu2cS3AXroHw3tl3VQ+9uzTNzp9iIonsKjSJ
 5WQPc+0Ebg5NPtHHkimeUTFcxmYfqOFV2u+wVDi9Lcfm7xzJ8zM7w/IyM6sMpdoZ
 xKQ0jto8KN0eQKWmih2GL/pde2iihjOPa6RYuRom7LCLMgjJvBMCIQJwUZBg1PU5
 0eh7WipmOt1xCfKWi3HX3A+2ibkdT/3CkochK26Md/mrCH4aI4JSacr3lXYTALhi
 yy37o4ogWgCwDGOmxCPfG2BxZzLywNIBJb3qwT3maDPMkMT0efs=
 =IdA4
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.86' into 5.4-2.2.x-imx

This is the 5.4.86 stable release

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2021-01-03 22:38:54 +00:00
Fabio Estevam 4202cbbd2c usb: chipidea: ci_hdrc_imx: Pass DISABLE_DEVICE_STREAMING flag to imx6ul
commit c7721e15f4 upstream.

According to the i.MX6UL Errata document:
https://www.nxp.com/docs/en/errata/IMX6ULCE.pdf

ERR007881 also affects i.MX6UL, so pass the
CI_HDRC_DISABLE_DEVICE_STREAMING flag to workaround the issue.

Fixes: 52fe568e5d ("usb: chipidea: imx: add imx6ul usb support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20201207020909.22483-2-peter.chen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-30 11:50:58 +01:00
Andrey Zhizhikin ee7b6ad15b This is the 5.4.67 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl9rJlYACgkQONu9yGCS
 aT6WbRAAga6QVKrO6R4NeKk0fPqKQQoQeTK+phBOFA7jAoX/rIRKyob2Si9BwhBA
 F77vZ6HIZ7+e/o35JJQYQbffbHYs0ANuS1oHGqe0vgbh+72Viaan6g7lFOhpx8qf
 y0YS7q+hw4WLZB0gGlBM7nkPXRiis32IrEVabQW+t8hmT2lWyutY8E2yFAU60tvI
 Tvjm2c2pvHEcHz9MrjEd/jIVxMFnIl42FBTx9bGsbDUCDzBwEvPArS4bNioP7EFJ
 O+rrGCNvwtiv0DuKzX1UIZzQ88IROmU3ZjsIlgOwla7xJWv4QDgmPfyAyRI48QhH
 PAZQmSntz+y+MP6B3z3ZBrxc2Fx0kCDtugn2P9+2RVUEpheANJ293vUgYTKN9Roy
 dHdWHFWNTO9IYpIN0cZjc25db4ULdjerWQrKcCr6ZO8+Ep/0mSzx3lkWjfuUP8Hr
 L2RD6rAm259OpPq8xhAcJpJvoQLwGxaBHyr4QYUmRgmNVURoqe9Q0MTZuiyGsXhm
 rtcNky9WvmyyI1lJgXi4A+vmsIThCHEstEMycgTejfJ4itIVA9e1ctJVVomWULCn
 9oNStBJpmHw0myDCohbKNjeO1UX/erdF9NaoGto5bnfIhcSae1YQEjRB8zKmzbg1
 DpgC1f7IZ7q53vfrDGsAjInOcuEwAn/Y5JMLJOL4mdA9j3XlX2o=
 =Ot99
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.67' into 5.4-2.2.x-imx

This is the 5.4.67 stable release

This updates the kernel present in the NXP release imx_5.4.47_2.2.0 to the
latest patchset available from stable korg.

Base stable kernel version present in the NXP BSP release is v5.4.47.

Following conflicts were recorded and resolved:
- arch/arm/mach-imx/pm-imx6.c
NXP version has a different PM vectoring scheme, where the IRAM bottom
half (8k) is used to store IRAM code and pm_info. Keep this version to
be compatible with NXP PM implementation.

- arch/arm64/boot/dts/freescale/imx8mm-evk.dts
- arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
NXP patches kept to provide proper LDO setup:
imx8mm-evk.dts: 975d8ab07267ded741c4c5d7500e524c85ab40d3
imx8mn-ddr4-evk.dts: e8e35fd0e759965809f3dca5979a908a09286198

- drivers/crypto/caam/caamalg.c
Keep NXP version, as it already covers the functionality for the
upstream patch [d6bbd4eea2]

- drivers/gpu/drm/imx/dw_hdmi-imx.c
- drivers/gpu/drm/imx/imx-ldb.c
- drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c
Port changes from upstream commit [1a27987101], which extends
component lifetime by moving drm structures allocation/free from
bind() to probe().

- drivers/gpu/drm/imx/imx-ldb.c
Merge patch [1752ab50e8] from upstream to disable both LVDS channels
when Enoder is disabled

- drivers/mmc/host/sdhci-esdhc-imx.c
Fix merge fuzz produced by [6534c897fd].

- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Commit d1a00c9bb1 from upstream solves the issue with improper error
reporting when qdisc type support is absent. Upstream version is merged
into NXP implementation.

- drivers/net/ethernet/freescale/enetc/enetc.c
Commit [ce06fcb6a6] from upstream merged,
base NXP version kept

- drivers/net/ethernet/freescale/enetc/enetc_pf.c
Commit [e8b86b4d87] from upstream solves
the kernel panic in case if probing fails. NXP has a clean-up logic
implemented different, where the MDIO remove would be invoked in any
failure case. Keep the NXP logic in place.

- drivers/thermal/imx_thermal.c
Upstream patch [9025a5589c] adds missing
of_node_put call, NXP version has been adapted to accommodate this patch
into the code.

- drivers/usb/cdns3/ep0.c
Manual merge of commit [be8df02707] from
upstream to protect cdns3_check_new_setup

- drivers/xen/swiotlb-xen.c
Port upstream commit cca58a1669 to NXP tree, manual hunk was
resolved during merge.

- sound/soc/fsl/fsl_esai.c
Commit [53057bd4ac] upstream addresses the problem of endless isr in
case if exception interrupt is enabled and tasklet is scheduled. Since
NXP implementation has tasklet removed with commit [2bbe95fe6c],
upstream fix does not match the main implementation, hence we keep the
NXP version here.

- sound/soc/fsl/fsl_sai.c
Apply patch [b8ae2bf5cc] from upstream, which uses FIFO watermark
mask macro.

Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
2020-09-26 20:54:42 +00:00
Li Jun 4da32c0295 MLK-15984 usb: chipidea: wait controller resume finished for wakeup irq
After the chipidea driver introduce extcon for id and vbus, it's able
to wakeup from another irq source, in case the system with extcon ID
cable, wakeup from usb ID cable and device removal, the usb device
disconnect irq may come firstly before the extcon notifier while system
resume, so we will get 2 "wakeup" irq, one for usb device disconnect;
and one for extcon ID cable change(real wakeup event), current driver
treat them as 2 successive wakeup irq so can't handle it correctly, then
finially the usb irq can't be enabled. This patch adds a check to bypass
further usb events before controller resume finished to fix it.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2020-09-10 10:33:42 +08:00
Peter Chen 2c9b4dafaf
MLK-24475-1 usb: chipidea: udc: delete the WARN_ON for .pullup
The UDC core calls .pullup unconditional during gadget loading
routine (see below dump), if the controller is in low power mode,
it will trigger WARN_ON. It is not easy to change common code
behavior easily, it deletes the WARN_ON now.

[   46.613319] Mass Storage Function, version: 2009/09/11
[   46.618503] LUN: removable file: (no medium)
[   46.662123] ------------[ cut here ]------------
[   46.666765] WARNING: CPU: 3 PID: 741 at drivers/usb/chipidea/udc.c:1720 ci_udc_pullup+0xd4/0xe0
[   46.675470] Modules linked in:
[   46.678534] CPU: 3 PID: 741 Comm: sh Not tainted 5.4.47-00053-gc4f85e73b4dc-dirty #277
[   46.686451] Hardware name: Freescale i.MX8QXP MEK (DT)
[   46.691597] pstate: 80000005 (Nzcv daif -PAN -UAO)
[   46.696391] pc : ci_udc_pullup+0xd4/0xe0
[   46.700320] lr : usb_gadget_disconnect+0x38/0x140
[   46.705024] sp : ffff800012763be0
[   46.708333] x29: ffff800012763be0 x28: ffff000837cd0000
[   46.713649] x27: 0000000000000000 x26: ffff000836dede00
[   46.718966] x25: ffff000837c94000 x24: ffff000837502500
[   46.724282] x23: ffff00083bf98498 x22: ffff0008368a6348
[   46.729599] x21: 0000000000000000 x20: 0000000000000000
[   46.734916] x19: ffff00083bf98498 x18: 0000000000000001
[   46.740233] x17: 0000000000000000 x16: 0000000000000000
[   46.745550] x15: ffff000837cd0470 x14: ffffffffffffffff
[   46.750866] x13: 0000000000000000 x12: ffff8000123b6000
[   46.756183] x11: ffff800012157000 x10: ffff8000123b6328
[   46.761500] x9 : ffff800012242000 x8 : ffff800012242000
[   46.766817] x7 : ffff800012242000 x6 : 0000000000010001
[   46.772133] x5 : ffff8000129b6040 x4 : 0000000000000001
[   46.777450] x3 : 0000000000000040 x2 : ffff800010cc5500
[   46.782767] x1 : ffff00083bf98080 x0 : 0000000000000001
[   46.788086] Call trace:
[   46.790531]  ci_udc_pullup+0xd4/0xe0
[   46.794109]  usb_gadget_disconnect+0x38/0x140
[   46.798470]  usb_udc_vbus_handler+0x44/0x50
[   46.802657]  ci_udc_start+0xbc/0xe0
[   46.806149]  udc_bind_to_driver+0x84/0x140
[   46.810248]  usb_gadget_probe_driver+0xa4/0x158
[   46.814785]  gadget_dev_desc_UDC_store+0xd0/0x118
[   46.819496]  configfs_write_file+0x148/0x1d8
[   46.823769]  __vfs_write+0x48/0x90
[   46.827173]  vfs_write+0xe4/0x1c8
[   46.830493]  ksys_write+0x78/0x100
[   46.833898]  __arm64_sys_write+0x24/0x30
[   46.837825]  el0_svc_common.constprop.0+0x74/0x168
[   46.842617]  el0_svc_handler+0x34/0xa0
[   46.846373]  el0_svc+0x8/0xc
[   46.849255] ---[ end trace 4f72051fa5255b2d ]---
[   46.854090] ------------[ cut here ]------------
[   46.858732] WARNING: CPU: 3 PID: 741 at drivers/usb/chipidea/udc.c:1720 ci_udc_pullup+0xd4/0xe0
[   46.867438] Modules linked in:
[   46.870502] CPU: 3 PID: 741 Comm: sh Tainted: G        W         5.4.47-00053-gc4f85e73b4dc-dirty #277
[   46.879808] Hardware name: Freescale i.MX8QXP MEK (DT)
[   46.884946] pstate: 80000005 (Nzcv daif -PAN -UAO)
[   46.889742] pc : ci_udc_pullup+0xd4/0xe0
[   46.893669] lr : usb_gadget_disconnect+0x38/0x140
[   46.898373] sp : ffff800012763c40
[   46.901682] x29: ffff800012763c40 x28: ffff000837cd0000
[   46.906998] x27: 0000000000000000 x26: ffff000836dede00
[   46.912315] x25: ffff000837c94000 x24: ffff000837502500
[   46.917632] x23: ffff000836c04280 x22: ffff80001223edf0
[   46.922948] x21: 0000000000000000 x20: 0000000000000000
[   46.928265] x19: ffff00083bf98498 x18: 0000000000000001
[   46.933582] x17: 0000000000000000 x16: 0000000000000000
[   46.938899] x15: ffff000837cd0470 x14: ffffffffffffffff
[   46.944215] x13: 0000000000000000 x12: ffff8000123b6000
[   46.949532] x11: ffff800012157000 x10: ffff8000123b6328
[   46.954849] x9 : ffff800012242000 x8 : ffff800012242000
[   46.960166] x7 : ffff800012242000 x6 : 0000000000010001
[   46.965482] x5 : ffff8000129b6040 x4 : 0000000000000001
[   46.970799] x3 : 0000000000000000 x2 : ffff800010cc5500
[   46.976116] x1 : ffff00083bf98080 x0 : 0000000000000001
[   46.981435] Call trace:
[   46.983880]  ci_udc_pullup+0xd4/0xe0
[   46.987456]  usb_gadget_disconnect+0x38/0x140
[   46.991819]  udc_bind_to_driver+0x11c/0x140
[   46.996004]  usb_gadget_probe_driver+0xa4/0x158
[   47.000541]  gadget_dev_desc_UDC_store+0xd0/0x118
[   47.005252]  configfs_write_file+0x148/0x1d8
[   47.009526]  __vfs_write+0x48/0x90
[   47.012930]  vfs_write+0xe4/0x1c8
[   47.016249]  ksys_write+0x78/0x100
[   47.019654]  __arm64_sys_write+0x24/0x30
[   47.023582]  el0_svc_common.constprop.0+0x74/0x168
[   47.028375]  el0_svc_handler+0x34/0xa0
[   47.032129]  el0_svc+0x8/0xc
[   47.035011] ---[ end trace 4f72051fa5255b2e ]---

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-08-10 18:02:02 +08:00
Peter Chen c4f85e73b4
MLK-24465-2 usb: chipidea: udc: quit .pullup if the controller is in lpm
If the controller is in low power mode, it needs to skip pullup
operation since it is meaningless, meanwhile, it is not allowed
from current design, show warning message for it.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-08-06 17:22:51 +08:00
Peter Chen 6f91298b54
MLK-24465-1 usb: chipidea: udc: update vbus flag for struct usb_udc correctly
At udc core, it sets vbus flag as true and call usb_gadget_connect by
default. But for chipidea udc driver, it depends on VBUS status to
call usb_gadget_connect, so it needs to set vbus flag according to
VBUS at the .udc_start. With this change, the un-necessary
usb_gadget_connect when load gadget function could be avoided.
It could fix below oops as well:

[   17.175905] BUG: scheduling while atomic: v4l_id/649/0x00000002
[   17.182016] Modules linked in: crct10dif_ce brcmfmac brcmutil synaptics_dsx_i2c fsl_imx8_ddr_perf galcore(O)
[   17.191893] CPU: 1 PID: 649 Comm: v4l_id Tainted: G           O      5.4.3-lts-lf-5.4.y+gf8118585ee3c #1
[   17.201369] Hardware name: FSL i.MX8MM DDR4 EVK RevB board (DT)
[   17.207286] Call trace:
[   17.209739]  dump_backtrace+0x0/0x140
[   17.213401]  show_stack+0x14/0x20
[   17.216717]  dump_stack+0xb4/0xf8
[   17.220033]  __schedule_bug+0x5c/0x70
[   17.223695]  __schedule+0x4b4/0x560
[   17.227181]  schedule+0x40/0xe0
[   17.230321]  schedule_hrtimeout_range_clock+0x9c/0x118
[   17.235455]  schedule_hrtimeout_range+0x10/0x18
[   17.239985]  usleep_range+0x74/0xa0
[   17.243473]  ci_controller_resume+0x90/0xd8
[   17.247652]  ci_runtime_resume+0xc/0x18
[   17.251488]  pm_generic_runtime_resume+0x28/0x40
[   17.256103]  __rpm_callback+0x88/0x140
[   17.259848]  rpm_callback+0x20/0x80
[   17.263334]  rpm_resume+0x39c/0x580
[   17.266819]  __pm_runtime_resume+0x38/0x80
[   17.270914]  ci_udc_pullup+0x40/0xf8
[   17.274489]  usb_gadget_activate+0x48/0x78
[   17.278582]  usb_function_activate+0x68/0xb8
[   17.282851]  uvc_function_connect+0x18/0x50
[   17.287031]  uvc_v4l2_open+0x5c/0x78
[   17.290607]  v4l2_open+0xa0/0x118
[   17.293922]  chrdev_open+0xa0/0x198
[   17.297408]  do_dentry_open+0x110/0x3b0
[   17.301240]  vfs_open+0x28/0x30
[   17.304381]  path_openat+0x4a0/0x1240
[   17.308040]  do_filp_open+0x74/0xf8
[   17.311525]  do_sys_open+0x168/0x218
[   17.315097]  __arm64_sys_openat+0x20/0x28
[   17.319107]  el0_svc_common.constprop.0+0x68/0x160
[   17.323898]  el0_svc_handler+0x20/0x80
[   17.327647]  el0_svc+0x8/0xc

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-08-06 17:22:51 +08:00
Peter Chen 01512075a3 usb: chipidea: core: add wakeup support for extcon
commit 876d4e1e82 upstream.

If wakeup event occurred by extcon event, it needs to call
ci_irq again since the first ci_irq calling at extcon notifier
only wakes up controller, but do noop for event handling,
it causes the extcon use case can't work well from low power mode.

Cc: <stable@vger.kernel.org>
Fixes: 3ecb3e09b0 ("usb: chipidea: Use extcon framework for VBUS and ID detect")
Reported-by: Philippe Schenker <philippe.schenker@toradex.com>
Tested-by: Philippe Schenker <philippe.schenker@toradex.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20200707060601.31907-2-peter.chen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-22 09:33:10 +02:00
Jason Liu 5691e22711 Merge tag 'v5.4.47' into imx_5.4.y
* tag 'v5.4.47': (2193 commits)
  Linux 5.4.47
  KVM: arm64: Save the host's PtrAuth keys in non-preemptible context
  KVM: arm64: Synchronize sysreg state on injecting an AArch32 exception
  ...

 Conflicts:
	arch/arm/boot/dts/imx6qdl.dtsi
	arch/arm/mach-imx/Kconfig
	arch/arm/mach-imx/common.h
	arch/arm/mach-imx/suspend-imx6.S
	arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
	arch/powerpc/include/asm/cacheflush.h
	drivers/cpufreq/imx6q-cpufreq.c
	drivers/dma/imx-sdma.c
	drivers/edac/synopsys_edac.c
	drivers/firmware/imx/imx-scu.c
	drivers/net/ethernet/freescale/fec.h
	drivers/net/ethernet/freescale/fec_main.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
	drivers/net/phy/phy_device.c
	drivers/perf/fsl_imx8_ddr_perf.c
	drivers/usb/cdns3/gadget.c
	drivers/usb/dwc3/gadget.c
	include/uapi/linux/dma-buf.h

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2020-06-19 17:32:49 +08:00
Bryan O'Donoghue 4f4dc27c09 usb: chipidea: msm: Ensure proper controller reset using role switch API
commit 91edf63d50 upstream.

Currently we check to make sure there is no error state on the extcon
handle for VBUS when writing to the HS_PHY_GENCONFIG_2 register. When using
the USB role-switch API we still need to write to this register absent an
extcon handle.

This patch makes the appropriate update to ensure the write happens if
role-switching is true.

Fixes: 05559f10ed ("usb: chipidea: add role switch class support")
Cc: stable <stable@vger.kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20200507004918.25975-2-peter.chen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-14 07:58:25 +02:00
Peter Chen 809e95fe71
MLK-23677-5 usb: chipidea: udc: use tracepoint
Use tracepoint for adding td and td completion.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-03-27 11:22:00 +08:00
Peter Chen d74f8108dc
MLK-23677-4 usb: chipidea: add tracepoint support for udc
Add basic tracepoint support for udc driver.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-03-27 11:21:59 +08:00
Peter Chen 104a42c649
MLK-23677-3 usb: chipidea: udc: put as many as sg buffers per TD
At most of cases, the system allocated sg buffers for 4KB, but
the TD could contain 5 * 4KB non-contiguous buffers at most. In order
to avoid more chained TDs, we tried to put more sg buffers in one
TD instead of putting only one sg buffer.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-03-27 11:21:59 +08:00
Peter Chen 4fa36b5b4c
MLK-23677-2 usb: chipidea: udc: fix the kernel doc for udc.h
The kernel doc for td_node is outdated, update it.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-03-27 11:21:59 +08:00
Jason Liu 335d2828a9 This is the 5.4.24 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl5hHjgACgkQONu9yGCS
 aT6CSBAA0c16mnDb59jgmW/sBj/p/MrlD/WJzLriqiKN5BUsPt9++I5mNj8mG+d2
 Glm4086e8L826zv8oKiZm23xk93on+78ExhVFVZvZNaEUpiRNYCGSuDq2NrHW0z+
 kpagkAFLfCUZFoKtmWo+bpl0YtF4dd/fg7+EjyL6qT1DBs8NVMwZx7i/v0xXv7Wc
 0vsGCLYoBLzcW1FB2d9cfAUPCBuGEzL/7TdifNOXRgI9owGsZndFJgXgIzoBUt/P
 tqB8RLjIupCiMEPtsEAZ/rgEQLPFkb3yrBvgjd1wDI8bHUIQU0clqThKVNvmNSmv
 UTBSNgPAhkP8nZG7X9xCkyfEsUefejBJy66da9n4XTGGrXf9ga0BL0nNrOGwOesr
 m+tNnBSFsbFCMqFopQnt4zZSnaf67AOk2mzxbEu4E+sStyW943aDO9MoRRFgaYGH
 pfie3qOKtKta2MuNTJA+q6F0W9H+V5MtMpwbyuy1/dp2eVln2wewBBMvXYdL1YOy
 E/Z87nsQgalsDynz9m/niv32J4JAxHptyOyROkktDLBSzL5RawNn+Op8X5EtmZOe
 sPkiYicqp9CLmMj13qWXJhtuyNdD4wk6FyyAy6cX9mF44+EZGOBkyNP+n8g789Kn
 sqFJ7sfTfOnwLBFciMA5PaMTGNWROyWXNkvvUzO+9t0CyFAnT2U=
 =abGA
 -----END PGP SIGNATURE-----

Merge tag 'v5.4.24' into imx_5.4.y

Merge Linux stable release v5.4.24 into imx_5.4.y

* tag 'v5.4.24': (3306 commits)
  Linux 5.4.24
  blktrace: Protect q->blk_trace with RCU
  kvm: nVMX: VMWRITE checks unsupported field before read-only field
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm/boot/dts/imx6sll-evk.dts
	arch/arm/boot/dts/imx7ulp.dtsi
	arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
	drivers/clk/imx/clk-composite-8m.c
	drivers/gpio/gpio-mxc.c
	drivers/irqchip/Kconfig
	drivers/mmc/host/sdhci-of-esdhc.c
	drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
	drivers/net/can/flexcan.c
	drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
	drivers/net/ethernet/mscc/ocelot.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
	drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
	drivers/net/phy/realtek.c
	drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
	drivers/perf/fsl_imx8_ddr_perf.c
	drivers/tee/optee/shm_pool.c
	drivers/usb/cdns3/gadget.c
	kernel/sched/cpufreq.c
	net/core/xdp.c
	sound/soc/fsl/fsl_esai.c
	sound/soc/fsl/fsl_sai.c
	sound/soc/sof/core.c
	sound/soc/sof/imx/Kconfig
	sound/soc/sof/loader.c
2020-03-08 18:57:18 +08:00
Peter Chen 3800732005
MLK-23349-6 usb: chipdea: don't return -EINVAL if request role is the same with current role
It should not return -EINVAL if the request role is the same with
current role, return non-error and without do anything instead.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-28 11:15:58 +08:00
Peter Chen ff01b0f10d
MLK-23349-2 usb: chipidea: udc: add sg list support
For low system memory system (eg, 265M), it may met OOM issue if the
request buffer is large (eg, 64KB). We ran out below OOM issue for f_fs.
Luckily, the f_fs supports sg list now, the OOM issue is fixed with
this patch.

ufb: page allocation failure: order:4, mode:0x40cc0(GFP_KERNEL|__GFP_COMP),
nodemask=(null),cpuset=/,mems_allowed=0
CPU: 2 PID: 370 Comm: ufb Not tainted 5.4.3-1.1.0+g54b3750d61fd #1
Hardware name: NXP i.MX8MNano DDR4 EVK board (DT)
Call trace:
 dump_backtrace+0x0/0x140
 show_stack+0x14/0x20
 dump_stack+0xb4/0xf8
 warn_alloc+0xec/0x158
 __alloc_pages_slowpath+0x9cc/0x9f8
 __alloc_pages_nodemask+0x21c/0x280
 alloc_pages_current+0x7c/0xe8
 kmalloc_order+0x1c/0x88
 __kmalloc+0x25c/0x298
 ffs_epfile_io.isra.0+0x20c/0x7d0
 ffs_epfile_read_iter+0xa8/0x188
 new_sync_read+0xe4/0x170
 __vfs_read+0x2c/0x40
 vfs_read+0xc8/0x1a0
 ksys_read+0x68/0xf0
 __arm64_sys_read+0x18/0x20
 el0_svc_common.constprop.0+0x68/0x160
 el0_svc_handler+0x20/0x80
 el0_svc+0x8/0xc
Mem-Info:
active_anon:2856 inactive_anon:5269 isolated_anon:12
 active_file:5238 inactive_file:18803 isolated_file:0
 unevictable:0 dirty:22 writeback:416 unstable:0
 slab_reclaimable:4073 slab_unreclaimable:3408
 mapped:727 shmem:7393 pagetables:37 bounce:0
 free:4104 free_pcp:118 free_cma:0
Node 0 active_anon:11436kB inactive_anon:21076kB active_file:20988kB inactive_file:75216kB unevictable:0kB isolated(ano
Node 0 DMA32 free:16820kB min:1808kB low:2260kB high:2712kB active_anon:11436kB inactive_anon:21076kB active_file:2098B
lowmem_reserve[]: 0 0 0
Node 0 DMA32: 508*4kB (UME) 242*8kB (UME) 730*16kB (UM) 21*32kB (UME) 5*64kB (UME) 2*128kB (M) 0*256kB 0*512kB 0*1024kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=32768kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=64kB
31455 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap  = 0kB
Total swap = 0kB
65536 pages RAM
0 pages HighMem/MovableOnly
10766 pages reserved
0 pages cma reserved
0 pages hwpoisoned

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-28 11:15:59 +08:00
Peter Chen 4fad2caf7e
MLK-23349-1 usb: chipidea: otg: delete duplicate code
After below code:
		if (role == CI_ROLE_GADGET)
			ci_handle_vbus_change(ci);

It has already handled the VBUS event in suspend for device mode.

In fact, it just reverts 5f59266728 ("MLK-12344-1 usb: chipidea:
otg: add vbus connect for gadget after sleep"), but git refuses
to revert this commit, so we it with a new patch.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-28 11:15:58 +08:00
Peter Chen 1e0b2f7717
LF-705-1 usb: chipidea: udc: delete the redundancy code
Delete the redundancy code

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-16 21:01:30 +08:00
Peter Chen 355b1b61bc
LF-705 usb: chipidea: imx: delete useless code
Delete the redundancy code

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-16 21:01:03 +08:00
Peter Chen 5deba7d4ff
MLK-23319-3 usb: chipidea: usbmisc_imx: fix .init API for imx7d and imx7ulp
Fix the .init API for imx7d and imx7ulp

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2020-02-16 20:42:14 +08:00
Guenter Roeck b5c477d904 usb: chipidea: host: Disable port power only if previously enabled
commit c1ffba305d upstream.

On shutdown, ehci_power_off() is called unconditionally to power off
each port, even if it was never called to power on the port.
For chipidea, this results in a call to ehci_ci_portpower() with a request
to power off ports even if the port was never powered on.
This results in the following warning from the regulator code.

WARNING: CPU: 0 PID: 182 at drivers/regulator/core.c:2596 _regulator_disable+0x1a8/0x210
unbalanced disables for usb_otg2_vbus
Modules linked in:
CPU: 0 PID: 182 Comm: init Not tainted 5.4.6 #1
Hardware name: Freescale i.MX7 Dual (Device Tree)
[<c0313658>] (unwind_backtrace) from [<c030d698>] (show_stack+0x10/0x14)
[<c030d698>] (show_stack) from [<c1133afc>] (dump_stack+0xe0/0x10c)
[<c1133afc>] (dump_stack) from [<c0349098>] (__warn+0xf4/0x10c)
[<c0349098>] (__warn) from [<c0349128>] (warn_slowpath_fmt+0x78/0xbc)
[<c0349128>] (warn_slowpath_fmt) from [<c09f36ac>] (_regulator_disable+0x1a8/0x210)
[<c09f36ac>] (_regulator_disable) from [<c09f374c>] (regulator_disable+0x38/0xe8)
[<c09f374c>] (regulator_disable) from [<c0df7bac>] (ehci_ci_portpower+0x38/0xdc)
[<c0df7bac>] (ehci_ci_portpower) from [<c0db4fa4>] (ehci_port_power+0x50/0xa4)
[<c0db4fa4>] (ehci_port_power) from [<c0db5420>] (ehci_silence_controller+0x5c/0xc4)
[<c0db5420>] (ehci_silence_controller) from [<c0db7644>] (ehci_stop+0x3c/0xcc)
[<c0db7644>] (ehci_stop) from [<c0d5bdc4>] (usb_remove_hcd+0xe0/0x19c)
[<c0d5bdc4>] (usb_remove_hcd) from [<c0df7638>] (host_stop+0x38/0xa8)
[<c0df7638>] (host_stop) from [<c0df2f34>] (ci_hdrc_remove+0x44/0xe4)
...

Keeping track of the power enable state avoids the warning and traceback.

Fixes: c8679a2fb8 ("usb: chipidea: host: add portpower override")
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: Peter Chen <peter.chen@freescale.com>
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20191226155754.25451-1-linux@roeck-us.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-14 20:08:19 +01:00
Li Jun f7841e1734 LF-592 usb: chipidea: handle single role for usb role class
If usb port is configed to be single role, but usb role class
is trying to set unavailable role, don't try to do role change.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-12-25 08:55:01 +08:00
Peter Chen 86e8efc80b MLK-22752-3 usb: chipidea: imx: pinctrl for HSIC is optional
For imx chipidea controllers, if they use mxs PHY, they need pinctrl
for HSIC. Otherwise, it doesn't need pinctrl and usbmisc control. Like
imx7d and imx8mm.

Reported-by: André Draszik <git@andred.net>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:59 +08:00
Peter Chen 304618fb1d MLK-22752-2 usb: chipidea: imx: refine the error handling for hsic
- -EPROBE_DEFER is an error, but without need show error message
- If pinctrl is not existed, set pinctrl as NULL

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:59 +08:00
Peter Chen 04ebf23cb1 MLK-22752-1 usb: chipidea: imx: change hsic power regulator as optional
Not every platform needs this regulator.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:58 +08:00
Li Jun dc5f8b1958 MLK-21900-2 usb: chipidea: imx: turn off vbus comparator when suspend
As we use bvalid for vbus wakeup source, to save power when
suspend, turn off the vbus comparator for imx7d and imx8mm.

Below is this bit description from RM of iMX8MM
"VBUS Valid Comparator Enable:
 This signal controls the USB OTG PHY VBUS Valid comparator which
indicates whether the voltage on the USB_OTG*_VBUS pin is below
the VBUS Valid threshold. The VBUS Valid threshold is nominally
4.75V on this USB PHY. The VBUS Valid threshold can be adjusted
using the USBNC_OTGn_PHY_CFG1[OTGTUNE0] bit field. Status of the
VBUS Valid comparator, when it is enabled, is reported on the
USBNC_OTGn_PHY_STATUS[VBUS_VLD] bit.
When OTGDISABLE0 (USBNC_USB_OTGx_PHY_CFG2[10])is set to 1'b0 and
DRVVBUS0 is set to 1'b1, the Bandgap circuitry and VBUS Valid
comparator are powered, even in Suspend or Sleep mode.
DRVVBUS0 should be reset to 1'b0 when the internal VBUS Valid comparator
is not required, to reduce quiescent current in Suspend or Sleep mode.
 - 0 The VBUS Valid comparator is disabled
  - 1 The VBUS Valid comparator is enabled"

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
Li Jun 29f824ce61 MLK-21900-1 usb: chipidea: imx: group usbmisc operations for PM
As there maybe more APIs of usbmisc for suspend and resume, group
them into imx_usbmisc_suspend/resume, no function change.

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
Jun Li e9ccde105e MLK-22025-1 usb: chipidea: phy enter low power mode when host suspend
On some imx host, if USB PHY is active when bus suspended, host may
have problem on taking over resume signal of remote wakeup from usb
device, resolve this by making PHY enter low power mode right after
bus suspended.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:57 +08:00
Peter Chen cf4c986d39 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>
2019-11-25 15:56:56 +08:00
Peter Chen 55276da7e4 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>
2019-11-25 15:56:56 +08:00
Peter Chen a320ed8dd7 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>
2019-11-25 15:56:55 +08:00
Peter Chen b4b090d280 MLK-19850-5 usb: chipidea: imx: add imx7d USB charger detection
Since USB generic PHY doesn't have USB charger interface, we
implement imx7d (using USB generic PHY) USB charger detection
at usbmisc.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:55 +08:00
Peter Chen b90bd6962c 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.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:54 +08:00
Peter Chen ecac0beb56 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>
2019-11-25 15:56:53 +08:00
Peter Chen 8f70f8f6b5 MLK-20045-1 usb: chipidea: usbmisc_imx: using different ops 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.

Besides, these two platforms use different HSIC controller, imx7ulp
needs software operation, but imx7d doesn't.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:53 +08:00
Peter Chen 9a2bb23f01 MLK-16715-7 usb: chipidea: imx: add "ci-disable-lpm" quirk
Some chipidea hardware needs to disable low power mode for controller
due to IC issue or hardware issue, add one quirk for it.

Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:52 +08:00
Peter Chen 1fbbc6bd15 MLK-16532 usb: chipidea: do not call WARN_ON if controller is going to suspend twice
At current PM framework, the dev->runtime_suspend may be called after
dev->system_suspend is called, and the dev->runtime_resume may be called
before dev->system_suspend is called. So, we need to delete WARN_ON to
avoid before dump:

[  466.712978] [<ffff200008c49cdc>] ci_hdrc_imx_runtime_suspend+0x2c/0xa8
[  466.719619] [<ffff2000088c29e8>] pm_generic_runtime_suspend+0x48/0x68
[  466.726168] [<ffff2000088d4f04>] genpd_runtime_suspend+0xcc/0x300
[  466.732372] [<ffff2000088c7068>] pm_runtime_force_suspend+0x48/0xa8
[  466.738748] [<ffff2000088d5330>] pm_genpd_suspend_noirq+0xa0/0x118
[  466.745032] [<ffff2000088c86ec>] dpm_run_callback+0x4c/0xc0
[  466.750709] [<ffff2000088c941c>] __device_suspend_noirq+0x194/0x3d0
[  466.757080] [<ffff2000088cb460>] dpm_suspend_noirq+0x188/0x328
[  466.763024] [<ffff200008143218>] suspend_devices_and_enter+0x230/0x650
[  466.769655] [<ffff200008143990>] pm_suspend+0x358/0x3d0
[  466.774984] [<ffff200008141f0c>] state_store+0x8c/0x100
[  466.780321] [<ffff20000857a83c>] kobj_attr_store+0x44/0x60
[  466.785915] [<ffff2000083436a8>] sysfs_kf_write+0x98/0xb0
[  466.791419] [<ffff200008342118>] kernfs_fop_write+0x120/0x288
[  466.797276] [<ffff20000828d518>] __vfs_write+0xc0/0x238
[  466.802604] [<ffff20000828e900>] vfs_write+0xc8/0x248
[  466.807764] [<ffff200008290678>] SyS_write+0xa0/0x110
[  466.812919] [<ffff20000808374c>] __sys_trace_return+0x0/0x4

BuildInfo:
- SCFW 1f59442e, IMX-MKIMAGE fb52c576, ATF
- U-Boot 2017.03-imx_v2017.03+g34be5a2

Cc: Anson Huang <anson.huang@nxp.com>
Acked-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:52 +08:00
Peter Chen d6f08b0a29 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>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:56:52 +08:00
Peter Chen cebd6f46dd MLK-14396 usb: chipidea: add mutex for concurrent running
The ci_handle_id_switch is called at two places, at very rare situations,
it may be running at the same time. Eg, when the system is back from
the resume, the id event is occurred from extcon driver, as well as
power_lost work item is called due to the controller is poweroff at
the suspend.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:51 +08:00
Li Jun 28dcf702b0 MLK-14285-2 usb: chipidea: set mode for usb phy driver
After enters one specific role, notify usb phy driver.

Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit d3aa2a13f4e47bc7fae7f2eee1e86291d7513312)
2019-11-25 15:56:51 +08:00
Peter Chen 21b67cda90 MLK-13851-1 usb: chipidea: otg: delete the workaround code
After commit 49670184289e ("usb: chipidea: otg: change workqueue
ci_otg as freezable"), we have fixed the bug that ID removed
wakeup (ID: 0->1) will lock up system resume, we delete the
workaround code in this commit.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:50 +08:00
Peter Chen 62985ce5ff MLK-13638-6 usb: chipidea: add recovery from vbus is off during system suspend
When the vbus is off during the suspend controller is powered off, if we
do not want to see disconnection from USB core, we need to make sure the
device pulls DP up before USB core resume runs. However, several devices
are slow to pull DP up when see vbus (maybe it needs vbus to power up
system), so we need to wait connection at platform code.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:49 +08:00
Peter Chen 8f3d6882f0 MLK-13570-8 usb: chpidea: usbmisc_imx: add non-burst setting for both imx7d and imx7ulp
For all imx Socs later than imx6 (including imx6), the USB_nSBUSCFG.AHBBRST
will be set as 0 at dtsi file, so the non-burst setting needs to be
set at non-core register, or there will be no burst for USB AHB/AXI
transfer.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:48 +08:00
Peter Chen ae54db9905 MLK-13308-1 usb: chipidea: udc: add USB PHY event
Add USB PHY event for below situation:
- vbus connect
- vbus disconnect
- gadget driver is enumerated

USB PHY driver can get the last event after above situation
occurs.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2019-11-25 15:56:48 +08:00
Li Jun 14bc08c6ab MLK-12421 usb: chipidea: fix build warning if disable CONFIG_USB_CHIPIDEA_HOST
Fix chipidea usb driver compile warning if CONFIG_USB_CHIPIDEA_HOST
is disabled:
In file included from drivers/usb/chipidea/otg.c:26:0:
drivers/usb/chipidea/host.h:23:13: warning: 'ci_hdrc_host_driver_init'
defined but not used [-Wunused-function]
 static void ci_hdrc_host_driver_init(void)
             ^
  CC      drivers/usb/chipidea/otg_fsm.o
In file included from drivers/usb/chipidea/otg_fsm.c:34:0:
drivers/usb/chipidea/host.h:23:13: warning: 'ci_hdrc_host_driver_init'
defined but not used [-Wunused-function]
 static void ci_hdrc_host_driver_init(void)
             ^

Signed-off-by: Li Jun <jun.li@nxp.com>
2019-11-25 15:56:47 +08:00
Li Jun 43e724eb4e MLK-12344-3 usb: chipidea: update power lost handling for gadget
After we put gadget disconnect and connect in id switch handling,
update power lost work accordingly.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit fd49596eceeb4e61267f35fb74bf0c04056f2ed7)
2019-11-25 15:56:47 +08:00
Li Jun 82c83d06b3 MLK-12344-2 usb: chipidea: otg: add vbus disconnect for gadget after sleep
During system sleep, if we switch otg role from gadget to host, and host
vbus is directly controlled by ID signal, we will lose vbus drop event
after resume because the vbus is on both at system suspend and resume, so
we will miss gadget disconnect handling before start host role. This patch
is to fix it by adding gadget disconnect for this case.

Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Li Jun <jun.li@nxp.com>
(cherry picked from commit 79aab6fc3c9fca1fa4f83f25a5050ea4afc90f0a)
2019-11-25 15:56:46 +08:00