From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpCWo-0000K5-F0 for barebox@lists.infradead.org; Mon, 13 Aug 2018 13:05:05 +0000 From: Roland Hieber Date: Mon, 13 Aug 2018 15:02:57 +0200 Message-Id: <20180813130300.32497-12-r.hieber@pengutronix.de> In-Reply-To: <20180813130300.32497-1-r.hieber@pengutronix.de> References: <20180813130300.32497-1-r.hieber@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v3 11/14] ARM: MXS: make VDDx brownout setup more understandable To: barebox@lists.infradead.org Cc: Roland Hieber 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 --- 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