public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: John Clark <inindev@gmail.com>
To: Kever Yang <kever.yang@rock-chips.com>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de, John Clark <inindev@gmail.com>
Subject: [PATCH 1/1] pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type
Date: Fri, 28 Apr 2023 14:28:46 -0400	[thread overview]
Message-ID: <20230428182846.37414-2-inindev@gmail.com> (raw)
In-Reply-To: <20230428182846.37414-1-inindev@gmail.com>

If the regulator is fixed, the call to regulator_set_value will fail with
-ENOSYS as fixed regulators do not support dm_regulator_ops->set_value.
    see: regulator-uclass.c, regulator_set_value(), ops->set_value

This patch ignores -ENOSYS and enables the regulator via
regulator_set_enable which should be suitable for all regulator types.

Signed-off-by: John Clark <inindev@gmail.com>

---

 drivers/pci/pcie_dw_rockchip.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c
index 9322e735b9..a30fb45222 100644
--- a/drivers/pci/pcie_dw_rockchip.c
+++ b/drivers/pci/pcie_dw_rockchip.c
@@ -289,6 +289,13 @@ static int rockchip_pcie_init_port(struct udevice *dev)
 	/* Set power and maybe external ref clk input */
 	if (priv->vpcie3v3) {
 		ret = regulator_set_value(priv->vpcie3v3, 3300000);
+		if (ret && ret != -ENOSYS) {
+			dev_err(priv->dw.dev,
+				"failed to set vpcie3v3 value (ret=%d)\n", ret);
+			return ret;
+		}
+
+		ret = regulator_set_enable(priv->vpcie3v3, true);
 		if (ret) {
 			dev_err(priv->dw.dev, "failed to enable vpcie3v3 (ret=%d)\n",
 				ret);
-- 
2.39.2 (Apple Git-143)


  reply	other threads:[~2023-04-28 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28 18:28 [PATCH 0/1] pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type John Clark
2023-04-28 18:28 ` John Clark [this message]
2023-04-29  9:44   ` [PATCH 1/1] " Jonas Karlman

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=20230428182846.37414-2-inindev@gmail.com \
    --to=inindev@gmail.com \
    --cc=kever.yang@rock-chips.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.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