linux/drivers/reset
Claudiu Beznea 78f2d64e48 reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY
On the Renesas RZ/G3S SoC, the USB PHY block has an input signal called
PWRRDY. This signal is managed by the system controller and must be
de-asserted after powering on the area where USB PHY resides and asserted
before powering it off.

On power-on/resume the USB PWRRDY signal need to be de-asserted before
enabling clock and switching the module to normal state (through MSTOP
support). The power-on/resume configuration sequence must be:

1/ PWRRDY=0
2/ CLK_ON=1
3/ MSTOP=0

On power-off/suspend the configuration sequence should be:

1/ MSTOP=1
2/ CLK_ON=0
3/ PWRRDY=1

The CLK_ON and MSTOP functionalities are controlled by clock drivers.
The suspend/resume support will be handled by different patches.

After long discussions with the internal HW team, it has been confirmed
that the HW connection b/w USB PHY block, the USB channels, the system
controller, clock, MSTOP, PWRRDY signal is as follows:

                               ┌──────────────────────────────┐
                               │                              │◄── CPG_CLKON_USB.CLK0_ON
                               │     USB CH0                  │
┌──────────────────────────┐   │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK2_ON
│                 ┌────────┐   ││host controller registers  │ │
│                 │        │   ││function controller registers│
│                 │ PHY0   │◄──┤└───────────────────────────┘ │
│     USB PHY     │        │   └────────────▲─────────────────┘
│                 └────────┘                │
│                          │    CPG_BUS_PERI_COM_MSTOP.MSTOP{6, 5}_ON
│┌──────────────┐ ┌────────┐
││USHPHY control│ │        │
││  registers   │ │ PHY1   │   ┌──────────────────────────────┐
│└──────────────┘ │        │◄──┤     USB CH1                  │
│                 └────────┘   │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK1_ON
└─▲───────▲─────────▲──────┘   ││ host controller registers │ │
  │       │         │          │└───────────────────────────┘ │
  │       │         │          └────────────▲─────────────────┘
  │       │         │                       │
  │       │         │           CPG_BUS_PERI_COM_MSTOP.MSTOP7_ON
  │PWRRDY │         │
  │       │   CPG_CLK_ON_USB.CLK3_ON
  │       │
  │  CPG_BUS_PERI_COM_MSTOP.MSTOP4_ON
  │
┌────┐
│SYSC│
└────┘

where:
- CPG_CLKON_USB.CLK.CLKX_ON is the register bit controlling the clock X
  of different USB blocks, X in {0, 1, 2, 3}
- CPG_BUS_PERI_COM_MSTOP.MSTOPX_ON is the register bit controlling the
  MSTOP of different USB blocks, X in {4, 5, 6, 7}
- USB PHY is the USB PHY block exposing 2 ports, port0 and port1, used
  by the USB CH0, USB CH1
- SYSC is the system controller block controlling the PWRRDY signal
- USB CHx are individual USB block with host and function capabilities
  (USB CH0 have both host and function capabilities, USB CH1 has only
  host capabilities)

The USBPHY control registers are controlled though the
reset-rzg2l-usbphy-ctrl driver. The USB PHY ports are controlled by
phy_rcar_gen3_usb2 (drivers/phy/renesas/phy-rcar-gen3-usb2.c file). The
USB PHY ports request resets from the reset-rzg2l-usbphy-ctrl driver.

The connection b/w the system controller and the USB PHY CTRL driver is
implemented through the renesas,sysc-pwrrdy device tree property
proposed in this patch. This property specifies the register offset and the
bitmask required to control the PWRRDY signal.

