i.MX7D anatop regulator and GPCv2 PD support
v3 cover i.MX7D anatop regulator and GPCv2 PD support
These are the regulator and power domain parts of [1] to prepare for i.MX7D USB HSIC support, split off into a separate series so it can go through the appropriate tree.
The anatop and power domain drivers will be enabled in the TQMa7 defconfigs in a follow-up series when the remaining USB HSIC support patches from [1] have been reworked.
Changes since v2:
- Drop rename of imx8m-power-domain driver
- Rebase onto current next
Changes since v1:
- Split from USB subsystem changes
- Rebase onto current next
[1] https://lists.u-boot-project.org/pipermail/u-boot/2026-October/637395.html
Nora Schiffer (7):
regulator: anatop: fix probe without vin-supply
regulator: anatop: add support for anatop-enable-bit
power: domain: imx8m: update outdated Kconfig help text
power: domain: imx8m: do not unconditionally select CONFIG_CLK
power: domain: imx8m: set CPU domain mapping on probe
power: domain: imx8m: add support for power-supply regulator
power: domain: imx8m: add support for i.MX7D
drivers/power/domain/Kconfig | 8 +- drivers/power/domain/imx8m-power-domain.c | 101 ++++++++++++++++++++- drivers/power/regulator/anatop_regulator.c | 42 ++++++++- 3 files changed, 142 insertions(+), 9 deletions(-)
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 1/7 regulator: anatop: fix probe without vin-supply
device_get_supply_regulator() returns -ENOENT, not -ENODEV when no supply exists. This fixes the probe on i.MX7D.
--- drivers/power/regulator/anatop_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/regulator/anatop_regulator.c +1 -1
@@ -176,7 +176,7 @@ static int anatop_regulator_probe(struct udevice *dev) ret =device_get_supply_regulator (dev,"vin-supply" , &anatop_reg->supply); -if (ret != -ENODEV ) { +if (ret != -ENOENT ) {if (ret)return log_msg_ret ("get vin-supply" , ret);
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 2/7 regulator: anatop: add support for anatop-enable-bit
In reply to Nora SchifferSome variants of the anatop like the one found on the i.MX7D need to be enabled. Add support for the anatop-enable-bit property that is used for this purpose.
Instances without this property are considered to be always enabled, and attempting to disable them will fail.
--- drivers/power/regulator/anatop_regulator.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/power/regulator/anatop_regulator.c +40 -0
@@ -42,6 +42,7 @@ struct anatop_regulator {u32 delay_reg;u32 delay_bit_shift;u32 delay_bit_width; +u32 enable_mask; }; static u32 anatop_get_bits(struct udevice *dev, u32 addr, int bit_shift,
@@ -154,9 +155,42 @@ static int anatop_set_voltage(struct udevice *dev, int uV)return ret; } +static int anatop_set_enable (struct udevice *dev,bool enable) +{ +const struct anatop_regulator *anatop_reg =dev_get_plat (dev); + +dev_dbg (dev,"enable = %d\n" , enable); + +if (!anatop_reg->enable_mask) +return enable ?0 : -ENOSYS ; +return regmap_update_bits (anatop_reg->regmap, anatop_reg->control_reg, + anatop_reg->enable_mask, + enable ? anatop_reg->enable_mask :0 ); +} + +static int anatop_get_enable (struct udevice *dev) +{ +const struct anatop_regulator *anatop_reg =dev_get_plat (dev); +u32 val; +int err; + +if (!anatop_reg->enable_mask) +return 1 ; + + err =regmap_read (anatop_reg->regmap, anatop_reg->control_reg, &val); +if (err) { +dev_dbg (dev,"cannot read reg (%d)\n" , err); +return err; + } + +return !!(val & anatop_reg->enable_mask); +} +static const struct dm_regulator_ops anatop_regulator_ops = { .set_value = anatop_set_voltage, .get_value = anatop_get_voltage, + .get_enable = anatop_get_enable, + .set_enable = anatop_set_enable, };static int anatop_regulator_probe (struct udevice *dev)
@@ -229,6 +263,12 @@ static int anatop_regulator_probe(struct udevice *dev)dev_read_u32 (dev,"anatop-delay-bit-shift" , &anatop_reg->delay_bit_shift); + ret =dev_read_u32 (dev, +"anatop-enable-bit" , + &val); +if (!ret) + anatop_reg->enable_mask =BIT (val); + syscon =dev_get_parent (dev);if (!syscon) {dev_dbg (dev,"unable to find syscon device\n" );
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 3/7 power: domain: imx8m: update outdated Kconfig help text
In reply to Nora SchifferThe help text incorrectly stated that the driver manipulates power domains via the ATF, which hasn't been the case for a long time.
--- drivers/power/domain/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/power/domain/Kconfig +1 -2
@@ -45,8 +45,7 @@ config IMX8M_POWER_DOMAIN depends on POWER_DOMAIN && ARCH_IMX8M select CLK help - Enable support for manipulating NXP i.MX8M on-SoC power domains via - requests to the ATF. + Enable support for manipulating NXP i.MX8M on-SoC power domains. config IMX8MP_HSIOMIX_BLKCTRL bool "Enable i.MX8MP HSIOMIX domain driver"
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 4/7 power: domain: imx8m: do not unconditionally select CONFIG_CLK
In reply to Nora SchifferNo clock is needed on the i.MX7D, and currently no clk-imx7d driver exists, so CONFIG_CLK can't be enabled.
--- drivers/power/domain/Kconfig | 1 - drivers/power/domain/imx8m-power-domain.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/power/domain/Kconfig +0 -1
@@ -43,7 +43,6 @@ config IMX8_POWER_DOMAIN config IMX8M_POWER_DOMAIN bool "Enable i.MX8M power domain driver" depends on POWER_DOMAIN && ARCH_IMX8M - select CLK help Enable support for manipulating NXP i.MX8M on-SoC power domains.
drivers/power/domain/imx8m-power-domain.c +1 -1
@@ -517,7 +517,7 @@ static int imx8m_power_domain_probe(struct udevice *dev)/* Grab optional power domain clock. */ ret =clk_get_bulk (dev, &pdata->clk); -if (ret && ret != -ENOENT ) { +if (ret && ret != -ENOENT && ret != -ENOSYS ) {dev_err (dev,"Failed to get domain clock (%d)\n" , ret);return ret; }
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 5/7 power: domain: imx8m: set CPU domain mapping on probe
In reply to Nora SchifferThe CPU domain mapping registers and bits were already defined, but they were not written to the hardware. This is necessary on the i.MX7D.
--- drivers/power/domain/imx8m-power-domain.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/power/domain/imx8m-power-domain.c +3 -0
@@ -522,6 +522,9 @@ static int imx8m_power_domain_probe(struct udevice *dev)return ret; } +if (pdata->domain->bits.map) +setbits_le32 (pdata->base + pdata->regs->map, pdata->domain->bits.map); +return 0 ; }
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 6/7 power: domain: imx8m: add support for power-supply regulator
In reply to Nora SchifferOn the i.MX7D, the integrated anatop regulator needs to be configured and enabled with the power domains.
--- drivers/power/domain/imx8m-power-domain.c | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
drivers/power/domain/imx8m-power-domain.c +35 -1
@@ -14,6 +14,7 @@#include <dm/device_compat.h> #include <imx_sip.h> #include <linux/bitmap.h> +#include <power/regulator.h> #include <wait_bit.h> #include <dt-bindings/power/imx8mm-power.h>
@@ -128,6 +129,7 @@ struct imx_pgc_domain {u32 hskack; } bits; +const int voltage;const bool keep_clocks; };
@@ -141,6 +143,7 @@ struct imx8m_power_domain_plat {struct power_domain pd;const struct imx_pgc_domain *domain;const struct imx_pgc_regs *regs; +struct udevice *regulator;struct clk_bulk clk;void __iomem *base;int resource_id;
@@ -343,11 +346,19 @@ static int imx8m_power_domain_on(struct power_domain *power_domain)u32 pgc;int ret; +if (pdata->regulator) { + ret =regulator_enable (pdata->regulator); +if (ret) { +dev_err (dev,"failed to enable regulator: %d\n" , ret); +return ret; + } + } +if (pdata->clk.count) { ret =clk_enable_bulk (&pdata->clk);if (ret) {dev_err (dev,"failed to enable reset clocks\n" ); -return ret; + goto out_regulator_disable; } }
@@ -392,6 +403,9 @@ static int imx8m_power_domain_on(struct power_domain *power_domain) out_clk_disable:if (pdata->clk.count)clk_disable_bulk (&pdata->clk); +out_regulator_disable: +if (pdata->regulator) +regulator_disable (pdata->regulator);return ret; }
@@ -450,6 +464,14 @@ static int imx8m_power_domain_off(struct power_domain *power_domain)if (pdata->clk.count)clk_disable_bulk (&pdata->clk); +if (pdata->regulator) { + ret =regulator_disable (pdata->regulator); +if (ret) { +dev_err (dev,"failed to disable regulator: %d\n" , ret); +return ret; + } + } +if (pdata->has_pd)power_domain_off (&pdata->pd);
@@ -458,6 +480,8 @@ static int imx8m_power_domain_off(struct power_domain *power_domain) out_clk_disable:if (!domain->keep_clocks && pdata->clk.count)clk_disable_bulk (&pdata->clk); +if (pdata->regulator) +regulator_disable (pdata->regulator);return ret; }
@@ -515,6 +539,16 @@ static int imx8m_power_domain_probe(struct udevice *dev)if (!strstr (dev->name,"power-domain" ))return 0 ; + ret =device_get_supply_regulator (dev,"power-supply" , &pdata->regulator); +if (ret) { +if (ret != -ENOENT && ret != -ENOSYS ) { +dev_err (dev,"Failed to get domain's regulator (%d)\n" , ret); +return ret; + } + }else if (pdata->domain->voltage) { +regulator_set_value (pdata->regulator, pdata->domain->voltage); + } +/* Grab optional power domain clock. */ ret =clk_get_bulk (dev, &pdata->clk);if (ret && ret != -ENOENT && ret != -ENOSYS ) {
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/
PATCH v3 7/7 power: domain: imx8m: add support for i.MX7D
In reply to Nora SchifferImport the power domain definitions for the i.MX7D from the Linux kernel.
--- drivers/power/domain/Kconfig | 6 +-- drivers/power/domain/imx8m-power-domain.c | 60 ++++++++++++++++++++++- 2 files changed, 62 insertions(+), 4 deletions(-)
drivers/power/domain/Kconfig +3 -3
@@ -41,10 +41,10 @@ config IMX8_POWER_DOMAIN requests to the SCU. config IMX8M_POWER_DOMAIN - bool "Enable i.MX8M power domain driver" - depends on POWER_DOMAIN && ARCH_IMX8M + bool "Enable i.MX7D/i.MX8M power domain driver" + depends on POWER_DOMAIN && (MX7D || ARCH_IMX8M) help - Enable support for manipulating NXP i.MX8M on-SoC power domains. + Enable support for manipulating NXP i.MX7D/i.MX8M on-SoC power domains. config IMX8MP_HSIOMIX_BLKCTRL bool "Enable i.MX8MP HSIOMIX domain driver"
drivers/power/domain/imx8m-power-domain.c +59 -1
102 lines not on this page · raw message
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider https://www.tq-group.com/