diff mbox series

[1/5] arm: mxs: Provide Kconfig option to to not use VDD5V as IMX28 PMU source

Message ID 20230509143243.1523791-1-lukma@denx.de
State Accepted
Commit 1c3c601ac54d3e3f301f391c4aa86a891d4db6c2
Delegated to: Stefano Babic
Headers show
Series [1/5] arm: mxs: Provide Kconfig option to to not use VDD5V as IMX28 PMU source | expand

Commit Message

Lukasz Majewski May 9, 2023, 2:32 p.m. UTC
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).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 4 ++++
 arch/arm/mach-imx/mxs/Kconfig               | 8 ++++++++
 2 files changed, 12 insertions(+)

Comments

Marek Vasut May 9, 2023, 2:40 p.m. UTC | #1
On 5/9/23 16:32, Lukasz Majewski wrote:
> 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).

Is it possible to dig this information out of DT or is the DT not 
available in SPL for this platform ?
Lukasz Majewski May 9, 2023, 2:46 p.m. UTC | #2
Hi Marek,

> On 5/9/23 16:32, Lukasz Majewski wrote:
> > 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).  
> 
> 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: lukma@denx.de
Marek Vasut May 9, 2023, 2:48 p.m. UTC | #3
On 5/9/23 16:46, Lukasz Majewski wrote:
> Hi Marek,

Hi,

>> On 5/9/23 16:32, Lukasz Majewski wrote:
>>> 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).
>>
>> 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.

Why not use the platdata then ?
This makes it far better, as the code is actually always compiled and 
doesn't start to bitrot.
Lukasz Majewski May 9, 2023, 3:04 p.m. UTC | #4
Hi Marek,

> On 5/9/23 16:46, Lukasz Majewski wrote:
> > Hi Marek,  
> 
> Hi,
> 
> >> On 5/9/23 16:32, Lukasz Majewski wrote:  
> >>> 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).  
> >>
> >> 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.  
> 
> 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: lukma@denx.de
Marek Vasut May 9, 2023, 3:51 p.m. UTC | #5
On 5/9/23 17:04, Lukasz Majewski wrote:
> Hi Marek,
> 
>> On 5/9/23 16:46, Lukasz Majewski wrote:
>>> Hi Marek,
>>
>> Hi,
>>
>>>> On 5/9/23 16:32, Lukasz Majewski wrote:
>>>>> 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).
>>>>
>>>> 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.
>>
>> 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.

Hum, considering that this platform is basically legacy and winding 
down, I guess that's OK too.
Fabio Estevam May 10, 2023, 2:28 p.m. UTC | #6
Hi Lukasz,

The series looks good. Only a minor comment:

On Tue, May 9, 2023 at 11:33 AM Lukasz Majewski <lukma@denx.de> wrote:

> +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
Lukasz Majewski May 19, 2023, 8:41 a.m. UTC | #7
Hi Marek,

> On 5/9/23 17:04, Lukasz Majewski wrote:
> > Hi Marek,
> >   
> >> On 5/9/23 16:46, Lukasz Majewski wrote:  
> >>> Hi Marek,  
> >>
> >> Hi,
> >>  
> >>>> On 5/9/23 16:32, Lukasz Majewski wrote:  
> >>>>> 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).  
> >>>>
> >>>> 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.  
> >>
> >> 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.  
> 
> 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: lukma@denx.de
Marek Vasut May 19, 2023, 12:43 p.m. UTC | #8
On 5/19/23 10:41, Lukasz Majewski wrote:

Hello Lukasz,

>>>>>> On 5/9/23 16:32, Lukasz Majewski wrote:
>>>>>>> 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).
>>>>>>
>>>>>> 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.
>>>>
>>>> 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.
>>
>> 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
Stefano Babic July 11, 2023, 7:44 p.m. UTC | #9
> 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).
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index c33170f06d..9965810ac2 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -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();
 }
 
diff --git a/arch/arm/mach-imx/mxs/Kconfig b/arch/arm/mach-imx/mxs/Kconfig
index b2026a3758..3232b0fb67 100644
--- a/arch/arm/mach-imx/mxs/Kconfig
+++ b/arch/arm/mach-imx/mxs/Kconfig
@@ -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"