Skip to contentSkip to conversation

arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3

PATCH In review Frank Wunderlich 3 participants 5 messages Sep 1, 2023 – Sep 12, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3

From: Frank Wunderlich <[email protected]>

Bananapi R3 has a Power socket entended for using external SATA drives. This Socket is off by default but can be switched with gpio 8.

Add an overlay to activate it.

---
 arch/arm64/boot/dts/mediatek/Makefile         |  1 +
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
arch/arm64/boot/dts/mediatek/Makefile +1 -0
index c99c3372a4b5..822d3e36d3df 100644
@@ -13,6 +13,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sata.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986b-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt8167-pumpkin.dtb
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +39 -0
new file mode 100644
index 000000000000..6ab06813412a
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 MediaTek Inc.
+ * Author: Frank Wunderlich <[email protected]>
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	compatible = "bananapi,bpi-r3", "mediatek,mt7986a";
+
+	fragment@0 {
+		target-path = "/";
+		__overlay__ {
+			reg_sata12v: regulator-sata12v {
+				compatible = "regulator-fixed";
+				regulator-name = "sata12v";
+				regulator-min-microvolt = <12000000>;
+				regulator-max-microvolt = <12000000>;
+				gpio = <&pio 8 GPIO_ACTIVE_HIGH>;
+				enable-active-high;
+				regulator-always-on;
+			};
+
+			reg_sata5v: regulator-sata5v {
+				compatible = "regulator-fixed";
+				regulator-name = "sata5v";
+				regulator-min-microvolt = <5000000>;
+				regulator-max-microvolt = <5000000>;
+				regulator-always-on;
+				vin-supply = <&reg_sata12v>;
+			};
+		};
+	};
+};
+
Signature · 1 line
2.34.1
#1 lore raw
Quoted 20 lines · Frank Wunderlich

From: Frank Wunderlich <[email protected]>

Bananapi R3 has a Power socket entended for using external SATA drives. This Socket is off by default but can be switched with gpio 8.

Add an overlay to activate it.

---
 arch/arm64/boot/dts/mediatek/Makefile         |  1 +
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
arch/arm64/boot/dts/mediatek/Makefile +0 -0
index c99c3372a4b5..822d3e36d3df 100644

arch/arm64/boot/dts/mediatek/Makefile dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo · line 16

Quoted 4 lines
arch/arm64/boot/dts/mediatek/Makefile +1 -0
@@ -13,6 +13,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sata.dtbo

The requirement for overlays is they have a target base dt in tree and that you apply the overlay to it. All these existing overlays have the same problem which I pointed out when you submitted them. Please fix the existing ones before adding more.

Rob

#2 lore raw

Am 11. September 2023 21:51:42 MESZ schrieb Rob Herring <[email protected]>:

Quoted 32 lines · Frank Wunderlich
Quoted 20 lines

From: Frank Wunderlich <[email protected]>

Bananapi R3 has a Power socket entended for using external SATA drives. This Socket is off by default but can be switched with gpio 8.

Add an overlay to activate it.

---
 arch/arm64/boot/dts/mediatek/Makefile         |  1 +
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
arch/arm64/boot/dts/mediatek/Makefile +0 -0
index c99c3372a4b5..822d3e36d3df 100644

arch/arm64/boot/dts/mediatek/Makefile dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo · line 16

Quoted 4 lines
arch/arm64/boot/dts/mediatek/Makefile +1 -0
@@ -13,6 +13,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sata.dtbo

The requirement for overlays is they have a target base dt in tree and that you apply the overlay to it. All these existing overlays have the same problem which I pointed out when you submitted them. Please fix the existing ones before adding more.

Quoted 1 line

Rob

Hi Rob,

i do not understand the problem as there is a target base dt...mt7986a-bananapi-bpi-r3.dtb.

Do you mean that overlays should be merged with basedt at compiletime?

We pack the base-dt and all overlays into one fit image and let uboot dynamically select the combination to apply. E.g. check if emmc is available, if yes apply emmc overlay else the sd one,same for nand/nor.

Else i do not know *how* to fix as i don't see it as broken.

regards Frank

#3 lore raw
Quoted 34 lines · Frank Wunderlich

Am 11. September 2023 21:51:42 MESZ schrieb Rob Herring <[email protected]>:

Quoted 32 lines · Frank Wunderlich
Quoted 20 lines

From: Frank Wunderlich <[email protected]>

Bananapi R3 has a Power socket entended for using external SATA drives. This Socket is off by default but can be switched with gpio 8.

Add an overlay to activate it.

---
 arch/arm64/boot/dts/mediatek/Makefile         |  1 +
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
arch/arm64/boot/dts/mediatek/Makefile +0 -0
index c99c3372a4b5..822d3e36d3df 100644

arch/arm64/boot/dts/mediatek/Makefile dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo · line 16

