Message ID | 20230428182846.37414-2-inindev@gmail.com |
---|---|
State | Superseded |
Delegated to: | Kever Yang |
Headers | show |
Series | pci: pcie_dw_rockchip: support fixed vcc3v3 regulator type | expand |
Hi John, On 2023-04-28 20:28, John Clark wrote: > 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/20230422181943.889436-3-jonas@kwiboo.se/ Regards, Jonas > > 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);
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);
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(+)