arm: mxs: Provide Kconfig option to to not use VDD5V as IMX28 PMU source
Subsystems (3)
PATCH 1/5 arm: mxs: Provide Kconfig option to to not use VDD5V as IMX28 PMU source
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (DCDC_BAT).
This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where DCDC_BAT is connected to fixed and regulated 4.2V source (so the "battery" is not present).
--- arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 4 ++++ arch/arm/mach-imx/mxs/Kconfig | 8 ++++++++ 2 files changed, 12 insertions(+)
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +4 -0
@@ -752,6 +752,10 @@ static void mxs_batt_boot(void)POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK , 0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET); +if (CONFIG_IS_ENABLED (MXS_PMU_MINIMAL_VDD5V_CURRENT )) +setbits_le32 (&power_regs->hw_power_5vctrl, +POWER_5VCTRL_ILIMIT_EQ_ZERO ); +mxs_power_enable_4p2 (); }
arch/arm/mach-imx/mxs/Kconfig +8 -0
@@ -51,6 +51,14 @@ endchoice config SYS_SOC default "mxs" +config SPL_MXS_PMU_MINIMAL_VDD5V_CURRENT + bool "Force minimal current draw from VDD5V by MX28 PMU" + default n + help + After setting this option, the current drawn from VDD5V + by the PMU is reduced to zero - the DCDC_BATT is used as + the main power source for PMU. + source "board/freescale/mx28evk/Kconfig" source "board/liebherr/xea/Kconfig"
Signature · 1 line
2.30.2
PATCH 2/5 arm: mxs: Provide Kconfig option to disable battery charging at IMX28 PMU
This new Kconfig option allows disabling the in-PMU battery charging block. This may be required when DCDC_BAT source is powered not from battery, but from already regulated, good quality source.
--- arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 7 +++++++ arch/arm/mach-imx/mxs/Kconfig | 4 ++++ 2 files changed, 11 insertions(+)
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +7 -0
@@ -756,6 +756,13 @@ static void mxs_batt_boot(void)setbits_le32 (&power_regs->hw_power_5vctrl,POWER_5VCTRL_ILIMIT_EQ_ZERO ); +if (CONFIG_IS_ENABLED (MXS_PMU_DISABLE_BATT_CHARGE )) { +writel (POWER_CHARGE_PWD_BATTCHRG , + &power_regs->hw_power_charge_set); +writel (POWER_5VCTRL_PWD_CHARGE_4P2_MASK , + &power_regs->hw_power_5vctrl_set); + } +mxs_power_enable_4p2 (); }
arch/arm/mach-imx/mxs/Kconfig +4 -0
@@ -59,6 +59,10 @@ config SPL_MXS_PMU_MINIMAL_VDD5V_CURRENT by the PMU is reduced to zero - the DCDC_BATT is used as the main power source for PMU. +config SPL_MXS_PMU_DISABLE_BATT_CHARGE + bool "Disable Battery Charging in MX28 PMU" + default n + source "board/freescale/mx28evk/Kconfig" source "board/liebherr/xea/Kconfig"
Signature · 1 line
2.30.2
PATCH 2/5 arm: mxs: Provide Kconfig option to disable battery charging at IMX28 PMU
Quoted 4 lines
This new
Kconfigoption allows disabling the in-PMU battery charging block. This may be required whenDCDC_BATsource is powered not from battery, but from already regulated, good quality source.Signed-off-by Lukasz Majewski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH 3/5 arm: mxs: Provide Kconfig option to not enable 4P2 regulator in IMX28 PMU
In reply to Lukasz MajewskiThe IMX28 PMU (Power Management Unit) has a dedicated Linear Regulator to produce (by default) 4.2V output - available outside the chip as VDD_4P2.
When system is supposed to not use VDD5V as a main power source - instead the DCDC_BATT is used; it is safe to disable this regulator.
As the in-PMU DCDC switching regulator (from which DCDC_VDDA, DCDC_VDDIO and DCDC_VDDD are generated) can be driven from DCDC_BATT or output of this 4P2 regulator - by disabling the latter the use of the DCDC_BATT is forced.
To be more specific - according to NXP's AN4199 the DCDC_BATT source is preferred (over VDD5V), as more efficient and stable source for industrial applications.
--- arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 3 ++- arch/arm/mach-imx/mxs/Kconfig | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +2 -1
@@ -763,7 +763,8 @@ static void mxs_batt_boot(void) &power_regs->hw_power_5vctrl_set); } -mxs_power_enable_4p2 (); +if (CONFIG_IS_ENABLED (MXS_PMU_ENABLE_4P2_LINEAR_REGULATOR )) +mxs_power_enable_4p2 (); }/**
arch/arm/mach-imx/mxs/Kconfig +7 -0
@@ -63,6 +63,13 @@ config SPL_MXS_PMU_DISABLE_BATT_CHARGE bool "Disable Battery Charging in MX28 PMU" default n +config SPL_MXS_PMU_ENABLE_4P2_LINEAR_REGULATOR + bool "Enable the 4P2 linear regulator in MX28 PMU" + default y + help + This option enables the 4P2 linear regulator (derived + from VDD5V) - so the VDD4P2 power source is operational. + source "board/freescale/mx28evk/Kconfig" source "board/liebherr/xea/Kconfig"
Signature · 1 line
2.30.2
PATCH 3/5 arm: mxs: Provide Kconfig option to not enable 4P2 regulator in IMX28 PMU
Quoted 12 lines
The IMX28 PMU (Power Management Unit) has a dedicated Linear Regulator to produce (by default) 4.2V output - available outside the chip as
VDD_4P2.
When system is supposed to not use VDD5V as a main power source - instead theDCDC_BATTis used; it is safe to disable this regulator. As the in-PMU DCDC switching regulator (from whichDCDC_VDDA,DCDC_VDDIOandDCDC_VDDDare generated) can be driven fromDCDC_BATTor output of this 4P2 regulator - by disabling the latter the use of theDCDC_BATTis forced.
To be more specific - according to NXP's AN4199 theDCDC_BATTsource is preferred (over VDD5V), as more efficient and stable source for industrial applications.
Quoted 1 line
Signed-off-by Lukasz Majewski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH 4/5 arm: mxs: Add function to dump PMU registers
In reply to Lukasz MajewskiThis commit provides function, which when debugging output is enabled dumps the IMX28 PMU registers.
--- arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/cpu/arm926ejs/mxs/spl_power_init.c +24 -0
@@ -41,6 +41,29 @@ static void mxs_power_clock2xtal(void) &clkctrl_regs->hw_clkctrl_clkseq_set); } +static void mxs_power_regs_dump (void ) +{ +struct mxs_power_regs *power_regs = + (struct mxs_power_regs *)MXS_POWER_BASE ; + +debug ("ctrl:\t\t 0x%x\n" ,readl (&power_regs->hw_power_ctrl)); +debug ("5vctrl:\t\t 0x%x\n" ,readl (&power_regs->hw_power_5vctrl)); +debug ("minpwr:\t\t 0x%x\n" ,readl (&power_regs->hw_power_minpwr)); +debug ("charge:\t\t 0x%x\n" ,readl (&power_regs->hw_power_charge)); +debug ("vddctrl:\t 0x%x\n" ,readl (&power_regs->hw_power_vdddctrl)); +debug ("vddactrl:\t 0x%x\n" ,readl (&power_regs->hw_power_vddactrl)); +debug ("vddioctrl:\t 0x%x\n" ,readl (&power_regs->hw_power_vddioctrl)); +debug ("vddmemctrl:\t 0x%x\n" ,readl (&power_regs->hw_power_vddmemctrl)); +debug ("dcdc4p2:\t 0x%x\n" ,readl (&power_regs->hw_power_dcdc4p2)); +debug ("misc:\t\t 0x%x\n" ,readl (&power_regs->hw_power_misc)); +debug ("dclimits:\t 0x%x\n" ,readl (&power_regs->hw_power_dclimits)); +debug ("loopctrl:\t 0x%x\n" ,readl (&power_regs->hw_power_loopctrl)); +debug ("sts:\t\t 0x%x\n" ,readl (&power_regs->hw_power_sts)); +debug ("speed:\t\t 0x%x\n" ,readl (&power_regs->hw_power_speed)); +debug ("battmonitor:\t 0x%x\n" , +readl (&power_regs->hw_power_battmonitor)); +} +/** * mxs_power_clock2pll() - Switch CPU core clock source to PLL *
@@ -1280,6 +1303,7 @@ void mxs_power_init(void) POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);writel (POWER_5VCTRL_PWDN_5VBRNOUT , &power_regs->hw_power_5vctrl_set); +mxs_power_regs_dump ();early_delay (1000 ); }
Signature · 1 line
2.30.2
PATCH 4/5 arm: mxs: Add function to dump PMU registers
Quoted 3 lines
This commit provides function, which when debugging output is enabled dumps the IMX28 PMU registers.
Signed-off-by Lukasz Majewski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH 5/5 arm: config: Adjust imx287 based XEA board PMU configuration
In reply to Lukasz MajewskiThis patch adjusts XEA's PMU setup as this board is supposed to be mainly powered from DCDC_BATT source.
Moreover, in this HW design the VDD_4P2 is not used as well.
--- configs/imx28_xea_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/imx28_xea_defconfig +3 -0
@@ -13,6 +13,9 @@ CONFIG_SPL_DM_SPI=y CONFIG_DEFAULT_DEVICE_TREE="imx28-xea" CONFIG_SPL_TEXT_BASE=0x1000 CONFIG_TARGET_XEA=y +CONFIG_SPL_MXS_PMU_MINIMAL_VDD5V_CURRENT=y +CONFIG_SPL_MXS_PMU_DISABLE_BATT_CHARGE=y +# CONFIG_SPL_MXS_PMU_ENABLE_4P2_LINEAR_REGULATOR is not set CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y CONFIG_SPL_STACK=0x20000
Signature · 1 line
2.30.2
PATCH 5/5 arm: config: Adjust imx287 based XEA board PMU configuration
Quoted 4 lines
This patch adjusts XEA's PMU setup as this board is supposed to be mainly powered from
DCDC_BATTsource.
Moreover, in this HW design theVDD_4P2is not used as well.Signed-off-by Lukasz Majewski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
Quoted 7 lines · Lukasz Majewski
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).
Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
Hi Marek,
Quoted 5 lines · Lukasz Majewski
Quoted 4 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).
Quoted 7 lines
Quoted 4 lines
This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
This platform uses only SPL_OF_PLATDATA to keep the SPL size < 40 KiB.
I would prefer to keep this as Kconfig as the PMU driver is not supporting DT and in fact now ARCH_MX28 only has two boards supported - XEA and imx28evk.
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]
Quoted 1 line · Lukasz Majewski
Hi Marek,
Hi,
Quoted 10 lines
Quoted 10 lines · Lukasz Majewski
Quoted 8 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).
Quoted 8 lines
Quoted 2 lines
Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
This platform uses only
SPL_OF_PLATDATAto keep the SPL size < 40 KiB.I would prefer to keep this as
Kconfigas the PMU driver is not supporting DT and in fact nowARCH_MX28only has two boards supported - XEA and imx28evk.
Why not use the platdata then ?
This makes it far better, as the code is actually always compiled and doesn't start to bitrot.
Hi Marek,
Quoted 21 lines · Lukasz Majewski
Quoted 1 line
Hi Marek,
Hi,
Quoted 16 lines
Quoted 5 lines · Lukasz Majewski
Quoted 4 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).Quoted 7 lines
Quoted 4 lines
This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
This platform uses only
SPL_OF_PLATDATAto keep the SPL size < 40 KiB.
Quoted 7 lines
Quoted 3 lines
I would prefer to keep this as
Kconfigas the PMU driver is not supporting DT and in fact nowARCH_MX28only has two boards supported - XEA and imx28evk.Why not use the platdata then ?
This makes it far better, as the code is actually always compiled and doesn't start to bitrot.
As fair as I can tell - the MX28 PMU driver in SPL is not supporting OF_PLATDATA. Or have I overlooked something?
I would like to investigate the PMU issue, and avoid extra work to provide platdata support for two supported imx287 based boards.
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]
Quoted 31 lines · Lukasz Majewski
Hi Marek,
Quoted 21 lines · Lukasz Majewski
Quoted 1 line
Hi Marek,
Hi,
Quoted 16 lines
Quoted 5 lines · Lukasz Majewski
Quoted 4 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).Quoted 7 lines
Quoted 4 lines
This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
This platform uses only
SPL_OF_PLATDATAto keep the SPL size < 40 KiB.Quoted 7 lines
Quoted 3 lines
I would prefer to keep this as
Kconfigas the PMU driver is not supporting DT and in fact nowARCH_MX28only has two boards supported - XEA and imx28evk.Why not use the platdata then ?
This makes it far better, as the code is actually always compiled and doesn't start to bitrot.
Quoted 5 lines
As fair as I can tell - the MX28 PMU driver in SPL is not supporting
OF_PLATDATA. Or have I overlooked something?I would like to investigate the PMU issue, and avoid extra work to provide platdata support for two supported imx287 based boards.
Hum, considering that this platform is basically legacy and winding down, I guess that's OK too.
Hi Marek,
Quoted 32 lines · Lukasz Majewski
Quoted 31 lines
Hi Marek,
Quoted 28 lines · Lukasz Majewski
Quoted 1 line
Hi Marek,
Hi,
Quoted 13 lines
Quoted 5 lines · Lukasz Majewski
Quoted 4 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).Quoted 7 lines
Quoted 4 lines
This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
Quoted 6 lines
This platform uses only
SPL_OF_PLATDATAto keep the SPL size < 40 KiB.I would prefer to keep this as
Kconfigas the PMU driver is not supporting DT and in fact nowARCH_MX28only has two boards supported - XEA and imx28evk.Why not use the platdata then ?
This makes it far better, as the code is actually always compiled and doesn't start to bitrot.
Quoted 8 lines
Quoted 5 lines
As fair as I can tell - the MX28 PMU driver in SPL is not supporting
OF_PLATDATA. Or have I overlooked something?I would like to investigate the PMU issue, and avoid extra work to provide platdata support for two supported imx287 based boards.
Hum, considering that this platform is basically legacy and winding down, I guess that's OK too.
Are there any other issues to be solved? Or is this patch set eligible for pulling?
(Especially that NXP has confirmed that approach used in this patch set is in sync with their idea of PMU usage).
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]
On 5/19/23 10:41, Lukasz Majewski wrote:
Hello Lukasz,
Quoted 30 lines
Quoted 30 lines
Quoted 29 lines
Quoted 16 lines
Quoted 16 lines
Quoted 5 lines · Lukasz Majewski
Quoted 4 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT).Quoted 7 lines
Quoted 4 lines
This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems where
DCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).Is it possible to dig this information out of DT or is the DT not available in SPL for this platform ?
This platform uses only
SPL_OF_PLATDATAto keep the SPL size < 40 KiB.Quoted 7 lines
Quoted 3 lines
I would prefer to keep this as
Kconfigas the PMU driver is not supporting DT and in fact nowARCH_MX28only has two boards supported - XEA and imx28evk.Why not use the platdata then ?
This makes it far better, as the code is actually always compiled and doesn't start to bitrot.As fair as I can tell - the MX28 PMU driver in SPL is not supporting
OF_PLATDATA. Or have I overlooked something?I would like to investigate the PMU issue, and avoid extra work to provide platdata support for two supported imx287 based boards.
Quoted 8 lines
Quoted 2 lines
Hum, considering that this platform is basically legacy and winding down, I guess that's OK too.
Are there any other issues to be solved? Or is this patch set eligible for pulling?
(Especially that NXP has confirmed that approach used in this patch set is in sync with their idea of PMU usage).
I think this is just waiting for Stefano to pick and do a MR
Fabio Estevam
reviewerHi Lukasz,
The series looks good. Only a minor comment:
arch/arm/mach-imx/mxs/Kconfig endchoice · line 56
Quoted 3 lines · Lukasz Majewski
arch/arm/mach-imx/mxs/Kconfig +3
-0+config SPL_MXS_PMU_MINIMAL_VDD5V_CURRENT + bool "Force minimal current draw from VDD5V by MX28 PMU" + default n
Please drop "default n" as it is already the default.
The same applies to patch 2/5.
Thanks
PATCH 1/5 arm: mxs: Provide Kconfig option to to not use VDD5V as IMX28 PMU source
In reply to Lukasz MajewskiQuoted 7 lines
This option sets the current limit for 5V source to zero, so all the PMU outputs are primarily powered from battery source (
DCDC_BAT). This option may be set on systems, where the 5V is NOT supposed to be in any scenario powering the system - for example on systems whereDCDC_BATis connected to fixed and regulated 4.2V source (so the "battery" is not present).Signed-off-by Lukasz Majewski <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================