summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-07-23 14:42:13 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2017-12-21 14:27:15 +0100
commit11d65dc74ae7659ed5d6f116a6aa1ac1f7aaefbb (patch)
tree331625573d3804368d16ef65bda5586c17f36fc7
parentee4c0dec087d836246c82d9fc0a7a305b93c6ab2 (diff)
mach-imx6q.c: handle RESET_MOCI when PCIe is disabled
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 02110528b45ae331d89f7e7bb6a29b5494ec0be1) (cherry picked from commit 8d07763eb1d6a2a11e9b237ac94b8de43183b02e) Conflicts: arch/arm/mach-imx/mach-imx6q.c (cherry picked from commit bea05755680df306e93e5a13f730fd1db203f947)
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c35
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 b884209edaa6..7569722ff7ea 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -21,6 +21,7 @@
#include <linux/irqchip.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_gpio.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/pm_opp.h>
@@ -40,6 +41,37 @@
#include "cpuidle.h"
#include "hardware.h"
+/* 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__);
+ }
+ }
+ }
+}
+
/* For imx6q sabrelite board: set KSZ9021RN RGMII pad skew */
static int ksz9021rn_phy_fixup(struct phy_device *phydev)
{
@@ -335,6 +367,9 @@ static void __init imx6q_init_machine(void)
imx6q_csi_mux_init();
cpu_is_imx6q() ? imx6q_pm_init() : imx6dl_pm_init();
imx6q_axi_init();
+
+ if (of_machine_is_compatible("toradex,apalis_imx6q"))
+ apalis_reset_moci();
}
#define OCOTP_CFG3 0x440