public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alan Kay <alan@londelec.com>
To: Stefano Babic <sbabic@denx.de>
Cc: Marek Vasut <marex@denx.de>, Alan Kay <alan@londelec.com>,
	Fabio Estevam <festevam@gmail.com>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	u-boot@lists.denx.de
Subject: [RFC PATCH] mxs: Don't enable 4P2 reg if mx28 is powered only from DCDC_BATT without 5V
Date: Tue, 30 Aug 2022 18:49:32 +0100	[thread overview]
Message-ID: <20220830174932.96360-1-alan@londelec.com> (raw)

mxs_power_enable_4p2() was added to mxs_batt_boot() in
'commit a0f97610757d ("ARM: mxs: Enable DCDC converter for battery boot")'
to enable DCDC converter when board is powered from 5V and has
detected sufficient battery voltage.
This involves enabling 4P2 regulator and there is a code
in mxs_power_enable_4p2() that disables VDDIO, VDDA, VDDD outputs of
the DCDC converter and enables BO for each power rail e.g.

	setbits_le32(&power_regs->hw_power_vddioctrl,
		POWER_VDDIOCTRL_DISABLE_FET | POWER_VDDIOCTRL_PWDN_BRNOUT);

In case the mx28 is powered by the 5V source and linear regulators are
supplying power to the VDDIO, VDDA, VDDD rails there is no issue.

However if the mx28 is powered by the DCDC_BATT source only without 5V,
disabling the DCDC converter outputs causes brownout power down.

The proposed solution is not to call mxs_power_enable_4p2() at all
if the mx28 is powered by the DCDC_BATT source only. There is no
reason to enable 4P2 regulator in this case and setup of all registers
is done in mxs_batt_boot().

Also there is no need to enable 5V brownout in
mxs_power_init() in this case.

Please consider if this is acceptable and I will submit a proper patch.

Signed-off-by: Alan Kay <alan@londelec.com>
---

 arch/arm/cpu/arm926ejs/mxs/spl_power_init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index c33170f06d..c8feadce54 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -752,7 +752,9 @@ static void mxs_batt_boot(void)
 		POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
 		0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
 
+#ifndef CONFIG_SPL_MXS_NO_VDD5V_SOURCE
 	mxs_power_enable_4p2();
+#endif
 }
 
 /**
@@ -1267,7 +1269,9 @@ void mxs_power_init(void)
 		POWER_CTRL_VBUS_VALID_IRQ | POWER_CTRL_BATT_BO_IRQ |
 		POWER_CTRL_DCDC4P2_BO_IRQ, &power_regs->hw_power_ctrl_clr);
 
+#ifndef CONFIG_SPL_MXS_NO_VDD5V_SOURCE
 	writel(POWER_5VCTRL_PWDN_5VBRNOUT, &power_regs->hw_power_5vctrl_set);
+#endif
 
 	early_delay(1000);
 }
-- 
2.25.1


             reply	other threads:[~2022-08-30 18:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30 17:49 Alan Kay [this message]
2023-10-07 17:46 ` [RFC PATCH] mxs: Don't enable 4P2 reg if mx28 is powered only from DCDC_BATT without 5V Fabio Estevam
2023-10-09  7:49   ` Lukasz Majewski
2023-10-09 12:45     ` Alan Kay
2023-12-15 16:20       ` Fabio Estevam
2023-12-15 19:23         ` Fabio Estevam
2023-12-19  8:50           ` Cody Green

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220830174932.96360-1-alan@londelec.com \
    --to=alan@londelec.com \
    --cc=festevam@gmail.com \
    --cc=marex@denx.de \
    --cc=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox