stm32mp1: pwr: use the last binding for pwr
authorPatrick Delaunay <patrick.delaunay@st.com>
Tue, 28 Jan 2020 09:10:59 +0000 (10:10 +0100)
committerPatrick Delaunay <patrick.delaunay@st.com>
Thu, 13 Feb 2020 16:26:22 +0000 (17:26 +0100)
Update the driver to use the latest binding from kernel v5.5-rc1:
no more use syscon or regmap to access to pwr register and
only one pwr_regulators node with the compatibility "st,stm32mp1,pwr-reg"
is available.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
arch/arm/dts/stm32mp157-u-boot.dtsi
arch/arm/dts/stm32mp157a-avenger96.dts
arch/arm/dts/stm32mp157a-dk1.dts
arch/arm/dts/stm32mp157c-ed1.dts
arch/arm/dts/stm32mp157c.dtsi
arch/arm/dts/stm32mp15xx-dhcom.dtsi
arch/arm/mach-stm32mp/include/mach/stm32.h
arch/arm/mach-stm32mp/pwr_regulator.c
arch/arm/mach-stm32mp/syscon.c

index 0d1d387e5400641c06abe8cb5683fe7042edf107..cb8d60e33da647c0cdea451e4a4cadf00dd4ab5c 100644 (file)
        u-boot,dm-pre-reloc;
 };
 
-&pwr {
+&pwr_regulators {
        u-boot,dm-pre-reloc;
 };
 
index 5b15a4a915e671035082d42767fc465dc182e3a0..232fe709057f275a299bcb0ee538504bb44f0280 100644 (file)
        status = "okay";
 };
 
