summaryrefslogtreecommitdiff
path: root/drivers/pci/host/pci-imx6.c
diff options
context:
space:
mode:
authorRichard Zhu <hongxing.zhu@nxp.com>2017-03-30 17:56:55 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit364031ff8434200f1ebbd8c0538e84703688d7b9 (patch)
tree1248f22af3f0f742b80724131da7fc2325d686b8 /drivers/pci/host/pci-imx6.c
parenta3c01ef11a95082a302d07f2248fcb8b44eb951d (diff)
MLK-14554 PCI: imx: pcie ep board can't boot up
In the imx pcie ep/rc validation system, the mem resource parser of ep probe is failed on 4.9. Change the mem resource parser method from 4.1 to 4.9 to fix this failure. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Diffstat (limited to 'drivers/pci/host/pci-imx6.c')
-rw-r--r--drivers/pci/host/pci-imx6.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 57d880a0c2b2..d81e2afed251 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -19,9 +19,10 @@
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
#include <linux/mfd/syscon/imx7-iomuxc-gpr.h>
#include <linux/module.h>
-#include <linux/of_gpio.h>
-#include <linux/of_device.h>
#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+#include <linux/of_pci.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
@@ -1381,21 +1382,30 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
struct timeval tv1s, tv1e, tv2s, tv2e;
u32 tv_count1, tv_count2;
struct device_node *np = pp->dev->of_node;
- struct of_pci_range range;
- struct of_pci_range_parser parser;
- unsigned long restype;
+ LIST_HEAD(res);
+ struct resource_entry *win, *tmp;
+
+ ret = of_pci_get_host_bridge_resources(np, 0, 0xff, &res,
+ &pp->io_base);
+ if (ret)
+ return ret;
- if (of_pci_range_parser_init(&parser, np)) {
+ ret = devm_request_pci_bus_resources(&pdev->dev, &res);
+ if (ret) {
dev_err(pp->dev, "missing ranges property\n");
- return -EINVAL;
+ pci_free_resource_list(&res);
+ return ret;
}
- /* Get the memory ranges from DT */
- for_each_of_pci_range(&parser, &range) {
- restype = range.flags & IORESOURCE_TYPE_BITS;
- if (restype == IORESOURCE_MEM) {
- of_pci_range_to_resource(&range, np, pp->mem);
+ /* Get the I/O and memory ranges from DT */
+ resource_list_for_each_entry_safe(win, tmp, &res) {
+ switch (resource_type(win->res)) {
+ case IORESOURCE_MEM:
+ pp->mem = win->res;
pp->mem->name = "MEM";
+ pp->mem_size = resource_size(pp->mem);
+ pp->mem_bus_addr = pp->mem->start - win->offset;
+ break;
}
}