From 58b8ff0b663a7491c1964e1e3a8d1d88ef707077 Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Thu, 7 Aug 2025 17:35:22 +0100 Subject: power: regulator: tps65910: Cannot test unsigned for being negative The code in tps65910_regulator.c treats the field supply in struct tps65910_regulator_pdata as an int and even tests the value for being negative so change it from a u32 to int so that the code all works as expected. This issue was found by Smatch. Signed-off-by: Andrew Goodbody Signed-off-by: Peng Fan --- include/power/tps65910_pmic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/power/tps65910_pmic.h b/include/power/tps65910_pmic.h index 2026ec2f426..8fa02f33ab1 100644 --- a/include/power/tps65910_pmic.h +++ b/include/power/tps65910_pmic.h @@ -123,7 +123,7 @@ enum { /* platform data */ struct tps65910_regulator_pdata { - u32 supply; /* regulator supply voltage in uV */ + int supply; /* regulator supply voltage in uV */ uint unit; /* unit-address according to DT */ }; -- cgit v1.2.3 From b7360bd9e8e05dcfd1b4e5fd1c996aabf919e180 Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 11 Aug 2025 15:11:57 +0200 Subject: Revert "pmic: pca9450: Add optional SD_VSEL GPIO for LDO5" This reverts commit 2add0511757e2c5897a88b57c5ea8c912140e60f. It turns out that all boards using the PCA9450 actually have the SD_VSEL input connected to the VSELECT signal of the SoCs SD/MMC interface. Therefore we don't need manual control for this signal via GPIO and there aren't any users. This is equivalent to the following change in Linux: c73be62caabb ("Revert "regulator: pca9450: Add SD_VSEL GPIO for LDO5"") Signed-off-by: Frieder Schrempf Signed-off-by: Peng Fan --- drivers/power/pmic/pca9450.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index 9d875f8bdbe..0e3d14abf15 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -6,12 +6,9 @@ #include #include #include -#include #include -#include #include #include -#include #include #include #include @@ -29,10 +26,6 @@ static const struct pmic_child_info pmic_children_info[] = { { }, }; -struct pca9450_priv { - struct gpio_desc *sd_vsel_gpio; -}; - static int pca9450_reg_count(struct udevice *dev) { return PCA9450_REG_NUM; @@ -85,21 +78,7 @@ static int pca9450_bind(struct udevice *dev) static int pca9450_probe(struct udevice *dev) { - struct pca9450_priv *priv = dev_get_priv(dev); unsigned int reset_ctrl; - int ret = 0; - - if (CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(DM_REGULATOR_PCA9450)) { - priv->sd_vsel_gpio = devm_gpiod_get_optional(dev, "sd-vsel", - GPIOD_IS_OUT | - GPIOD_IS_OUT_ACTIVE); - if (IS_ERR(priv->sd_vsel_gpio)) { - ret = PTR_ERR(priv->sd_vsel_gpio); - dev_err(dev, "Failed to request SD_VSEL GPIO: %d\n", ret); - if (ret) - return ret; - } - } if (ofnode_read_bool(dev_ofnode(dev), "nxp,wdog_b-warm-reset")) reset_ctrl = PCA9450_PMIC_RESET_WDOG_B_CFG_WARM; @@ -132,5 +111,4 @@ U_BOOT_DRIVER(pmic_pca9450) = { .bind = pca9450_bind, .probe = pca9450_probe, .ops = &pca9450_ops, - .priv_auto = sizeof(struct pca9450_priv), }; -- cgit v1.2.3 From 8a04fbd9afd635d37c9afc1b56d014d134861e29 Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 11 Aug 2025 15:11:58 +0200 Subject: pmic: pca9450: Fix enable register for LDO5 The LDO5 regulator has two configuration registers, but only LDO5CTRL_L contains the bits for enabling/disabling the regulator. This is equivalent to the following change in Linux: f5aab0438ef1 ("regulator: pca9450: Fix enable register for LDO5") Fixes: 326337fb005f ("pmic: pca9450: Add regulator driver") Signed-off-by: Frieder Schrempf Signed-off-by: Peng Fan --- drivers/power/regulator/pca9450.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/regulator/pca9450.c b/drivers/power/regulator/pca9450.c index a2a34244723..27db55e688d 100644 --- a/drivers/power/regulator/pca9450.c +++ b/drivers/power/regulator/pca9450.c @@ -144,7 +144,7 @@ static struct pca9450_plat pca9450_reg_data[] = { PCA_DATA("LDO4", PCA9450_LDO4CTRL, HW_STATE_CONTROL, PCA9450_LDO4CTRL, PCA9450_LDO34_MASK, pca9450_ldo34_vranges), - PCA_DATA("LDO5", PCA9450_LDO5CTRL_H, HW_STATE_CONTROL, + PCA_DATA("LDO5", PCA9450_LDO5CTRL_L, HW_STATE_CONTROL, PCA9450_LDO5CTRL_H, PCA9450_LDO5_MASK, pca9450_ldo5_vranges), }; -- cgit v1.2.3 From addfe4544630a96a1cd03daf822a196af42b7a73 Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 11 Aug 2025 15:11:59 +0200 Subject: pmic: pca9450: Fix control register for LDO5 For LDO5 we need to be able to check the status of the SD_VSEL input in order to know which control register is used. Read the status of the SD_VSEL signal via GPIO and use the correct register accordingly. To use this, the LDO5 node in the devicetree needs the sd-vsel-gpios property to reference the GPIO that is used to read back the SD_VSEL status internally. Please note that the SION bit in the IOMUX must be set if the signal is muxed as VSELECT and controlled by the USDHC controller. This is equivalent to the following change in Linux: 3ce6f4f943dd ("regulator: pca9450: Fix control register for LDO5") Signed-off-by: Frieder Schrempf Signed-off-by: Peng Fan --- drivers/power/regulator/pca9450.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/power/regulator/pca9450.c b/drivers/power/regulator/pca9450.c index 27db55e688d..9d8d142b464 100644 --- a/drivers/power/regulator/pca9450.c +++ b/drivers/power/regulator/pca9450.c @@ -7,9 +7,12 @@ * ROHM BD71837 regulator driver */ +#include #include +#include #include #include +#include #include #include #include @@ -52,6 +55,7 @@ struct pca9450_plat { u8 volt_mask; struct pca9450_vrange *ranges; unsigned int numranges; + struct gpio_desc *sd_vsel_gpio; }; #define PCA_RANGE(_min, _vstep, _sel_low, _sel_hi) \ @@ -222,13 +226,23 @@ static int pca9450_set_enable(struct udevice *dev, bool enable) val); } +static u8 pca9450_get_vsel_reg(struct pca9450_plat *plat) +{ + if (!strcmp(plat->name, "LDO5") && + (plat->sd_vsel_gpio && !dm_gpio_get_value(plat->sd_vsel_gpio)) { + return PCA9450_LDO5CTRL_L; + } + + return plat->volt_reg; +} + static int pca9450_get_value(struct udevice *dev) { struct pca9450_plat *plat = dev_get_plat(dev); unsigned int reg, tmp; int i, ret; - ret = pmic_reg_read(dev->parent, plat->volt_reg); + ret = pmic_reg_read(dev->parent, pca9450_get_vsel_reg(plat)); if (ret < 0) return ret; @@ -274,7 +288,7 @@ static int pca9450_set_value(struct udevice *dev, int uvolt) if (!found) return -EINVAL; - return pmic_clrsetbits(dev->parent, plat->volt_reg, + return pmic_clrsetbits(dev->parent, pca9450_get_vsel_reg(plat), plat->volt_mask, sel); } @@ -335,6 +349,19 @@ static int pca9450_regulator_probe(struct udevice *dev) *plat = pca9450_reg_data[i]; + if (!strcmp(plat->name, "LDO5")) { + if (CONFIG_IS_ENABLED(DM_GPIO) && CONFIG_IS_ENABLED(DM_REGULATOR_PCA9450)) { + plat->sd_vsel_gpio = devm_gpiod_get_optional(dev, "sd-vsel", + GPIOD_IS_IN); + if (IS_ERR(plat->sd_vsel_gpio)) { + ret = PTR_ERR(plat->sd_vsel_gpio); + dev_err(dev, "Failed to request SD_VSEL GPIO: %d\n", ret); + if (ret) + return ret; + } + } + } + return 0; } -- cgit v1.2.3 From 281829f5ca1645c3bffa130d04753a1a76b64dfb Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 11 Aug 2025 15:12:00 +0200 Subject: pmic: pca9450: Handle hardware with fixed SD_VSEL for LDO5 There are two ways to set the output voltage of the LD05 regulator. First by writing to the voltage selection registers and second by toggling the SD_VSEL signal. Usually board designers connect SD_VSEL to the VSELECT signal controlled by the USDHC controller, but in some cases the signal is hardwired to a fixed low level (therefore selecting 3.3V as initial value for allowing to boot from the SD card). In these cases, the voltage is only determined by the value of the LDO5CTRL_L register. Introduce a property nxp,sd-vsel-fixed-low to let the driver know that SD_VSEL is low and there is no GPIO to actually get that information from dynamically. This is equivalent to the following change in Linux: c8c1ab2c5cb7 ("regulator: pca9450: Handle hardware with fixed SD_VSEL for LDO5") Signed-off-by: Frieder Schrempf Signed-off-by: Peng Fan --- drivers/power/regulator/pca9450.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/power/regulator/pca9450.c b/drivers/power/regulator/pca9450.c index 9d8d142b464..3bb0c71dde7 100644 --- a/drivers/power/regulator/pca9450.c +++ b/drivers/power/regulator/pca9450.c @@ -56,6 +56,7 @@ struct pca9450_plat { struct pca9450_vrange *ranges; unsigned int numranges; struct gpio_desc *sd_vsel_gpio; + bool sd_vsel_fixed_low; }; #define PCA_RANGE(_min, _vstep, _sel_low, _sel_hi) \ @@ -229,7 +230,8 @@ static int pca9450_set_enable(struct udevice *dev, bool enable) static u8 pca9450_get_vsel_reg(struct pca9450_plat *plat) { if (!strcmp(plat->name, "LDO5") && - (plat->sd_vsel_gpio && !dm_gpio_get_value(plat->sd_vsel_gpio)) { + ((plat->sd_vsel_gpio && !dm_gpio_get_value(plat->sd_vsel_gpio)) || + plat->sd_vsel_fixed_low)) { return PCA9450_LDO5CTRL_L; } @@ -360,6 +362,8 @@ static int pca9450_regulator_probe(struct udevice *dev) return ret; } } + + plat->sd_vsel_fixed_low = dev_read_bool(dev, "nxp,sd-vsel-fixed-low"); } return 0; -- cgit v1.2.3 From 925f63b0209483cd04b014cc8b5deab1f20267b7 Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 11 Aug 2025 15:12:01 +0200 Subject: arm: dts: imx8mp-data-modul-edm-sbc: Remove deprecated sd-vsel-gpios The sd-vsel-gpios property in the root of the PMIC node is deprecated and therefore not parsed by the driver anymore. We can safely remove this as it wasn't used anyway due to the pad not having the correct pinmux settings. Signed-off-by: Frieder Schrempf Reviewed-by: Marek Vasut Signed-off-by: Peng Fan --- arch/arm/dts/imx8mp-data-modul-edm-sbc.dts | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/imx8mp-data-modul-edm-sbc.dts b/arch/arm/dts/imx8mp-data-modul-edm-sbc.dts index 8066f7fb649..6b40106e3bd 100644 --- a/arch/arm/dts/imx8mp-data-modul-edm-sbc.dts +++ b/arch/arm/dts/imx8mp-data-modul-edm-sbc.dts @@ -344,7 +344,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <3 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; /* * i.MX 8M Plus Data Sheet for Consumer Products -- cgit v1.2.3 From dc0a12fecea789de83015319f3e9aeddd0a824a2 Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Mon, 11 Aug 2025 15:12:02 +0200 Subject: arm: dts: imx8mp-dhcom-som: Remove deprecated sd-vsel-gpios The sd-vsel-gpios property in the root of the PMIC node is deprecated and therefore not parsed by the driver anymore. We can safely remove this as it wasn't used anyway due to the pad not having the correct pinmux settings. Signed-off-by: Frieder Schrempf Reviewed-by: Marek Vasut Signed-off-by: Peng Fan --- arch/arm/dts/imx8mp-dhcom-som.dtsi | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/dts/imx8mp-dhcom-som.dtsi b/arch/arm/dts/imx8mp-dhcom-som.dtsi index f2d99d05854..c1ca3805737 100644 --- a/arch/arm/dts/imx8mp-dhcom-som.dtsi +++ b/arch/arm/dts/imx8mp-dhcom-som.dtsi @@ -245,7 +245,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <3 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; /* * i.MX 8M Plus Data Sheet for Consumer Products -- cgit v1.2.3 From 38443338c7d491852d21d6c5e7e742fc347b9a44 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:23 +0200 Subject: power: pmic: s2mps11: look for both {voltage-,}regulators Linux's DTSes uses regulators { }; while u-boot's DTSes uses voltage-regulators { };. Look for regulators, and fallback to voltage-regulators if not found, so that both type of DTSes can be used with the driver. Signed-off-by: Henrik Grimler Reviewed-by: Anand Moon Signed-off-by: Peng Fan --- drivers/power/pmic/s2mps11.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c index 17780017035..3aa8cad0827 100644 --- a/drivers/power/pmic/s2mps11.c +++ b/drivers/power/pmic/s2mps11.c @@ -52,11 +52,14 @@ static int s2mps11_probe(struct udevice *dev) ofnode regulators_node; int children; - regulators_node = dev_read_subnode(dev, "voltage-regulators"); + regulators_node = dev_read_subnode(dev, "regulators"); if (!ofnode_valid(regulators_node)) { - debug("%s: %s regulators subnode not found!\n", __func__, - dev->name); - return -ENXIO; + regulators_node = dev_read_subnode(dev, "voltage-regulators"); + if (!ofnode_valid(regulators_node)) { + debug("%s: %s regulators subnode not found!\n", __func__, + dev->name); + return -ENXIO; + } } debug("%s: '%s' - found regulators subnode\n", __func__, dev->name); -- cgit v1.2.3 From 8575c09a42efc438eacb55483135deb322f98fdc Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:24 +0200 Subject: ARM: dts: exynos5422-odroidxu3: rename s2mps11 regulators node With this both linux and u-boot uses the same node name, which simplifies devicetree parsing in s2mps11 driver. Signed-off-by: Henrik Grimler Reviewed-by: Anand Moon Signed-off-by: Peng Fan --- arch/arm/dts/exynos5422-odroidxu3.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/exynos5422-odroidxu3.dts b/arch/arm/dts/exynos5422-odroidxu3.dts index ef25cf77447..e147fcb8643 100644 --- a/arch/arm/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/dts/exynos5422-odroidxu3.dts @@ -40,7 +40,7 @@ s2mps11_pmic@66 { compatible = "samsung,s2mps11-pmic"; reg = <0x66>; - voltage-regulators { + regulators { ldo1_reg: LDO1 { regulator-name = "vdd_ldo1"; regulator-min-microvolt = <1000000>; -- cgit v1.2.3 From 983a16f38627c49704811c12ca7c6d134b08289c Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:25 +0200 Subject: power: pmic: s2mps11: remove check for voltage-regulators node All devicetrees that use s2mps11 driver have been converted to use regulators { };, so we can safely drop the voltage-regulators fallback check. Signed-off-by: Henrik Grimler Reviewed-by: Anand Moon Signed-off-by: Peng Fan --- drivers/power/pmic/s2mps11.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c index 3aa8cad0827..6e819579030 100644 --- a/drivers/power/pmic/s2mps11.c +++ b/drivers/power/pmic/s2mps11.c @@ -54,12 +54,9 @@ static int s2mps11_probe(struct udevice *dev) regulators_node = dev_read_subnode(dev, "regulators"); if (!ofnode_valid(regulators_node)) { - regulators_node = dev_read_subnode(dev, "voltage-regulators"); - if (!ofnode_valid(regulators_node)) { - debug("%s: %s regulators subnode not found!\n", __func__, - dev->name); - return -ENXIO; - } + debug("%s: %s regulators subnode not found!\n", __func__, + dev->name); + return -ENXIO; } debug("%s: '%s' - found regulators subnode\n", __func__, dev->name); -- cgit v1.2.3 From 89cad7ed6fdfdb3bcbb5c6d42b3d178c55d6c8d9 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:26 +0200 Subject: ARM: dts: exynos4210-universal_c210: rename max8998 regulators node Linux uses just regulators { }; instead of voltage-regulators { };, so this change aligns the DTSes found in the two projects. The max8998 driver does not yet parse the regulators node, so we can safely change its name without breaking anything. Signed-off-by: Henrik Grimler Signed-off-by: Peng Fan --- arch/arm/dts/exynos4210-universal_c210.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/exynos4210-universal_c210.dts b/arch/arm/dts/exynos4210-universal_c210.dts index c87b92be609..cfa99b62828 100644 --- a/arch/arm/dts/exynos4210-universal_c210.dts +++ b/arch/arm/dts/exynos4210-universal_c210.dts @@ -77,7 +77,7 @@ max8998-pmic@66 { compatible = "maxim,max8998"; reg = <0x66 0 0>; - voltage-regulators { + regulators { ldo2_reg: LDO2 { regulator-name = "VALIVE_1.2V"; regulator-min-microvolt = <1200000>; -- cgit v1.2.3 From e64d1a03171d3a3cf62210f930497a25bc4f4f55 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:27 +0200 Subject: ARM: dts: s5c1xx-goni: rename max8998-pmic regulators node Linux uses just regulators { }; instead of voltage-regulators { };, so this change aligns the DTSes found in the two projects. The max8998 driver does not yet parse the regulators node, so we can safely change its name without breaking anything. Signed-off-by: Henrik Grimler Signed-off-by: Peng Fan --- arch/arm/dts/s5pc1xx-goni.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/s5pc1xx-goni.dts b/arch/arm/dts/s5pc1xx-goni.dts index 90e3405040a..6c15a87ffb0 100644 --- a/arch/arm/dts/s5pc1xx-goni.dts +++ b/arch/arm/dts/s5pc1xx-goni.dts @@ -45,7 +45,7 @@ compatible = "maxim,max8998"; reg = <0x66 0 0>; - voltage-regulators { + regulators { ldo2_reg: LDO2 { regulator-compatible = "LDO2"; regulator-name = "VALIVE_1.1V"; -- cgit v1.2.3 From 0fdd3b4243359fd81d11923b711c28230795cc54 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:28 +0200 Subject: power: pmic: fix typo and capitalisation in max8997 Kconfig help msg To make the help message slightly easier to understand. Signed-off-by: Henrik Grimler Signed-off-by: Peng Fan --- drivers/power/pmic/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index ec7ccc3a63f..b1a5b1c2a1f 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -228,9 +228,9 @@ config PMIC_MAX8997 This is a Power Management IC with RTC, Fuel Gauge, MUIC control on Chip. - 21x LDOs - 12x GPIOs - - Haptic Motor driver + - Haptic motor driver - RTC with two alarms - - Fueal Gauge and One backup battery charger + - Fuel Gauge and one backup battery charger - MUIC - Others -- cgit v1.2.3 From 920404409cf1bb7644199b4194bf137fc62cff82 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:29 +0200 Subject: power: pmic: max8997: support maxim,max8997-pmic compatible as well Linux's DTSes uses maxim,max8997-pmic, so check for this compatible as well so that max8997 pmic driver can support both u-boot and Linux's DTSes. Signed-off-by: Henrik Grimler Signed-off-by: Peng Fan --- drivers/power/pmic/max8997.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/power/pmic/max8997.c b/drivers/power/pmic/max8997.c index 4afa6c84ef8..ecdad505b26 100644 --- a/drivers/power/pmic/max8997.c +++ b/drivers/power/pmic/max8997.c @@ -47,6 +47,7 @@ static struct dm_pmic_ops max8997_ops = { static const struct udevice_id max8997_ids[] = { { .compatible = "maxim,max8997" }, + { .compatible = "maxim,max8997-pmic" }, { }, }; -- cgit v1.2.3 From 1ca245d1c51173f73a98861244a33add45cb50d5 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:30 +0200 Subject: ARM: dts: exynos4210-trats: use maxim,max8997-pmic compatible Instead of maxim,max8997. Linux uses maxim,max8997-pmic, so with this change we align the trats DTS with its linux counterpart. Signed-off-by: Henrik Grimler Signed-off-by: Peng Fan --- arch/arm/dts/exynos4210-trats.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/exynos4210-trats.dts b/arch/arm/dts/exynos4210-trats.dts index 88e9c0ed2bb..2947d79f0cd 100644 --- a/arch/arm/dts/exynos4210-trats.dts +++ b/arch/arm/dts/exynos4210-trats.dts @@ -102,7 +102,7 @@ status = "okay"; max8997-pmic@66 { - compatible = "maxim,max8997"; + compatible = "maxim,max8997-pmic"; reg = <0x66 0 0>; voltage-regulators { valive_reg: LDO2 { -- cgit v1.2.3 From 31c376cf4f383e57ce2053c3e4b8c7138fdb1e6e Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:31 +0200 Subject: power: pmic: max8997: drop maxim,max8997 compatible All u-boot users now use maxim,max8997-pmic instead, as does Linux's DTSes, so we can now safely drop the maxim,max8997 compatible. Signed-off-by: Henrik Grimler Reviewed-by: Anand Moon Signed-off-by: Peng Fan --- drivers/power/pmic/max8997.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/power/pmic/max8997.c b/drivers/power/pmic/max8997.c index ecdad505b26..fb65a3ca730 100644 --- a/drivers/power/pmic/max8997.c +++ b/drivers/power/pmic/max8997.c @@ -46,7 +46,6 @@ static struct dm_pmic_ops max8997_ops = { }; static const struct udevice_id max8997_ids[] = { - { .compatible = "maxim,max8997" }, { .compatible = "maxim,max8997-pmic" }, { }, }; -- cgit v1.2.3 From cec29c00bc4c3cfd4312b9444da0cc77f161442e Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:32 +0200 Subject: ARM: dts: trats: rename max8997-pmic regulators node Linux uses just regulators { }; instead of voltage-regulators { };, so this change aligns the DTSes found in the two projects. The max8997 driver does not yet parse the regulators node, so we can safely change its name without breaking anything. Signed-off-by: Henrik Grimler Signed-off-by: Peng Fan --- arch/arm/dts/exynos4210-trats.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/dts/exynos4210-trats.dts b/arch/arm/dts/exynos4210-trats.dts index 2947d79f0cd..38b168950df 100644 --- a/arch/arm/dts/exynos4210-trats.dts +++ b/arch/arm/dts/exynos4210-trats.dts @@ -104,7 +104,7 @@ max8997-pmic@66 { compatible = "maxim,max8997-pmic"; reg = <0x66 0 0>; - voltage-regulators { + regulators { valive_reg: LDO2 { regulator-name = "VALIVE_1.1V_C210"; regulator-min-microvolt = <1100000>; -- cgit v1.2.3 From a65798ddbb88b06539e2a109d686edd3fb3a8173 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Fri, 22 Aug 2025 20:33:33 +0200 Subject: board: samsung: odroid: drop exynos_power_init exynos_power_init sets up regulators for the emmc and sdcard, but these regulators are already marked as always-on and boot-on and hence are handled already by the regulator-uclass. Since we currently try to set them up twice we get error -114 (EALREADY) from exynos_power_init on every boot: LDO20@VDDQ_EMMC_1.8V: set 1800000 uV; enabling (ret: -114) LDO22@VDDQ_EMMC_2.8V: set 2800000 uV; enabling (ret: -114) LDO21@TFLASH_2.8V: set 2800000 uV; enabling (ret: -114) Remove the superfluous exynos_power_init to silence these errors. Signed-off-by: Henrik Grimler Reviewed-by: Anand Moon Signed-off-by: Peng Fan --- board/samsung/odroid/odroid.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c index 84d6d919f07..a48b8e94b77 100644 --- a/board/samsung/odroid/odroid.c +++ b/board/samsung/odroid/odroid.c @@ -428,21 +428,6 @@ void exynos_init(void) board_gpio_init(); } -int exynos_power_init(void) -{ - const char *mmc_regulators[] = { - "VDDQ_EMMC_1.8V", - "VDDQ_EMMC_2.8V", - "TFLASH_2.8V", - NULL, - }; - - if (regulator_list_autoset(mmc_regulators, NULL, true)) - pr_err("Unable to init all mmc regulators\n"); - - return 0; -} - #ifdef CONFIG_USB_GADGET static int s5pc210_phy_control(int on) { -- cgit v1.2.3 From 9065b87f35018a4e993e7dfb8a8ec29474785f76 Mon Sep 17 00:00:00 2001 From: Primoz Fiser Date: Thu, 28 Aug 2025 13:24:04 +0200 Subject: power: pmic: pca9450: Add support for system reset The family of PCA9450 PMICs have the ability to perform system resets. Restarting via PMIC is preferred method of restarting the system as all the peripherals are brought to a know state after a power-cycle. The PCA9450 features a cold restart procedure which is initiated by an I2C command 0x14 to the SW_RST register. Support in Linux for restarting via PCA9450 PMIC has been added by Linux commit 6157e62b07d9 ("regulator: pca9450: Add restart handler"). Now add support for it also in the U-Boot via sysreset framework. Signed-off-by: Primoz Fiser Reviewed-by: Paul Geurts Signed-off-by: Peng Fan --- drivers/power/pmic/pca9450.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ include/power/pca9450.h | 2 ++ 2 files changed, 46 insertions(+) diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index 0e3d14abf15..8b98c2239e1 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -6,13 +6,17 @@ #include #include #include +#include +#include #include #include #include +#include #include #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -79,6 +83,15 @@ static int pca9450_bind(struct udevice *dev) static int pca9450_probe(struct udevice *dev) { unsigned int reset_ctrl; + int ret; + + if (CONFIG_IS_ENABLED(SYSRESET)) { + ret = device_bind_driver_to_node(dev, "pca9450_sysreset", + "pca9450_sysreset", + dev_ofnode(dev), NULL); + if (ret) + return ret; + } if (ofnode_read_bool(dev_ofnode(dev), "nxp,wdog_b-warm-reset")) reset_ctrl = PCA9450_PMIC_RESET_WDOG_B_CFG_WARM; @@ -112,3 +125,34 @@ U_BOOT_DRIVER(pmic_pca9450) = { .probe = pca9450_probe, .ops = &pca9450_ops, }; + +#ifdef CONFIG_SYSRESET +static int pca9450_sysreset_request(struct udevice *dev, enum sysreset_t type) +{ + u8 cmd = PCA9450_SW_RST_COLD_RST; + + if (type != SYSRESET_COLD) + return -EPROTONOSUPPORT; + + if (pmic_write(dev->parent, PCA9450_SW_RST, &cmd, 1)) { + dev_err(dev, "reset command failed\n"); + } else { + /* tRESTART is 250ms, delay 300ms just to be sure */ + mdelay(300); + /* Should not get here, warn if we do */ + dev_warn(dev, "didn't respond to reset command\n"); + } + + return -EINPROGRESS; +} + +static struct sysreset_ops pca9450_sysreset_ops = { + .request = pca9450_sysreset_request, +}; + +U_BOOT_DRIVER(pca9450_sysreset) = { + .name = "pca9450_sysreset", + .id = UCLASS_SYSRESET, + .ops = &pca9450_sysreset_ops, +}; +#endif /* CONFIG_SYSRESET */ diff --git a/include/power/pca9450.h b/include/power/pca9450.h index e5ab09fb8c8..9119ef793b1 100644 --- a/include/power/pca9450.h +++ b/include/power/pca9450.h @@ -75,4 +75,6 @@ enum { #define PCA9450_PMIC_RESET_WDOG_B_CFG_WARM 0x40 #define PCA9450_PMIC_RESET_WDOG_B_CFG_COLD_LDO12 0x80 +#define PCA9450_SW_RST_COLD_RST 0x14 + #endif -- cgit v1.2.3 From ad197b31b3f88d53c349995d8bbaeba4b18b8f2b Mon Sep 17 00:00:00 2001 From: Primoz Fiser Date: Thu, 28 Aug 2025 13:24:05 +0200 Subject: power: pmic: pca9450: Add support for reset status PCA9450 PMIC supports reading the reset status from the PWRON_STAT register. Bits 7-4 give indication of the PMIC reset cause: - PWRON (BIT7) - Power ON triggered by PMIC_ON_REQ input line, - WDOGB (BIT6) - Boot after cold reset by WDOGB pin (watchdog reset), - SW_RST (BIT5) - Boot after cold reset initiated by the software, - PMIC_RST (BIT4) - Boot after PMIC_RST_B input line trigger. Add support for reading reset status via the sysreset framework in a convenient printable format. Signed-off-by: Primoz Fiser Reviewed-by: Paul Geurts Signed-off-by: Peng Fan --- drivers/power/pmic/pca9450.c | 38 ++++++++++++++++++++++++++++++++++++++ include/power/pca9450.h | 5 +++++ 2 files changed, 43 insertions(+) diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index 8b98c2239e1..e5c1f037b61 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -146,8 +146,46 @@ static int pca9450_sysreset_request(struct udevice *dev, enum sysreset_t type) return -EINPROGRESS; } +int pca9450_sysreset_get_status(struct udevice *dev, char *buf, int size) +{ + const char *reason; + int ret; + u8 reg; + + ret = pmic_read(dev->parent, PCA9450_PWRON_STAT, ®, 1); + if (ret) + return ret; + + switch (reg) { + case PCA9450_PWRON_STAT_PWRON_MASK: + reason = "PWRON"; + break; + case PCA9450_PWRON_STAT_WDOG_MASK: + reason = "WDOGB"; + break; + case PCA9450_PWRON_STAT_SW_RST_MASK: + reason = "SW_RST"; + break; + case PCA9450_PWRON_STAT_PMIC_RST_MASK: + reason = "PMIC_RST"; + break; + default: + reason = "UNKNOWN"; + break; + } + + ret = snprintf(buf, size, "Reset Status: %s\n", reason); + if (ret < 0) { + dev_err(dev, "Write reset status error (err = %d)\n", ret); + return -EIO; + } + + return 0; +} + static struct sysreset_ops pca9450_sysreset_ops = { .request = pca9450_sysreset_request, + .get_status = pca9450_sysreset_get_status, }; U_BOOT_DRIVER(pca9450_sysreset) = { diff --git a/include/power/pca9450.h b/include/power/pca9450.h index 9119ef793b1..41b7f95c034 100644 --- a/include/power/pca9450.h +++ b/include/power/pca9450.h @@ -75,6 +75,11 @@ enum { #define PCA9450_PMIC_RESET_WDOG_B_CFG_WARM 0x40 #define PCA9450_PMIC_RESET_WDOG_B_CFG_COLD_LDO12 0x80 +#define PCA9450_PWRON_STAT_PWRON_MASK 0x80 +#define PCA9450_PWRON_STAT_WDOG_MASK 0x40 +#define PCA9450_PWRON_STAT_SW_RST_MASK 0x20 +#define PCA9450_PWRON_STAT_PMIC_RST_MASK 0x10 + #define PCA9450_SW_RST_COLD_RST 0x14 #endif -- cgit v1.2.3 From 95994d4e5996610c8205597b2849b48eaaf2baff Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Wed, 30 Jul 2025 17:52:56 +0100 Subject: mmc: iproc_sdhci: Cannot test unsigned variable for negative In sdhci_iproc_execute_tuning the variable tuning_loop_counter is unsigned and therefore will always fail the test for it being less than 0. Fix this by changing the variable type to be s8. This issue was found by Smatch. Signed-off-by: Andrew Goodbody Reviewed-by: Peng Fan Signed-off-by: Peng Fan --- drivers/mmc/iproc_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/iproc_sdhci.c b/drivers/mmc/iproc_sdhci.c index 7ab74ff117a..654672a546f 100644 --- a/drivers/mmc/iproc_sdhci.c +++ b/drivers/mmc/iproc_sdhci.c @@ -182,7 +182,7 @@ static int sdhci_iproc_execute_tuning(struct mmc *mmc, u8 opcode) u32 ctrl; u32 blocksize = SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, 64); struct sdhci_host *host = dev_get_priv(mmc->dev); - char tuning_loop_counter = MAX_TUNING_LOOP; + s8 tuning_loop_counter = MAX_TUNING_LOOP; int ret = 0; sdhci_start_tuning(host); -- cgit v1.2.3 From 140562d3a2b447079499d773a7d21ec1728692cb Mon Sep 17 00:00:00 2001 From: Bhimeswararao Matsa Date: Fri, 29 Aug 2025 07:41:31 +0530 Subject: mmc: core: drop space before newline in trace printf Remove unnecessary whitespace before '\n' in trace printf format strings (checkpatch warning QUOTED_WHITESPACE_BEFORE_NEWLINE). No functional change intended. Signed-off-by: Bhimeswararao Matsa Signed-off-by: Peng Fan --- drivers/mmc/mmc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 5f2efbe6df9..20afcffde3d 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -125,21 +125,21 @@ void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret) printf("\t\tMMC_RSP_NONE\n"); break; case MMC_RSP_R1: - printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08x \n", + printf("\t\tMMC_RSP_R1,5,6,7 \t 0x%08x\n", cmd->response[0]); break; case MMC_RSP_R1b: - printf("\t\tMMC_RSP_R1b\t\t 0x%08x \n", + printf("\t\tMMC_RSP_R1b\t\t 0x%08x\n", cmd->response[0]); break; case MMC_RSP_R2: - printf("\t\tMMC_RSP_R2\t\t 0x%08x \n", + printf("\t\tMMC_RSP_R2\t\t 0x%08x\n", cmd->response[0]); - printf("\t\t \t\t 0x%08x \n", + printf("\t\t \t\t 0x%08x\n", cmd->response[1]); - printf("\t\t \t\t 0x%08x \n", + printf("\t\t \t\t 0x%08x\n", cmd->response[2]); - printf("\t\t \t\t 0x%08x \n", + printf("\t\t \t\t 0x%08x\n", cmd->response[3]); printf("\n"); printf("\t\t\t\t\tDUMPING DATA\n"); @@ -154,7 +154,7 @@ void mmmc_trace_after_send(struct mmc *mmc, struct mmc_cmd *cmd, int ret) } break; case MMC_RSP_R3: - printf("\t\tMMC_RSP_R3,4\t\t 0x%08x \n", + printf("\t\tMMC_RSP_R3,4\t\t 0x%08x\n", cmd->response[0]); break; default: -- cgit v1.2.3