Skip to content

Commit 4d31c61

Browse files
ndreysbjorn-helgaas
authored andcommitted
PCI: imx6: Implement reset sequence for i.MX6+
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 c34068d from http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git Tested-by: Gary Bisson <[email protected]> Signed-off-by: Andrey Smirnov <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Fabio Estevam <[email protected]>
1 parent e6f1fef commit 4d31c61

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This PCIe host controller is based on the Synopsis Designware PCIe IP
44
and thus inherits all the common properties defined in designware-pcie.txt.
55

66
Required properties:
7-
- compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie"
7+
- compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie", "fsl,imx6qp-pcie"
88
- reg: base address and length of the PCIe controller
99
- interrupts: A list of interrupt outputs of the controller. Must contain an
1010
entry for each entry in the interrupt-names property.

drivers/pci/host/pci-imx6.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434

3535
enum imx6_pcie_variants {
3636
IMX6Q,
37-
IMX6SX
37+
IMX6SX,
38+
IMX6QP,
3839
};
3940

4041
struct imx6_pcie {
@@ -256,6 +257,11 @@ static int imx6_pcie_assert_core_reset(struct pcie_port *pp)
256257
IMX6SX_GPR5_PCIE_BTNRST_RESET,
257258
IMX6SX_GPR5_PCIE_BTNRST_RESET);
258259
break;
260+
case IMX6QP:
261+
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
262+
IMX6Q_GPR1_PCIE_SW_RST,
263+
IMX6Q_GPR1_PCIE_SW_RST);
264+
break;
259265
case IMX6Q:
260266
/*
261267
* 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)
310316
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12,
311317
IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0);
312318
break;
319+
case IMX6QP: /* FALLTHROUGH */
313320
case IMX6Q:
314321
/* power up core phy and enable ref clock */
315322
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
@@ -370,9 +377,20 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
370377
!imx6_pcie->gpio_active_high);
371378
}
372379

373-
if (imx6_pcie->variant == IMX6SX)
380+
switch (imx6_pcie->variant) {
381+
case IMX6SX:
374382
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR5,
375383
IMX6SX_GPR5_PCIE_BTNRST_RESET, 0);
384+
break;
385+
case IMX6QP:
386+
regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1,
387+
IMX6Q_GPR1_PCIE_SW_RST, 0);
388+
389+
usleep_range(200, 500);
390+
break;
391+
case IMX6Q: /* Nothing to do */
392+
break;
393+
}
376394

377395
return 0;
378396

@@ -718,6 +736,7 @@ static void imx6_pcie_shutdown(struct platform_device *pdev)
718736
static const struct of_device_id imx6_pcie_of_match[] = {
719737
{ .compatible = "fsl,imx6q-pcie", .data = (void *)IMX6Q, },
720738
{ .compatible = "fsl,imx6sx-pcie", .data = (void *)IMX6SX, },
739+
{ .compatible = "fsl,imx6qp-pcie", .data = (void *)IMX6QP, },
721740
{},
722741
};
723742
MODULE_DEVICE_TABLE(of, imx6_pcie_of_match);

include/linux/mfd/syscon/imx6q-iomuxc-gpr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_IOMUX BIT(0)
9696

9797
#define IMX6Q_GPR1_PCIE_REQ_MASK (0x3 << 30)
98+
#define IMX6Q_GPR1_PCIE_SW_RST BIT(29)
9899
#define IMX6Q_GPR1_PCIE_EXIT_L1 BIT(28)
99100
#define IMX6Q_GPR1_PCIE_RDY_L23 BIT(27)
100101
#define IMX6Q_GPR1_PCIE_ENTER_L1 BIT(26)

0 commit comments

Comments
 (0)