mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
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 <hal.feng@starfivetech.com>
This commit is contained in:
committed by
Leo Yu-Chi Liang
parent
ab4f610deb
commit
a10587939b
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user