aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2014-07-17 05:00:40 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-07-22 16:17:47 -0400
commit4dd964df36d0e548e1806ec2ec275b62d4dc46e8 (patch)
tree43313b69940936402b2931c761e96231d12ffd7c
parent7171511eaec5bf23fb06078f59784a3a0626b38f (diff)
PCI: designware: Look for configuration space in 'reg', not 'ranges'
The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Mohit Kumar <mohit.kumar@st.com> Acked-by: Jingoo Han <jg1.han@samsung.com> Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Cc: Marek Vasut <marex@denx.de> Cc: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--Documentation/devicetree/bindings/pci/designware-pcie.txt4
-rw-r--r--drivers/pci/host/pcie-designware.c17
2 files changed, 19 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt
index d0d15ee42834..ed0d9b9fff2b 100644
--- a/Documentation/devicetree/bindings/pci/designware-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt
@@ -2,6 +2,10 @@
2 2
3Required properties: 3Required properties:
4- compatible: should contain "snps,dw-pcie" to identify the core. 4- compatible: should contain "snps,dw-pcie" to identify the core.
5- reg: Should contain the configuration address space.
6- reg-names: Must be "config" for the PCIe configuration space.
7 (The old way of getting the configuration address space from "ranges"
8 is deprecated and should be avoided.)
5- #address-cells: set to <3> 9- #address-cells: set to <3>
6- #size-cells: set to <2> 10- #size-cells: set to <2>
7- device_type: set to "pci" 11- device_type: set to "pci"
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 1eaf4df3618a..0b7b4558bcfd 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -20,6 +20,7 @@
20#include <linux/of_pci.h> 20#include <linux/of_pci.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/pci_regs.h> 22#include <linux/pci_regs.h>
23#include <linux/platform_device.h>
23#include <linux/types.h> 24#include <linux/types.h>
24 25
25#include "pcie-designware.h" 26#include "pcie-designware.h"
@@ -396,11 +397,23 @@ static const struct irq_domain_ops msi_domain_ops = {
396int __init dw_pcie_host_init(struct pcie_port *pp) 397int __init dw_pcie_host_init(struct pcie_port *pp)
397{ 398{
398 struct device_node *np = pp->dev->of_node; 399 struct device_node *np = pp->dev->of_node;
400 struct platform_device *pdev = to_platform_device(pp->dev);
399 struct of_pci_range range; 401 struct of_pci_range range;
400 struct of_pci_range_parser parser; 402 struct of_pci_range_parser parser;
403 struct resource *cfg_res;
401 u32 val; 404 u32 val;
402 int i; 405 int i;
403 406
407 cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
408 if (cfg_res) {
409 pp->config.cfg0_size = resource_size(cfg_res)/2;
410 pp->config.cfg1_size = resource_size(cfg_res)/2;
411 pp->cfg0_base = cfg_res->start;
412 pp->cfg1_base = cfg_res->start + pp->config.cfg0_size;
413 } else {
414 dev_err(pp->dev, "missing *config* reg space\n");
415 }
416
404 if (of_pci_range_parser_init(&parser, np)) { 417 if (of_pci_range_parser_init(&parser, np)) {
405 dev_err(pp->dev, "missing ranges property\n"); 418 dev_err(pp->dev, "missing ranges property\n");
406 return -EINVAL; 419 return -EINVAL;
@@ -433,6 +446,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
433 of_pci_range_to_resource(&range, np, &pp->cfg); 446 of_pci_range_to_resource(&range, np, &pp->cfg);
434 pp->config.cfg0_size = resource_size(&pp->cfg)/2; 447 pp->config.cfg0_size = resource_size(&pp->cfg)/2;
435 pp->config.cfg1_size = resource_size(&pp->cfg)/2; 448 pp->config.cfg1_size = resource_size(&pp->cfg)/2;
449 pp->cfg0_base = pp->cfg.start;
450 pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size;
436 } 451 }
437 } 452 }
438 453
@@ -445,8 +460,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
445 } 460 }
446 } 461 }
447 462
448 pp->cfg0_base = pp->cfg.start;
449 pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size;
450 pp->mem_base = pp->mem.start; 463 pp->mem_base = pp->mem.start;
451 464
452 pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, 465 pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,