diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-14 13:11:34 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-11-14 13:11:34 -0500 |
commit | 2b61a44e115e346dcf248b4b35ae2aafed99bb78 (patch) | |
tree | 19f25ab595a2395b2b81b73a22c145dc0b0cd120 /drivers | |
parent | 9ff950304d2b39e00e090e71e7d1316d4e9fdd9d (diff) | |
parent | d76bdce394bf48140cbb33b07509c32df1cef8e7 (diff) |
Merge branch 'pci/host-tango' into next
* pci/host-tango:
PCI: tango: Add MSI controller support
PCI: Use of_pci_dma_range_parser_init() to reduce duplication
of/pci: Add of_pci_dma_range_parser_init() for dma-ranges parsing support
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/of/address.c | 19 | ||||
-rw-r--r-- | drivers/pci/host/pci-ftpci100.c | 20 | ||||
-rw-r--r-- | drivers/pci/host/pci-rcar-gen2.c | 20 | ||||
-rw-r--r-- | drivers/pci/host/pci-xgene.c | 20 | ||||
-rw-r--r-- | drivers/pci/host/pcie-iproc.c | 20 | ||||
-rw-r--r-- | drivers/pci/host/pcie-rcar.c | 20 | ||||
-rw-r--r-- | drivers/pci/host/pcie-tango.c | 205 |
7 files changed, 223 insertions, 101 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c index 792722e7d458..fa6cabfc3cb9 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c | |||
@@ -232,8 +232,8 @@ int of_pci_address_to_resource(struct device_node *dev, int bar, | |||
232 | } | 232 | } |
233 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); | 233 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); |
234 | 234 | ||
235 | int of_pci_range_parser_init(struct of_pci_range_parser *parser, | 235 | static int parser_init(struct of_pci_range_parser *parser, |
236 | struct device_node *node) | 236 | struct device_node *node, const char *name) |
237 | { | 237 | { |
238 | const int na = 3, ns = 2; | 238 | const int na = 3, ns = 2; |
239 | int rlen; | 239 | int rlen; |
@@ -242,7 +242,7 @@ int of_pci_range_parser_init(struct of_pci_range_parser *parser, | |||
242 | parser->pna = of_n_addr_cells(node); | 242 | parser->pna = of_n_addr_cells(node); |
243 | parser->np = parser->pna + na + ns; | 243 | parser->np = parser->pna + na + ns; |
244 | 244 | ||
245 | parser->range = of_get_property(node, "ranges", &rlen); | 245 | parser->range = of_get_property(node, name, &rlen); |
246 | if (parser->range == NULL) | 246 | if (parser->range == NULL) |
247 | return -ENOENT; | 247 | return -ENOENT; |
248 | 248 | ||
@@ -250,8 +250,21 @@ int of_pci_range_parser_init(struct of_pci_range_parser *parser, | |||
250 | 250 | ||
251 | return 0; | 251 | return 0; |
252 | } | 252 | } |
253 | |||
254 | int of_pci_range_parser_init(struct of_pci_range_parser *parser, | ||
255 | struct device_node *node) | ||
256 | { | ||
257 | return parser_init(parser, node, "ranges"); | ||
258 | } | ||
253 | EXPORT_SYMBOL_GPL(of_pci_range_parser_init); | 259 | EXPORT_SYMBOL_GPL(of_pci_range_parser_init); |
254 | 260 | ||
261 | int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, | ||
262 | struct device_node *node) | ||
263 | { | ||
264 | return parser_init(parser, node, "dma-ranges"); | ||
265 | } | ||
266 | EXPORT_SYMBOL_GPL(of_pci_dma_range_parser_init); | ||
267 | |||
255 | struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, | 268 | struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, |
256 | struct of_pci_range *range) | 269 | struct of_pci_range *range) |
257 | { | 270 | { |
diff --git a/drivers/pci/host/pci-ftpci100.c b/drivers/pci/host/pci-ftpci100.c index a19919c17d04..fae6bd190770 100644 --- a/drivers/pci/host/pci-ftpci100.c +++ b/drivers/pci/host/pci-ftpci100.c | |||
@@ -370,24 +370,6 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p) | |||
370 | return 0; | 370 | return 0; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int pci_dma_range_parser_init(struct of_pci_range_parser *parser, | ||
374 | struct device_node *node) | ||
375 | { | ||
376 | const int na = 3, ns = 2; | ||
377 | int rlen; | ||
378 | |||
379 | parser->node = node; | ||
380 | parser->pna = of_n_addr_cells(node); | ||
381 | parser->np = parser->pna + na + ns; | ||
382 | |||
383 | parser->range = of_get_property(node, "dma-ranges", &rlen); | ||
384 | if (!parser->range) | ||
385 | return -ENOENT; | ||
386 | parser->end = parser->range + rlen / sizeof(__be32); | ||
387 | |||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p, | 373 | static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p, |
392 | struct device_node *np) | 374 | struct device_node *np) |
393 | { | 375 | { |
@@ -402,7 +384,7 @@ static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p, | |||
402 | int i = 0; | 384 | int i = 0; |
403 | u32 val; | 385 | u32 val; |
404 | 386 | ||
405 | if (pci_dma_range_parser_init(&parser, np)) { | 387 | if (of_pci_dma_range_parser_init(&parser, np)) { |
406 | dev_err(dev, "missing dma-ranges property\n"); | 388 | dev_err(dev, "missing dma-ranges property\n"); |
407 | return -EINVAL; | 389 | return -EINVAL; |
408 | } | 390 | } |
diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index 6f879685fedd..e46de69f0380 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c | |||
@@ -293,24 +293,6 @@ static struct pci_ops rcar_pci_ops = { | |||
293 | .write = pci_generic_config_write, | 293 | .write = pci_generic_config_write, |
294 | }; | 294 | }; |
295 | 295 | ||
296 | static int pci_dma_range_parser_init(struct of_pci_range_parser *parser, | ||
297 | struct device_node *node) | ||
298 | { | ||
299 | const int na = 3, ns = 2; | ||
300 | int rlen; | ||
301 | |||
302 | parser->node = node; | ||
303 | parser->pna = of_n_addr_cells(node); | ||
304 | parser->np = parser->pna + na + ns; | ||
305 | |||
306 | parser->range = of_get_property(node, "dma-ranges", &rlen); | ||
307 | if (!parser->range) | ||
308 | return -ENOENT; | ||
309 | |||
310 | parser->end = parser->range + rlen / sizeof(__be32); | ||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static int rcar_pci_parse_map_dma_ranges(struct rcar_pci_priv *pci, | 296 | static int rcar_pci_parse_map_dma_ranges(struct rcar_pci_priv *pci, |
315 | struct device_node *np) | 297 | struct device_node *np) |
316 | { | 298 | { |
@@ -320,7 +302,7 @@ static int rcar_pci_parse_map_dma_ranges(struct rcar_pci_priv *pci, | |||
320 | int index = 0; | 302 | int index = 0; |
321 | 303 | ||
322 | /* Failure to parse is ok as we fall back to defaults */ | 304 | /* Failure to parse is ok as we fall back to defaults */ |
323 | if (pci_dma_range_parser_init(&parser, np)) | 305 | if (of_pci_dma_range_parser_init(&parser, np)) |
324 | return 0; | 306 | return 0; |
325 | 307 | ||
326 | /* Get the dma-ranges from DT */ | 308 | /* Get the dma-ranges from DT */ |
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c index 087645116ecb..8fc45d95edab 100644 --- a/drivers/pci/host/pci-xgene.c +++ b/drivers/pci/host/pci-xgene.c | |||
@@ -542,24 +542,6 @@ static void xgene_pcie_setup_ib_reg(struct xgene_pcie_port *port, | |||
542 | xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1)); | 542 | xgene_pcie_setup_pims(port, pim_reg, pci_addr, ~(size - 1)); |
543 | } | 543 | } |
544 | 544 | ||
545 | static int pci_dma_range_parser_init(struct of_pci_range_parser *parser, | ||
546 | struct device_node *node) | ||
547 | { | ||
548 | const int na = 3, ns = 2; | ||
549 | int rlen; | ||
550 | |||
551 | parser->node = node; | ||
552 | parser->pna = of_n_addr_cells(node); | ||
553 | parser->np = parser->pna + na + ns; | ||
554 | |||
555 | parser->range = of_get_property(node, "dma-ranges", &rlen); | ||
556 | if (!parser->range) | ||
557 | return -ENOENT; | ||
558 | parser->end = parser->range + rlen / sizeof(__be32); | ||
559 | |||
560 | return 0; | ||
561 | } | ||
562 | |||
563 | static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port) | 545 | static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port) |
564 | { | 546 | { |
565 | struct device_node *np = port->node; | 547 | struct device_node *np = port->node; |
@@ -568,7 +550,7 @@ static int xgene_pcie_parse_map_dma_ranges(struct xgene_pcie_port *port) | |||
568 | struct device *dev = port->dev; | 550 | struct device *dev = port->dev; |
569 | u8 ib_reg_mask = 0; | 551 | u8 ib_reg_mask = 0; |
570 | 552 | ||
571 | if (pci_dma_range_parser_init(&parser, np)) { | 553 | if (of_pci_dma_range_parser_init(&parser, np)) { |
572 | dev_err(dev, "missing dma-ranges property\n"); | 554 | dev_err(dev, "missing dma-ranges property\n"); |
573 | return -EINVAL; | 555 | return -EINVAL; |
574 | } | 556 | } |
diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index 3a8b9d20ee57..935909bbe5c4 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c | |||
@@ -1097,24 +1097,6 @@ err_ib: | |||
1097 | return ret; | 1097 | return ret; |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | static int pci_dma_range_parser_init(struct of_pci_range_parser *parser, | ||
1101 | struct device_node *node) | ||
1102 | { | ||
1103 | const int na = 3, ns = 2; | ||
1104 | int rlen; | ||
1105 | |||
1106 | parser->node = node; | ||
1107 | parser->pna = of_n_addr_cells(node); | ||
1108 | parser->np = parser->pna + na + ns; | ||
1109 | |||
1110 | parser->range = of_get_property(node, "dma-ranges", &rlen); | ||
1111 | if (!parser->range) | ||
1112 | return -ENOENT; | ||
1113 | |||
1114 | parser->end = parser->range + rlen / sizeof(__be32); | ||
1115 | return 0; | ||
1116 | } | ||
1117 | |||
1118 | static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie) | 1100 | static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie) |
1119 | { | 1101 | { |
1120 | struct of_pci_range range; | 1102 | struct of_pci_range range; |
@@ -1122,7 +1104,7 @@ static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie) | |||
1122 | int ret; | 1104 | int ret; |
1123 | 1105 | ||
1124 | /* Get the dma-ranges from DT */ | 1106 | /* Get the dma-ranges from DT */ |
1125 | ret = pci_dma_range_parser_init(&parser, pcie->dev->of_node); | 1107 | ret = of_pci_dma_range_parser_init(&parser, pcie->dev->of_node); |
1126 | if (ret) | 1108 | if (ret) |
1127 | return ret; | 1109 | return ret; |
1128 | 1110 | ||
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 4e0b25d09b0c..12796eccb2be 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c | |||
@@ -1027,24 +1027,6 @@ static int rcar_pcie_inbound_ranges(struct rcar_pcie *pcie, | |||
1027 | return 0; | 1027 | return 0; |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | static int pci_dma_range_parser_init(struct of_pci_range_parser *parser, | ||
1031 | struct device_node *node) | ||
1032 | { | ||
1033 | const int na = 3, ns = 2; | ||
1034 | int rlen; | ||
1035 | |||
1036 | parser->node = node; | ||
1037 | parser->pna = of_n_addr_cells(node); | ||
1038 | parser->np = parser->pna + na + ns; | ||
1039 | |||
1040 | parser->range = of_get_property(node, "dma-ranges", &rlen); | ||
1041 | if (!parser->range) | ||
1042 | return -ENOENT; | ||
1043 | |||
1044 | parser->end = parser->range + rlen / sizeof(__be32); | ||
1045 | return 0; | ||
1046 | } | ||
1047 | |||
1048 | static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie, | 1030 | static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie, |
1049 | struct device_node *np) | 1031 | struct device_node *np) |
1050 | { | 1032 | { |
@@ -1053,7 +1035,7 @@ static int rcar_pcie_parse_map_dma_ranges(struct rcar_pcie *pcie, | |||
1053 | int index = 0; | 1035 | int index = 0; |
1054 | int err; | 1036 | int err; |
1055 | 1037 | ||
1056 | if (pci_dma_range_parser_init(&parser, np)) | 1038 | if (of_pci_dma_range_parser_init(&parser, np)) |
1057 | return -EINVAL; | 1039 | return -EINVAL; |
1058 | 1040 | ||
1059 | /* Get the dma-ranges from DT */ | 1041 | /* Get the dma-ranges from DT */ |
diff --git a/drivers/pci/host/pcie-tango.c b/drivers/pci/host/pcie-tango.c index 6bbb81f06a53..e23f7383ac33 100644 --- a/drivers/pci/host/pcie-tango.c +++ b/drivers/pci/host/pcie-tango.c | |||
@@ -1,12 +1,172 @@ | |||
1 | #include <linux/irqchip/chained_irq.h> | ||
2 | #include <linux/irqdomain.h> | ||
1 | #include <linux/pci-ecam.h> | 3 | #include <linux/pci-ecam.h> |
2 | #include <linux/delay.h> | 4 | #include <linux/delay.h> |
3 | #include <linux/of.h> | 5 | #include <linux/msi.h> |
6 | #include <linux/of_address.h> | ||
7 | |||
8 | #define MSI_MAX 256 | ||
4 | 9 | ||
5 | #define SMP8759_MUX 0x48 | 10 | #define SMP8759_MUX 0x48 |
6 | #define SMP8759_TEST_OUT 0x74 | 11 | #define SMP8759_TEST_OUT 0x74 |
12 | #define SMP8759_DOORBELL 0x7c | ||
13 | #define SMP8759_STATUS 0x80 | ||
14 | #define SMP8759_ENABLE 0xa0 | ||
7 | 15 | ||
8 | struct tango_pcie { | 16 | struct tango_pcie { |
9 | void __iomem *base; | 17 | DECLARE_BITMAP(used_msi, MSI_MAX); |
18 | u64 msi_doorbell; | ||
19 | spinlock_t used_msi_lock; | ||
20 | void __iomem *base; | ||
21 | struct irq_domain *dom; | ||
22 | }; | ||
23 | |||
24 | static void tango_msi_isr(struct irq_desc *desc) | ||
25 | { | ||
26 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
27 | struct tango_pcie *pcie = irq_desc_get_handler_data(desc); | ||
28 | unsigned long status, base, virq, idx, pos = 0; | ||
29 | |||
30 | chained_irq_enter(chip, desc); | ||
31 | spin_lock(&pcie->used_msi_lock); | ||
32 | |||
33 | while ((pos = find_next_bit(pcie->used_msi, MSI_MAX, pos)) < MSI_MAX) { | ||
34 | base = round_down(pos, 32); | ||
35 | status = readl_relaxed(pcie->base + SMP8759_STATUS + base / 8); | ||
36 | for_each_set_bit(idx, &status, 32) { | ||
37 | virq = irq_find_mapping(pcie->dom, base + idx); | ||
38 | generic_handle_irq(virq); | ||
39 | } | ||
40 | pos = base + 32; | ||
41 | } | ||
42 | |||
43 | spin_unlock(&pcie->used_msi_lock); | ||
44 | chained_irq_exit(chip, desc); | ||
45 | } | ||
46 | |||
47 | static void tango_ack(struct irq_data *d) | ||
48 | { | ||
49 | struct tango_pcie *pcie = d->chip_data; | ||
50 | u32 offset = (d->hwirq / 32) * 4; | ||
51 | u32 bit = BIT(d->hwirq % 32); | ||
52 | |||
53 | writel_relaxed(bit, pcie->base + SMP8759_STATUS + offset); | ||
54 | } | ||
55 | |||
56 | static void update_msi_enable(struct irq_data *d, bool unmask) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | struct tango_pcie *pcie = d->chip_data; | ||
60 | u32 offset = (d->hwirq / 32) * 4; | ||
61 | u32 bit = BIT(d->hwirq % 32); | ||
62 | u32 val; | ||
63 | |||
64 | spin_lock_irqsave(&pcie->used_msi_lock, flags); | ||
65 | val = readl_relaxed(pcie->base + SMP8759_ENABLE + offset); | ||
66 | val = unmask ? val | bit : val & ~bit; | ||
67 | writel_relaxed(val, pcie->base + SMP8759_ENABLE + offset); | ||
68 | spin_unlock_irqrestore(&pcie->used_msi_lock, flags); | ||
69 | } | ||
70 | |||
71 | static void tango_mask(struct irq_data *d) | ||
72 | { | ||
73 | update_msi_enable(d, false); | ||
74 | } | ||
75 | |||
76 | static void tango_unmask(struct irq_data *d) | ||
77 | { | ||
78 | update_msi_enable(d, true); | ||
79 | } | ||
80 | |||
81 | static int tango_set_affinity(struct irq_data *d, const struct cpumask *mask, | ||
82 | bool force) | ||
83 | { | ||
84 | return -EINVAL; | ||
85 | } | ||
86 | |||
87 | static void tango_compose_msi_msg(struct irq_data *d, struct msi_msg *msg) | ||
88 | { | ||
89 | struct tango_pcie *pcie = d->chip_data; | ||
90 | msg->address_lo = lower_32_bits(pcie->msi_doorbell); | ||
91 | msg->address_hi = upper_32_bits(pcie->msi_doorbell); | ||
92 | msg->data = d->hwirq; | ||
93 | } | ||
94 | |||
95 | static struct irq_chip tango_chip = { | ||
96 | .irq_ack = tango_ack, | ||
97 | .irq_mask = tango_mask, | ||
98 | .irq_unmask = tango_unmask, | ||
99 | .irq_set_affinity = tango_set_affinity, | ||
100 | .irq_compose_msi_msg = tango_compose_msi_msg, | ||
101 | }; | ||
102 | |||
103 | static void msi_ack(struct irq_data *d) | ||
104 | { | ||
105 | irq_chip_ack_parent(d); | ||
106 | } | ||
107 | |||
108 | static void msi_mask(struct irq_data *d) | ||
109 | { | ||
110 | pci_msi_mask_irq(d); | ||
111 | irq_chip_mask_parent(d); | ||
112 | } | ||
113 | |||
114 | static void msi_unmask(struct irq_data *d) | ||
115 | { | ||
116 | pci_msi_unmask_irq(d); | ||
117 | irq_chip_unmask_parent(d); | ||
118 | } | ||
119 | |||
120 | static struct irq_chip msi_chip = { | ||
121 | .name = "MSI", | ||
122 | .irq_ack = msi_ack, | ||
123 | .irq_mask = msi_mask, | ||
124 | .irq_unmask = msi_unmask, | ||
125 | }; | ||
126 | |||
127 | static struct msi_domain_info msi_dom_info = { | ||
128 | .flags = MSI_FLAG_PCI_MSIX | ||
129 | | MSI_FLAG_USE_DEF_DOM_OPS | ||
130 | | MSI_FLAG_USE_DEF_CHIP_OPS, | ||
131 | .chip = &msi_chip, | ||
132 | }; | ||
133 | |||
134 | static int tango_irq_domain_alloc(struct irq_domain *dom, unsigned int virq, | ||
135 | unsigned int nr_irqs, void *args) | ||
136 | { | ||
137 | struct tango_pcie *pcie = dom->host_data; | ||
138 | unsigned long flags; | ||
139 | int pos; | ||
140 | |||
141 | spin_lock_irqsave(&pcie->used_msi_lock, flags); | ||
142 | pos = find_first_zero_bit(pcie->used_msi, MSI_MAX); | ||
143 | if (pos >= MSI_MAX) { | ||
144 | spin_unlock_irqrestore(&pcie->used_msi_lock, flags); | ||
145 | return -ENOSPC; | ||
146 | } | ||
147 | __set_bit(pos, pcie->used_msi); | ||
148 | spin_unlock_irqrestore(&pcie->used_msi_lock, flags); | ||
149 | irq_domain_set_info(dom, virq, pos, &tango_chip, | ||
150 | pcie, handle_edge_irq, NULL, NULL); | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static void tango_irq_domain_free(struct irq_domain *dom, unsigned int virq, | ||
156 | unsigned int nr_irqs) | ||
157 | { | ||
158 | unsigned long flags; | ||
159 | struct irq_data *d = irq_domain_get_irq_data(dom, virq); | ||
160 | struct tango_pcie *pcie = d->chip_data; | ||
161 | |||
162 | spin_lock_irqsave(&pcie->used_msi_lock, flags); | ||
163 | __clear_bit(d->hwirq, pcie->used_msi); | ||
164 | spin_unlock_irqrestore(&pcie->used_msi_lock, flags); | ||
165 | } | ||
166 | |||
167 | static const struct irq_domain_ops dom_ops = { | ||
168 | .alloc = tango_irq_domain_alloc, | ||
169 | .free = tango_irq_domain_free, | ||
10 | }; | 170 | }; |
11 | 171 | ||
12 | static int smp8759_config_read(struct pci_bus *bus, unsigned int devfn, | 172 | static int smp8759_config_read(struct pci_bus *bus, unsigned int devfn, |
@@ -76,7 +236,11 @@ static int tango_pcie_probe(struct platform_device *pdev) | |||
76 | struct device *dev = &pdev->dev; | 236 | struct device *dev = &pdev->dev; |
77 | struct tango_pcie *pcie; | 237 | struct tango_pcie *pcie; |
78 | struct resource *res; | 238 | struct resource *res; |
79 | int ret; | 239 | struct fwnode_handle *fwnode = of_node_to_fwnode(dev->of_node); |
240 | struct irq_domain *msi_dom, *irq_dom; | ||
241 | struct of_pci_range_parser parser; | ||
242 | struct of_pci_range range; | ||
243 | int virq, offset; | ||
80 | 244 | ||
81 | dev_warn(dev, "simultaneous PCI config and MMIO accesses may cause data corruption\n"); | 245 | dev_warn(dev, "simultaneous PCI config and MMIO accesses may cause data corruption\n"); |
82 | add_taint(TAINT_CRAP, LOCKDEP_STILL_OK); | 246 | add_taint(TAINT_CRAP, LOCKDEP_STILL_OK); |
@@ -95,6 +259,41 @@ static int tango_pcie_probe(struct platform_device *pdev) | |||
95 | if (!tango_pcie_link_up(pcie)) | 259 | if (!tango_pcie_link_up(pcie)) |
96 | return -ENODEV; | 260 | return -ENODEV; |
97 | 261 | ||
262 | if (of_pci_dma_range_parser_init(&parser, dev->of_node) < 0) | ||
263 | return -ENOENT; | ||
264 | |||
265 | if (of_pci_range_parser_one(&parser, &range) == NULL) | ||
266 | return -ENOENT; | ||
267 | |||
268 | range.pci_addr += range.size; | ||
269 | pcie->msi_doorbell = range.pci_addr + res->start + SMP8759_DOORBELL; | ||
270 | |||
271 | for (offset = 0; offset < MSI_MAX / 8; offset += 4) | ||
272 | writel_relaxed(0, pcie->base + SMP8759_ENABLE + offset); | ||
273 | |||
274 | virq = platform_get_irq(pdev, 1); | ||
275 | if (virq <= 0) { | ||
276 | dev_err(dev, "Failed to map IRQ\n"); | ||
277 | return -ENXIO; | ||
278 | } | ||
279 | |||
280 | irq_dom = irq_domain_create_linear(fwnode, MSI_MAX, &dom_ops, pcie); | ||
281 | if (!irq_dom) { | ||
282 | dev_err(dev, "Failed to create IRQ domain\n"); | ||
283 | return -ENOMEM; | ||
284 | } | ||
285 | |||
286 | msi_dom = pci_msi_create_irq_domain(fwnode, &msi_dom_info, irq_dom); | ||
287 | if (!msi_dom) { | ||
288 | dev_err(dev, "Failed to create MSI domain\n"); | ||
289 | irq_domain_remove(irq_dom); | ||
290 | return -ENOMEM; | ||
291 | } | ||
292 | |||
293 | pcie->dom = irq_dom; | ||
294 | spin_lock_init(&pcie->used_msi_lock); | ||
295 | irq_set_chained_handler_and_data(virq, tango_msi_isr, pcie); | ||
296 | |||
98 | return pci_host_common_probe(pdev, &smp8759_ecam_ops); | 297 | return pci_host_common_probe(pdev, &smp8759_ecam_ops); |
99 | } | 298 | } |
100 | 299 | ||