1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-01 15:31:27 +02:00

stm32mp1: pwr: use the last binding for pwr

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>
This commit is contained in:
Patrick Delaunay
2020-01-28 10:10:59 +01:00
parent 4f28092783
commit 7915b9914e
9 changed files with 41 additions and 62 deletions

View File

@@ -128,7 +128,7 @@
u-boot,dm-pre-reloc; u-boot,dm-pre-reloc;
}; };
&pwr { &pwr_regulators {
u-boot,dm-pre-reloc; u-boot,dm-pre-reloc;
}; };

View File

@@ -282,11 +282,9 @@
status = "okay"; status = "okay";
}; };
&pwr { &pwr_regulators {
pwr-regulators {
vdd-supply = <&vdd>; vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>; vdd_3v3_usbfs-supply = <&vdd_usb>;
};
}; };
&rng1 { &rng1 {

View File

@@ -397,11 +397,9 @@
status = "okay"; status = "okay";
}; };
&pwr { &pwr_regulators {
pwr-regulators {
vdd-supply = <&vdd>; vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>; vdd_3v3_usbfs-supply = <&vdd_usb>;
};
}; };
&rng1 { &rng1 {

View File

@@ -263,11 +263,9 @@
status = "okay"; status = "okay";
}; };
&pwr { &pwr_regulators {
pwr-regulators {
vdd-supply = <&vdd>; vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>; vdd_3v3_usbfs-supply = <&vdd_usb>;
};
}; };
&rng1 { &rng1 {

View File

@@ -1110,18 +1110,9 @@
#reset-cells = <1>; #reset-cells = <1>;
}; };
pwr: pwr@50001000 { pwr_regulators: 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"; compatible = "st,stm32mp1,pwr-reg";
st,tzcr = <&rcc 0x0 0x1>; reg = <0x50001000 0x10>;
reg11: reg11 { reg11: reg11 {
regulator-name = "reg11"; regulator-name = "reg11";
@@ -1141,7 +1132,6 @@
regulator-max-microvolt = <3300000>; regulator-max-microvolt = <3300000>;
}; };
}; };
};
exti: interrupt-controller@5000d000 { exti: interrupt-controller@5000d000 {
compatible = "st,stm32mp1-exti", "syscon"; compatible = "st,stm32mp1-exti", "syscon";

View File

@@ -217,11 +217,9 @@
status = "okay"; status = "okay";
}; };
&pwr { &pwr_regulators {
pwr-regulators {
vdd-supply = <&vdd>; vdd-supply = <&vdd>;
vdd_3v3_usbfs-supply = <&vdd_usb>; vdd_3v3_usbfs-supply = <&vdd_usb>;
};
}; };
&qspi { &qspi {

View File

@@ -37,7 +37,6 @@
/* enumerated used to identify the SYSCON driver instance */ /* enumerated used to identify the SYSCON driver instance */
enum { enum {
STM32MP_SYSCON_UNKNOWN, STM32MP_SYSCON_UNKNOWN,
STM32MP_SYSCON_PWR,
STM32MP_SYSCON_SYSCFG, STM32MP_SYSCON_SYSCFG,
}; };

View File

@@ -6,8 +6,8 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <regmap.h>
#include <syscon.h> #include <syscon.h>
#include <asm/io.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <linux/err.h> #include <linux/err.h>
#include <power/pmic.h> #include <power/pmic.h>
@@ -28,7 +28,7 @@ struct stm32mp_pwr_reg_info {
}; };
struct stm32mp_pwr_priv { struct stm32mp_pwr_priv {
struct regmap *regmap; fdt_addr_t base;
}; };
static int stm32mp_pwr_write(struct udevice *dev, uint reg, 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) if (len != 4)
return -EINVAL; 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, 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) if (len != 4)
return -EINVAL; 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) static int stm32mp_pwr_ofdata_to_platdata(struct udevice *dev)
{ {
struct stm32mp_pwr_priv *priv = dev_get_priv(dev); struct stm32mp_pwr_priv *priv = dev_get_priv(dev);
struct regmap *regmap;
regmap = syscon_get_regmap_by_driver_data(STM32MP_SYSCON_PWR); priv->base = dev_read_addr(dev);
if (IS_ERR(regmap)) { if (priv->base == FDT_ADDR_T_NONE)
pr_err("%s: unable to find regmap (%ld)\n", __func__, return -EINVAL;
PTR_ERR(regmap));
return PTR_ERR(regmap);
}
priv->regmap = regmap;
return 0; return 0;
} }

View File

@@ -9,7 +9,6 @@
#include <asm/arch/stm32.h> #include <asm/arch/stm32.h>
static const struct udevice_id stm32mp_syscon_ids[] = { static const struct udevice_id stm32mp_syscon_ids[] = {
{ .compatible = "st,stm32mp1-pwr", .data = STM32MP_SYSCON_PWR },
{ .compatible = "st,stm32mp157-syscfg", { .compatible = "st,stm32mp157-syscfg",
.data = STM32MP_SYSCON_SYSCFG }, .data = STM32MP_SYSCON_SYSCFG },
{ } { }