ARM: tegra: harmony: update PCI-e initialization sequence
On Harmony board PCI-e subsystem can be enabled only after certain voltage regulators are on. One of the regulators is an internal regulator on the PMIC and another one is controlled by a PMIC GPIO. Addition of the voltage control to the Harmony PCI-e initialization allows booting of kernel with CONFIG_TEGRA_PCI even if the PMIC driver is not loaded. In this case the PCI-e initialization will fail gracefully intead of hanging the system. Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
parent
c4d9e4a0b9
commit
ce005cf450
|
@ -27,13 +27,29 @@
|
||||||
|
|
||||||
#ifdef CONFIG_TEGRA_PCI
|
#ifdef CONFIG_TEGRA_PCI
|
||||||
|
|
||||||
|
/* GPIO 3 of the PMIC */
|
||||||
|
#define EN_VDD_1V05_GPIO (TEGRA_NR_GPIOS + 2)
|
||||||
|
|
||||||
static int __init harmony_pcie_init(void)
|
static int __init harmony_pcie_init(void)
|
||||||
{
|
{
|
||||||
|
struct regulator *regulator = NULL;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!machine_is_harmony())
|
if (!machine_is_harmony())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
gpio_direction_output(EN_VDD_1V05_GPIO, 1);
|
||||||
|
|
||||||
|
regulator = regulator_get(NULL, "pex_clk");
|
||||||
|
if (IS_ERR_OR_NULL(regulator))
|
||||||
|
goto err_reg;
|
||||||
|
|
||||||
|
regulator_enable(regulator);
|
||||||
|
|
||||||
tegra_pinmux_set_tristate(TEGRA_PINGROUP_GPV, TEGRA_TRI_NORMAL);
|
tegra_pinmux_set_tristate(TEGRA_PINGROUP_GPV, TEGRA_TRI_NORMAL);
|
||||||
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_NORMAL);
|
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_NORMAL);
|
||||||
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_NORMAL);
|
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_NORMAL);
|
||||||
|
@ -49,9 +65,15 @@ err_pcie:
|
||||||
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_TRISTATE);
|
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_TRISTATE);
|
||||||
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_TRISTATE);
|
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_TRISTATE);
|
||||||
|
|
||||||
|
regulator_disable(regulator);
|
||||||
|
regulator_put(regulator);
|
||||||
|
err_reg:
|
||||||
|
gpio_free(EN_VDD_1V05_GPIO);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
subsys_initcall(harmony_pcie_init);
|
/* PCI should be initialized after I2C, mfd and regulators */
|
||||||
|
subsys_initcall_sync(harmony_pcie_init);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue