mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Cc: mgr@pengutronix.de
Subject: [PATCH 2/2] regulator: stm32-pwr: don't propagate regulator turn-off to supply
Date: Mon, 21 Dec 2020 01:32:51 +0100	[thread overview]
Message-ID: <20201221003251.83042-3-ahmad@a3f.at> (raw)
In-Reply-To: <20201221003251.83042-1-ahmad@a3f.at>

Linux walks up the regulator supply chain in the core code, which we
don't do in barebox. Instead the stm32-pwr driver did enable/disable its
parent manually. This is problematic, because it doesn't respect
the regulator-always-on flag the parent supply may have, leading to
prohibited disabling of regulators. Work around this by dropping the
regulator disable altogether and just enable the parent supply
unconditionally.

When we gain proper regulator supply chain handling, this patch can be
reverted.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 drivers/regulator/stm32-pwr.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/stm32-pwr.c b/drivers/regulator/stm32-pwr.c
index 7df8074ba78e..4cb46b081abb 100644
--- a/drivers/regulator/stm32-pwr.c
+++ b/drivers/regulator/stm32-pwr.c
@@ -86,8 +86,6 @@ static int stm32_pwr_reg_enable(struct regulator_dev *rdev)
 	int ret;
 	u32 val;
 
-	regulator_enable(priv->supply);
-
 	val = readl(priv->base + REG_PWR_CR3);
 	val |= rdev->desc->enable_mask;
 	writel(val, priv->base + REG_PWR_CR3);
@@ -120,8 +118,6 @@ static int stm32_pwr_reg_disable(struct regulator_dev *rdev)
 		dev_err(rdev->dev, "%s: regulator disable timed out!\n",
 			desc->name);
 
-	regulator_disable(priv->supply);
-
 	return ret;
 }
 
@@ -194,6 +190,8 @@ static int stm32_pwr_regulator_probe(struct device_d *dev)
 				desc->name, ret);
 			goto release_region;
 		}
+
+		regulator_enable(priv->supply);
 	}
 
 	return 0;
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2020-12-21  0:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21  0:32 [PATCH 0/2] usb: dwc2: gadget: fix stm32mp1 hang on barebox shutdown Ahmad Fatoum
2020-12-21  0:32 ` [PATCH 1/2] fixup! usb: dwc2: Add support for optional usb phy Ahmad Fatoum
2021-01-06 10:05   ` Sascha Hauer
2022-03-21 22:17     ` Michael Grzeschik
2022-03-22  5:35       ` Ahmad Fatoum
2022-03-22  8:19         ` Michael Grzeschik
2022-03-22  8:25           ` Ahmad Fatoum
2022-03-22  8:29             ` Michael Grzeschik
2022-03-22  9:23               ` Jules Maselbas
2020-12-21  0:32 ` Ahmad Fatoum [this message]

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=20201221003251.83042-3-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    --cc=mgr@pengutronix.de \
    /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