-&pwr {
-       pwr-regulators {
-               vdd-supply = <&vdd>;
-               vdd_3v3_usbfs-supply = <&vdd_usb>;
-       };
+&pwr_regulators {
+       vdd-supply = <&vdd>;
+       vdd_3v3_usbfs-supply = <&vdd_usb>;
 };
 
 &rng1 {
index 46522530128c8cd7a55583064ebf9d876e966345..dc61bfc3d5abd411b51107bfa11597342fa902f6 100644 (file)
        status = "okay";
 };
 
-&pwr {
-       pwr-regulators {
-               vdd-supply = <&vdd>;
-               vdd_3v3_usbfs-supply = <&vdd_usb>;
-       };
+&pwr_regulators {
+       vdd-supply = <&vdd>;
+       vdd_3v3_usbfs-supply = <&vdd_usb>;
 };
 
 &rng1 {
index bc4d7e1ab5dbe33f0a2a5eeeea56458a418d4e77..acb59f24cc6a3d089d739e96de3e62b64d800714 100644 (file)
        status = "okay";
 };
 
-&pwr {
-       pwr-regulators {
-               vdd-supply = <&vdd>;
-               vdd_3v3_usbfs-supply = <&vdd_usb>;
-       };
+&pwr_regulators {
+       vdd-supply = <&vdd>;
+       vdd_3v3_usbfs-supply = <&vdd_usb>;
 };
 
 &rng1 {
index 28a7e4c08a1a553d85432d47f89544449d421ef7..22a9386248d8515832aafa2044baa7476838906f 100644 (file)
                        #reset-cells = <1>;
                };
 
-               pwr: pwr@50001000 {
-                       compatible = "st,stm32mp1-pwr", "st,stm32-pwr", "syscon", "simple-mfd";
-                       reg = <0x50001000 0x400>;
-                       system-power-controller;
-                       interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>;
-                       st,sysrcc = <&rcc>;
-                       clocks = <&rcc PLL2_R>;
-                       clock-names = "phyclk";
-
-                       pwr-regulators {
-                               compatible = "st,stm32mp1,pwr-reg";
-                               st,tzcr = <&rcc 0x0 0x1>;
-
-                               reg11: reg11 {
-                                       regulator-name = "reg11";
-                                       regulator-min-microvolt = <1100000>;
-                                       regulator-max-microvolt = <1100000>;
-                               };
+               pwr_regulators: pwr@50001000 {
+                       compatible = "st,stm32mp1,pwr-reg";
+                       reg = <0x50001000 0x10>;
+
+                       reg11: reg11 {
+                               regulator-name = "reg11";
+                               regulator-min-microvolt = <1100000>;
+                               regulator-max-microvolt = <1100000>;
+                       };
 
-                               reg18: reg18 {
-                                       regulator-name = "reg18";
-                                       regulator-min-microvolt = <1800000>;
-                                       regulator-max-microvolt = <1800000>;
-                               };
+                       reg18: reg18 {
+                               regulator-name = "reg18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                       };
 
-                               usb33: usb33 {
-                                       regulator-name = "usb33";
-                                       regulator-min-microvolt = <3300000>;
-                                       regulator-max-microvolt = <3300000>;
-                               };
+                       usb33: usb33 {
+                               regulator-name = "usb33";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
                        };
                };
 
index 96661ae783c85dce9519b2b6c85217579a753685..bed69c97b6b7a1742fafa6ba65739436e6674d92 100644 (file)
        status = "okay";
 };
 
-&pwr {
-       pwr-regulators {
-               vdd-supply = <&vdd>;
-               vdd_3v3_usbfs-supply = <&vdd_usb>;
-       };
+&pwr_regulators {
+       vdd-supply = <&vdd>;
+       vdd_3v3_usbfs-supply = <&vdd_usb>;
 };
 
 &qspi {
index 88126b8cdbad662deee0a6ead3045c718ff17afb..f0636005e5d9d4736007449272c165e9534b143b 100644 (file)
@@ -37,7 +37,6 @@
 /* enumerated used to identify the SYSCON driver instance */
 enum {
        STM32MP_SYSCON_UNKNOWN,
-       STM32MP_SYSCON_PWR,
        STM32MP_SYSCON_SYSCFG,
 };
 
index 4559ef599d7b61ad9850e553b4f0b422eaa8c600..b52e1e85d5c3af625f0dac1d99c2b59bc2fbfa33 100644 (file)
@@ -6,8 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
-#include <regmap.h>
 #include <syscon.h>
+#include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/err.h>
 #include <power/pmic.h>
@@ -28,7 +28,7 @@ struct stm32mp_pwr_reg_info {
 };
 
 struct stm32mp_pwr_priv {
-       struct regmap *regmap;
+       fdt_addr_t base;
 };
 
 static int stm32mp_pwr_write(struct udevice *dev, uint reg,
@@ -40,7 +40,9 @@ static int stm32mp_pwr_write(struct udevice *dev, uint reg,
        if (len != 4)
                return -EINVAL;
 
-       return regmap_write(priv->regmap, STM32MP_PWR_CR3, val);
+       writel(val, priv->base + STM32MP_PWR_CR3);
+
+       return 0;
 }
 
 static int stm32mp_pwr_read(struct udevice *dev, uint reg, uint8_t *buff,
@@ -51,21 +53,18 @@ static int stm32mp_pwr_read(struct udevice *dev, uint reg, uint8_t *buff,
        if (len != 4)
                return -EINVAL;
 
-       return regmap_read(priv->regmap, STM32MP_PWR_CR3, (u32 *)buff);
+       *(u32 *)buff = readl(priv->base + STM32MP_PWR_CR3);
+
+       return 0;
 }
 
 static int stm32mp_pwr_ofdata_to_platdata(struct udevice *dev)
 {
        struct stm32mp_pwr_priv *priv = dev_get_priv(dev);
-       struct regmap *regmap;
 
-       regmap = syscon_get_regmap_by_driver_data(STM32MP_SYSCON_PWR);
-       if (IS_ERR(regmap)) {
-               pr_err("%s: unable to find regmap (%ld)\n", __func__,
-                      PTR_ERR(regmap));
-               return PTR_ERR(regmap);
-       }
-       priv->regmap = regmap;
+       priv->base = dev_read_addr(dev);
+       if (priv->base == FDT_ADDR_T_NONE)
+               return -EINVAL;
 
        return 0;
 }
index 6070837bf01bce14f6baabbd4e81891e1153f2c9..3e61ce40978c37c27f266373db492772c324bf87 100644 (file)
@@ -9,7 +9,6 @@
 #include <asm/arch/stm32.h>
 
 static const struct udevice_id stm32mp_syscon_ids[] = {
-       { .compatible = "st,stm32mp1-pwr", .data = STM32MP_SYSCON_PWR },
        { .compatible = "st,stm32mp157-syscfg",
          .data = STM32MP_SYSCON_SYSCFG },
        { }