Re: [PATCH v2 2/2] arm64: dts: rockchip: Add FriendlyElec CM3588 NAS board

From: Sebastian Kropatsch
Date: Sun Jun 09 2024 - 12:46:26 EST


Am 09.06.2024 um 18:05 schrieb Heiko Stübner:
Am Samstag, 8. Juni 2024, 19:22:01 CEST schrieb Sebastian Kropatsch:
Am 08.06.2024 um 16:38 schrieb Heiko Stuebner:
Am Donnerstag, 6. Juni 2024, 15:13:20 CEST schrieb Space Meyer:
On 02.06.2024 22:20, Sebastian Kropatsch wrote:
+ vcc_3v3_pcie30: regulator-vcc-3v3-pcie30 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc_3v3_pcie30";
+ regulator-always-on;
+ regulator-boot-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ vin-supply = <&vcc_5v0_sys>;
+ };

These are 4 seperate regulators according to the schematic. However, as
they are all fixed, idk if they should be split or kept like this.

personally, I really like the power-diagram to match schematics.
I.e. $debugfs/regulator/regulator_summary will produce a really nice
graph of all the system's regulators, so it's definitly nice if the
hirarchy matches. Also prevents head-scratching later on ;-)

These are indeed 4 different regulators according to the schematic.[1]
But they don't have any pin to control them separately. I can
duplicate them 4 times if that's the preferred practice.

But matching the schematics won't be possible either way, since
e.g. there is only one single 5v regulator acc. to the schematic
(vcc_5v0_sys), but vcc_5v0_host_20, vcc_5v0_host_30, vbus_5v0_typec
and so on are needed since each device has a different control pin
to enable its power. Or is there a better way to solve this while
having only one 5v regulator node but still being able to set the
control pins separately for the different USB ports?

The other option we often use is to define multiple phandles
for a regulator. For exactly that case where one gpio controls
a set of regulators.

So you have one regulator

vcc_5v0_host_20: vcc_5v0_host_30: vbus_5v0_typec: regulator-vcc-whatever {
foo;
}

So in short there is not set rule, but more like a best-effort to get as
close to the schematics as possible. I.e. someone going from dt
to schematics should be able to just search for an identifier
(of course same for the other direction).

I see. And then later in the file have something like this?

&vcc_5v0_host_20{
gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
};

&vcc_5v0_host_30{
gpios = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>;
};

&vbus_5v0_typec{
gpios = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
};

Will this work? I thought these gpios would then all just go into
the above mentioned "regulator-vcc-whatever" node, overwriting
each other. If so, I think the solution of keeping them as separate
regulators would still be fine, since as Space Meyer mentioned that,
although all USBs are connected to the same regulator, they have one
SY6280AAC power switch each and these switches have enable pins (which
are seen above in the gpios).


Cheers,
Sebastian