]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
pcie: starfive: Add a optional power gpio support
authorHal Feng <hal.feng@starfivetech.com>
Fri, 24 Oct 2025 08:59:29 +0000 (16:59 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Mon, 16 Mar 2026 17:36:57 +0000 (01:36 +0800)
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 <hal.feng@starfivetech.com>
drivers/pci/pcie_starfive_jh7110.c

index 761e64be58a590c4ec6433c1b44db19ae7fa7bd3..88a2bf8453893e682b6bbeaeef6c299b7c38d0ff 100644 (file)
@@ -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++) {