i.MX7 PCI support
Subsystems (5)
v3 cover i.MX7 PCI support
Hello, everyone:
This is a third iteration of the code that adds PCI-subsystem bits necessary for enabling PCI support on i.MX7.
Changes since v2 (can be found at [version2]):
- Collected Reviewed-by for patch #2 from Lucas
- Reset logic implementation moved out into a reset controller driver (see [reset1])
- Removed unused leftover code
Changes since v1 (can be found at [version1]):
- All GPC related code moved into a separate driver (see [gpc1])
- Removed GPIO probe deferral logging
- Fixed section mismatch warning
- Minor reformatting of fsl,imx6q-pcie.txt(as per Rob Herring's request)
[version2] https://lkml.org/lkml/2017/2/1/510
[version1] https://lkml.org/lkml/2017/1/19/488
[gpc1] https://lkml.org/lkml/2017/2/6/551
[reset1] https://lkml.org/lkml/2017/2/6/554
Andrey Smirnov (3):
PCI: imx6: Fix a typo in error message
PCI: imx6: Allow probe deferal by reset GPIO
PCI: imx6: Add code to support i.MX7D
.../devicetree/bindings/pci/fsl,imx6q-pcie.txt | 6 +- drivers/pci/host/pci-imx6.c | 131 ++++++++++++++++----- include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 4 + 3 files changed, 111 insertions(+), 30 deletions(-)
Signature · 1 line
2.9.3
PATCH v3 1/3 PCI: imx6: Fix a typo in error message
--- drivers/pci/host/pci-imx6.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pci/host/pci-imx6.c +1 -2
@@ -678,8 +678,7 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) imx6_pcie->pcie_inbound_axi =devm_clk_get (dev,"pcie_inbound_axi" );if (IS_ERR (imx6_pcie->pcie_inbound_axi)) { -dev_err (dev, -"pcie_incbound_axi clock missing or invalid\n" ); +dev_err (dev,"pcie_inbound_axi clock missing or invalid\n" );return PTR_ERR (imx6_pcie->pcie_inbound_axi); } }
Signature · 1 line
2.9.3
PATCH v3 2/3 PCI: imx6: Allow probe deferal by reset GPIO
In reply to Andrey SmirnovSome designs implement reset GPIO via a GPIO expander connected to a peripheral bus. One such example would be i.MX7 Sabre board where said GPIO is provided by SPI shift register connected to a bitbanged SPI bus. In order to support such designs allow reset GPIO request to defer probing of the driver.
--- drivers/pci/host/pci-imx6.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pci/host/pci-imx6.c +5 -2
@@ -611,7 +611,7 @@ static int __init imx6_add_pcie_port(struct imx6_pcie *imx6_pcie,return 0 ; } -static int __init imx6_pcie_probe (struct platform_device *pdev) +static int imx6_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct imx6_pcie *imx6_pcie;
@@ -653,6 +653,8 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)dev_err (dev,"unable to get reset gpio\n" );return ret; } + }else if (imx6_pcie->reset_gpio == -EPROBE_DEFER ) { +return imx6_pcie->reset_gpio; }/* Fetch clocks */
@@ -746,11 +748,12 @@ static struct platform_driver imx6_pcie_driver = { .name = "imx6q-pcie", .of_match_table = imx6_pcie_of_match, }, + .probe = imx6_pcie_probe, .shutdown = imx6_pcie_shutdown, };static int __init imx6_pcie_init (void ) { -return platform_driver_probe (&imx6_pcie_driver, imx6_pcie_probe); +return platform_driver_register (&imx6_pcie_driver); }device_initcall (imx6_pcie_init);
Signature · 1 line
2.9.3
PATCH v3 3/3 PCI: imx6: Add code to support i.MX7D
In reply to Andrey SmirnovAdd various bits of code needed to support i.MX7D variant of the IP.
--- .../devicetree/bindings/pci/fsl,imx6q-pcie.txt | 6 +- drivers/pci/host/pci-imx6.c | 121 ++++++++++++++++----- include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 4 + 3 files changed, 105 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +5 -1
@@ -4,7 +4,11 @@ This PCIe host controller is based on the Synopsis Designware PCIe IP and thus inherits all the common properties defined in designware-pcie.txt. Required properties: -- compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie", "fsl,imx6qp-pcie" +- compatible: + - "fsl,imx6q-pcie" + - "fsl,imx6sx-pcie", + - "fsl,imx6qp-pcie" + - "fsl,imx7d-pcie" - reg: base address and length of the PCIe controller - interrupts: A list of interrupt outputs of the controller. Must contain an entry for each entry in the interrupt-names property.
drivers/pci/host/pci-imx6.c +96 -25
211 lines not on this page · raw message
include/linux/mfd/syscon/imx7-iomuxc-gpr.h +4 -0
@@ -44,4 +44,8 @@#define IMX7D_GPR5_CSI_MUX_CONTROL_MIPI (0x1 << 4) +#define IMX7D_GPR12_PCIE_PHY_REFCLK_SEL BIT(5) + +#define IMX7D_GPR22_PCIE_PHY_PLL_LOCKED BIT(31) +#endif /* __LINUX_IMX7_IOMUXC_GPR_H */
Signature · 1 line
2.9.3
Re: [PATCH v3 3/3] PCI: imx6: Add code to support i.MX7D
Am Montag, den 06.02.2017, 07:17 -0800 schrieb Andrey Smirnov:
Quoted 13 lines
Add various bits of code needed to support i.MX7D variant of the IP.
Cc yurovsky at gmail.comCc Lucas Stach <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Fabio Estevam <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Lee Jones <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc devicetree at vger.kernel.orgCc linux-kernel at vger.kernel.orgSigned-off-by Andrey Smirnov <[email protected]>
Two small comments inline, otherwise looks real good now.
Quoted 13 lines
--- .../devicetree/bindings/pci/fsl,imx6q-pcie.txt | 6 +- drivers/pci/host/pci-imx6.c | 121 ++++++++++++++++----- include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 4 + 3 files changed, 105 insertions(+), 26 deletions(-)Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +0
-0@@ -4,7 +4,11 @@ This PCIe host controller is based on the Synopsis Designware PCIe IP and thus inherits all the common properties defined in designware-pcie.txt.
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt This PCIe host controller is based on the Synopsis Designware PCIe IP · line 14
Quoted 10 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +5
-1Required properties: -- compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie", "fsl,imx6qp-pcie" +- compatible: + - "fsl,imx6q-pcie" + - "fsl,imx6sx-pcie", + - "fsl,imx6qp-pcie" + - "fsl,imx7d-pcie" - reg: base address and length of the PCIe controller - interrupts: A list of interrupt outputs of the controller. Must contain an entry for each entry in the interrupt-names property.
This misses an "Additional required properties for imx7d-pcie" section listing the required reset handles.
Quoted 4 lines
drivers/pci/host/pci-imx6.c +0
-0
[...]
drivers/pci/host/pci-imx6.c static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) · line 420
Quoted 9 lines
static void
imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie){drivers/pci/host/pci-imx6.c +2
-0struct pcie_port *pp = &imx6_pcie->pp;@@ -381,6 +416,11 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) }switch (imx6_pcie->variant) { +case IMX7D : +reset_control_assert (imx6_pcie->apps_reset);
Can this reset assertion be moved into imx6_pcie_assert_core_reset()? This may change the programming order slightly from the downstream driver, but I guess that won't hurt if this is the equivalent of the LTSSM enable signal.
Regards,
Lucas
Re: [PATCH v3 3/3] PCI: imx6: Add code to support i.MX7D
Quoted 30 lines · Lucas Stach
Am Montag, den 06.02.2017, 07:17 -0800 schrieb Andrey Smirnov:
Quoted 13 lines
Add various bits of code needed to support i.MX7D variant of the IP.
Cc yurovsky at gmail.comCc Lucas Stach <[email protected]>Cc Bjorn Helgaas <[email protected]>Cc Fabio Estevam <[email protected]>Cc Rob Herring <[email protected]>Cc Mark Rutland <[email protected]>Cc Lee Jones <[email protected]>Cc linux-arm-kernel at lists.infradead.orgCc devicetree at vger.kernel.orgCc linux-kernel at vger.kernel.orgSigned-off-by Andrey Smirnov <[email protected]>Two small comments inline, otherwise looks real good now.
Quoted 13 lines
--- .../devicetree/bindings/pci/fsl,imx6q-pcie.txt | 6 +- drivers/pci/host/pci-imx6.c | 121 ++++++++++++++++----- include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 4 + 3 files changed, 105 insertions(+), 26 deletions(-)Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +0
-0@@ -4,7 +4,11 @@ This PCIe host controller is based on the Synopsis Designware PCIe IP and thus inherits all the common properties defined in designware-pcie.txt.
Quoted 13 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt This PCIe host controller is based on the Synopsis Designware PCIe IP · line 14
Quoted 10 lines
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +5
-1Required properties: -- compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie", "fsl,imx6qp-pcie" +- compatible: + - "fsl,imx6q-pcie" + - "fsl,imx6sx-pcie", + - "fsl,imx6qp-pcie" + - "fsl,imx7d-pcie" - reg: base address and length of the PCIe controller - interrupts: A list of interrupt outputs of the controller. Must contain an entry for each entry in the interrupt-names property.This misses an "Additional required properties for imx7d-pcie" section listing the required reset handles.
Darn! Forgot to update this part. Will fix in v4.
Quoted 14 lines
Quoted 5 lines
drivers/pci/host/pci-imx6.c +0
-0[...]
Quoted 6 lines
static void
imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie){ struct pcie_port *pp = &imx6_pcie->pp;drivers/pci/host/pci-imx6.c +0
-0@@ -381,6 +416,11 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) }
Quoted 8 lines
drivers/pci/host/pci-imx6.c static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) · line 420
Quoted 3 lines
drivers/pci/host/pci-imx6.c +2
-0switch (imx6_pcie->variant) { +case IMX7D : +reset_control_assert (imx6_pcie->apps_reset);Can this reset assertion be moved into
imx6_pcie_assert_core_reset()? This may change the programming order slightly from the downstream driver, but I guess that won't hurt if this is the equivalent of the LTSSM enable signal.
I don't see why it wouldn't be possible to move it. I'll give it a try on a real HW and update v4 accordingly.
Thanks,
Andrey Smirnov