u-boot/drivers/phy
Alper Nebi Yasak 226fce6108 phy: Track power-on and init counts in uclass
On boards using the RK3399 SoC, the USB OHCI and EHCI controllers share
the same PHY device instance. While these controllers are being stopped
they both attempt to power-off and deinitialize it, but trying to
power-off the deinitialized PHY device results in a hang. This usually
happens just before booting an OS, and can be explicitly triggered by
running "usb start; usb stop" in the U-Boot shell.

Implement a uclass-wide counting mechanism for PHY initialization and
power state change requests, so that we don't power-off/deinitialize a
PHY instance until all of its users want it done. The Allwinner A10 USB
PHY driver does this counting in-driver, remove those parts in favour of
this in-uclass implementation.

The sandbox PHY operations test needs some changes since the uclass will
no longer call into the drivers for actions matching its tracked state
(e.g. powering-off a powered-off PHY). Update that test, and add a new
one which simulates multiple users of a single PHY.

The major complication here is that PHY handles aren't deduplicated per
instance, so the obvious idea of putting the counts in the PHY handles
don't immediately work. It seems possible to bind a child udevice per
PHY instance to the PHY provider and deduplicate the handles in each
child's uclass-private areas, like in the CLK framework. An alternative
approach could be to use those bound child udevices themselves as the
PHY handles. Instead, to avoid the architectural changes those would
require, this patch solves things by dynamically allocating a list of
structs (one per instance) in the provider's uclass-private area.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com> - Rock960
2022-01-14 14:36:57 -05:00
..
allwinner phy: Track power-on and init counts in uclass 2022-01-14 14:36:57 -05:00
cadence phy: cadence: phy-cadence-torrent: Change the name of subnode searched 2021-11-17 17:09:47 -05:00
marvell phy: marvell: a3700: Convert to official DT bindings in COMPHY driver 2021-12-19 09:50:47 +01:00
rockchip common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
socionext phy: socionext: Add UniPhier PCIe PHY driver 2021-07-14 16:48:07 -04:00
ti phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC 2021-07-27 10:57:12 +05:30
bcm6318-usbh-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bcm6348-usbh-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bcm6358-usbh-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
bcm6368-usbh-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
Kconfig phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC 2021-07-27 10:57:12 +05:30
keystone-usb-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
Makefile Merge tag 'ti-v2021.10-rc2' of https://source.denx.de/u-boot/custodians/u-boot-ti 2021-07-29 08:20:06 -04:00
meson-axg-mipi-dphy.c phy: meson-axg-mipi: Rename "priv_auto_alloc_size" to "priv_auto" 2021-07-27 10:32:09 +02:00
meson-axg-mipi-pcie-analog.c phy: meson-axg-mipi: Access parent ofnode through dev_ofnode() 2021-07-27 10:32:09 +02:00
meson-g12a-usb2.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
meson-g12a-usb3-pcie.c phy: meson-g12a-usb3-pcie: add support for PCIe ops 2021-04-19 16:59:33 +02:00
meson-gxbb-usb2.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
meson-gxl-usb2.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
msm8916-usbh-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
mt76x8-usb-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
mt7620-usb-phy.c phy: add USB PHY driver for MediaTek MT7620 SoC 2021-01-24 21:39:26 +01:00
nop-phy.c phy: nop-phy: Add standard usb-nop-xceiv compat string 2021-04-18 04:29:35 +02:00
omap-usb2-phy.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
phy-ab8500-usb.c phy: Add driver for ST-Ericsson AB8500 USB PHY 2021-07-14 16:48:15 -04:00
phy-bcm-sr-pcie.c dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
phy-core-mipi-dphy.c phy: dphy: Add configuration helpers 2021-02-10 10:00:51 +01:00
phy-da8xx-usb.c common: Drop log.h from common header 2020-05-18 21:19:18 -04:00
phy-imx8mq-usb.c phy: phy-imx8mq-usb: Add USB PHY driver for i.MX8MQ 2021-07-17 13:12:23 +02:00
phy-mtk-tphy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy-qcom-ipq4019-usb.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy-rcar-gen2.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy-rcar-gen3.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
phy-stm32-usbphyc.c phy: stm32-usbphyc: stm32: usbphyc: add protection on phy sub-node 2021-10-08 08:19:59 +02:00
phy-ti-am654.c dm: core: Access device ofnode through functions 2021-01-05 12:24:41 -07:00
phy-uclass.c phy: Track power-on and init counts in uclass 2022-01-14 14:36:57 -05:00
sandbox-phy.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
sti_usb_phy.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ti-pipe3-phy.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00