depends on (ARCH_KIRKWOOD || ARCH_MVEBU)
select MISC
select DM_RESET
+ select DM_GPIO
help
Say Y here if you want to enable PCIe controller support on
Kirkwood and Armada 370/XP/375/38x SoCs.
#include <asm/io.h>
#include <asm/arch/cpu.h>
#include <asm/arch/soc.h>
+#include <asm/gpio.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/errno.h>
struct resource mem;
void __iomem *iobase;
struct resource io;
+ struct gpio_desc reset_gpio;
u32 intregs;
u32 port;
u32 lane;
struct udevice *ctlr = pci_get_controller(dev);
struct pci_controller *hose = dev_get_uclass_priv(ctlr);
u32 reg;
+ int ret;
+
+ /* Request for optional PERST# GPIO */
+ ret = gpio_request_by_name(dev, "reset-gpios", 0, &pcie->reset_gpio, GPIOD_IS_OUT);
+ if (ret && ret != -ENOENT) {
+ printf("%s: unable to request reset-gpios: %d\n", pcie->name, ret);
+ return ret;
+ }
/*
* Change Class Code of PCI Bridge device to PCI Bridge (0x600400)
pcie->cfgcache[(PCI_PREF_MEMORY_BASE - 0x10) / 4] =
PCI_PREF_RANGE_TYPE_64 | (PCI_PREF_RANGE_TYPE_64 << 16);
+ /* Release PERST# via GPIO when it was defined */
+ if (dm_gpio_is_valid(&pcie->reset_gpio))
+ dm_gpio_set_value(&pcie->reset_gpio, 0);
+
mvebu_pcie_wait_for_link(pcie);
return 0;