mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 12:56:00 +01:00
pci: imx: use vpcie-supply if defined by device-tree
If vpcie-supply is defined by device-tree use that if CONFIG_PCIE_IMX_POWER_GPIO is not defined. Note that after this the following boards which define CONFIG_PCIE_IMX_POWER_GPIO in their board header file as well as their device-tree should be able to remove CONFIG_PCIE_IMX_PERST_GPIO without consequence: - mx6sabresd - mx6sxsabresd - novena Note that the ge_bx50v3 board uses CONFIG_PCIE_IMX_POWER_GPIO and does not have vpcie-supply defined in it's pcie node in the dt thus removing CONFIG_PCIE_IMX_POWER_GPIO globally can't be done until that board adds vpcie-supply. Cc: Ian Ray <ian.ray@ge.com> (maintainer:GE BX50V3 BOARD) Cc: Sebastian Reichel <sebastian.reichel@collabora.com> (maintainer:GE BX50V3 BOARD) Cc: Fabio Estevam <festevam@gmail.com> (maintainer:MX6SABRESD BOARD) Cc: Marek Vasut <marex@denx.de> (maintainer:NOVENA BOARD) Signed-off-by: Tim Harvey <tharvey@gateworks.com>
This commit is contained in:
parent
fc102c87c1
commit
6f6e069ca3
@ -18,7 +18,7 @@
|
|||||||
#define is_usbotg_phy_active(void) (!(readl(USB_PHY0_BASE_ADDR + USBPHY_PWD) & \
|
#define is_usbotg_phy_active(void) (!(readl(USB_PHY0_BASE_ADDR + USBPHY_PWD) & \
|
||||||
USBPHY_PWD_RXPWDRX))
|
USBPHY_PWD_RXPWDRX))
|
||||||
|
|
||||||
int imx6_pcie_toggle_power(void);
|
int imx6_pcie_toggle_power(struct udevice *vpcie);
|
||||||
int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high);
|
int imx6_pcie_toggle_reset(struct gpio_desc *gpio, bool active_high);
|
||||||
|
|
||||||
enum ldo_reg {
|
enum ldo_reg {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <pci.h>
|
#include <pci.h>
|
||||||
|
#include <power/regulator.h>
|
||||||
#include <asm/arch/clock.h>
|
#include <asm/arch/clock.h>
|
||||||
#include <asm/arch/iomux.h>
|
#include <asm/arch/iomux.h>
|
||||||
#include <asm/arch/crm_regs.h>
|
#include <asm/arch/crm_regs.h>
|
||||||
@ -102,6 +103,7 @@ struct imx_pcie_priv {
|
|||||||
void __iomem *cfg_base;
|
void __iomem *cfg_base;
|
||||||
struct gpio_desc reset_gpio;
|
struct gpio_desc reset_gpio;
|
||||||
bool reset_active_high;
|
bool reset_active_high;
|
||||||
|
struct udevice *vpcie;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -530,7 +532,7 @@ static int imx6_pcie_init_phy(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak int imx6_pcie_toggle_power(void)
|
__weak int imx6_pcie_toggle_power(struct udevice *vpcie)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PCIE_IMX_POWER_GPIO
|
#ifdef CONFIG_PCIE_IMX_POWER_GPIO
|
||||||
gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power");
|
gpio_request(CONFIG_PCIE_IMX_POWER_GPIO, "pcie_power");
|
||||||
@ -540,6 +542,15 @@ __weak int imx6_pcie_toggle_power(void)
|
|||||||
mdelay(20);
|
mdelay(20);
|
||||||
gpio_free(CONFIG_PCIE_IMX_POWER_GPIO);
|
gpio_free(CONFIG_PCIE_IMX_POWER_GPIO);
|
||||||
#endif
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +609,7 @@ static int imx6_pcie_deassert_core_reset(struct imx_pcie_priv *priv)
|
|||||||
{
|
{
|
||||||
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
|
struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
|
||||||
|
|
||||||
imx6_pcie_toggle_power();
|
imx6_pcie_toggle_power(priv->vpcie);
|
||||||
|
|
||||||
enable_pcie_clock();
|
enable_pcie_clock();
|
||||||
|
|
||||||
@ -717,6 +728,10 @@ static int imx_pcie_dm_probe(struct udevice *dev)
|
|||||||
{
|
{
|
||||||
struct imx_pcie_priv *priv = dev_get_priv(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 */
|
/* if PERST# valid from dt then assert it */
|
||||||
gpio_request_by_name(dev, "reset-gpio", 0, &priv->reset_gpio,
|
gpio_request_by_name(dev, "reset-gpio", 0, &priv->reset_gpio,
|
||||||
GPIOD_IS_OUT);
|
GPIOD_IS_OUT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user