]> Git Repo - linux.git/blob - drivers/pci/controller/pcie-xilinx.c
Merge tag 'arc-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
[linux.git] / drivers / pci / controller / pcie-xilinx.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * PCIe host controller driver for Xilinx AXI PCIe Bridge
4  *
5  * Copyright (c) 2012 - 2014 Xilinx, Inc.
6  *
7  * Based on the Tegra PCIe driver
8  *
9  * Bits taken from Synopsys DesignWare Host controller driver and
10  * ARM PCI Host generic driver.
11  */
12
13 #include <linux/interrupt.h>
14 #include <linux/irq.h>
15 #include <linux/irqdomain.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/msi.h>
19 #include <linux/of_address.h>
20 #include <linux/of_pci.h>
21 #include <linux/of_platform.h>
22 #include <linux/of_irq.h>
23 #include <linux/pci.h>
24 #include <linux/pci-ecam.h>
25 #include <linux/platform_device.h>
26
27 #include "../pci.h"
28
29 /* Register definitions */
30 #define XILINX_PCIE_REG_BIR             0x00000130
31 #define XILINX_PCIE_REG_IDR             0x00000138
32 #define XILINX_PCIE_REG_IMR             0x0000013c
33 #define XILINX_PCIE_REG_PSCR            0x00000144
34 #define XILINX_PCIE_REG_RPSC            0x00000148
35 #define XILINX_PCIE_REG_MSIBASE1        0x0000014c
36 #define XILINX_PCIE_REG_MSIBASE2        0x00000150
37 #define XILINX_PCIE_REG_RPEFR           0x00000154
38 #define XILINX_PCIE_REG_RPIFR1          0x00000158
39 #define XILINX_PCIE_REG_RPIFR2          0x0000015c
40
41 /* Interrupt registers definitions */
42 #define XILINX_PCIE_INTR_LINK_DOWN      BIT(0)
43 #define XILINX_PCIE_INTR_ECRC_ERR       BIT(1)
44 #define XILINX_PCIE_INTR_STR_ERR        BIT(2)
45 #define XILINX_PCIE_INTR_HOT_RESET      BIT(3)
46 #define XILINX_PCIE_INTR_CFG_TIMEOUT    BIT(8)
47 #define XILINX_PCIE_INTR_CORRECTABLE    BIT(9)
48 #define XILINX_PCIE_INTR_NONFATAL       BIT(10)
49 #define XILINX_PCIE_INTR_FATAL          BIT(11)
50 #define XILINX_PCIE_INTR_INTX           BIT(16)
51 #define XILINX_PCIE_INTR_MSI            BIT(17)
52 #define XILINX_PCIE_INTR_SLV_UNSUPP     BIT(20)
53 #define XILINX_PCIE_INTR_SLV_UNEXP      BIT(21)
54 #define XILINX_PCIE_INTR_SLV_COMPL      BIT(22)
55 #define XILINX_PCIE_INTR_SLV_ERRP       BIT(23)
56 #define XILINX_PCIE_INTR_SLV_CMPABT     BIT(24)
57 #define XILINX_PCIE_INTR_SLV_ILLBUR     BIT(25)
58 #define XILINX_PCIE_INTR_MST_DECERR     BIT(26)
59 #define XILINX_PCIE_INTR_MST_SLVERR     BIT(27)
60 #define XILINX_PCIE_INTR_MST_ERRP       BIT(28)
61 #define XILINX_PCIE_IMR_ALL_MASK        0x1FF30FED
62 #define XILINX_PCIE_IMR_ENABLE_MASK     0x1FF30F0D
63 #define XILINX_PCIE_IDR_ALL_MASK        0xFFFFFFFF
64
65 /* Root Port Error FIFO Read Register definitions */
66 #define XILINX_PCIE_RPEFR_ERR_VALID     BIT(18)
67 #define XILINX_PCIE_RPEFR_REQ_ID        GENMASK(15, 0)
68 #define XILINX_PCIE_RPEFR_ALL_MASK      0xFFFFFFFF
69
70 /* Root Port Interrupt FIFO Read Register 1 definitions */
71 #define XILINX_PCIE_RPIFR1_INTR_VALID   BIT(31)
72 #define XILINX_PCIE_RPIFR1_MSI_INTR     BIT(30)
73 #define XILINX_PCIE_RPIFR1_INTR_MASK    GENMASK(28, 27)
74 #define XILINX_PCIE_RPIFR1_ALL_MASK     0xFFFFFFFF
75 #define XILINX_PCIE_RPIFR1_INTR_SHIFT   27
76
77 /* Bridge Info Register definitions */
78 #define XILINX_PCIE_BIR_ECAM_SZ_MASK    GENMASK(18, 16)
79 #define XILINX_PCIE_BIR_ECAM_SZ_SHIFT   16
80
81 /* Root Port Interrupt FIFO Read Register 2 definitions */
82 #define XILINX_PCIE_RPIFR2_MSG_DATA     GENMASK(15, 0)
83
84 /* Root Port Status/control Register definitions */
85 #define XILINX_PCIE_REG_RPSC_BEN        BIT(0)
86
87 /* Phy Status/Control Register definitions */
88 #define XILINX_PCIE_REG_PSCR_LNKUP      BIT(11)
89
90 /* Number of MSI IRQs */
91 #define XILINX_NUM_MSI_IRQS             128
92
93 /**
94  * struct xilinx_pcie_port - PCIe port information
95  * @reg_base: IO Mapped Register Base
96  * @irq: Interrupt number
97  * @msi_pages: MSI pages
98  * @dev: Device pointer
99  * @msi_domain: MSI IRQ domain pointer
100  * @leg_domain: Legacy IRQ domain pointer
101  * @resources: Bus Resources
102  */
103 struct xilinx_pcie_port {
104         void __iomem *reg_base;
105         u32 irq;
106         unsigned long msi_pages;
107         struct device *dev;
108         struct irq_domain *msi_domain;
109         struct irq_domain *leg_domain;
110         struct list_head resources;
111 };
112
113 static DECLARE_BITMAP(msi_irq_in_use, XILINX_NUM_MSI_IRQS);
114
115 static inline u32 pcie_read(struct xilinx_pcie_port *port, u32 reg)
116 {
117         return readl(port->reg_base + reg);
118 }
119
120 static inline void pcie_write(struct xilinx_pcie_port *port, u32 val, u32 reg)
121 {
122         writel(val, port->reg_base + reg);
123 }
124
125 static inline bool xilinx_pcie_link_up(struct xilinx_pcie_port *port)
126 {
127         return (pcie_read(port, XILINX_PCIE_REG_PSCR) &
128                 XILINX_PCIE_REG_PSCR_LNKUP) ? 1 : 0;
129 }
130
131 /**
132  * xilinx_pcie_clear_err_interrupts - Clear Error Interrupts
133  * @port: PCIe port information
134  */
135 static void xilinx_pcie_clear_err_interrupts(struct xilinx_pcie_port *port)
136 {
137         struct device *dev = port->dev;
138         unsigned long val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
139
140         if (val & XILINX_PCIE_RPEFR_ERR_VALID) {
141                 dev_dbg(dev, "Requester ID %lu\n",
142                         val & XILINX_PCIE_RPEFR_REQ_ID);
143                 pcie_write(port, XILINX_PCIE_RPEFR_ALL_MASK,
144                            XILINX_PCIE_REG_RPEFR);
145         }
146 }
147
148 /**
149  * xilinx_pcie_valid_device - Check if a valid device is present on bus
150  * @bus: PCI Bus structure
151  * @devfn: device/function
152  *
153  * Return: 'true' on success and 'false' if invalid device is found
154  */
155 static bool xilinx_pcie_valid_device(struct pci_bus *bus, unsigned int devfn)
156 {
157         struct xilinx_pcie_port *port = bus->sysdata;
158
159         /* Check if link is up when trying to access downstream ports */
160         if (!pci_is_root_bus(bus)) {
161                 if (!xilinx_pcie_link_up(port))
162                         return false;
163         } else if (devfn > 0) {
164                 /* Only one device down on each root port */
165                 return false;
166         }
167         return true;
168 }
169
170 /**
171  * xilinx_pcie_map_bus - Get configuration base
172  * @bus: PCI Bus structure
173  * @devfn: Device/function
174  * @where: Offset from base
175  *
176  * Return: Base address of the configuration space needed to be
177  *         accessed.
178  */
179 static void __iomem *xilinx_pcie_map_bus(struct pci_bus *bus,
180                                          unsigned int devfn, int where)
181 {
182         struct xilinx_pcie_port *port = bus->sysdata;
183
184         if (!xilinx_pcie_valid_device(bus, devfn))
185                 return NULL;
186
187         return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where);
188 }
189
190 /* PCIe operations */
191 static struct pci_ops xilinx_pcie_ops = {
192         .map_bus = xilinx_pcie_map_bus,
193         .read   = pci_generic_config_read,
194         .write  = pci_generic_config_write,
195 };
196
197 /* MSI functions */
198
199 /**
200  * xilinx_pcie_destroy_msi - Free MSI number
201  * @irq: IRQ to be freed
202  */
203 static void xilinx_pcie_destroy_msi(unsigned int irq)
204 {
205         struct msi_desc *msi;
206         struct xilinx_pcie_port *port;
207         struct irq_data *d = irq_get_irq_data(irq);
208         irq_hw_number_t hwirq = irqd_to_hwirq(d);
209
210         if (!test_bit(hwirq, msi_irq_in_use)) {
211                 msi = irq_get_msi_desc(irq);
212                 port = msi_desc_to_pci_sysdata(msi);
213                 dev_err(port->dev, "Trying to free unused MSI#%d\n", irq);
214         } else {
215                 clear_bit(hwirq, msi_irq_in_use);
216         }
217 }
218
219 /**
220  * xilinx_pcie_assign_msi - Allocate MSI number
221  *
222  * Return: A valid IRQ on success and error value on failure.
223  */
224 static int xilinx_pcie_assign_msi(void)
225 {
226         int pos;
227
228         pos = find_first_zero_bit(msi_irq_in_use, XILINX_NUM_MSI_IRQS);
229         if (pos < XILINX_NUM_MSI_IRQS)
230                 set_bit(pos, msi_irq_in_use);
231         else
232                 return -ENOSPC;
233
234         return pos;
235 }
236
237 /**
238  * xilinx_msi_teardown_irq - Destroy the MSI
239  * @chip: MSI Chip descriptor
240  * @irq: MSI IRQ to destroy
241  */
242 static void xilinx_msi_teardown_irq(struct msi_controller *chip,
243                                     unsigned int irq)
244 {
245         xilinx_pcie_destroy_msi(irq);
246         irq_dispose_mapping(irq);
247 }
248
249 /**
250  * xilinx_pcie_msi_setup_irq - Setup MSI request
251  * @chip: MSI chip pointer
252  * @pdev: PCIe device pointer
253  * @desc: MSI descriptor pointer
254  *
255  * Return: '0' on success and error value on failure
256  */
257 static int xilinx_pcie_msi_setup_irq(struct msi_controller *chip,
258                                      struct pci_dev *pdev,
259                                      struct msi_desc *desc)
260 {
261         struct xilinx_pcie_port *port = pdev->bus->sysdata;
262         unsigned int irq;
263         int hwirq;
264         struct msi_msg msg;
265         phys_addr_t msg_addr;
266
267         hwirq = xilinx_pcie_assign_msi();
268         if (hwirq < 0)
269                 return hwirq;
270
271         irq = irq_create_mapping(port->msi_domain, hwirq);
272         if (!irq)
273                 return -EINVAL;
274
275         irq_set_msi_desc(irq, desc);
276
277         msg_addr = virt_to_phys((void *)port->msi_pages);
278
279         msg.address_hi = 0;
280         msg.address_lo = msg_addr;
281         msg.data = irq;
282
283         pci_write_msi_msg(irq, &msg);
284
285         return 0;
286 }
287
288 /* MSI Chip Descriptor */
289 static struct msi_controller xilinx_pcie_msi_chip = {
290         .setup_irq = xilinx_pcie_msi_setup_irq,
291         .teardown_irq = xilinx_msi_teardown_irq,
292 };
293
294 /* HW Interrupt Chip Descriptor */
295 static struct irq_chip xilinx_msi_irq_chip = {
296         .name = "Xilinx PCIe MSI",
297         .irq_enable = pci_msi_unmask_irq,
298         .irq_disable = pci_msi_mask_irq,
299         .irq_mask = pci_msi_mask_irq,
300         .irq_unmask = pci_msi_unmask_irq,
301 };
302
303 /**
304  * xilinx_pcie_msi_map - Set the handler for the MSI and mark IRQ as valid
305  * @domain: IRQ domain
306  * @irq: Virtual IRQ number
307  * @hwirq: HW interrupt number
308  *
309  * Return: Always returns 0.
310  */
311 static int xilinx_pcie_msi_map(struct irq_domain *domain, unsigned int irq,
312                                irq_hw_number_t hwirq)
313 {
314         irq_set_chip_and_handler(irq, &xilinx_msi_irq_chip, handle_simple_irq);
315         irq_set_chip_data(irq, domain->host_data);
316
317         return 0;
318 }
319
320 /* IRQ Domain operations */
321 static const struct irq_domain_ops msi_domain_ops = {
322         .map = xilinx_pcie_msi_map,
323 };
324
325 /**
326  * xilinx_pcie_enable_msi - Enable MSI support
327  * @port: PCIe port information
328  */
329 static int xilinx_pcie_enable_msi(struct xilinx_pcie_port *port)
330 {
331         phys_addr_t msg_addr;
332
333         port->msi_pages = __get_free_pages(GFP_KERNEL, 0);
334         if (!port->msi_pages)
335                 return -ENOMEM;
336
337         msg_addr = virt_to_phys((void *)port->msi_pages);
338         pcie_write(port, 0x0, XILINX_PCIE_REG_MSIBASE1);
339         pcie_write(port, msg_addr, XILINX_PCIE_REG_MSIBASE2);
340
341         return 0;
342 }
343
344 /* INTx Functions */
345
346 /**
347  * xilinx_pcie_intx_map - Set the handler for the INTx and mark IRQ as valid
348  * @domain: IRQ domain
349  * @irq: Virtual IRQ number
350  * @hwirq: HW interrupt number
351  *
352  * Return: Always returns 0.
353  */
354 static int xilinx_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
355                                 irq_hw_number_t hwirq)
356 {
357         irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq);
358         irq_set_chip_data(irq, domain->host_data);
359
360         return 0;
361 }
362
363 /* INTx IRQ Domain operations */
364 static const struct irq_domain_ops intx_domain_ops = {
365         .map = xilinx_pcie_intx_map,
366         .xlate = pci_irqd_intx_xlate,
367 };
368
369 /* PCIe HW Functions */
370
371 /**
372  * xilinx_pcie_intr_handler - Interrupt Service Handler
373  * @irq: IRQ number
374  * @data: PCIe port information
375  *
376  * Return: IRQ_HANDLED on success and IRQ_NONE on failure
377  */
378 static irqreturn_t xilinx_pcie_intr_handler(int irq, void *data)
379 {
380         struct xilinx_pcie_port *port = (struct xilinx_pcie_port *)data;
381         struct device *dev = port->dev;
382         u32 val, mask, status;
383
384         /* Read interrupt decode and mask registers */
385         val = pcie_read(port, XILINX_PCIE_REG_IDR);
386         mask = pcie_read(port, XILINX_PCIE_REG_IMR);
387
388         status = val & mask;
389         if (!status)
390                 return IRQ_NONE;
391
392         if (status & XILINX_PCIE_INTR_LINK_DOWN)
393                 dev_warn(dev, "Link Down\n");
394
395         if (status & XILINX_PCIE_INTR_ECRC_ERR)
396                 dev_warn(dev, "ECRC failed\n");
397
398         if (status & XILINX_PCIE_INTR_STR_ERR)
399                 dev_warn(dev, "Streaming error\n");
400
401         if (status & XILINX_PCIE_INTR_HOT_RESET)
402                 dev_info(dev, "Hot reset\n");
403
404         if (status & XILINX_PCIE_INTR_CFG_TIMEOUT)
405                 dev_warn(dev, "ECAM access timeout\n");
406
407         if (status & XILINX_PCIE_INTR_CORRECTABLE) {
408                 dev_warn(dev, "Correctable error message\n");
409                 xilinx_pcie_clear_err_interrupts(port);
410         }
411
412         if (status & XILINX_PCIE_INTR_NONFATAL) {
413                 dev_warn(dev, "Non fatal error message\n");
414                 xilinx_pcie_clear_err_interrupts(port);
415         }
416
417         if (status & XILINX_PCIE_INTR_FATAL) {
418                 dev_warn(dev, "Fatal error message\n");
419                 xilinx_pcie_clear_err_interrupts(port);
420         }
421
422         if (status & (XILINX_PCIE_INTR_INTX | XILINX_PCIE_INTR_MSI)) {
423                 val = pcie_read(port, XILINX_PCIE_REG_RPIFR1);
424
425                 /* Check whether interrupt valid */
426                 if (!(val & XILINX_PCIE_RPIFR1_INTR_VALID)) {
427                         dev_warn(dev, "RP Intr FIFO1 read error\n");
428                         goto error;
429                 }
430
431                 /* Decode the IRQ number */
432                 if (val & XILINX_PCIE_RPIFR1_MSI_INTR) {
433                         val = pcie_read(port, XILINX_PCIE_REG_RPIFR2) &
434                                 XILINX_PCIE_RPIFR2_MSG_DATA;
435                 } else {
436                         val = (val & XILINX_PCIE_RPIFR1_INTR_MASK) >>
437                                 XILINX_PCIE_RPIFR1_INTR_SHIFT;
438                         val = irq_find_mapping(port->leg_domain, val);
439                 }
440
441                 /* Clear interrupt FIFO register 1 */
442                 pcie_write(port, XILINX_PCIE_RPIFR1_ALL_MASK,
443                            XILINX_PCIE_REG_RPIFR1);
444
445                 /* Handle the interrupt */
446                 if (IS_ENABLED(CONFIG_PCI_MSI) ||
447                     !(val & XILINX_PCIE_RPIFR1_MSI_INTR))
448                         generic_handle_irq(val);
449         }
450
451         if (status & XILINX_PCIE_INTR_SLV_UNSUPP)
452                 dev_warn(dev, "Slave unsupported request\n");
453
454         if (status & XILINX_PCIE_INTR_SLV_UNEXP)
455                 dev_warn(dev, "Slave unexpected completion\n");
456
457         if (status & XILINX_PCIE_INTR_SLV_COMPL)
458                 dev_warn(dev, "Slave completion timeout\n");
459
460         if (status & XILINX_PCIE_INTR_SLV_ERRP)
461                 dev_warn(dev, "Slave Error Poison\n");
462
463         if (status & XILINX_PCIE_INTR_SLV_CMPABT)
464                 dev_warn(dev, "Slave Completer Abort\n");
465
466         if (status & XILINX_PCIE_INTR_SLV_ILLBUR)
467                 dev_warn(dev, "Slave Illegal Burst\n");
468
469         if (status & XILINX_PCIE_INTR_MST_DECERR)
470                 dev_warn(dev, "Master decode error\n");
471
472         if (status & XILINX_PCIE_INTR_MST_SLVERR)
473                 dev_warn(dev, "Master slave error\n");
474
475         if (status & XILINX_PCIE_INTR_MST_ERRP)
476                 dev_warn(dev, "Master error poison\n");
477
478 error:
479         /* Clear the Interrupt Decode register */
480         pcie_write(port, status, XILINX_PCIE_REG_IDR);
481
482         return IRQ_HANDLED;
483 }
484
485 /**
486  * xilinx_pcie_init_irq_domain - Initialize IRQ domain
487  * @port: PCIe port information
488  *
489  * Return: '0' on success and error value on failure
490  */
491 static int xilinx_pcie_init_irq_domain(struct xilinx_pcie_port *port)
492 {
493         struct device *dev = port->dev;
494         struct device_node *node = dev->of_node;
495         struct device_node *pcie_intc_node;
496         int ret;
497
498         /* Setup INTx */
499         pcie_intc_node = of_get_next_child(node, NULL);
500         if (!pcie_intc_node) {
501                 dev_err(dev, "No PCIe Intc node found\n");
502                 return -ENODEV;
503         }
504
505         port->leg_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
506                                                  &intx_domain_ops,
507                                                  port);
508         of_node_put(pcie_intc_node);
509         if (!port->leg_domain) {
510                 dev_err(dev, "Failed to get a INTx IRQ domain\n");
511                 return -ENODEV;
512         }
513
514         /* Setup MSI */
515         if (IS_ENABLED(CONFIG_PCI_MSI)) {
516                 port->msi_domain = irq_domain_add_linear(node,
517                                                          XILINX_NUM_MSI_IRQS,
518                                                          &msi_domain_ops,
519                                                          &xilinx_pcie_msi_chip);
520                 if (!port->msi_domain) {
521                         dev_err(dev, "Failed to get a MSI IRQ domain\n");
522                         return -ENODEV;
523                 }
524
525                 ret = xilinx_pcie_enable_msi(port);
526                 if (ret)
527                         return ret;
528         }
529
530         return 0;
531 }
532
533 /**
534  * xilinx_pcie_init_port - Initialize hardware
535  * @port: PCIe port information
536  */
537 static void xilinx_pcie_init_port(struct xilinx_pcie_port *port)
538 {
539         struct device *dev = port->dev;
540
541         if (xilinx_pcie_link_up(port))
542                 dev_info(dev, "PCIe Link is UP\n");
543         else
544                 dev_info(dev, "PCIe Link is DOWN\n");
545
546         /* Disable all interrupts */
547         pcie_write(port, ~XILINX_PCIE_IDR_ALL_MASK,
548                    XILINX_PCIE_REG_IMR);
549
550         /* Clear pending interrupts */
551         pcie_write(port, pcie_read(port, XILINX_PCIE_REG_IDR) &
552                          XILINX_PCIE_IMR_ALL_MASK,
553                    XILINX_PCIE_REG_IDR);
554
555         /* Enable all interrupts we handle */
556         pcie_write(port, XILINX_PCIE_IMR_ENABLE_MASK, XILINX_PCIE_REG_IMR);
557
558         /* Enable the Bridge enable bit */
559         pcie_write(port, pcie_read(port, XILINX_PCIE_REG_RPSC) |
560                          XILINX_PCIE_REG_RPSC_BEN,
561                    XILINX_PCIE_REG_RPSC);
562 }
563
564 /**
565  * xilinx_pcie_parse_dt - Parse Device tree
566  * @port: PCIe port information
567  *
568  * Return: '0' on success and error value on failure
569  */
570 static int xilinx_pcie_parse_dt(struct xilinx_pcie_port *port)
571 {
572         struct device *dev = port->dev;
573         struct device_node *node = dev->of_node;
574         struct resource regs;
575         int err;
576
577         err = of_address_to_resource(node, 0, &regs);
578         if (err) {
579                 dev_err(dev, "missing \"reg\" property\n");
580                 return err;
581         }
582
583         port->reg_base = devm_pci_remap_cfg_resource(dev, &regs);
584         if (IS_ERR(port->reg_base))
585                 return PTR_ERR(port->reg_base);
586
587         port->irq = irq_of_parse_and_map(node, 0);
588         err = devm_request_irq(dev, port->irq, xilinx_pcie_intr_handler,
589                                IRQF_SHARED | IRQF_NO_THREAD,
590                                "xilinx-pcie", port);
591         if (err) {
592                 dev_err(dev, "unable to request irq %d\n", port->irq);
593                 return err;
594         }
595
596         return 0;
597 }
598
599 /**
600  * xilinx_pcie_probe - Probe function
601  * @pdev: Platform device pointer
602  *
603  * Return: '0' on success and error value on failure
604  */
605 static int xilinx_pcie_probe(struct platform_device *pdev)
606 {
607         struct device *dev = &pdev->dev;
608         struct xilinx_pcie_port *port;
609         struct pci_host_bridge *bridge;
610         int err;
611
612         if (!dev->of_node)
613                 return -ENODEV;
614
615         bridge = devm_pci_alloc_host_bridge(dev, sizeof(*port));
616         if (!bridge)
617                 return -ENODEV;
618
619         port = pci_host_bridge_priv(bridge);
620
621         port->dev = dev;
622
623         err = xilinx_pcie_parse_dt(port);
624         if (err) {
625                 dev_err(dev, "Parsing DT failed\n");
626                 return err;
627         }
628
629         xilinx_pcie_init_port(port);
630
631         err = xilinx_pcie_init_irq_domain(port);
632         if (err) {
633                 dev_err(dev, "Failed creating IRQ Domain\n");
634                 return err;
635         }
636
637         bridge->sysdata = port;
638         bridge->ops = &xilinx_pcie_ops;
639
640 #ifdef CONFIG_PCI_MSI
641         xilinx_pcie_msi_chip.dev = dev;
642         bridge->msi = &xilinx_pcie_msi_chip;
643 #endif
644         return pci_host_probe(bridge);
645 }
646
647 static const struct of_device_id xilinx_pcie_of_match[] = {
648         { .compatible = "xlnx,axi-pcie-host-1.00.a", },
649         {}
650 };
651
652 static struct platform_driver xilinx_pcie_driver = {
653         .driver = {
654                 .name = "xilinx-pcie",
655                 .of_match_table = xilinx_pcie_of_match,
656                 .suppress_bind_attrs = true,
657         },
658         .probe = xilinx_pcie_probe,
659 };
660 builtin_platform_driver(xilinx_pcie_driver);
This page took 0.068897 seconds and 4 git commands to generate.