From a10587939bcc7d9325dbe24cde335a65887f9377 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Fri, 24 Oct 2025 16:59:29 +0800 Subject: pcie: starfive: Add a optional power gpio support 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. Signed-off-by: Hal Feng --- drivers/pci/pcie_starfive_jh7110.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers') diff --git a/drivers/pci/pcie_starfive_jh7110.c b/drivers/pci/pcie_starfive_jh7110.c index 761e64be58a..88a2bf84538 100644 --- a/drivers/pci/pcie_starfive_jh7110.c +++ b/drivers/pci/pcie_starfive_jh7110.c @@ -42,6 +42,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; @@ -181,6 +182,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; } @@ -202,6 +207,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++) { -- cgit v1.2.3