summaryrefslogtreecommitdiff
path: root/drivers/pci/pcie_dw_mvebu.c
diff options
context:
space:
mode:
authorKonstantin Porotchkin <kostap@marvell.com>2017-02-08 17:34:13 +0200
committerStefan Roese <sr@denx.de>2017-03-23 08:45:25 +0100
commit130b53ec79f3f1b1349d409f08f1f17e68a15f96 (patch)
tree07151fdfc5d350454539d9d79d70394cf689650b /drivers/pci/pcie_dw_mvebu.c
parentd9fb41a3e195f5d655eecfad6437ea42ba5c8062 (diff)
mvebu: pcie: Add support for GPIO reset for PCIe device
Add support for "marvell,reset-gpio" property to mvebu DW PCIe driver. This option is valid when CONFIG_DM_GPIO=y Change-Id: Ic17c500449050c2fbb700731f1a9ca8b83298986 Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com> Cc: Stefan Roese <sr@denx.de> Cc: Nadav Haklai <nadavh@marvell.com> Cc: Neta Zur Hershkovits <neta@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Haim Boot <hayim@marvell.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/pci/pcie_dw_mvebu.c')
-rw-r--r--drivers/pci/pcie_dw_mvebu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c
index 17fa0244d0..d4776a9c81 100644
--- a/drivers/pci/pcie_dw_mvebu.c
+++ b/drivers/pci/pcie_dw_mvebu.c
@@ -15,6 +15,7 @@
#include <dm.h>
#include <pci.h>
#include <asm/io.h>
+#include <asm-generic/gpio.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -461,6 +462,25 @@ static int pcie_dw_mvebu_probe(struct udevice *dev)
struct pcie_dw_mvebu *pcie = dev_get_priv(dev);
struct udevice *ctlr = pci_get_controller(dev);
struct pci_controller *hose = dev_get_uclass_priv(ctlr);
+#ifdef CONFIG_DM_GPIO
+ struct gpio_desc reset_gpio;
+
+ gpio_request_by_name(dev, "marvell,reset-gpio", 0, &reset_gpio,
+ GPIOD_IS_OUT);
+ /*
+ * Issue reset to add-in card trough the dedicated GPIO.
+ * Some boards are connecting the card reset pin to common system
+ * reset wire and others are using separate GPIO port.
+ * In the last case we have to release a reset of the addon card
+ * using this GPIO.
+ */
+ if (dm_gpio_is_valid(&reset_gpio)) {
+ dm_gpio_set_value(&reset_gpio, 1);
+ mdelay(200);
+ }
+#else
+ debug("PCIE Reset on GPIO support is missing\n");
+#endif /* CONFIG_DM_GPIO */
pcie->first_busno = dev->seq;