From: Roland Hieber <r.hieber@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Roland Hieber <r.hieber@pengutronix.de>
Subject: [PATCH v3 11/14] ARM: MXS: make VDDx brownout setup more understandable
Date: Mon, 13 Aug 2018 15:02:57 +0200 [thread overview]
Message-ID: <20180813130300.32497-12-r.hieber@pengutronix.de> (raw)
In-Reply-To: <20180813130300.32497-1-r.hieber@pengutronix.de>
Rename bo_int to prev_bo_enirq to make its purpose clearer, and throw in
a few comments for easier understanding.
Signed-off-by: Roland Hieber <r.hieber@pengutronix.de>
---
arch/arm/mach-mxs/power-init.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-mxs/power-init.c b/arch/arm/mach-mxs/power-init.c
index 6796a4491d..9ab36463e2 100644
--- a/arch/arm/mach-mxs/power-init.c
+++ b/arch/arm/mach-mxs/power-init.c
@@ -1066,7 +1066,7 @@ static void mxs_power_set_vddx(const struct mxs_vddx_cfg *cfg,
{
struct mxs_power_regs *power_regs =
(struct mxs_power_regs *)IMX_POWER_BASE;
- uint32_t cur_target, diff, bo_int = 0;
+ uint32_t cur_target, diff, prev_bo_enirq = 0;
uint32_t powered_by_linreg = 0;
int adjust_up, tmp;
@@ -1082,8 +1082,10 @@ static void mxs_power_set_vddx(const struct mxs_vddx_cfg *cfg,
powered_by_linreg = cfg->powered_by_linreg();
if (adjust_up && cfg->bo_irq) {
+ /* temporarily disable brownout to prevent it from taking
+ effect prematurely during the adjustment */
if (powered_by_linreg) {
- bo_int = readl(&power_regs->hw_power_ctrl);
+ prev_bo_enirq = readl(&power_regs->hw_power_ctrl) & cfg->bo_enirq;
writel(cfg->bo_enirq, &power_regs->hw_power_ctrl_clr);
}
setbits_le32(cfg->reg, cfg->bo_offset_mask);
@@ -1124,8 +1126,10 @@ static void mxs_power_set_vddx(const struct mxs_vddx_cfg *cfg,
if (cfg->bo_irq) {
if (adjust_up && powered_by_linreg) {
+ /* clear brownout IRQ flag in case it fired */
writel(cfg->bo_irq, &power_regs->hw_power_ctrl_clr);
- if (bo_int & cfg->bo_enirq)
+ if (prev_bo_enirq)
+ /* re-enable brownout IRQ after adjustment has finished */
writel(cfg->bo_enirq, &power_regs->hw_power_ctrl_set);
}
--
2.18.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-08-13 13:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-13 13:02 [PATCH v3 00/14] MXS low-level improvements Roland Hieber
2018-08-13 13:02 ` [PATCH v3 01/14] scripts: mxsimage: Allow unencrypted images Roland Hieber
2018-08-13 13:02 ` [PATCH v3 02/14] images: MXS: allow generation of unencrypted bootstreams Roland Hieber
2018-08-13 13:02 ` [PATCH v3 03/14] ARM: MXS: i.MX28: allow setup of low-voltage SDRAM Roland Hieber
2018-08-13 13:02 ` [PATCH v3 04/14] ARM: MXS: allow configuration of EMI clock prescaler Roland Hieber
2018-08-13 13:02 ` [PATCH v3 05/14] ARM: i.MX28: Add memory size detection Roland Hieber
2018-08-13 13:02 ` [PATCH v3 06/14] ARM: i.MX23: " Roland Hieber
2018-08-13 13:02 ` [PATCH v3 07/14] ARM: MXS: refactor mx2*_power_init source configuration Roland Hieber
2018-08-13 13:02 ` [PATCH v3 08/14] ARM: MXS: allow starting from battery input without 4P2 source enabled Roland Hieber
2018-08-13 13:02 ` [PATCH v3 09/14] ARM: MXS: make power levels configurable in mx2*_power_init Roland Hieber
2018-08-13 13:02 ` [PATCH v3 10/14] ARM: MXS: fix VDDx brownout setup logic Roland Hieber
2018-08-13 13:02 ` Roland Hieber [this message]
2018-08-13 13:02 ` [PATCH v3 12/14] ARM: MXS: mxs_power_status: use less magic values Roland Hieber
2018-08-13 13:02 ` [PATCH v3 13/14] ARM: MXS: mxs_power_status: align output Roland Hieber
2018-08-13 13:03 ` [PATCH v3 14/14] Documentation: MXS: general update and improvements Roland Hieber
2018-08-14 6:55 ` [PATCH v3 00/14] MXS low-level improvements Sascha Hauer
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=20180813130300.32497-12-r.hieber@pengutronix.de \
--to=r.hieber@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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