Quoted 4 lines
arch/arm64/boot/dts/mediatek/Makefile +1 -0
@@ -13,6 +13,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sata.dtbo

The requirement for overlays is they have a target base dt in tree and that you apply the overlay to it. All these existing overlays have the same problem which I pointed out when you submitted them. Please fix the existing ones before adding more.

Quoted 7 lines
Quoted 1 line

Rob

Hi Rob,

i do not understand the problem as there is a target base dt...mt7986a-bananapi-bpi-r3.dtb.

Do you mean that overlays should be merged with basedt at compiletime?

Yes, because we want to know an overlay can actually apply to what's upstream.

Quoted 1 line

We pack the base-dt and all overlays into one fit image and let uboot dynamically select the combination to apply. E.g. check if emmc is available, if yes apply emmc overlay else the sd one,same for nand/nor.

That's irrelevant.

Though do you really want to wait until that point to find out you made some mistake in your overlay that it doesn't apply when you could find out much sooner?

Quoted 1 line

Else i do not know *how* to fix as i don't see it as broken.

You need what I pointed out last time[1].

Rob

[1] https://lore.kernel.org/all/CAL_JsqK_3xxD0DFwipXO85P=q=EYjUdjE1_8g1MKtvw3vVzx5A@mail.gmail.com/

#4 lore raw

Hi

Quoted 44 lines

Gesendet: Montag, 11. September 2023 um 23:06 Uhr
Von: "Rob Herring" <[email protected]>
An: [email protected]
Cc: "Frank Wunderlich" <[email protected]>, [email protected], "Matthias Brugger" <[email protected]>, "AngeloGioacchino Del Regno" <[email protected]>, "Krzysztof Kozlowski" <[email protected]>, "Conor Dooley" <[email protected]>, [email protected], [email protected], [email protected]
Betreff: Re: [PATCH v1] arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3

Quoted 36 lines · Frank Wunderlich

Am 11. September 2023 21:51:42 MESZ schrieb Rob Herring <[email protected]>:

Quoted 33 lines · Frank Wunderlich
Quoted 20 lines

From: Frank Wunderlich <[email protected]>

Bananapi R3 has a Power socket entended for using external SATA drives. This Socket is off by default but can be switched with gpio 8.

Add an overlay to activate it.

---
 arch/arm64/boot/dts/mediatek/Makefile         |  1 +
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
arch/arm64/boot/dts/mediatek/Makefile +0 -0
index c99c3372a4b5..822d3e36d3df 100644

arch/arm64/boot/dts/mediatek/Makefile dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo · line 16

Quoted 4 lines
arch/arm64/boot/dts/mediatek/Makefile +1 -0
@@ -13,6 +13,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sata.dtbo

The requirement for overlays is they have a target base dt in tree and that you apply the overlay to it. All these existing overlays have the same problem which I pointed out when you submitted them. Please fix the existing ones before adding more.

Rob

Quoted 7 lines
Quoted 5 lines

Hi Rob,

i do not understand the problem as there is a target base dt...mt7986a-bananapi-bpi-r3.dtb.

Do you mean that overlays should be merged with basedt at compiletime?

Yes, because we want to know an overlay can actually apply to what's upstream.

so you want this only as compile-time-check or to provide dtbs for users in all possible combinations?

for compiletime-check i would add only these 4 lines:

mt7986a-bananapi-bpi-r3-sd-nand-dtbs := mt7986a-bananapi-bpi-r3.dtb mt7986a-bananapi-bpi-r3-sd.dtbo mt7986a-bananapi-bpi-r3-nand.dtbo dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nand.dtb
mt7986a-bananapi-bpi-r3-emmc-nor-dtbs := mt7986a-bananapi-bpi-r3.dtb mt7986a-bananapi-bpi-r3-emmc.dtbo mt7986a-bananapi-bpi-r3-nor.dtbo dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-nor.dtb

for all possible situations we need 8 lines as i wrote in the thread you've linked (sd-nand, sd-nor, emmc-nand, emmc-nor) and this will double the lines in makefile with each additional overlay (e.g. the sata one here resulting in 16 lines total).

if the basic syntax is ok (maybe naming the dtbs differently?) and i know compiletest vs. all possibilities i can send patch for correcting this.

Quoted 16 lines
Quoted 1 line

We pack the base-dt and all overlays into one fit image and let uboot dynamically select the combination to apply. E.g. check if emmc is available, if yes apply emmc overlay else the sd one,same for nand/nor.

That's irrelevant.

Though do you really want to wait until that point to find out you made some mistake in your overlay that it doesn't apply when you could find out much sooner?

Quoted 1 line

Else i do not know *how* to fix as i don't see it as broken.

You need what I pointed out last time[1].

Rob

[1] https://lore.kernel.org/all/CAL_JsqK_3xxD0DFwipXO85P=q=EYjUdjE1_8g1MKtvw3vVzx5A@mail.gmail.com/