Skip to content

Commit ce005cf

Browse files
Mike Rapoportolofj
authored andcommitted
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>
1 parent c4d9e4a commit ce005cf

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

arch/arm/mach-tegra/board-harmony-pcie.c

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,29 @@
2727

2828
#ifdef CONFIG_TEGRA_PCI
2929

30+
/* GPIO 3 of the PMIC */
31+
#define EN_VDD_1V05_GPIO (TEGRA_NR_GPIOS + 2)
32+
3033
static int __init harmony_pcie_init(void)
3134
{
35+
struct regulator *regulator = NULL;
3236
int err;
3337

3438
if (!machine_is_harmony())
3539
return 0;
3640

41+
err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
42+
if (err)
43+
return err;
44+
45+
gpio_direction_output(EN_VDD_1V05_GPIO, 1);
46+
47+
regulator = regulator_get(NULL, "pex_clk");
48+
if (IS_ERR_OR_NULL(regulator))
49+
goto err_reg;
50+
51+
regulator_enable(regulator);
52+
3753
tegra_pinmux_set_tristate(TEGRA_PINGROUP_GPV, TEGRA_TRI_NORMAL);
3854
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_NORMAL);
3955
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_NORMAL);
@@ -49,9 +65,15 @@ static int __init harmony_pcie_init(void)
4965
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXA, TEGRA_TRI_TRISTATE);
5066
tegra_pinmux_set_tristate(TEGRA_PINGROUP_SLXK, TEGRA_TRI_TRISTATE);
5167

68+
regulator_disable(regulator);
69+
regulator_put(regulator);
70+
err_reg:
71+
gpio_free(EN_VDD_1V05_GPIO);
72+
5273
return err;
5374
}
5475

55-
subsys_initcall(harmony_pcie_init);
76+
/* PCI should be initialized after I2C, mfd and regulators */
77+
subsys_initcall_sync(harmony_pcie_init);
5678

5779
#endif

0 commit comments

Comments
 (0)