diff options
author | Richard Zhu <r65037@freescale.com> | 2014-04-28 21:58:40 -0400 |
---|---|---|
committer | Richard Zhu <r65037@freescale.com> | 2014-05-26 01:18:36 -0400 |
commit | bd47cc6fcaefb69dfd42863136d36b5cb70e0403 (patch) | |
tree | 648add58688542ace5b45da92bece697de89bfb7 | |
parent | 671cc6a3c1f7ce2da92bccdf00d3fa9d9fb1633b (diff) |
ENGR00314581 pcie: enable pcie ep rc on imx6sx
enable pcie ep rc validation on imx6sx sdb board.
Signed-off-by: Richard Zhu <r65037@freescale.com>
-rw-r--r-- | drivers/pci/host/pci-imx6.c | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 064d40f3ae11..6645220911f1 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/of_gpio.h> | 23 | #include <linux/of_gpio.h> |
24 | #include <linux/of_device.h> | 24 | #include <linux/of_device.h> |
25 | #include <linux/of_address.h> | ||
25 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
26 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
27 | #include <linux/regmap.h> | 28 | #include <linux/regmap.h> |
@@ -39,8 +40,10 @@ | |||
39 | /* | 40 | /* |
40 | * The default value of the reserved ddr memory | 41 | * The default value of the reserved ddr memory |
41 | * used to verify EP/RC memory space access operations. | 42 | * used to verify EP/RC memory space access operations. |
42 | * BTW, here is the layout of the 1G ddr on SD boards | 43 | * The layout of the 1G ddr on SD boards |
43 | * 0x1000_0000 ~ 0x4FFF_FFFF | 44 | * [others]0x1000_0000 ~ 0x4FFF_FFFF |
45 | * [imx6sx]0x8000_0000 ~ 0xBFFF_FFFF | ||
46 | * | ||
44 | */ | 47 | */ |
45 | static u32 ddr_test_region = 0x40000000; | 48 | static u32 ddr_test_region = 0x40000000; |
46 | static u32 test_region_size = SZ_2M; | 49 | static u32 test_region_size = SZ_2M; |
@@ -537,15 +540,18 @@ static void imx_pcie_regions_setup(struct device *dev) | |||
537 | struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); | 540 | struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); |
538 | struct pcie_port *pp = &imx6_pcie->pp; | 541 | struct pcie_port *pp = &imx6_pcie->pp; |
539 | 542 | ||
543 | if (is_imx6sx_pcie(imx6_pcie)) | ||
544 | ddr_test_region = 0xb0000000; | ||
545 | |||
540 | if (IS_ENABLED(CONFIG_EP_MODE_IN_EP_RC_SYS)) { | 546 | if (IS_ENABLED(CONFIG_EP_MODE_IN_EP_RC_SYS)) { |
541 | /* | 547 | /* |
542 | * region2 outbound used to access rc mem | 548 | * region2 outbound used to access rc mem |
543 | * in imx6 pcie ep/rc validation system | 549 | * in imx6 pcie ep/rc validation system |
544 | */ | 550 | */ |
545 | writel(0, pp->dbi_base + PCIE_ATU_VIEWPORT); | 551 | writel(2, pp->dbi_base + PCIE_ATU_VIEWPORT); |
546 | writel(0x01000000, pp->dbi_base + PCIE_ATU_LOWER_BASE); | 552 | writel(pp->mem_base, pp->dbi_base + PCIE_ATU_LOWER_BASE); |
547 | writel(0, pp->dbi_base + PCIE_ATU_UPPER_BASE); | 553 | writel(0, pp->dbi_base + PCIE_ATU_UPPER_BASE); |
548 | writel(0x01000000 + test_region_size, | 554 | writel(pp->mem_base + test_region_size, |
549 | pp->dbi_base + PCIE_ATU_LIMIT); | 555 | pp->dbi_base + PCIE_ATU_LIMIT); |
550 | 556 | ||
551 | writel(ddr_test_region, | 557 | writel(ddr_test_region, |
@@ -561,9 +567,9 @@ static void imx_pcie_regions_setup(struct device *dev) | |||
561 | * in imx6 pcie ep/rc validation system | 567 | * in imx6 pcie ep/rc validation system |
562 | */ | 568 | */ |
563 | writel(2, pp->dbi_base + PCIE_ATU_VIEWPORT); | 569 | writel(2, pp->dbi_base + PCIE_ATU_VIEWPORT); |
564 | writel(0x01000000, pp->dbi_base + PCIE_ATU_LOWER_BASE); | 570 | writel(pp->mem_base, pp->dbi_base + PCIE_ATU_LOWER_BASE); |
565 | writel(0, pp->dbi_base + PCIE_ATU_UPPER_BASE); | 571 | writel(0, pp->dbi_base + PCIE_ATU_UPPER_BASE); |
566 | writel(0x01000000 + test_region_size, | 572 | writel(pp->mem_base + test_region_size, |
567 | pp->dbi_base + PCIE_ATU_LIMIT); | 573 | pp->dbi_base + PCIE_ATU_LIMIT); |
568 | 574 | ||
569 | writel(ddr_test_region, | 575 | writel(ddr_test_region, |
@@ -1002,6 +1008,30 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) | |||
1002 | } | 1008 | } |
1003 | 1009 | ||
1004 | if (IS_ENABLED(CONFIG_EP_MODE_IN_EP_RC_SYS)) { | 1010 | if (IS_ENABLED(CONFIG_EP_MODE_IN_EP_RC_SYS)) { |
1011 | if (is_imx6sx_pcie(imx6_pcie)) { | ||
1012 | struct device_node *np = pp->dev->of_node; | ||
1013 | struct of_pci_range range; | ||
1014 | struct of_pci_range_parser parser; | ||
1015 | unsigned long restype; | ||
1016 | |||
1017 | if (of_pci_range_parser_init(&parser, np)) { | ||
1018 | dev_err(pp->dev, "missing ranges property\n"); | ||
1019 | return -EINVAL; | ||
1020 | } | ||
1021 | |||
1022 | /* Get the memory ranges from DT */ | ||
1023 | for_each_of_pci_range(&parser, &range) { | ||
1024 | restype = range.flags & IORESOURCE_TYPE_BITS; | ||
1025 | if (restype == IORESOURCE_MEM) { | ||
1026 | of_pci_range_to_resource(&range, | ||
1027 | np, &pp->mem); | ||
1028 | pp->mem.name = "MEM"; | ||
1029 | } | ||
1030 | } | ||
1031 | |||
1032 | pp->mem_base = pp->mem.start; | ||
1033 | } | ||
1034 | |||
1005 | if (IS_ENABLED(CONFIG_EP_SELF_IO_TEST)) { | 1035 | if (IS_ENABLED(CONFIG_EP_SELF_IO_TEST)) { |
1006 | /* Prepare the test regions and data */ | 1036 | /* Prepare the test regions and data */ |
1007 | test_reg1 = devm_kzalloc(&pdev->dev, | 1037 | test_reg1 = devm_kzalloc(&pdev->dev, |
@@ -1020,7 +1050,7 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) | |||
1020 | goto err; | 1050 | goto err; |
1021 | } | 1051 | } |
1022 | 1052 | ||
1023 | pcie_arb_base_addr = ioremap_cached(0x01000000, | 1053 | pcie_arb_base_addr = ioremap_cached(pp->mem_base, |
1024 | test_region_size); | 1054 | test_region_size); |
1025 | 1055 | ||
1026 | if (!pcie_arb_base_addr) { | 1056 | if (!pcie_arb_base_addr) { |