[PATCH 1/1] pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type

John Clark inindev at gmail.com
Fri Apr 28 20:28:46 CEST 2023


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 at 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)



More information about the U-Boot mailing list