Re: [PATCH 00/16] Add initial USB support for the Renesas RZ/G3S SoC
From: Ulf Hansson <hidden>
Date: 2024-08-30 10:15:10
Also in:
linux-clk, linux-devicetree, linux-phy, linux-pm, linux-renesas-soc, linux-usb, lkml
On Fri, 30 Aug 2024 at 10:22, claudiu beznea [off-list ref] wrote:
Hi, Ulf, On 29.08.2024 18:26, Ulf Hansson wrote:quoted
On Thu, 22 Aug 2024 at 17:28, Claudiu [off-list ref] wrote:quoted
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Hi, Series adds initial USB support for the Renesas RZ/G3S SoC. Series is split as follows: - patch 01/16 - add clock reset and power domain support for USB - patch 02-04/16 - add reset control support for a USB signal that need to be controlled before/after the power to USB area is turned on/off. Philipp, Ulf, Geert, all, I detailed my approach for this in patch 04/16, please have a look and let me know your input.I have looked briefly. Your suggested approach may work, but I have a few thoughts, see below. If I understand correctly, it is the consumer driver for the device that is attached to the USB power domain that becomes responsible for asserting/de-asserting this new signal. Right?Right!quoted
In this regard, please note that the consumer driver doesn't really know when the power domain really gets powered-on/off. Calling pm_runtime_get|put*() is dealing with the reference counting. For example, a call to pm_runtime_get*() just makes sure that the PM domain gets-or-remains powered-on. Could this be a problem from the reset-signal point of view?It should be safe. From the HW manual I understand the hardware block is something like the following: USB area +-------------------------+ | | | PHY --->USB controller | SYSC --> | ^ | | | | | PHY reset | +-------------------------+ Where: - SYSC is the system controller that controls the new signal for which I'm requesting opinions in this series - PHY reset: is the block controlling the PHYs - PHY: is the block controlling the USB PHYs - USB controller: is the USB controller Currently, I passed the SYSC signal handling to the PHY reset driver; w/o PHY reset the rest of the USB logic cannot work (neither PHY block nor USB controller). Currently, the PHY reset driver call pm_runtime_resume_and_get() in probe and pm_runtime_put() in remove. The struct reset_control_ops::{assert, deassert} only set specific bits in registers (no pm_runtime* calls).
Thanks for clarifying! For my understanding, in what register range do these bits belong? Is it the USB logic or in the PM domain logic, or something else.
The PHY driver is taking its PHY reset in probe and release it in remove(). With this approach the newly introduced SYSC signal will be de-asserted/asserted only in the PHY reset probe/remove (either if it is handled though PM domain or reset control signal). If the SYSC signal would be passed to all the blocks in the USB area (and it would be handled though PM domains) it should be no problem either, AFAICT, because of reference counting the pm_runtime_get|put*() is taking care of. As the PHY reset is the root node the in the devices node tree for USB the reference counting should work, too (I may miss something though, please correct me if I'm wrong). If the SYSC signal would be handled though a reset control driver (as proposed in this series) and we want to pass this reference to all the blocks in the USB area then we can request the reset signal as shared and, AFAIK, this is also reference counted. The devices node tree should help with the order, too, if I'm not wrong.
Reference counting a reset signal sounds a bit weird to me, but I guess it can work. :-) To sum up from my side; As long as it's fine that we may end up asserting/de-asserting the reset-signal, without actually knowing if the PM domain is getting turn-on/off, then using a reset-control like what you propose seems okay to me. If not, there are two other options that can be considered I think. *) Using the genpd on/off notifiers, to really allow the consumer driver of the reset-control to know when the PM domain gets turned on/off. **) Move the entire reset handling into the PM domain provider, as it obviously knows when the domain is getting turned on/off. Thanks again for your explanations! Kind regards Uffe