RE: [RFC 06/10] pcie: starfive: Add a optional power gpio support

Hal Feng
2025-10-22T07:23:11Z

> On 03.09.25 07:48, E Shattow wrote:
> On 8/28/25 23:09, Hal Feng wrote:
> > Get a optional power gpio and enable it if it is valid.
> >
>
> I see this appears to be a normal thing that needs implemented in U-Boot to
> have parity with Linux kernel, but the commit message should help me
> understand why so I don't have to think so hard.
>
> Expand why this is useful and how this is implemented in Linux kernel, what is
> the API reference or something to give reason why U-Boot can expect the
> devicetree property to be present from upstream devicetree-rebasing.

OK. Will improve the commit messages. Thanks.

Best regards,
Hal

>
> > Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
> > ---
> > drivers/pci/pcie_starfive_jh7110.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/pci/pcie_starfive_jh7110.c
> > b/drivers/pci/pcie_starfive_jh7110.c
> > index 51aca7359ff..f6b50d12a90 100644
> > --- a/drivers/pci/pcie_starfive_jh7110.c
> > +++ b/drivers/pci/pcie_starfive_jh7110.c
> > @@ -45,6 +45,7 @@ struct starfive_pcie {
> > struct pcie_plda plda;
> > struct clk_bulk clks;
> > struct reset_ctl_bulk rsts;
> > + struct gpio_desc power_gpio;
> > struct gpio_desc reset_gpio;
> > struct regmap *regmap;
> > unsigned int stg_pcie_base;
> > @@ -184,6 +185,10 @@ static int starfive_pcie_parse_dt(struct udevice
> *dev)
> > dev_err(dev, "reset-gpio is not valid\n");
> > return -EINVAL;
> > }
> > +
> > + gpio_request_by_name(dev, "enable-gpios", 0, &priv->power_gpio,
> > + GPIOD_IS_OUT);
> > +
> > return 0;
> > }
> >
> > @@ -205,6 +210,9 @@ static int starfive_pcie_init_port(struct udevice *dev)
> > goto err_deassert_clk;
> > }
> >
> > + if (dm_gpio_is_valid(&priv->power_gpio))
> > + dm_gpio_set_value(&priv->power_gpio, 1);
> > +
> > dm_gpio_set_value(&priv->reset_gpio, 1);
> > /* Disable physical functions except #0 */
> > for (i = 1; i < PLDA_FUNC_NUM; i++) {
>
> -E