Skip to contentSkip to conversation

mt7986 DTS Patches

PATCH Applied Frank Wunderlich 3 participants 14 messages Oct 25, 2023 – Jun 4, 2024

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

v2 cover mt7986 DTS Patches

From: Frank Wunderlich <[email protected]>

Hi,

i collected the open dts patches for mt7986 to make it easier for mtk maintainer to pick them up.

so the following patches/series are superseeded:

- Fix emmc hs400 mode on mt7986
https://patchwork.kernel.org/project/linux-mediatek/list/?series=761293
- mt7986 DTS fixes (for thermal and sfp)
https://patchwork.kernel.org/project/linux-mediatek/list/?series=777712
- arm64: dts: mediatek: add dtbs with applied overlays for bpi-r3
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/
- arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3
https://patchwork.kernel.org/project/linux-mediatek/patch/[email protected]/

updated the dtbs overlay patch to make it better readable based on arm64/boot/dts/ti/Makefile and squashed 2 patches from the thermal-zone series.

sidenote for angelo: after this series only the thermal driver patch is open from the list i've sent to you if this goes through your tree.

regards Frank

Eric Woudstra (1):
arm64: dts: mt7986: fix emmc hs400 mode without uboot initialization

Frank Wunderlich (4):
arm64: dts: mt7986: define 3W max power to both SFP on BPI-R3
arm64: dts: mt7986: change cooling trips
arm64: dts: mt7986: add dtbs with applied overlays for bpi-r3
arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3

 arch/arm64/boot/dts/mediatek/Makefile         | 27 +++++++++++++
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts  | 12 +++---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi     | 24 ++++++++++--
 4 files changed, 93 insertions(+), 9 deletions(-)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/5 arm64: dts: mt7986: fix emmc hs400 mode without uboot initialization

From: Eric Woudstra <[email protected]>

Eric reports errors on emmc with hs400 mode when booting linux on bpi-r3 without uboot [1]. Booting with uboot does not show this because clocks seem to be initialized by uboot.

Fix this by adding assigned-clocks and assigned-clock-parents like it's done in uboot [2].

[1] https://forum.banana-pi.org/t/bpi-r3-kernel-fails-setting-emmc-clock-to-416m-depends-on-u-boot/15170
[2] https://github.com/u-boot/u-boot/blob/master/arch/arm/dts/mt7986.dtsi#L287

