]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
PCI: imx6: Implement reset sequence for i.MX6+
authorAndrey Smirnov <andrew.smirnov@gmail.com>
Mon, 2 May 2016 19:09:10 +0000 (14:09 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 2 May 2016 19:33:17 +0000 (14:33 -0500)
I.MX6+ has a dedicated bit for resetting PCIe core, which should be used
instead of a regular reset sequence since using the latter will hang the
SoC.

This commit is based on c34068d48273e24d392d9a49a38be807954420ed from
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git

Tested-by: Gary Bisson <gary.bisson@boundarydevices.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
drivers/pci/host/pci-imx6.c
include/linux/mfd/syscon/imx6q-iomuxc-gpr.h

index d742f917505a9f413da72455ce1167e6b47a0e5d..83aeb1f5a645ce2fe494e14dedce27dc7085155f 100644 (file)
@@ -4,7 +4,7 @@ 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"
+- compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie", "fsl,imx6qp-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.
index 6b5d8c2fe2f2323c0147974a6175bcdca3851c98..b741a36a67f3c0ba77acfaa3606ea2031a7742f7 100644 (file)
@@ -34,7 +34,8 @@
 
 enum imx6_pcie_variants {
        IMX6Q,
-       IMX6SX
+       IMX6SX,
+       IMX6QP,
 };
 
 struct imx6_pcie {
@@ -256,6 +257,11 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
                                   IMX6SX_GPR5_PCIE_BTNRST_RESET,
                                   IMX6SX_GPR5_PCIE_BTNRST_RESET);
                break;
+       case IMX6QP:
+               regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+                                  IMX6Q_GPR1_PCIE_SW_RST,
+                                  IMX6Q_GPR1_PCIE_SW_RST);
+               break;
        case IMX6Q:
                /*
                 * If the bootloader already enabled the link we need some
@@ -310,6 +316,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie)
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
                                   IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0);
                break;
+       case IMX6QP:            /* FALLTHROUGH */
        case IMX6Q:
                /* power up core phy and enable ref clock */
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
@@ -370,9 +377,20 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
                                        !imx6_pcie->gpio_active_high);
        }
 
-       if (imx6_pcie->variant == IMX6SX)
+       switch (imx6_pcie->variant) {
+       case IMX6SX:
                regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5,
                                   IMX6SX_GPR5_PCIE_BTNRST_RESET, 0);
+               break;
+       case IMX6QP:
+               regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
+                                  IMX6Q_GPR1_PCIE_SW_RST, 0);
+
+               usleep_range(200, 500);
+               break;
+       case IMX6Q:             /* Nothing to do */
+               break;
+       }
 
        return 0;
 
@@ -718,6 +736,7 @@ static void imx6_pcie_shutdown(struct platform_device *pdev)
 static const struct of_device_id imx6_pcie_of_match[] = {
        { .compatible = "fsl,imx6q-pcie",  .data = (void *)IMX6Q,  },
        { .compatible = "fsl,imx6sx-pcie", .data = (void *)IMX6SX, },
+       { .compatible = "fsl,imx6qp-pcie", .data = (void *)IMX6QP, },
        {},
 };
 MODULE_DEVICE_TABLE(of, imx6_pcie_of_match);
index 238c8db953eba25d61151709062968d669ae0b6d..5b08e3c5325f0a7d7bbc011ad157f96b6d7effc5 100644 (file)
@@ -95,6 +95,7 @@
 #define IMX6Q_GPR0_DMAREQ_MUX_SEL0_IOMUX       BIT(0)
 
 #define IMX6Q_GPR1_PCIE_REQ_MASK               (0x3 << 30)
+#define IMX6Q_GPR1_PCIE_SW_RST                 BIT(29)
 #define IMX6Q_GPR1_PCIE_EXIT_L1                        BIT(28)
 #define IMX6Q_GPR1_PCIE_RDY_L23                        BIT(27)
 #define IMX6Q_GPR1_PCIE_ENTER_L1               BIT(26)