Since the USB PHY CTRL driver needs to be probed before any other
USB-specific driver on RZ/G3S, control of PWRRDY is passed exclusively
to it. This guarantees the correct configuration sequence between clocks,
MSTOP bits, and the PWRRDY bit on probe/resume and remove/suspend. At the
same time, changes are kept minimal by avoiding modifications to the USB
PHY driver to also handle the PWRRDY itself.

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2025-11-18 17:52:54 +01:00
..
amlogic Reset controller updates for v6.14 (v2) 2025-01-15 18:05:41 +01:00
hisilicon reset: hisilicon: hi6220: add missing MODULE_DESCRIPTION() macro 2024-06-21 13:49:25 +02:00
starfive reset: starfive: jh71x0: Fix accessing the empty member on JH7110 SoC 2024-09-30 14:24:37 +02:00
sti reset: sti: allow building under COMPILE_TEST 2024-06-24 09:50:31 +02:00
tegra reset: tegra-bpmp: allow building under COMPILE_TEST 2024-07-01 09:57:48 +02:00
core.c reset: Add devres helpers to request pre-deasserted reset controls 2024-10-01 17:39:53 +02:00
Kconfig reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY 2025-11-18 17:52:54 +01:00
Makefile reset: eswin: Add eic7700 reset driver 2025-11-18 17:52:54 +01:00
reset-a10sr.c reset: a10sr: add missing of_match_table reference 2021-05-10 09:48:17 +02:00
reset-aspeed.c reset: aspeed: register AST2700 reset auxiliary bus device 2025-08-14 12:17:45 +02:00
reset-ath79.c reset: ath79: remove unneeded call to platform_set_drvdata() 2023-08-08 15:31:00 +02:00
reset-axs10x.c reset: axs10x: Use devm_platform_ioremap_resource() 2023-05-08 09:28:31 +02:00
reset-bcm6345.c reset: bcm6345: add support for bcm63xx ephy control register 2025-08-14 12:13:55 +02:00
reset-berlin.c reset: berlin: fix OF node leak in probe() error path 2024-09-02 11:51:19 +02:00
reset-brcmstb-rescal.c reset: brcmstb-rescal: Use devm_platform_ioremap_resource() 2023-05-08 09:28:31 +02:00
reset-brcmstb.c reset: brcmstb: Use devm_platform_get_and_ioremap_resource() 2023-11-28 17:19:38 +01:00
reset-eic7700.c reset: eswin: Add eic7700 reset driver 2025-11-18 17:52:54 +01:00
reset-eyeq.c reset: eyeq: fix OF node leak 2025-08-27 16:40:13 +02:00
reset-gpio.c reset: gpio: Add GPIO-based reset controller 2024-02-21 11:53:25 +01:00
reset-hsdk.c reset: reset-hsdk: Use devm_platform_ioremap_resource() 2023-05-08 09:28:31 +02:00
reset-imx-scu.c reset: imx: fix incorrect module device table 2025-03-14 16:46:15 +01:00
reset-imx7.c reset: Explicitly include correct DT includes 2023-07-28 17:36:20 +02:00
reset-imx8mp-audiomix.c reset: imx8mp-audiomix: Add support for DSP run/stall 2025-03-13 09:10:33 -06:00
reset-intel-gw.c reset: remove unneeded 'fast_io' parameter in regmap_config 2025-08-14 12:21:39 +02:00
reset-k210.c reset: k210: fix OF node leak in probe() error path 2024-09-02 11:51:19 +02:00
reset-k230.c reset: canaan: add reset driver for Kendryte K230 2025-06-27 17:45:51 +02:00
reset-lantiq.c reset: lantiq: remove unneeded call to platform_set_drvdata() 2023-08-08 15:31:00 +02:00
reset-lpc18xx.c reset: lpc18xx: simplify with devm_clk_get_enabled() 2024-09-02 11:56:15 +02:00
reset-ma35d1.c reset: Add Nuvoton ma35d1 reset driver support 2023-06-05 13:18:09 +02:00
reset-microchip-sparx5.c reset: mchp: sparx5: Fix for lan966x 2025-03-13 09:40:26 +01:00
reset-mpfs.c reset: mpfs: use the auxiliary device creation 2025-06-27 18:15:35 +02:00
reset-npcm.c The core framework gained a clk provider helper, a clk consumer helper, and 2024-11-22 17:02:25 -08:00
reset-pistachio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
reset-qcom-aoss.c reset: qcom-aoss: Convert to devm_platform_ioremap_resource() 2023-11-28 17:19:39 +01:00
reset-qcom-pdc.c reset: remove unneeded 'fast_io' parameter in regmap_config 2025-08-14 12:21:39 +02:00
reset-raspberrypi.c reset: raspberrypi: Release firmware handle on unbind 2021-03-22 17:59:51 +01:00
reset-rzg2l-usbphy-ctrl.c reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY 2025-11-18 17:52:54 +01:00
reset-rzv2h-usb2phy.c reset: Add USB2PHY port reset driver for Renesas RZ/V2H(P) 2025-05-05 15:18:35 +02:00
reset-scmi.c reset: reset-scmi: Port driver to the new scmi_reset_proto_ops interface 2021-03-30 16:34:54 +01:00
reset-simple.c reset: simple: add support for Sophgo CV1800B 2025-06-27 18:20:15 +02:00
reset-socfpga.c reset: socfpga: add empty driver allowing consumers to probe 2021-10-05 12:23:16 +02:00
reset-spacemit.c reset: spacemit: add support for SpacemiT CCU resets 2025-07-07 21:54:16 +08:00
reset-sunplus.c reset: sunplus: Use devm_platform_get_and_ioremap_resource() 2023-11-28 17:19:39 +01:00
reset-sunxi.c reset: Move reset-simple header out of drivers/reset 2020-06-16 14:19:56 +02:00
reset-th1520.c reset: remove unneeded 'fast_io' parameter in regmap_config 2025-08-14 12:21:39 +02:00
reset-ti-sci.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
reset-ti-syscon.c reset: ti: syscon: remove unneeded call to platform_set_drvdata() 2023-08-08 15:31:00 +02:00
reset-tn48m.c reset: Add Delta TN48M CPLD reset controller 2022-02-25 09:59:35 +01:00
reset-tps380x.c reset: tps380x: Fix spelling mistake "Voltags" -> "Voltage" 2022-07-28 14:08:50 +02:00
reset-uniphier-glue.c reset: uniphier-glue: Use devm_reset_control_bulk_get_shared_deasserted() 2024-10-01 17:39:53 +02:00
reset-uniphier.c reset: Explicitly include correct DT includes 2023-07-28 17:36:20 +02:00
reset-zynq.c reset: zynq: remove unneeded call to platfrom_set_drvdata() 2023-08-08 15:31:00 +02:00
reset-zynqmp.c reset: zynqmp: removed unneeded call to platform_set_drvdata() 2023-08-08 15:31:00 +02:00