Fixes 513b49d19b34 ("arm64: dts: mt7986: add mmc related device nodes")
---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +4 -0
index 24eda00e320d..77ddd9e44ed2 100644
@@ -374,6 +374,10 @@ mmc0: mmc@11230000 {
 			reg = <0 0x11230000 0 0x1000>,
 			      <0 0x11c20000 0 0x1000>;
 			interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
+			assigned-clocks = <&topckgen CLK_TOP_EMMC_416M_SEL>,
+					  <&topckgen CLK_TOP_EMMC_250M_SEL>;
+			assigned-clock-parents = <&apmixedsys CLK_APMIXED_MPLL>,
+						 <&topckgen CLK_TOP_NET1PLL_D5_D2>;
 			clocks = <&topckgen CLK_TOP_EMMC_416M_SEL>,
 				 <&infracfg CLK_INFRA_MSDC_HCK_CK>,
 				 <&infracfg CLK_INFRA_MSDC_CK>,
Signature · 1 line
2.34.1
maintainer Applied
#2 lore raw

Re: [PATCH v2 1/5] arm64: dts: mt7986: fix emmc hs400 mode without uboot initialization

Quoted 8 lines · Frank Wunderlich

Eric reports errors on emmc with hs400 mode when booting linux on bpi-r3 without uboot [1]. Booting with uboot does not show this because clocks seem to be initialized by uboot.

Fix this by adding assigned-clocks and assigned-clock-parents like it's done in uboot [2].

[...]

Applied, thanks!

[1/5] arm64: dts: mt7986: fix emmc hs400 mode without uboot initialization
(no commit info)

Best regards,

Signature · 1 line
AngeloGioacchino Del Regno <[email protected]>
#3 lore raw

PATCH v2 2/5 arm64: dts: mt7986: define 3W max power to both SFP on BPI-R3

In reply to Frank Wunderlich

From: Frank Wunderlich <[email protected]>

All SFP power supplies are connected to the system VDD33 which is 3v3/8A. Set 3A per SFP slot to allow SFPs work which need more power than the default 1W.

Fixes 8e01fb15b815 ("arm64: dts: mt7986: add Bananapi R3")
---
 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +2 -0
index af4a4309bda4..f9702284607a 100644
@@ -126,6 +126,7 @@ sfp1: sfp-1 {
 		compatible = "sff,sfp";
 		i2c-bus = <&i2c_sfp1>;
 		los-gpios = <&pio 46 GPIO_ACTIVE_HIGH>;
+		maximum-power-milliwatt = <3000>;
 		mod-def0-gpios = <&pio 49 GPIO_ACTIVE_LOW>;
 		tx-disable-gpios = <&pio 20 GPIO_ACTIVE_HIGH>;
 		tx-fault-gpios = <&pio 7 GPIO_ACTIVE_HIGH>;
@@ -137,6 +138,7 @@ sfp2: sfp-2 {
 		i2c-bus = <&i2c_sfp2>;
 		los-gpios = <&pio 31 GPIO_ACTIVE_HIGH>;
 		mod-def0-gpios = <&pio 47 GPIO_ACTIVE_LOW>;
+		maximum-power-milliwatt = <3000>;
 		tx-disable-gpios = <&pio 15 GPIO_ACTIVE_HIGH>;
 		tx-fault-gpios = <&pio 48 GPIO_ACTIVE_HIGH>;
 	};
Signature · 1 line
2.34.1
maintainer Applied
#4 lore raw

Re: [PATCH v2 2/5] arm64: dts: mt7986: define 3W max power to both SFP on BPI-R3

Quoted 5 lines · Frank Wunderlich

All SFP power supplies are connected to the system VDD33 which is 3v3/8A. Set 3A per SFP slot to allow SFPs work which need more power than the default 1W.

Applied, thanks!

[2/5] arm64: dts: mt7986: define 3W max power to both SFP on BPI-R3
(no commit info)

Best regards,

Signature · 1 line
AngeloGioacchino Del Regno <[email protected]>
#5 lore raw

PATCH v2 3/5 arm64: dts: mt7986: change cooling trips

In reply to Frank Wunderlich

From: Frank Wunderlich <[email protected]>

Add Critical and hot trips for emergency system shutdown and limiting system load.

Change passive trip to active to make sure fan is activated on the lowest trip.

Fixes 1f5be05132f3 ("arm64: dts: mt7986: add thermal-zones")
Fixes c26f779a2295 ("arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts")

---
v2:
- squash patch for bpi-r3 as suggested by angelo

---
 .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts  | 10 +++++-----
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi     | 20 +++++++++++++++----
 2 files changed, 21 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +5 -5
index f9702284607a..b876e501216b 100644
@@ -152,16 +152,16 @@ cpu-active-high {
 			trip = <&cpu_trip_active_high>;
 		};
 
-		cpu-active-low {
+		cpu-active-med {
 			/* active: set fan to cooling level 1 */
 			cooling-device = <&fan 1 1>;
-			trip = <&cpu_trip_active_low>;
+			trip = <&cpu_trip_active_med>;
 		};
 
-		cpu-passive {
-			/* passive: set fan to cooling level 0 */
+		cpu-active-low {
+			/* active: set fan to cooling level 0 */
 			cooling-device = <&fan 0 0>;
-			trip = <&cpu_trip_passive>;
+			trip = <&cpu_trip_active_low>;
 		};
 	};
 };
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +16 -4
index 77ddd9e44ed2..fc751e049953 100644
@@ -614,22 +614,34 @@ cpu_thermal: cpu-thermal {
 			thermal-sensors = <&thermal 0>;
 
 			trips {
+				cpu_trip_crit: crit {
+					temperature = <125000>;
+					hysteresis = <2000>;
+					type = "critical";
+				};
+
+				cpu_trip_hot: hot {
+					temperature = <120000>;
+					hysteresis = <2000>;
+					type = "hot";
+				};
+
 				cpu_trip_active_high: active-high {
 					temperature = <115000>;
 					hysteresis = <2000>;
 					type = "active";
 				};
 
-				cpu_trip_active_low: active-low {
+				cpu_trip_active_med: active-med {
 					temperature = <85000>;
 					hysteresis = <2000>;
 					type = "active";
 				};
 
-				cpu_trip_passive: passive {
-					temperature = <40000>;
+				cpu_trip_active_low: active-low {
+					temperature = <60000>;
 					hysteresis = <2000>;
-					type = "passive";
+					type = "active";
 				};
 			};
 		};
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 3/5
#6 lore raw

Re: [PATCH v2 3/5] arm64: dts: mt7986: change cooling trips

Il 25/10/23 19:08, Frank Wunderlich ha scritto:

Quoted 5 lines

From: Frank Wunderlich <[email protected]>

Add Critical and hot trips for emergency system shutdown and limiting system load.

Quoted 7 lines

Change passive trip to active to make sure fan is activated on the lowest trip.

Fixes 1f5be05132f3 ("arm64: dts: mt7986: add thermal-zones")
Fixes c26f779a2295 ("arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts")
maintainer Applied
#7 lore raw

Re: [PATCH v2 3/5] arm64: dts: mt7986: change cooling trips

In reply to Frank Wunderlich
Quoted 8 lines · Frank Wunderlich

Add Critical and hot trips for emergency system shutdown and limiting system load.

Change passive trip to active to make sure fan is activated on the lowest trip.

[...]

Applied, thanks!

[3/5] arm64: dts: mt7986: change cooling trips
(no commit info)

Best regards,

Signature · 1 line
AngeloGioacchino Del Regno <[email protected]>
#8 lore raw

PATCH v2 4/5 arm64: dts: mt7986: add dtbs with applied overlays for bpi-r3

In reply to Frank Wunderlich

From: Frank Wunderlich <[email protected]>

Build devicetree binaries for testing overlays and providing users full dtb without using overlays.

---
https://lore.kernel.org/all/CAL_JsqK_3xxD0DFwipXO85P=q=EYjUdjE1_8g1MKtvw3vVzx5A@mail.gmail.com/
https://lore.kernel.org/all/CAL_JsqJSi=kJSix=f3787ULZnaCy_Y26Phdhy5y9fat_vkDuUw@mail.gmail.com/

v2:
make full dtbs multiline for better readability

---
 arch/arm64/boot/dts/mediatek/Makefile | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/mediatek/Makefile +22 -0
index c99c3372a4b5..24eeba0703ce 100644
@@ -8,11 +8,33 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-x20-dev.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-rfb1.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-bananapi-bpi-r64.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb
 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
+mt7986a-bananapi-bpi-r3-emmc-nand-dtbs := \
+	mt7986a-bananapi-bpi-r3.dtb \
+	mt7986a-bananapi-bpi-r3-emmc.dtbo \
+	mt7986a-bananapi-bpi-r3-nand.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-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
+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-sd-nor-dtbs := \
+	mt7986a-bananapi-bpi-r3.dtb \
+	mt7986a-bananapi-bpi-r3-sd.dtbo \
+	mt7986a-bananapi-bpi-r3-nor.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nor.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986b-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt8167-pumpkin.dtb
Signature · 1 line
2.34.1
#9 lore raw

Aw: [PATCH v2 4/5] arm64: dts: mt7986: add dtbs with applied overlays for bpi-r3

Hi

Parts 1-3 are applied here, but how to proceed with this? to add further devicetrees like for mt7988 we have to fix the "broken" dt-overlays first.

i want to keep to build the dtbo to allow dynamic apply in bootloader, but they should be checked in compiletime too and full dtb should be created for users not wanting to handle overlays.

regards Frank

Quoted 56 lines

Gesendet: Mittwoch, 25. Oktober 2023 um 18:08 Uhr
Von: "Frank Wunderlich" <[email protected]>

Build devicetree binaries for testing overlays and providing users full dtb without using overlays.

---
https://lore.kernel.org/all/CAL_JsqK_3xxD0DFwipXO85P=q=EYjUdjE1_8g1MKtvw3vVzx5A@mail.gmail.com/
https://lore.kernel.org/all/CAL_JsqJSi=kJSix=f3787ULZnaCy_Y26Phdhy5y9fat_vkDuUw@mail.gmail.com/

v2:
make full dtbs multiline for better readability

---
 arch/arm64/boot/dts/mediatek/Makefile | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/mediatek/Makefile +22 -0
index c99c3372a4b5..24eeba0703ce 100644
@@ -8,11 +8,33 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-x20-dev.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-rfb1.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-bananapi-bpi-r64.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb
 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
+mt7986a-bananapi-bpi-r3-emmc-nand-dtbs := \
+	mt7986a-bananapi-bpi-r3.dtb \
+	mt7986a-bananapi-bpi-r3-emmc.dtbo \
+	mt7986a-bananapi-bpi-r3-nand.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-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
+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-sd-nor-dtbs := \
+	mt7986a-bananapi-bpi-r3.dtb \
+	mt7986a-bananapi-bpi-r3-sd.dtbo \
+	mt7986a-bananapi-bpi-r3-nor.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nor.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986b-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt8167-pumpkin.dtb
#10 lore raw

Aw: [PATCH v2 4/5] arm64: dts: mt7986: add dtbs with applied overlays for bpi-r3

Hi,

how to proceed here?

regards Frank

Quoted 76 lines

Gesendet: Samstag, 09. Dezember 2023 um 16:56 Uhr
Von: "Frank Wunderlich" <[email protected]>
An: "Frank Wunderlich" <[email protected]>
Cc: [email protected], "Matthias Brugger" <[email protected]>, "AngeloGioacchino Del Regno" <[email protected]>, "Rob Herring" <[email protected]>, "Krzysztof Kozlowski" <[email protected]>, "Conor Dooley" <[email protected]>, "Daniel Golle" <[email protected]>, [email protected], [email protected], "Eric Woudstra" <[email protected]>
Betreff: Aw: [PATCH v2 4/5] arm64: dts: mt7986: add dtbs with applied overlays for bpi-r3

Hi

Parts 1-3 are applied here, but how to proceed with this? to add further devicetrees like for mt7988 we have to fix the "broken" dt-overlays first.

i want to keep to build the dtbo to allow dynamic apply in bootloader, but they should be checked in compiletime too and full dtb should be created for users not wanting to handle overlays.

regards Frank

Quoted 56 lines

Gesendet: Mittwoch, 25. Oktober 2023 um 18:08 Uhr
Von: "Frank Wunderlich" <[email protected]>

Build devicetree binaries for testing overlays and providing users full dtb without using overlays.

---
https://lore.kernel.org/all/CAL_JsqK_3xxD0DFwipXO85P=q=EYjUdjE1_8g1MKtvw3vVzx5A@mail.gmail.com/
https://lore.kernel.org/all/CAL_JsqJSi=kJSix=f3787ULZnaCy_Y26Phdhy5y9fat_vkDuUw@mail.gmail.com/

v2:
make full dtbs multiline for better readability

---
 arch/arm64/boot/dts/mediatek/Makefile | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/mediatek/Makefile +22 -0
index c99c3372a4b5..24eeba0703ce 100644
@@ -8,11 +8,33 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-evb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-x20-dev.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-rfb1.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-bananapi-bpi-r64.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb
 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
+mt7986a-bananapi-bpi-r3-emmc-nand-dtbs := \
+	mt7986a-bananapi-bpi-r3.dtb \
+	mt7986a-bananapi-bpi-r3-emmc.dtbo \
+	mt7986a-bananapi-bpi-r3-nand.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-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
+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-sd-nor-dtbs := \
+	mt7986a-bananapi-bpi-r3.dtb \
+	mt7986a-bananapi-bpi-r3-sd.dtbo \
+	mt7986a-bananapi-bpi-r3-nor.dtbo
+dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nor.dtb
+
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986b-rfb.dtb
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt8167-pumpkin.dtb
#11 lore raw

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

In reply to 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.

---
v2:
- rebase on the patch "add dtbs with applied overlays for bpi-r3"
- add sata-overlay to the full dtbs

---
 arch/arm64/boot/dts/mediatek/Makefile         | 13 +++++--
 .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
 2 files changed, 48 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso
arch/arm64/boot/dts/mediatek/Makefile +9 -4
index 24eeba0703ce..c3b236a47513 100644
@@ -13,26 +13,31 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb
 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-sata.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo
 mt7986a-bananapi-bpi-r3-emmc-nand-dtbs := \
 	mt7986a-bananapi-bpi-r3.dtb \
 	mt7986a-bananapi-bpi-r3-emmc.dtbo \
-	mt7986a-bananapi-bpi-r3-nand.dtbo
+	mt7986a-bananapi-bpi-r3-nand.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-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
+	mt7986a-bananapi-bpi-r3-nor.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-nor.dtb
 mt7986a-bananapi-bpi-r3-sd-nand-dtbs := \
 	mt7986a-bananapi-bpi-r3.dtb \
 	mt7986a-bananapi-bpi-r3-sd.dtbo \
-	mt7986a-bananapi-bpi-r3-nand.dtbo
+	mt7986a-bananapi-bpi-r3-nand.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nand.dtb
 mt7986a-bananapi-bpi-r3-sd-nor-dtbs := \
 	mt7986a-bananapi-bpi-r3.dtb \
 	mt7986a-bananapi-bpi-r3-sd.dtbo \
-	mt7986a-bananapi-bpi-r3-nor.dtbo
+	mt7986a-bananapi-bpi-r3-nor.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nor.dtb
 
 dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.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
#12 lore raw

Re: [PATCH v2 5/5] arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3

Il 25/10/23 19:08, Frank Wunderlich ha scritto:

Quoted 23 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.

---
v2:
- rebase on the patch "add dtbs with applied overlays for bpi-r3"
- add sata-overlay to the full dtbs

---
  arch/arm64/boot/dts/mediatek/Makefile         | 13 +++++--
  .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
  2 files changed, 48 insertions(+), 4 deletions(-)

create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso

arch/arm64/boot/dts/mediatek/Makefile +0 -0
index 24eeba0703ce..c3b236a47513 100644

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

Quoted 5 lines
arch/arm64/boot/dts/mediatek/Makefile +1 -0
@@ -13,26 +13,31 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb
  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-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo

The devicetree overlays make no sense without a base devicetree, right? :-)

dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo <-- makes no sense!

Check how it's done in freescale (nxp) and renesas... and there's also one instance of overlays in qualcomm.

In short:
- Remove all of the dtb-$(CONFIG_ARCH_MEDIATEK) += blah.dtbo
- xxxx-dtbs:= blah.dtb blah-overlay.dtbo, dtb-$(CONFIG_ARCH_MEDIATEK) += xxxx.dtb is correct.

Quoted 43 lines
arch/arm64/boot/dts/mediatek/Makefile +8 -4
  mt7986a-bananapi-bpi-r3-emmc-nand-dtbs := \
  	mt7986a-bananapi-bpi-r3.dtb \
  	mt7986a-bananapi-bpi-r3-emmc.dtbo \
-	mt7986a-bananapi-bpi-r3-nand.dtbo
+	mt7986a-bananapi-bpi-r3-nand.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-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
+	mt7986a-bananapi-bpi-r3-nor.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-nor.dtb
  mt7986a-bananapi-bpi-r3-sd-nand-dtbs := \
  	mt7986a-bananapi-bpi-r3.dtb \
  	mt7986a-bananapi-bpi-r3-sd.dtbo \
-	mt7986a-bananapi-bpi-r3-nand.dtbo
+	mt7986a-bananapi-bpi-r3-nand.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nand.dtb
  mt7986a-bananapi-bpi-r3-sd-nor-dtbs := \
  	mt7986a-bananapi-bpi-r3.dtb \
  	mt7986a-bananapi-bpi-r3-sd.dtbo \
-	mt7986a-bananapi-bpi-r3-nor.dtbo
+	mt7986a-bananapi-bpi-r3-nor.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nor.dtb
 
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +7 -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/;

arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso line 17

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +10 -0
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	compatible = "bananapi,bpi-r3", "mediatek,mt7986a";
+
+	fragment@0 {
+		target-path = "/";
+		__overlay__ {

This could be easier, I think.

&{/} {

	reg_sata12v: regulator-sata12v {
		....
	};

	something_else: something-else { ... };
};

Regards,
Angelo

Quoted 22 lines
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +22 -0
+			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>;
+			};
+		};
+	};
+};
+
#13 lore raw

Re: [PATCH v2 5/5] arm64: dts: mt7986: add overlay for SATA power socket on BPI-R3

Hi Angelo

Bpi-r3 can boot with only 1 mmc device and 1 spi-device. Some users may not use the sata overlay. Using overlays in fit have the advantage to probe hardware in uboot and load the required overlays instead of loading a full dtb.

Am 26. Oktober 2023 10:03:08 MESZ schrieb AngeloGioacchino Del Regno <[email protected]>:

Quoted 19 lines

Il 25/10/23 19:08, Frank Wunderlich ha scritto:

Quoted 18 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.

---
v2:
- rebase on the patch "add dtbs with applied overlays for bpi-r3"
- add sata-overlay to the full dtbs

---
  arch/arm64/boot/dts/mediatek/Makefile         | 13 +++++--
  .../mt7986a-bananapi-bpi-r3-sata.dtso         | 39 +++++++++++++++++++
  2 files changed, 48 insertions(+), 4 deletions(-)

create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso

Quoted 12 lines

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

Quoted 10 lines
arch/arm64/boot/dts/mediatek/Makefile +1 -0
index 24eeba0703ce..c3b236a47513 100644
@@ -13,26 +13,31 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb
  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-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd.dtbo

The devicetree overlays make no sense without a base devicetree, right? :-)

