diff options
Diffstat (limited to 'drivers/pci/pcie_imx.c')
-rw-r--r-- | drivers/pci/pcie_imx.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c index 2cec3900e9..46ac01713f 100644 --- a/drivers/pci/pcie_imx.c +++ b/drivers/pci/pcie_imx.c @@ -14,6 +14,7 @@ #include <log.h> #include <malloc.h> #include <pci.h> +#include <power/regulator.h> #include <asm/arch/clock.h> #include <asm/arch/iomux.h> #include <asm/arch/crm_regs.h> @@ -102,6 +103,7 @@ struct imx_pcie_priv { void __iomem *cfg_base; struct gpio_desc reset_gpio; bool reset_active_high; + struct udevice *vpcie; }; /* @@ -530,7 +532,7 @@ static int imx6_pcie_init_phy(void) return 0; } -__weak int imx6_pcie_toggle_power(void) +int imx6_pcie_toggle_power(struct udevice *vpcie) { #ifdef CONFIG_PCIE_IMX_POWER_GPIO gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power"); @@ -540,10 +542,19 @@ __weak int imx6_pcie_toggle_power(void) mdelay(20); gpio_free(CONFIG_PCIE_IMX_POWER_GPIO); #endif + +#if CONFIG_IS_ENABLED(DM_REGULATOR) + if (vpcie) { + regulator_set_enable(vpcie, false); + mdelay(20); + regulator_set_enable(vpcie, true); + mdelay(20); + } +#endif return 0; } -__weak int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high) +int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high) { /* * See 'PCI EXPRESS BASE SPECIFICATION, REV 3.0, SECTION 6.6.1' @@ -559,12 +570,6 @@ __weak int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high) * configuration file and the condition below will handle the rest * of the reset toggling. * - * In case your #PERST toggling logic is more complex, for example - * connected via CPLD or somesuch, you can override this function - * in your board file and implement reset logic as needed. You must - * not forget to wait at least 20 ms after de-asserting #PERST in - * this case either though. - * * In case your #PERST line of the PCIe EP device is not connected * at all, your design is broken and you should fix your design, * otherwise you will observe problems like for example the link @@ -598,7 +603,7 @@ static int imx6_pcie_deassert_core_reset(struct imx_pcie_priv *priv) { struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; - imx6_pcie_toggle_power(); + imx6_pcie_toggle_power(priv->vpcie); enable_pcie_clock(); @@ -717,6 +722,10 @@ static int imx_pcie_dm_probe(struct udevice *dev) { struct imx_pcie_priv *priv = dev_get_priv(dev); +#if CONFIG_IS_ENABLED(DM_REGULATOR) + device_get_supply_regulator(dev, "vpcie-supply", &priv->vpcie); +#endif + /* if PERST# valid from dt then assert it */ gpio_request_by_name(dev, "reset-gpio", 0, &priv->reset_gpio, GPIOD_IS_OUT); |