LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64
@ 2021-10-20  9:59 Florian Klink
  2021-10-20  9:59 ` [PATCH 2/2] arm64: dts: rockchip: fix poweroff Florian Klink
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Florian Klink @ 2021-10-20  9:59 UTC (permalink / raw)
  To: Heiko Stuebner, Aditya Prayoga
  Cc: Florian Klink, Rob Herring, Uwe Kleine-König, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel

This adds the hdd_{a,b}_power blocks present in the armbian helios64
dts. [1]

Without those powered up, no HDDs will appear (except one connected via
the m.2 slot).

From https://wiki.kobol.io/helios64/sata/#hdd-power:

> The power delivery of the HDDs is divided into two group:
>
>     HDD Rail A (Max. 3x Drives)
>     HDD Rail B (Max. 2x Drives)
>
> Helios64 implements a power staggering approach where HDD Rail A will be
> powered up first, then few seconds later HDD Rail B will be powered up.
> This power control scenario is performed to reduce the inrush current
> during disk spin-up.

In practice, this power staggering approach will be included in the
bootloader (not in the kernel), as we might want to boot from a SATA
drive.

From my experiments, if the bootloader doesn't implement the power
staggering, only one HDD will get recognized (probably cause the others
didn't boot due to few power).

Still, it makes sense to expose this block in the device-tree, so the
kernel can ensure both rails are on (and this can be shared with
u-boot).

[1] https://github.com/armbian/build/blob/744ea89a589d62cb6f409baab60fc6664520bc39/patch/kernel/archive/rockchip64-5.14/add-board-helios64.patch

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 .../dts/rockchip/rk3399-kobol-helios64.dts    | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
index 738cfd21df3e..93745dcc2af6 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
@@ -82,6 +82,30 @@ led-1 {
 		};
 	};
 
+	hdd_a_power: hdd-a-power {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
+		pinctrl-0 = <&hdd_a_power_en>;
+		pinctrl-names = "default";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-name = "hdd_a_power";
+		startup-delay-us = <2000000>;
+	};
+
+	hdd_b_power: hdd-b-power {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
+		pinctrl-0 = <&hdd_b_power_en>;
+		pinctrl-names = "default";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-name = "hdd_b_power";
+		startup-delay-us = <2000000>;
+	};
+
 	pcie_power: pcie-power {
 		compatible = "regulator-fixed";
 		enable-active-high;
@@ -422,6 +446,14 @@ pmic_int_l: pmic-int-l {
 	};
 
 	power {
+		hdd_a_power_en: hdd-a-power-en {
+			rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		hdd_b_power_en: hdd-b-power-en {
+			rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
 		vcc5v0_usb_en: vcc5v0-usb-en {
 			rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] arm64: dts: rockchip: fix poweroff
  2021-10-20  9:59 [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Florian Klink
@ 2021-10-20  9:59 ` Florian Klink
  2021-10-29  0:08   ` Dennis Gilmore
  2021-10-29  0:08 ` [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Dennis Gilmore
  2021-11-21 18:52 ` Heiko Stuebner
  2 siblings, 1 reply; 5+ messages in thread
From: Florian Klink @ 2021-10-20  9:59 UTC (permalink / raw)
  To: Heiko Stuebner, Aditya Prayoga
  Cc: Florian Klink, Rob Herring, Uwe Kleine-König, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel

Adding the rockchip,system-power-controller property here will use the
rk808 to power off the system.

Signed-off-by: Florian Klink <flokli@flokli.de>
---
 arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
index 93745dcc2af6..af3bf7800dba 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
@@ -293,6 +293,7 @@ rk808: pmic@1b {
 		clock-output-names = "xin32k", "rk808-clkout2";
 		pinctrl-names = "default";
 		pinctrl-0 = <&pmic_int_l>;
+		rockchip,system-power-controller;
 		vcc1-supply = <&vcc5v0_sys>;
 		vcc2-supply = <&vcc5v0_sys>;
 		vcc3-supply = <&vcc5v0_sys>;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] arm64: dts: rockchip: fix poweroff
  2021-10-20  9:59 ` [PATCH 2/2] arm64: dts: rockchip: fix poweroff Florian Klink
@ 2021-10-29  0:08   ` Dennis Gilmore
  0 siblings, 0 replies; 5+ messages in thread
From: Dennis Gilmore @ 2021-10-29  0:08 UTC (permalink / raw)
  To: Florian Klink
  Cc: Heiko Stuebner, Aditya Prayoga, Rob Herring,
	Uwe Kleine-König,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Rockchip SoC support, linux-rockchip,
	open list

Tested-by: Dennis Gilmore <dgilmore@redhat.com>


On Thu, Oct 28, 2021 at 11:37 AM Florian Klink <flokli@flokli.de> wrote:
>
> Adding the rockchip,system-power-controller property here will use the
> rk808 to power off the system.
>
> Signed-off-by: Florian Klink <flokli@flokli.de>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
> index 93745dcc2af6..af3bf7800dba 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
> @@ -293,6 +293,7 @@ rk808: pmic@1b {
>                 clock-output-names = "xin32k", "rk808-clkout2";
>                 pinctrl-names = "default";
>                 pinctrl-0 = <&pmic_int_l>;
> +               rockchip,system-power-controller;
>                 vcc1-supply = <&vcc5v0_sys>;
>                 vcc2-supply = <&vcc5v0_sys>;
>                 vcc3-supply = <&vcc5v0_sys>;
> --
> 2.33.0
>


-- 
Dennis Gilmore
Multiple Architecture Portfolio Enablement
T: +1-312-660-3523


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64
  2021-10-20  9:59 [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Florian Klink
  2021-10-20  9:59 ` [PATCH 2/2] arm64: dts: rockchip: fix poweroff Florian Klink
@ 2021-10-29  0:08 ` Dennis Gilmore
  2021-11-21 18:52 ` Heiko Stuebner
  2 siblings, 0 replies; 5+ messages in thread
From: Dennis Gilmore @ 2021-10-29  0:08 UTC (permalink / raw)
  To: Florian Klink
  Cc: Heiko Stuebner, Aditya Prayoga, Rob Herring,
	Uwe Kleine-König,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	moderated list:ARM/Rockchip SoC support, linux-rockchip,
	open list

Tested-by: Dennis Gilmore <dgilmore@redhat.com>

On Thu, Oct 28, 2021 at 11:37 AM Florian Klink <flokli@flokli.de> wrote:
>
> This adds the hdd_{a,b}_power blocks present in the armbian helios64
> dts. [1]
>
> Without those powered up, no HDDs will appear (except one connected via
> the m.2 slot).
>
> From https://wiki.kobol.io/helios64/sata/#hdd-power:
>
> > The power delivery of the HDDs is divided into two group:
> >
> >     HDD Rail A (Max. 3x Drives)
> >     HDD Rail B (Max. 2x Drives)
> >
> > Helios64 implements a power staggering approach where HDD Rail A will be
> > powered up first, then few seconds later HDD Rail B will be powered up.
> > This power control scenario is performed to reduce the inrush current
> > during disk spin-up.
>
> In practice, this power staggering approach will be included in the
> bootloader (not in the kernel), as we might want to boot from a SATA
> drive.
>
> From my experiments, if the bootloader doesn't implement the power
> staggering, only one HDD will get recognized (probably cause the others
> didn't boot due to few power).
>
> Still, it makes sense to expose this block in the device-tree, so the
> kernel can ensure both rails are on (and this can be shared with
> u-boot).
>
> [1] https://github.com/armbian/build/blob/744ea89a589d62cb6f409baab60fc6664520bc39/patch/kernel/archive/rockchip64-5.14/add-board-helios64.patch
>
> Signed-off-by: Florian Klink <flokli@flokli.de>
> ---
>  .../dts/rockchip/rk3399-kobol-helios64.dts    | 32 +++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
> index 738cfd21df3e..93745dcc2af6 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-kobol-helios64.dts
> @@ -82,6 +82,30 @@ led-1 {
>                 };
>         };
>
> +       hdd_a_power: hdd-a-power {
> +               compatible = "regulator-fixed";
> +               enable-active-high;
> +               gpio = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
> +               pinctrl-0 = <&hdd_a_power_en>;
> +               pinctrl-names = "default";
> +               regulator-always-on;
> +               regulator-boot-on;
> +               regulator-name = "hdd_a_power";
> +               startup-delay-us = <2000000>;
> +       };
> +
> +       hdd_b_power: hdd-b-power {
> +               compatible = "regulator-fixed";
> +               enable-active-high;
> +               gpio = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
> +               pinctrl-0 = <&hdd_b_power_en>;
> +               pinctrl-names = "default";
> +               regulator-always-on;
> +               regulator-boot-on;
> +               regulator-name = "hdd_b_power";
> +               startup-delay-us = <2000000>;
> +       };
> +
>         pcie_power: pcie-power {
>                 compatible = "regulator-fixed";
>                 enable-active-high;
> @@ -422,6 +446,14 @@ pmic_int_l: pmic-int-l {
>         };
>
>         power {
> +               hdd_a_power_en: hdd-a-power-en {
> +                       rockchip,pins = <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
> +               };
> +
> +               hdd_b_power_en: hdd-b-power-en {
> +                       rockchip,pins = <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
> +               };
> +
>                 vcc5v0_usb_en: vcc5v0-usb-en {
>                         rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
>                 };
> --
> 2.33.0
>


-- 
Dennis Gilmore
Multiple Architecture Portfolio Enablement
T: +1-312-660-3523


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64
  2021-10-20  9:59 [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Florian Klink
  2021-10-20  9:59 ` [PATCH 2/2] arm64: dts: rockchip: fix poweroff Florian Klink
  2021-10-29  0:08 ` [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Dennis Gilmore
@ 2021-11-21 18:52 ` Heiko Stuebner
  2 siblings, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2021-11-21 18:52 UTC (permalink / raw)
  To: Aditya Prayoga, Florian Klink
  Cc: Heiko Stuebner, linux-arm-kernel, Uwe Kleine-König,
	linux-rockchip, linux-kernel, devicetree, Rob Herring

On Wed, 20 Oct 2021 11:59:22 +0200, Florian Klink wrote:
> This adds the hdd_{a,b}_power blocks present in the armbian helios64
> dts. [1]
> 
> Without those powered up, no HDDs will appear (except one connected via
> the m.2 slot).
> 
> >From https://wiki.kobol.io/helios64/sata/#hdd-power:
> 
> [...]

Applied, thanks!

[1/2] arm64: dts: rockchip: Enable HDD power on helios64
      commit: 8169b9894dbd2d4e440cfbc5fe9f733e5876a564
[2/2] arm64: dts: rockchip: fix poweroff
      commit: aef4b9a89a376a9cabe5e744729914e7766c59bb

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-21 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20  9:59 [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Florian Klink
2021-10-20  9:59 ` [PATCH 2/2] arm64: dts: rockchip: fix poweroff Florian Klink
2021-10-29  0:08   ` Dennis Gilmore
2021-10-29  0:08 ` [PATCH 1/2] arm64: dts: rockchip: Enable HDD power on helios64 Dennis Gilmore
2021-11-21 18:52 ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).