The base-dtb is needed,but i prefer have 1 base-dt and overlays (in 1 fit image dynamically load in uboot) instead of 4+ full dtbs,but some people prefer using the full dtbs.

Quoted 1 line

dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo <-- makes no sense!

Depends on users preference :) full dtb is easier to load,but less flexible.

Quoted 7 lines

Check how it's done in freescale (nxp) and renesas... and there's also one instance of overlays in qualcomm.

In short:
- Remove all of the dtb-$(CONFIG_ARCH_MEDIATEK) += blah.dtbo
- xxxx-dtbs:= blah.dtb blah-overlay.dtbo, dtb-$(CONFIG_ARCH_MEDIATEK) += xxxx.dtb is correct.

That will break my current way :( openwrt uses same.

Quoted 55 lines
Quoted 42 lines
arch/arm64/boot/dts/mediatek/Makefile +8 -4
  mt7986a-bananapi-bpi-r3-emmc-nand-dtbs := \
  	mt7986a-bananapi-bpi-r3.dtb \
  	mt7986a-bananapi-bpi-r3-emmc.dtbo \
-	mt7986a-bananapi-bpi-r3-nand.dtbo
+	mt7986a-bananapi-bpi-r3-nand.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-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
+	mt7986a-bananapi-bpi-r3-nor.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc-nor.dtb
  mt7986a-bananapi-bpi-r3-sd-nand-dtbs := \
  	mt7986a-bananapi-bpi-r3.dtb \
  	mt7986a-bananapi-bpi-r3-sd.dtbo \
-	mt7986a-bananapi-bpi-r3-nand.dtbo
+	mt7986a-bananapi-bpi-r3-nand.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nand.dtb
  mt7986a-bananapi-bpi-r3-sd-nor-dtbs := \
  	mt7986a-bananapi-bpi-r3.dtb \
  	mt7986a-bananapi-bpi-r3-sd.dtbo \
-	mt7986a-bananapi-bpi-r3-nor.dtbo
+	mt7986a-bananapi-bpi-r3-nor.dtbo \
+	mt7986a-bananapi-bpi-r3-sata.dtbo
  dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-sd-nor.dtb
    dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-rfb.dtb
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +7 -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/;

arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso line 17

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +10 -0
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	compatible = "bananapi,bpi-r3", "mediatek,mt7986a";
+
+	fragment@0 {
+		target-path = "/";
+		__overlay__ {

This could be easier, I think.

Quoted 8 lines

&{/} {

	reg_sata12v: regulator-sata12v {
		....
	};

	something_else: something-else { ... };
};

Need to try this.

Quoted 17 lines

Regards,
Angelo

Quoted 14 lines
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +14 -0
+			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>;
Quoted 9 lines

arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso line 39

Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-sata.dtso new file +8 -0
+				regulator-max-microvolt = <5000000>;
+				regulator-always-on;
+				vin-supply = <&reg_sata12v>;
+			};
+		};
+	};
+};
+

regards Frank