0abc2e682c2a901d2ce50cc723add5c4243120cb
[openwrt/staging/wigyori.git] / package / boot / uboot-sunxi / patches / 4000-ARM-dts-sun8i-a83t-bananapi-m3-describe-SATA-disk-re.patch
1 From 99a186dbbbc9869d705fb3c189bcafc87c3bfe75 Mon Sep 17 00:00:00 2001
2 From: Andre Przywara <andre.przywara@arm.com>
3 Date: Thu, 19 Jan 2023 23:40:20 +0000
4 Subject: [PATCH 4000/4031] ARM: dts: sun8i: a83t: bananapi-m3: describe SATA
5 disk regulator
6
7 The Bananapi-M3 has a SATA connector, driven by a USB-to-SATA bridge
8 soldered on the board. The power for the SATA device is provided by a
9 GPIO controlled regulator. Since the SATA device is behind USB, it has
10 no DT node, so we never described this regulator. Instead U-Boot was
11 turning this on in a rather hackish way, which we now want to get rid of.
12 On top of that it seems fragile to leave this GPIO undescribed, as
13 userland could claim it and turn the disk off.
14
15 Add a fixed regulator, controlled by the PD25 GPIO, and mark it as
16 always-on. This would mimic the current situation, but in a safer way,
17 and would allow U-Boot to drop the CONFIG_SATAPWR enable hack.
18
19 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
20 ---
21 arch/arm/dts/sun8i-a83t-bananapi-m3.dts | 15 +++++++++++++++
22 1 file changed, 15 insertions(+)
23
24 diff --git a/arch/arm/dts/sun8i-a83t-bananapi-m3.dts b/arch/arm/dts/sun8i-a83t-bananapi-m3.dts
25 index b60016a442..197cf6959b 100644
26 --- a/arch/arm/dts/sun8i-a83t-bananapi-m3.dts
27 +++ b/arch/arm/dts/sun8i-a83t-bananapi-m3.dts
28 @@ -105,6 +105,21 @@
29 /* enables internal regulator and de-asserts reset */
30 reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 WL-PMU-EN */
31 };
32 +
33 + /*
34 + * Power supply for the SATA disk, behind a USB-SATA bridge.
35 + * Since it is a USB device, there is no consumer in the DT, so we
36 + * have to keep this always on.
37 + */
38 + regulator-sata-disk-pwr {
39 + compatible = "regulator-fixed";
40 + regulator-name = "sata-disk-pwr";
41 + regulator-min-microvolt = <5000000>;
42 + regulator-max-microvolt = <5000000>;
43 + regulator-always-on;
44 + enable-active-high;
45 + gpio = <&pio 3 25 GPIO_ACTIVE_HIGH>; /* PD25 */
46 + };
47 };
48
49 &cpu0 {
50 --
51 2.20.1
52