diff mbox series

[1/3] ARM: dts: stm32: add stpmic1 support on stm32mp157c ed1 board

Message ID 1554298852-9955-2-git-send-email-p.paillet@st.com (mailing list archive)
State New, archived
Headers show
Series Add support for STPMIC1 | expand

Commit Message

Pascal Paillet April 3, 2019, 1:40 p.m. UTC
This patch adds stpmic1 support on stm32mp157c ed1 board.
The STPMIC1 is a PMIC from STMicroelectronics. The STPMIC1 integrates 10
regulators, 3 power switches, a watchdog and an input for a power on key.

Signed-off-by: Pascal Paillet <p.paillet@st.com>
---
 arch/arm/boot/dts/stm32mp157c-ed1.dts | 155 ++++++++++++++++++++++++++++++----
 1 file changed, 139 insertions(+), 16 deletions(-)

Comments

Linus Walleij April 8, 2019, 12:05 p.m. UTC | #1
On Wed, Apr 3, 2019 at 3:41 PM Pascal PAILLET-LME <p.paillet@st.com> wrote:

> This patch adds stpmic1 support on stm32mp157c ed1 board.
> The STPMIC1 is a PMIC from STMicroelectronics. The STPMIC1 integrates 10
> regulators, 3 power switches, a watchdog and an input for a power on key.
>
> Signed-off-by: Pascal Paillet <p.paillet@st.com>

OK

> +       /delete-property/dmas;
> +       /delete-property/dma-names;

Maybe you can add a comment both to the commit message and the
DTS file as to why you are doing this?

I hope you are not trying to work around a bug in the driver by
stripping out DMA configuration from the device tree, because then
it is probably a better idea to fix the bug.

Yours,
Linus Walleij
Pascal Paillet April 8, 2019, 12:26 p.m. UTC | #2
Hello!

Le 04/08/2019 02:05 PM, Linus Walleij a écrit :
> On Wed, Apr 3, 2019 at 3:41 PM Pascal PAILLET-LME <p.paillet@st.com> wrote:
>
>> This patch adds stpmic1 support on stm32mp157c ed1 board.
>> The STPMIC1 is a PMIC from STMicroelectronics. The STPMIC1 integrates 10
>> regulators, 3 power switches, a watchdog and an input for a power on key.
>>
>> Signed-off-by: Pascal Paillet <p.paillet@st.com>
> OK
>
>> +       /delete-property/dmas;
>> +       /delete-property/dma-names;
> Maybe you can add a comment both to the commit message and the
> DTS file as to why you are doing this?
>
> I hope you are not trying to work around a bug in the driver by
> stripping out DMA configuration from the device tree, because then
> it is probably a better idea to fix the bug.
This is not a workaround. The PMIC can use the DMA over I2C bus.
Our goal is to avoid using a DMA channel for a consumer that generates a
very few traffic. Dma channels may lack for other use cases.

If you agree, you can add the to the commit message.
> Yours,
> Linus Walleij
>

thank you,
Best Regards,
Pascal
Linus Walleij April 8, 2019, 1:06 p.m. UTC | #3
On Mon, Apr 8, 2019 at 2:26 PM Pascal PAILLET-LME <p.paillet@st.com> wrote:

> > I hope you are not trying to work around a bug in the driver by
> > stripping out DMA configuration from the device tree, because then
> > it is probably a better idea to fix the bug.

> This is not a workaround. The PMIC can use the DMA over I2C bus.
> Our goal is to avoid using a DMA channel for a consumer that generates a
> very few traffic. Dma channels may lack for other use cases.
>
> If you agree, you can add the to the commit message.

OK I understand, then also write it directly in the dts as a comment,
so people understand why it is being removed when they just look
in the device tree.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/stm32mp157c-ed1.dts b/arch/arm/boot/dts/stm32mp157c-ed1.dts
index 9fd7943..678b0f1 100644
--- a/arch/arm/boot/dts/stm32mp157c-ed1.dts
+++ b/arch/arm/boot/dts/stm32mp157c-ed1.dts
@@ -8,6 +8,7 @@ 
 #include "stm32mp157c.dtsi"
 #include "stm32mp157-pinctrl.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/mfd/st,stpmic1.h>
 
 / {
 	model = "STMicroelectronics STM32MP157C eval daughter";
@@ -42,22 +43,6 @@ 
 		regulator-always-on;
 	};
 
