[U-Boot] [PATCH v5 22/33] ARM: i.MX6: sabresd: Add imx6_pcie_toggle_reset
Jagan Teki
jagan at openedev.com
Thu May 4 15:11:31 UTC 2017
From: Jagan Teki <jagan at amarulasolutions.com>
Add imx6_pcie_toggle_reset on board file using dm_gpio_*
calls for OF_CONTROL configs.
Cc: Stefano Babic <sbabic at denx.de>
Cc: Fabio Estevam <fabio.estevam at nxp.com>
Cc: Michael Trimarchi <michael at amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
board/freescale/mx6sabresd/mx6sabresd.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 2ed4e50..7c28cc7 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -561,6 +561,37 @@ int imx6_pcie_toggle_power(void)
#endif
return 0;
}
+
+int imx6_pcie_toggle_reset(void)
+{
+#ifdef CONFIG_PCIE_IMX_PERST_GPIO
+ struct gpio_desc reset;
+ int ret;
+
+ ret = dm_gpio_lookup_name("GPIO7_12", &reset);
+ if (ret) {
+ printf("Cannot get GPIO7_12\n");
+ return ret;
+ }
+
+ ret = dm_gpio_request(&reset, "reset");
+ if (ret) {
+ printf("Cannot request GPIO7_12\n");
+ return ret;
+ }
+
+ dm_gpio_set_dir_flags(&reset, GPIOD_IS_OUT);
+
+ dm_gpio_set_value(&reset, 0);
+ mdelay(20);
+ dm_gpio_set_value(&reset, 1);
+ mdelay(20);
+
+#else
+ puts("WARNING: Make sure the PCIe #PERST line is connected!\n");
+#endif
+ return 0;
+}
#endif
#ifndef CONFIG_OF_CONTROL
--
1.9.1
More information about the U-Boot
mailing list