Skip to contentSkip to conversation

pci: mx6: Implement power callback

PATCH New Marek Vasut 2 participants 4 messages Mar 23, 2014 – Apr 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 pci: mx6: Implement power callback

Implement a callback to toggle the slot power supply. The callback can be overriden in case some more complex power supply for the slot was implemented in hardware, yet for the usual case, one can define a GPIO which toggles the power to the slot.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Liu Ying <[email protected]>
---
 drivers/pci/pcie_imx.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/pci/pcie_imx.c +12 -1
index 34377e9..8951a93 100644
@@ -451,6 +451,17 @@ static int imx6_pcie_init_phy(void)
 	return 0;
 }
 
+__weak int imx6_pcie_toggle_power(void)
+{
+#ifdef CONFIG_PCIE_IMX_POWER_GPIO
+	gpio_direction_output(CONFIG_PCIE_IMX_POWER_GPIO, 0);
+	mdelay(20);
+	gpio_set_value(CONFIG_PCIE_IMX_POWER_GPIO, 1);
+	mdelay(20);
+#endif
+	return 0;
+}
+
 __weak int imx6_pcie_toggle_reset(void)
 {
 	/*
@@ -496,7 +507,7 @@ static int imx6_pcie_deassert_core_reset(void)
 {
 	struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
 
-	/* FIXME: Power-up GPIO goes here. */
+	imx6_pcie_toggle_power();
 
 	/* Enable PCIe */
 	clrbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_TEST_POWERDOWN);
Signature · 1 line
1.9.0
#1 lore raw

PATCH v2 2/2 ARM: mx6: Add PCIe on SabreSDP

Add support for PCIe on MX6 SabreSDP board and enable the support in the config file.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Liu Ying <[email protected]>
---
 board/freescale/mx6sabresd/mx6sabresd.c | 11 +++++++++++
 include/configs/mx6sabresd.h            | 10 ++++++++++
 2 files changed, 21 insertions(+)

V2: Use the default slot-power callback. This is a nicer and more generic
solution, which scales and produces less polution of the code.

NOTE: Please test with and without card, and schedule for v2014.07 .
Please note I just managed to test this on MX6DL SabreSDP.

board/freescale/mx6sabresd/mx6sabresd.c +11 -0
index 12d8c56..d7d932e 100644
@@ -135,6 +135,16 @@ static void setup_spi(void)
 	imx_iomux_v3_setup_multiple_pads(ecspi1_pads, ARRAY_SIZE(ecspi1_pads));
 }
 
+iomux_v3_cfg_t const pcie_pads[] = {
+	MX6_PAD_EIM_D19__GPIO3_IO19 | MUX_PAD_CTRL(NO_PAD_CTRL),	/* POWER */
+	MX6_PAD_GPIO_17__GPIO7_IO12 | MUX_PAD_CTRL(NO_PAD_CTRL),	/* RESET */
+};
+
+static void setup_pcie(void)
+{
+	imx_iomux_v3_setup_multiple_pads(pcie_pads, ARRAY_SIZE(pcie_pads));
+}
+
 iomux_v3_cfg_t const di0_pads[] = {
 	MX6_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK,	/* DISP0_CLK */
 	MX6_PAD_DI0_PIN2__IPU1_DI0_PIN02,		/* DISP0_HSYNC */
@@ -454,6 +464,7 @@ int overwrite_console(void)
 int board_eth_init(bd_t *bis)
 {
 	setup_iomux_enet();
+	setup_pcie();
 
 	return cpu_eth_init(bis);
 }
include/configs/mx6sabresd.h +10 -0
index 4919f53..5d02d23 100644
@@ -48,4 +48,14 @@
 #define CONFIG_IPUV3_CLK 260000000
 #define CONFIG_IMX_HDMI
 
+#define CONFIG_CMD_PCI
+#ifdef CONFIG_CMD_PCI
+#define CONFIG_PCI
+#define CONFIG_PCI_PNP
+#define CONFIG_PCI_SCAN_SHOW
+#define CONFIG_PCIE_IMX
+#define CONFIG_PCIE_IMX_PERST_GPIO	IMX_GPIO_NR(7, 12)
+#define CONFIG_PCIE_IMX_POWER_GPIO	IMX_GPIO_NR(3, 19)
+#endif
+
 #endif                         /* __MX6QSABRESD_CONFIG_H */
Signature · 1 line
1.9.0
#2 lore raw

PATCH v2 2/2 ARM: mx6: Add PCIe on SabreSDP

Quoted 8 lines · Marek Vasut

Add support for PCIe on MX6 SabreSDP board and enable the support in the config file.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Liu Ying <[email protected]>

---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 1/2 pci: mx6: Implement power callback

In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Implement a callback to toggle the slot power supply. The callback can be overriden in case some more complex power supply for the slot was implemented in hardware, yet for the usual case, one can define a GPIO which toggles the power to the slot.

Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Liu Ying <[email protected]>

---

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================