-	vdd_sd: regulator-vdd_sd {
-		compatible = "regulator-fixed";
-		regulator-name = "vdd_sd";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-always-on;
-	};
-
-	vdd_usb: vdd-usb {
-		compatible = "regulator-fixed";
-		regulator-name = "vdd_usb";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-always-on;
-	};
-
 	sd_switch: regulator-sd_switch {
 		compatible = "regulator-gpio";
 		regulator-name = "sd_switch";
@@ -82,6 +67,144 @@ 
 	i2c-scl-rising-time-ns = <185>;
 	i2c-scl-falling-time-ns = <20>;
 	status = "okay";
+	/delete-property/dmas;
+	/delete-property/dma-names;
+
+	pmic: stpmic@33 {
+		compatible = "st,stpmic1";
+		reg = <0x33>;
+		interrupts-extended = <&gpioa 0 IRQ_TYPE_EDGE_FALLING>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+		status = "okay";
+
+		regulators {
+			compatible = "st,stpmic1-regulators";
+			ldo1-supply = <&v3v3>;
+			ldo2-supply = <&v3v3>;
+			ldo3-supply = <&vdd_ddr>;
+			ldo5-supply = <&v3v3>;
+			ldo6-supply = <&v3v3>;
+			pwr_sw1-supply = <&bst_out>;
+			pwr_sw2-supply = <&bst_out>;
+
+			vddcore: buck1 {
+				regulator-name = "vddcore";
+				regulator-min-microvolt = <800000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+				regulator-initial-mode = <0>;
+				regulator-over-current-protection;
+			};
+
+			vdd_ddr: buck2 {
+				regulator-name = "vdd_ddr";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+				regulator-initial-mode = <0>;
+				regulator-over-current-protection;
+			};
+
+			vdd: buck3 {
+				regulator-name = "vdd";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+				st,mask-reset;
+				regulator-initial-mode = <0>;
+				regulator-over-current-protection;
+			};
+
+			v3v3: buck4 {
+				regulator-name = "v3v3";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-always-on;
+				regulator-over-current-protection;
+				regulator-initial-mode = <0>;
+			};
+
+			vdda: ldo1 {
+				regulator-name = "vdda";
+				regulator-min-microvolt = <2900000>;
+				regulator-max-microvolt = <2900000>;
+				interrupts = <IT_CURLIM_LDO1 0>;
+			};
+
+			v2v8: ldo2 {
+				regulator-name = "v2v8";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				interrupts = <IT_CURLIM_LDO2 0>;
+			};
+
+			vtt_ddr: ldo3 {
+				regulator-name = "vtt_ddr";
+				regulator-min-microvolt = <500000>;
+				regulator-max-microvolt = <750000>;
+				regulator-always-on;
+				regulator-over-current-protection;
+			};
+
+			vdd_usb: ldo4 {
+				regulator-name = "vdd_usb";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				interrupts = <IT_CURLIM_LDO4 0>;
+			};
+
+			vdd_sd: ldo5 {
+				regulator-name = "vdd_sd";
+				regulator-min-microvolt = <2900000>;
+				regulator-max-microvolt = <2900000>;
+				interrupts = <IT_CURLIM_LDO5 0>;
+				regulator-boot-on;
+			};
+
+			v1v8: ldo6 {
+				regulator-name = "v1v8";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				interrupts = <IT_CURLIM_LDO6 0>;
+			};
+
+			vref_ddr: vref_ddr {
+				regulator-name = "vref_ddr";
+				regulator-always-on;
+				regulator-over-current-protection;
+			};
+
+			bst_out: boost {
+				regulator-name = "bst_out";
+				interrupts = <IT_OCP_BOOST 0>;
+			};
+
+			vbus_otg: pwr_sw1 {
+				regulator-name = "vbus_otg";
+				interrupts = <IT_OCP_OTG 0>;
+			 };
+
+			 vbus_sw: pwr_sw2 {
+				regulator-name = "vbus_sw";
+				interrupts = <IT_OCP_SWOUT 0>;
+				regulator-active-discharge;
+			 };
+		};
+
+		onkey {
+			compatible = "st,stpmic1-onkey";
+			interrupts = <IT_PONKEY_F 0>, <IT_PONKEY_R 0>;
+			interrupt-names = "onkey-falling", "onkey-rising";
+			power-off-time-sec = <10>;
+			status = "okay";
+		};
+
+		watchdog {
+			compatible = "st,stpmic1-wdt";
+			status = "disabled";
+		};
+	};
 };
 
 &ipcc {