diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2015-07-23 14:42:13 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2015-08-24 14:32:18 +0200 |
commit | d67b7086ffa0db26050d15cec3e88bb38de2a8a3 (patch) | |
tree | 01d705e33b9a3e075c6d32a07a638e35d986bee3 /arch | |
parent | 41bd4be7bad6a6d949d1d637b0080cd8cdf170e2 (diff) |
mach-imx6q.c: handle RESET_MOCI when PCIe is disabled
(cherry picked from commit 02110528b45ae331d89f7e7bb6a29b5494ec0be1)
Conflicts:
arch/arm/mach-imx/mach-imx6q.c
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/mach-imx6q.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index cacbd8fe6507..d7f0c494a77b 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -46,6 +46,38 @@ #include "hardware.h" static struct fec_platform_data fec_pdata; + +/* The PCIe switch on the Apalis Evaluation Board requires to have its reset + * deasserted some time before the reset of the downstream endpoints. + * The downstream endpoints use RESET_MOCI while the PCIe switch uses GPIO7 + * for reset. + * Handle RESET_MOCI when the PCIe driver is not configured or disabled in + * the device tree */ +static void apalis_reset_moci(void) +{ + struct device_node *np; + int ret, reset_moci_gpio, no_pcie; +#ifdef CONFIG_PCI_IMX6 + no_pcie = 0; +#else + no_pcie = 1; +#endif + + np = of_find_node_by_name(NULL, "pcie"); + if (!of_device_is_available(np) || no_pcie) { + reset_moci_gpio = of_get_named_gpio(np, "reset-ep-gpio", 0); + if (gpio_is_valid(reset_moci_gpio)) { + ret = gpio_request_one(reset_moci_gpio, + GPIOF_OUT_INIT_LOW, + "RESET_MOCI"); + if (ret) { + pr_err("%s(): unable to get RESET_MOCI gpio" + " from dt pcie node\n", __func__); + } + } + } +} + static struct flexcan_platform_data flexcan_pdata[2]; static int flexcan_en_gpio; static int flexcan_stby_gpio; @@ -464,6 +496,9 @@ static void __init imx6q_init_machine(void) imx_anatop_init(); imx6q_csi_mux_init(); cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init(); + + if (of_machine_is_compatible("toradex,apalis_imx6q")) + apalis_reset_moci(); } #define OCOTP_CFG3 0x440 |