1
0
Fork 0
alistair23-linux/drivers/usb/chipidea
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
..
Kconfig usb: chipidea: add role switch class support 2019-08-28 10:39:53 +08:00
Makefile usb: chipidea: Always build ULPI code 2018-07-05 14:22:47 +08:00
bits.h USB: chipidea: Remove redundant license text 2017-11-07 15:45:01 +01:00
ci.h usb: chipidea: add role switch class support 2019-08-28 10:39:53 +08:00
ci_hdrc_imx.c usb: chipidea: imx: fix EPROBE_DEFER support during driver probe 2019-08-15 14:50:21 +02:00
ci_hdrc_imx.h usb: chipidea: imx: set power polarity 2019-02-27 15:51:02 +01:00
ci_hdrc_msm.c usb: chipidea: msm: Use device-managed registration API 2019-09-03 15:53:27 +02:00
ci_hdrc_pci.c USB: chipidea: Remove redundant license text 2017-11-07 15:45:01 +01:00
ci_hdrc_tegra.c usb: chipidea: tegra: Fix missed ci_hdrc_remove_device() 2019-02-26 11:57:38 +01:00
ci_hdrc_usb2.c USB: chipidea: Remove redundant license text 2017-11-07 15:45:01 +01:00
ci_hdrc_zevio.c USB: chipidea: Remove redundant license text 2017-11-07 15:45:01 +01:00
core.c usb: chipidea: add role switch class support 2019-08-28 10:39:53 +08:00
debug.c USB: chipidea: no need to check return value of debugfs_create functions 2018-05-31 12:54:22 +02:00
host.c usb: chipidea: host: Disable port power only if previously enabled 2020-01-14 20:08:19 +01:00
host.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
otg.c usb: chipidea: add role switch class support 2019-08-28 10:39:53 +08:00
otg.h usb: chipidea: Prevent unbalanced IRQ disable 2018-09-20 17:04:21 +08:00
otg_fsm.c USB: move many drivers to use DEVICE_ATTR_WO 2018-01-24 08:49:52 +01:00
otg_fsm.h USB: chipidea: Remove redundant license text 2017-11-07 15:45:01 +01:00
udc.c Merge 5.3-rc7 into usb-next 2019-09-02 19:31:18 +02:00
udc.h USB: chipidea: Remove redundant license text 2017-11-07 15:45:01 +01:00
ulpi.c usb: chipidea: Always build ULPI code 2018-07-05 14:22:47 +08:00
usbmisc_imx.c usb: chipidea: imx: Use devm_platform_ioremap_resource() 2019-06-14 17:40:20 +08:00