[PATCH v1 6/9] pcie: starfive: Add a optional power gpio support
    Hal Feng 
    hal.feng at starfivetech.com
       
    Mon Oct 27 09:26:30 CET 2025
    
    
  
> On 24.10.25 21:10, E Shattow wrote:
> On 10/24/25 01:59, Hal Feng wrote:
> > Get and enable a optional power gpio. This feature is ported from the
> > jh7110 pcie driver in Linux. VisionFive 2 Lite needs this gpio to
> > enable the PCI bus device (M.2 M-Key) power.
> >
> 
> That's alright. Good.
> 
> > Signed-off-by: Hal Feng <hal.feng at 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 0908ae16b67..04088b48ddc 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);
> > +
> 
> Are we missing some error handling here? I don't know, everything else
> above in the function is verbose with the dev_err() reporting.
The power gpio is optional, so I did not handle the error return here.
Best regards,
Hal
> 
> >  	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++) {
> 
> With that,
> 
> Reviewed-by: E Shattow <e at freeshell.de>
    
    
More information about the U-Boot
mailing list