Skip to contentSkip to conversation

pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type

PATCH In review John Clark 2 participants 3 messages Apr 28, 2023 – Apr 29, 2023

Subsystems (2)
lore
Share & tools
lore

John Clark

author
#0 lore raw

cover pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type

When trying to nvme boot rk3568 boards (tested with odroid-m1 and nanopi-r5s), it failes with error -19. This is because it is trying to set the voltage of a fixed-regulator to 3.3v.

John Clark (1):
pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type

 drivers/pci/pcie_dw_rockchip.c | 7 +++++++
 1 file changed, 7 insertions(+)
Signature · 1 line
2.39.2 (Apple Git-143)
author
#1 lore raw

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

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.

---

 drivers/pci/pcie_dw_rockchip.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pci/pcie_dw_rockchip.c +7 -0
index 9322e735b9..a30fb45222 100644
@@ -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);
Signature · 1 line
2.39.2 (Apple Git-143)
#2 lore raw

Hi John,

Quoted 6 lines · John Clark

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.

Please see patch [1] in my series "rockchip: Fix PCIe and NVMe support on RK3568", that series fixes this and other issues to fully support PCIe and NVMe on RK3568.

[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Regards,
Jonas

Quoted 26 lines

---

 drivers/pci/pcie_dw_rockchip.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/pci/pcie_dw_rockchip.c +7 -0
index 9322e735b9..a30fb45222 100644
@@ -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);