diff mbox series

[v2,06/11] arm64: dts: meson-g12a-x96-max: add regulators

Message ID 20190318100458.5619-7-narmstrong@baylibre.com (mailing list archive)
State Superseded
Headers show
Series arm64: dts: g12a: Add boards peripherals | expand

Commit Message

Neil Armstrong March 18, 2019, 10:04 a.m. UTC
From: Guillaume La Roque <glaroque@baylibre.com>

Add system regulators for the X96 Max Set-Top-Box.

Still missing
* VDD_EE (0.8V - PWM controlled)
* VDD_CPU (PWM controlled)

Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 .../boot/dts/amlogic/meson-g12a-x96-max.dts   | 67 +++++++++++++++++++
 1 file changed, 67 insertions(+)

Comments

Martin Blumenstingl March 18, 2019, 8:13 p.m. UTC | #1
Hi Neil,

On Mon, Mar 18, 2019 at 11:06 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> From: Guillaume La Roque <glaroque@baylibre.com>
>
> Add system regulators for the X96 Max Set-Top-Box.
>
> Still missing
> * VDD_EE (0.8V - PWM controlled)
> * VDD_CPU (PWM controlled)
>
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  .../boot/dts/amlogic/meson-g12a-x96-max.dts   | 67 +++++++++++++++++++
>  1 file changed, 67 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> index 0edbd00b358f..5c37930b09e2 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
[...]
> +       vcc_5v: regulator-vcc_5v {
> +               compatible = "regulator-fixed";
> +               regulator-name = "VCC_5V";
> +               regulator-min-microvolt = <5000000>;
> +               regulator-max-microvolt = <5000000>;
> +               vin-supply = <&dc_in>;
> +
> +               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
> +               enable-active-high;
is there any way to test whether this GPIO is the right one?
I couldn't find a reference to a GPIOH_8 regulator in
buildroot_openlinux_kernel_4.9_fbdev_20180706


Regards
Martin
Neil Armstrong March 19, 2019, 8:29 a.m. UTC | #2
On 18/03/2019 21:13, Martin Blumenstingl wrote:
> Hi Neil,
> 
> On Mon, Mar 18, 2019 at 11:06 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> From: Guillaume La Roque <glaroque@baylibre.com>
>>
>> Add system regulators for the X96 Max Set-Top-Box.
>>
>> Still missing
>> * VDD_EE (0.8V - PWM controlled)
>> * VDD_CPU (PWM controlled)
>>
>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  .../boot/dts/amlogic/meson-g12a-x96-max.dts   | 67 +++++++++++++++++++
>>  1 file changed, 67 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
>> index 0edbd00b358f..5c37930b09e2 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> [...]
>> +       vcc_5v: regulator-vcc_5v {
>> +               compatible = "regulator-fixed";
>> +               regulator-name = "VCC_5V";
>> +               regulator-min-microvolt = <5000000>;
>> +               regulator-max-microvolt = <5000000>;
>> +               vin-supply = <&dc_in>;
>> +
>> +               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
>> +               enable-active-high;
> is there any way to test whether this GPIO is the right one?
> I couldn't find a reference to a GPIOH_8 regulator in
> buildroot_openlinux_kernel_4.9_fbdev_20180706

The x96 is based on the U212 reference design, and the GPIOH_8 controls the 5V_EN signal,
but you are right, it's the wrong polarity here, it should be enable-active-low instead.
(FYI The SEI510 does not use this at all, 5V is always enabled)

The schematics describes :
VCC5V_EN (GPIOH_8-Hiz OD): 5V_EN
L: Enable
Hiz: Disable

FYI, the GPIOH_8 is Open-Drain only, this means this pin cannot pull to TTL 1, only to TTL 0
or set as input. We need to add a way to describe this in the pinctrl driver somehow....

I will send a fix on v3

I didn't notice because I power the board using a Type-A to Type-A connector,
and the 5V from the USB port bypasses this regulator...

Neil

> 
> 
> Regards
> Martin
>
Martin Blumenstingl March 19, 2019, 8:13 p.m. UTC | #3
Hi Neil,

On Tue, Mar 19, 2019 at 9:29 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> On 18/03/2019 21:13, Martin Blumenstingl wrote:
> > Hi Neil,
> >
> > On Mon, Mar 18, 2019 at 11:06 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
> >>
> >> From: Guillaume La Roque <glaroque@baylibre.com>
> >>
> >> Add system regulators for the X96 Max Set-Top-Box.
> >>
> >> Still missing
> >> * VDD_EE (0.8V - PWM controlled)
> >> * VDD_CPU (PWM controlled)
> >>
> >> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> >> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> >> ---
> >>  .../boot/dts/amlogic/meson-g12a-x96-max.dts   | 67 +++++++++++++++++++
> >>  1 file changed, 67 insertions(+)
> >>
> >> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> >> index 0edbd00b358f..5c37930b09e2 100644
> >> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> >> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> > [...]
> >> +       vcc_5v: regulator-vcc_5v {
> >> +               compatible = "regulator-fixed";
> >> +               regulator-name = "VCC_5V";
> >> +               regulator-min-microvolt = <5000000>;
> >> +               regulator-max-microvolt = <5000000>;
> >> +               vin-supply = <&dc_in>;
> >> +
> >> +               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
> >> +               enable-active-high;
> > is there any way to test whether this GPIO is the right one?
> > I couldn't find a reference to a GPIOH_8 regulator in
> > buildroot_openlinux_kernel_4.9_fbdev_20180706
>
> The x96 is based on the U212 reference design, and the GPIOH_8 controls the 5V_EN signal,
> but you are right, it's the wrong polarity here, it should be enable-active-low instead.
> (FYI The SEI510 does not use this at all, 5V is always enabled)
>
> The schematics describes :
> VCC5V_EN (GPIOH_8-Hiz OD): 5V_EN
> L: Enable
> Hiz: Disable
thank you for this explanation!

> FYI, the GPIOH_8 is Open-Drain only, this means this pin cannot pull to TTL 1, only to TTL 0
> or set as input. We need to add a way to describe this in the pinctrl driver somehow....
as far as I understand the pinctrl driver changes would result in an
error when the GPIO is used with "active high" (making incompatible
drivers or .dts easier to see). is this correct?

> I will send a fix on v3
>
> I didn't notice because I power the board using a Type-A to Type-A connector,
> and the 5V from the USB port bypasses this regulator...
this is good to know.
I'm also powering some of my boards using a Type-A to Type-A
connector. I'll need to remember this and this whether boards are
still booting with the DC plug


Regards
Martin
Neil Armstrong March 19, 2019, 8:30 p.m. UTC | #4
On 19/03/2019 21:13, Martin Blumenstingl wrote:
> Hi Neil,
> 
> On Tue, Mar 19, 2019 at 9:29 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> On 18/03/2019 21:13, Martin Blumenstingl wrote:
>>> Hi Neil,
>>>
>>> On Mon, Mar 18, 2019 at 11:06 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>>>
>>>> From: Guillaume La Roque <glaroque@baylibre.com>
>>>>
>>>> Add system regulators for the X96 Max Set-Top-Box.
>>>>
>>>> Still missing
>>>> * VDD_EE (0.8V - PWM controlled)
>>>> * VDD_CPU (PWM controlled)
>>>>
>>>> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
>>>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>>>> ---
>>>>  .../boot/dts/amlogic/meson-g12a-x96-max.dts   | 67 +++++++++++++++++++
>>>>  1 file changed, 67 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
>>>> index 0edbd00b358f..5c37930b09e2 100644
>>>> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
>>>> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
>>> [...]
>>>> +       vcc_5v: regulator-vcc_5v {
>>>> +               compatible = "regulator-fixed";
>>>> +               regulator-name = "VCC_5V";
>>>> +               regulator-min-microvolt = <5000000>;
>>>> +               regulator-max-microvolt = <5000000>;
>>>> +               vin-supply = <&dc_in>;
>>>> +
>>>> +               gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
>>>> +               enable-active-high;
>>> is there any way to test whether this GPIO is the right one?
>>> I couldn't find a reference to a GPIOH_8 regulator in
>>> buildroot_openlinux_kernel_4.9_fbdev_20180706
>>
>> The x96 is based on the U212 reference design, and the GPIOH_8 controls the 5V_EN signal,
>> but you are right, it's the wrong polarity here, it should be enable-active-low instead.
>> (FYI The SEI510 does not use this at all, 5V is always enabled)
>>
>> The schematics describes :
>> VCC5V_EN (GPIOH_8-Hiz OD): 5V_EN
>> L: Enable
>> Hiz: Disable
> thank you for this explanation!
> 
>> FYI, the GPIOH_8 is Open-Drain only, this means this pin cannot pull to TTL 1, only to TTL 0
>> or set as input. We need to add a way to describe this in the pinctrl driver somehow....
> as far as I understand the pinctrl driver changes would result in an
> error when the GPIO is used with "active high" (making incompatible
> drivers or .dts easier to see). is this correct?

I don't have a clear view of that, since it's really GPIO related.
I don't know if we can really disable non-opendrain support for a
specific gpio.

We will need to investigate ! Anyway, using GPIO_OPEN_DRAIN in DT
is the correct way to handle these GPIO lines.

Neil

> 
>> I will send a fix on v3
>>
>> I didn't notice because I power the board using a Type-A to Type-A connector,
>> and the 5V from the USB port bypasses this regulator...
> this is good to know.
> I'm also powering some of my boards using a Type-A to Type-A
> connector. I'll need to remember this and this whether boards are
> still booting with the DC plug
> 
> 
> Regards
> Martin
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
index 0edbd00b358f..5c37930b09e2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
@@ -6,6 +6,8 @@ 
 /dts-v1/;
 
 #include "meson-g12a.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
 
 / {
 	compatible = "amediatech,x96-max", "amlogic,u200", "amlogic,g12a";
@@ -21,6 +23,71 @@ 
 		device_type = "memory";
 		reg = <0x0 0x0 0x0 0x40000000>;
 	};
+
+	flash_1v8: regulator-flash_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "FLASH_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_3v3>;
+		regulator-always-on;
+	};
+
+	dc_in: regulator-dc_in {
+		compatible = "regulator-fixed";
+		regulator-name = "DC_IN";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
+
+	vcc_1v8: regulator-vcc_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_3v3>;
+		regulator-always-on;
+	};
+
+	vcc_3v3: regulator-vcc_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+		/* FIXME: actually controlled by VDDCPU_B_EN */
+	};
+
+	vcc_5v: regulator-vcc_5v {
+		compatible = "regulator-fixed";
+		regulator-name = "VCC_5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&dc_in>;
+
+		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
+		enable-active-high;
+	};
+
+	vddao_1v8: regulator-vddao_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+	};
+
+	vddao_3v3: regulator-vddao_3v3 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&dc_in>;
+		regulator-always-on;
+	};
 };
 
 &uart_AO {