summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2017-02-21 16:14:18 -0500
committerBjorn Helgaas <bhelgaas@google.com>2017-02-21 16:14:18 -0500
commitd9520971589b008faa8df31aa2bb3d1e4f1c4534 (patch)
tree5bbb628245575e29e7b30c72e8c5bb26187225bd
parentb2e6d3055d5545b97533d4e8376fa848639d9951 (diff)
parent3fb5561879d71b5b80ddb48b3e7e5fa18c696d2a (diff)
Merge branch 'pci/host-hisi' into next
* pci/host-hisi: PCI: generic: Call pci_fixup_irqs() only on ARM PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports PCI: hisi: Rename config space accessors to remove "acpi" PCI: hisi: Add DT almost-ECAM support for Hip06/Hip07 host controllers PCI: hisi: Use of_device_get_match_data() to simplify probe Conflicts: drivers/pci/dwc/pcie-hisi.c
-rw-r--r--Documentation/devicetree/bindings/pci/hisilicon-pcie.txt37
-rw-r--r--drivers/pci/dwc/pcie-hisi.c82
-rw-r--r--drivers/pci/host/pci-host-common.c2
-rw-r--r--drivers/pci/quirks.c1
-rw-r--r--include/linux/pci_ids.h2
5 files changed, 112 insertions, 12 deletions
diff --git a/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt b/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
index 59c2f47aa303..b7fa3b97986d 100644
--- a/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
+++ b/Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
@@ -42,3 +42,40 @@ Hip05 Example (note that Hip06 is the same except compatible):
42 0x0 0 0 4 &mbigen_pcie 4 13>; 42 0x0 0 0 4 &mbigen_pcie 4 13>;
43 status = "ok"; 43 status = "ok";
44 }; 44 };
45
46HiSilicon Hip06/Hip07 PCIe host bridge DT (almost-ECAM) description.
47The properties and their meanings are identical to those described in
48host-generic-pci.txt except as listed below.
49
50Properties of the host controller node that differ from
51host-generic-pci.txt:
52
53- compatible : Must be "hisilicon,pcie-almost-ecam"
54
55- reg : Two entries: First the ECAM configuration space for any
56 other bus underneath the root bus. Second, the base
57 and size of the HiSilicon host bridge registers include
58 the RC's own config space.
59
60Example:
61 pcie0: pcie@a0090000 {
62 compatible = "hisilicon,pcie-almost-ecam";
63 reg = <0 0xb0000000 0 0x2000000>, /* ECAM configuration space */
64 <0 0xa0090000 0 0x10000>; /* host bridge registers */
65 bus-range = <0 31>;
66 msi-map = <0x0000 &its_dsa 0x0000 0x2000>;
67 msi-map-mask = <0xffff>;
68 #address-cells = <3>;
69 #size-cells = <2>;
70 device_type = "pci";
71 dma-coherent;
72 ranges = <0x02000000 0 0xb2000000 0x0 0xb2000000 0 0x5ff0000
73 0x01000000 0 0 0 0xb7ff0000 0 0x10000>;
74 #interrupt-cells = <1>;
75 interrupt-map-mask = <0xf800 0 0 7>;
76 interrupt-map = <0x0 0 0 1 &mbigen_pcie0 650 4
77 0x0 0 0 2 &mbigen_pcie0 650 4
78 0x0 0 0 3 &mbigen_pcie0 650 4
79 0x0 0 0 4 &mbigen_pcie0 650 4>;
80 status = "ok";
81 };
diff --git a/drivers/pci/dwc/pcie-hisi.c b/drivers/pci/dwc/pcie-hisi.c
index 386467a4f00f..e3e4fedd9f68 100644
--- a/drivers/pci/dwc/pcie-hisi.c
+++ b/drivers/pci/dwc/pcie-hisi.c
@@ -24,10 +24,10 @@
24#include <linux/regmap.h> 24#include <linux/regmap.h>
25#include "../pci.h" 25#include "../pci.h"
26 26
27#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) 27#if defined(CONFIG_PCI_HISI) || (defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS))
28 28
29static int hisi_pcie_acpi_rd_conf(struct pci_bus *bus, u32 devfn, int where, 29static int hisi_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
30 int size, u32 *val) 30 int size, u32 *val)
31{ 31{
32 struct pci_config_window *cfg = bus->sysdata; 32 struct pci_config_window *cfg = bus->sysdata;
33 int dev = PCI_SLOT(devfn); 33 int dev = PCI_SLOT(devfn);
@@ -44,8 +44,8 @@ static int hisi_pcie_acpi_rd_conf(struct pci_bus *bus, u32 devfn, int where,
44 return pci_generic_config_read(bus, devfn, where, size, val); 44 return pci_generic_config_read(bus, devfn, where, size, val);
45} 45}
46 46
47static int hisi_pcie_acpi_wr_conf(struct pci_bus *bus, u32 devfn, 47static int hisi_pcie_wr_conf(struct pci_bus *bus, u32 devfn,
48 int where, int size, u32 val) 48 int where, int size, u32 val)
49{ 49{
50 struct pci_config_window *cfg = bus->sysdata; 50 struct pci_config_window *cfg = bus->sysdata;
51 int dev = PCI_SLOT(devfn); 51 int dev = PCI_SLOT(devfn);
@@ -74,6 +74,8 @@ static void __iomem *hisi_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
74 return pci_ecam_map_bus(bus, devfn, where); 74 return pci_ecam_map_bus(bus, devfn, where);
75} 75}
76 76
77#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
78
77static int hisi_pcie_init(struct pci_config_window *cfg) 79static int hisi_pcie_init(struct pci_config_window *cfg)
78{ 80{
79 struct device *dev = cfg->parent; 81 struct device *dev = cfg->parent;
@@ -110,8 +112,8 @@ struct pci_ecam_ops hisi_pcie_ops = {
110 .init = hisi_pcie_init, 112 .init = hisi_pcie_init,
111 .pci_ops = { 113 .pci_ops = {
112 .map_bus = hisi_pcie_map_bus, 114 .map_bus = hisi_pcie_map_bus,
113 .read = hisi_pcie_acpi_rd_conf, 115 .read = hisi_pcie_rd_conf,
114 .write = hisi_pcie_acpi_wr_conf, 116 .write = hisi_pcie_wr_conf,
115 } 117 }
116}; 118};
117 119
@@ -139,7 +141,7 @@ struct hisi_pcie {
139 struct dw_pcie *pci; 141 struct dw_pcie *pci;
140 struct regmap *subctrl; 142 struct regmap *subctrl;
141 u32 port_id; 143 u32 port_id;
142 struct pcie_soc_ops *soc_ops; 144 const struct pcie_soc_ops *soc_ops;
143}; 145};
144 146
145/* HipXX PCIe host only supports 32-bit config access */ 147/* HipXX PCIe host only supports 32-bit config access */
@@ -265,7 +267,6 @@ static int hisi_pcie_probe(struct platform_device *pdev)
265 struct device *dev = &pdev->dev; 267 struct device *dev = &pdev->dev;
266 struct dw_pcie *pci; 268 struct dw_pcie *pci;
267 struct hisi_pcie *hisi_pcie; 269 struct hisi_pcie *hisi_pcie;
268 const struct of_device_id *match;
269 struct resource *reg; 270 struct resource *reg;
270 struct device_driver *driver; 271 struct device_driver *driver;
271 int ret; 272 int ret;
@@ -283,11 +284,10 @@ static int hisi_pcie_probe(struct platform_device *pdev)
283 284
284 driver = dev->driver; 285 driver = dev->driver;
285 286
286 match = of_match_device(driver->of_match_table, dev); 287 hisi_pcie->soc_ops = of_device_get_match_data(dev);
287 hisi_pcie->soc_ops = (struct pcie_soc_ops *) match->data;
288 288
289 hisi_pcie->subctrl = 289 hisi_pcie->subctrl =
290 syscon_regmap_lookup_by_compatible("hisilicon,pcie-sas-subctrl"); 290 syscon_regmap_lookup_by_compatible("hisilicon,pcie-sas-subctrl");
291 if (IS_ERR(hisi_pcie->subctrl)) { 291 if (IS_ERR(hisi_pcie->subctrl)) {
292 dev_err(dev, "cannot get subctrl base\n"); 292 dev_err(dev, "cannot get subctrl base\n");
293 return PTR_ERR(hisi_pcie->subctrl); 293 return PTR_ERR(hisi_pcie->subctrl);
@@ -336,4 +336,62 @@ static struct platform_driver hisi_pcie_driver = {
336}; 336};
337builtin_platform_driver(hisi_pcie_driver); 337builtin_platform_driver(hisi_pcie_driver);
338 338
339static int hisi_pcie_almost_ecam_probe(struct platform_device *pdev)
340{
341 struct device *dev = &pdev->dev;
342 struct pci_ecam_ops *ops;
343
344 ops = (struct pci_ecam_ops *)of_device_get_match_data(dev);
345 return pci_host_common_probe(pdev, ops);
346}
347
348static int hisi_pcie_platform_init(struct pci_config_window *cfg)
349{
350 struct device *dev = cfg->parent;
351 struct platform_device *pdev = to_platform_device(dev);
352 struct resource *res;
353 void __iomem *reg_base;
354
355 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
356 if (!res) {
357 dev_err(dev, "missing \"reg[1]\"property\n");
358 return -EINVAL;
359 }
360
361 reg_base = devm_ioremap(dev, res->start, resource_size(res));
362 if (!reg_base)
363 return -ENOMEM;
364
365 cfg->priv = reg_base;
366 return 0;
367}
368
369struct pci_ecam_ops hisi_pcie_platform_ops = {
370 .bus_shift = 20,
371 .init = hisi_pcie_platform_init,
372 .pci_ops = {
373 .map_bus = hisi_pcie_map_bus,
374 .read = hisi_pcie_rd_conf,
375 .write = hisi_pcie_wr_conf,
376 }
377};
378
379static const struct of_device_id hisi_pcie_almost_ecam_of_match[] = {
380 {
381 .compatible = "hisilicon,pcie-almost-ecam",
382 .data = (void *) &hisi_pcie_platform_ops,
383 },
384 {},
385};
386
387static struct platform_driver hisi_pcie_almost_ecam_driver = {
388 .probe = hisi_pcie_almost_ecam_probe,
389 .driver = {
390 .name = "hisi-pcie-almost-ecam",
391 .of_match_table = hisi_pcie_almost_ecam_of_match,
392 },
393};
394builtin_platform_driver(hisi_pcie_almost_ecam_driver);
395
396#endif
339#endif 397#endif
diff --git a/drivers/pci/host/pci-host-common.c b/drivers/pci/host/pci-host-common.c
index e3c48b5deb93..e9a53bae1c25 100644
--- a/drivers/pci/host/pci-host-common.c
+++ b/drivers/pci/host/pci-host-common.c
@@ -145,7 +145,9 @@ int pci_host_common_probe(struct platform_device *pdev,
145 return -ENODEV; 145 return -ENODEV;
146 } 146 }
147 147
148#ifdef CONFIG_ARM
148 pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); 149 pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
150#endif
149 151
150 /* 152 /*
151 * We insert PCI resources into the iomem_resource and 153 * We insert PCI resources into the iomem_resource and
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a0b3cd5726dc..3deff4a98932 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1634,6 +1634,7 @@ static void quirk_pcie_mch(struct pci_dev *pdev)
1634DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_pcie_mch); 1634DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_pcie_mch);
1635DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_pcie_mch); 1635DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_pcie_mch);
1636DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_pcie_mch); 1636DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_pcie_mch);
1637DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1610, quirk_pcie_mch);
1637 1638
1638 1639
1639/* 1640/*
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 73dda0edcb97..a4f77feecbb0 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2516,6 +2516,8 @@
2516#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 2516#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700
2517#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff 2517#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff
2518 2518
2519#define PCI_VENDOR_ID_HUAWEI 0x19e5
2520
2519#define PCI_VENDOR_ID_NETRONOME 0x19ee 2521#define PCI_VENDOR_ID_NETRONOME 0x19ee
2520#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200 2522#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200
2521#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240 2523#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240