[U-Boot] [PATCH v5 21/33] ARM: i.MX6: sabresd: Add imx6_pcie_toggle_power

Jagan Teki jagan at openedev.com
Thu May 4 15:11:30 UTC 2017


From: Jagan Teki <jagan at amarulasolutions.com>

Add imx6_pcie_toggle_power 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 | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 1df81b9..2ed4e50 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -533,6 +533,36 @@ int overwrite_console(void)
 	return 1;
 }
 
+#ifdef CONFIG_OF_CONTROL
+int imx6_pcie_toggle_power(void)
+{
+#ifdef CONFIG_PCIE_IMX_POWER_GPIO
+	struct gpio_desc toggle;
+	int ret;
+
+	ret = dm_gpio_lookup_name("GPIO3_19", &toggle);
+	if (ret) {
+		printf("Cannot get GPIO3_19\n");
+		return ret;
+	}
+
+	ret = dm_gpio_request(&toggle, "toggle");
+	if (ret) {
+		printf("Cannot request GPIO3_19\n");
+		return ret;
+	}
+
+	dm_gpio_set_dir_flags(&toggle, GPIOD_IS_OUT);
+
+	dm_gpio_set_value(&toggle, 0);
+	mdelay(20);
+	dm_gpio_set_value(&toggle, 1);
+	mdelay(20);
+#endif
+	return 0;
+}
+#endif
+
 #ifndef CONFIG_OF_CONTROL
 int board_eth_init(bd_t *bis)
 {
-- 
1.9.1



More information about the U-Boot mailing list