pci: am57xx-evm: Fix PCIe card enumeration issue
Subsystems (4)
cover pci: am57xx-evm: Fix PCIe card enumeration issue
This series fixes PCIe card enumeration issue in am57xx-evm.
In the case of am57xx-evm, the PERST# line is connected to a gpio line and this has to be driven low in order to perform a fundamental reset of the card. If the gpio line is driven high, there is no way the card can come out of reset.
Add support in the pcie-dra7xx driver to make gpio drive PERST# line.
The PERST# line can be used to perform reset not during the power on sequence too (warm reset) but we are not adding support for this as the PCIe express base sepcification doesn't explain how to perform warm reset
"In some cases, it may be possible for the Fundamental Reset mechanism to be triggered by hardware without the removal and re-application of power to the component. This is called a warm reset. This document does not specify a means for generating a warm reset."
Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: Add support to make gpio drive PERST# line
ARM: dts: am57xx-evm: Add 'gpios' property with gpio2_8
Documentation/devicetree/bindings/pci/ti-pci.txt | 3 +++ arch/arm/boot/dts/am57xx-beagle-x15.dts | 5 +++++ arch/arm/boot/dts/dra7.dtsi | 2 +- drivers/pci/host/pci-dra7xx.c | 24 ++++++++++++++++++++-- 4 files changed, 31 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/2 pci: host: pci-dra7xx: Add support to make gpio drive PERST# line
The PERST# line in am57x-evm is connected to a gpio line and PERST# should be driven high to indicate the clocks are stable (As per Figure 2-10: Power Up of the PCIe CEM spec 3.0).
Add support in pci-dra7xx driver to make gpio drive PERST# line here.
--- Documentation/devicetree/bindings/pci/ti-pci.txt | 3 +++ drivers/pci/host/pci-dra7xx.c | 24 ++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/pci/ti-pci.txt +3 -0
@@ -23,6 +23,9 @@ PCIe Designware Controller interrupt-map-mask, interrupt-map : as specified in ../designware-pcie.txt +Optional Property: + - gpios : Should be added if a gpio line is required to drive PERST# line + Example: axi { compatible = "simple-bus";
drivers/pci/host/pci-dra7xx.c +22 -2
@@ -17,6 +17,7 @@#include <linux/irqdomain.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of_gpio.h> #include <linux/pci.h> #include <linux/phy/phy.h> #include <linux/platform_device.h>
@@ -336,6 +337,9 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;char name[10 ]; +int gpio_sel; +enum of_gpio_flags flags; +unsigned long gpio_flags; dra7xx =devm_kzalloc (dev,sizeof (*dra7xx),GFP_KERNEL );if (!dra7xx)
@@ -398,6 +402,22 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) goto err_get_sync; } + gpio_sel =of_get_gpio_flags (dev->of_node,0 , &flags); +if (gpio_is_valid (gpio_sel)) { + gpio_flags = (flags &OF_GPIO_ACTIVE_LOW ) ? +GPIOF_OUT_INIT_LOW :GPIOF_OUT_INIT_HIGH ; + ret =devm_gpio_request_one (dev, gpio_sel, gpio_flags, +"pcie_reset" ); +if (ret) { +dev_err (&pdev->dev,"gpio%d request failed, ret %d\n" , + gpio_sel, ret); + goto err_gpio; + } + }else if (gpio_sel == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto err_gpio; + } + reg =dra7xx_pcie_readl (dra7xx,PCIECTRL_DRA7XX_CONF_DEVICE_CMD ); reg &= ~LTSSM_EN ;dra7xx_pcie_writel (dra7xx,PCIECTRL_DRA7XX_CONF_DEVICE_CMD , reg);
@@ -406,11 +426,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) ret =dra7xx_add_pcie_port (dra7xx, pdev);if (ret <0 ) - goto err_add_port; + goto err_gpio;return 0 ; -err_add_port: +err_gpio:pm_runtime_put (dev); err_get_sync:
Signature · 1 line
1.7.9.5
PATCH 2/2 ARM: dts: am57xx-evm: Add 'gpios' property with gpio2_8
In reply to Kishon Vijay Abraham Igpio2_8 is connected to the PCIe_RESETn line and it has to be driven low in order to reset the PCIe cards. So added gpios property to pcie dt node.
--- arch/arm/boot/dts/am57xx-beagle-x15.dts | 5 +++++ arch/arm/boot/dts/dra7.dtsi | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/arm/boot/dts/am57xx-beagle-x15.dts +5 -0
@@ -693,3 +693,8 @@ }; }; }; + +&pcie1 { + gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; +}; +
arch/arm/boot/dts/dra7.dtsi +1 -1
@@ -211,7 +211,7 @@ #address-cells = <1>; ranges = <0x51000000 0x51000000 0x3000 0x0 0x20000000 0x10000000>; - pcie at 51000000 { + pcie1: pcie at 51000000 { compatible = "ti,dra7-pcie"; reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; reg-names = "rc_dbics", "ti_conf", "config";
Signature · 1 line
1.7.9.5
Re: [PATCH 2/2] ARM: dts: am57xx-evm: Add 'gpios' property with gpio2_8
Quoted 5 lines · Kishon Vijay Abraham I
gpio2_8is connected to thePCIe_RESETnline and it has to be driven low in order to reset the PCIe cards. So added gpios property to pcie dt node.Signed-off-by Kishon Vijay Abraham I <[email protected]>
This should not conflict with the device tree changes I'm queuing for v4.3 merge window, so please feel free to queue with the PCIe driver changes:
Bjorn Helgaas
maintainerQuoted 23 lines · Kishon Vijay Abraham I
This series fixes PCIe card enumeration issue in am57xx-evm.
In the case of am57xx-evm, the PERST# line is connected to a gpio line and this has to be driven low in order to perform a fundamental reset of the card. If the gpio line is driven high, there is no way the card can come out of reset.
Add support in the pcie-dra7xx driver to make gpio drive PERST# line.
The PERST# line can be used to perform reset not during the power on sequence too (warm reset) but we are not adding support for this as the PCIe express base sepcification doesn't explain how to perform warm reset
"In some cases, it may be possible for the Fundamental Reset mechanism to be triggered by hardware without the removal and re-application of power to the component. This is called a warm reset. This document does not specify a means for generating a warm reset."
Kishon Vijay Abraham I (2):
pci: host: pci-dra7xx: Add support to make gpio drive PERST# line
ARM: dts: am57xx-evm: Add 'gpios' property withgpio2_8
Quoted 5 lines
Documentation/devicetree/bindings/pci/ti-pci.txt | 3 +++ arch/arm/boot/dts/am57xx-beagle-x15.dts | 5 +++++ arch/arm/boot/dts/dra7.dtsi | 2 +- drivers/pci/host/pci-dra7xx.c | 24 ++++++++++++++++++++-- 4 files changed, 31 insertions(+), 3 deletions(-)
Applied with Tony's ack (for patch 2) to pci/host-dra7xx for v4.3, thanks!