1 // SPDX-License-Identifier: GPL-2.0
3 * leon_pci_grpci1.c: GRPCI1 Host PCI driver
5 * Copyright (C) 2013 Aeroflex Gaisler AB
7 * This GRPCI1 driver does not support PCI interrupts taken from
8 * GPIO pins. Interrupt generation at PCI parity and system error
9 * detection is by default turned off since some GRPCI1 cores does
10 * not support detection. It can be turned on from the bootloader
11 * using the all_pci_errors property.
13 * Contributors: Daniel Hellstrom <daniel@gaisler.com>
16 #include <linux/export.h>
17 #include <linux/kernel.h>
19 #include <linux/of_irq.h>
20 #include <linux/platform_device.h>
21 #include <linux/delay.h>
22 #include <linux/pci.h>
24 #include <asm/leon_pci.h>
25 #include <asm/sections.h>
26 #include <asm/vaddrs.h>
32 /* Enable/Disable Debugging Configuration Space Access */
33 #undef GRPCI1_DEBUG_CFGACCESS
36 * GRPCI1 APB Register MAP
39 unsigned int cfg_stat
; /* 0x00 Configuration / Status */
40 unsigned int bar0
; /* 0x04 BAR0 (RO) */
41 unsigned int page0
; /* 0x08 PAGE0 (RO) */
42 unsigned int bar1
; /* 0x0C BAR1 (RO) */
43 unsigned int page1
; /* 0x10 PAGE1 */
44 unsigned int iomap
; /* 0x14 IO Map */
45 unsigned int stat_cmd
; /* 0x18 PCI Status & Command (RO) */
46 unsigned int irq
; /* 0x1C Interrupt register */
49 #define REGLOAD(a) (be32_to_cpu(__raw_readl(&(a))))
50 #define REGSTORE(a, v) (__raw_writel(cpu_to_be32(v), &(a)))
52 #define PAGE0_BTEN_BIT 0
53 #define PAGE0_BTEN (1 << PAGE0_BTEN_BIT)
55 #define CFGSTAT_HOST_BIT 13
56 #define CFGSTAT_CTO_BIT 8
57 #define CFGSTAT_HOST (1 << CFGSTAT_HOST_BIT)
58 #define CFGSTAT_CTO (1 << CFGSTAT_CTO_BIT)
60 #define IRQ_DPE (1 << 9)
61 #define IRQ_SSE (1 << 8)
62 #define IRQ_RMA (1 << 7)
63 #define IRQ_RTA (1 << 6)
64 #define IRQ_STA (1 << 5)
65 #define IRQ_DPED (1 << 4)
66 #define IRQ_INTD (1 << 3)
67 #define IRQ_INTC (1 << 2)
68 #define IRQ_INTB (1 << 1)
69 #define IRQ_INTA (1 << 0)
70 #define IRQ_DEF_ERRORS (IRQ_RMA | IRQ_RTA | IRQ_STA)
71 #define IRQ_ALL_ERRORS (IRQ_DPED | IRQ_DEF_ERRORS | IRQ_SSE | IRQ_DPE)
72 #define IRQ_INTX (IRQ_INTA | IRQ_INTB | IRQ_INTC | IRQ_INTD)
73 #define IRQ_MASK_BIT 16
75 #define DEF_PCI_ERRORS (PCI_STATUS_SIG_TARGET_ABORT | \
76 PCI_STATUS_REC_TARGET_ABORT | \
77 PCI_STATUS_REC_MASTER_ABORT)
78 #define ALL_PCI_ERRORS (PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY | \
79 PCI_STATUS_SIG_SYSTEM_ERROR | DEF_PCI_ERRORS)
84 struct leon_pci_info info
; /* must be on top of this structure */
85 struct grpci1_regs __iomem
*regs
; /* GRPCI register map */
87 int pci_err_mask
; /* STATUS register error mask */
88 int irq
; /* LEON irqctrl GRPCI IRQ */
89 unsigned char irq_map
[4]; /* GRPCI nexus PCI INTX# IRQs */
90 unsigned int irq_err
; /* GRPCI nexus Virt Error IRQ */
93 unsigned long pci_area
; /* MEMORY */
94 unsigned long pci_area_end
;
95 unsigned long pci_io
; /* I/O */
96 unsigned long pci_conf
; /* CONFIGURATION */
97 unsigned long pci_conf_end
;
98 unsigned long pci_io_va
;
101 static struct grpci1_priv
*grpci1priv
;
103 static int grpci1_cfg_w32(struct grpci1_priv
*priv
, unsigned int bus
,
104 unsigned int devfn
, int where
, u32 val
);
106 static int grpci1_map_irq(const struct pci_dev
*dev
, u8 slot
, u8 pin
)
108 struct grpci1_priv
*priv
= dev
->bus
->sysdata
;
111 /* Use default IRQ decoding on PCI BUS0 according slot numbering */
112 irq_group
= slot
& 0x3;
113 pin
= ((pin
- 1) + irq_group
) & 0x3;
115 return priv
->irq_map
[pin
];
118 static int grpci1_cfg_r32(struct grpci1_priv
*priv
, unsigned int bus
,
119 unsigned int devfn
, int where
, u32
*val
)
121 u32
*pci_conf
, tmp
, cfg
;
127 devfn
+= (0x8 * 6); /* start at AD16=Device0 */
128 } else if (bus
== TGT
) {
130 devfn
= 0; /* special case: bridge controller itself */
134 cfg
= REGLOAD(priv
->regs
->cfg_stat
);
135 REGSTORE(priv
->regs
->cfg_stat
, (cfg
& ~(0xf << 23)) | (bus
<< 23));
138 pci_conf
= (u32
*) (priv
->pci_conf
| (devfn
<< 8) | (where
& 0xfc));
139 tmp
= LEON3_BYPASS_LOAD_PA(pci_conf
);
141 /* check if master abort was received */
142 if (REGLOAD(priv
->regs
->cfg_stat
) & CFGSTAT_CTO
) {
144 /* Clear Master abort bit in PCI cfg space (is set) */
145 tmp
= REGLOAD(priv
->regs
->stat_cmd
);
146 grpci1_cfg_w32(priv
, TGT
, 0, PCI_COMMAND
, tmp
);
148 /* Bus always little endian (unaffected by byte-swapping) */
155 static int grpci1_cfg_r16(struct grpci1_priv
*priv
, unsigned int bus
,
156 unsigned int devfn
, int where
, u32
*val
)
163 ret
= grpci1_cfg_r32(priv
, bus
, devfn
, where
& ~0x3, &v
);
164 *val
= 0xffff & (v
>> (8 * (where
& 0x3)));
168 static int grpci1_cfg_r8(struct grpci1_priv
*priv
, unsigned int bus
,
169 unsigned int devfn
, int where
, u32
*val
)
174 ret
= grpci1_cfg_r32(priv
, bus
, devfn
, where
& ~0x3, &v
);
175 *val
= 0xff & (v
>> (8 * (where
& 3)));
180 static int grpci1_cfg_w32(struct grpci1_priv
*priv
, unsigned int bus
,
181 unsigned int devfn
, int where
, u32 val
)
183 unsigned int *pci_conf
;
190 devfn
+= (0x8 * 6); /* start at AD16=Device0 */
191 } else if (bus
== TGT
) {
193 devfn
= 0; /* special case: bridge controller itself */
197 cfg
= REGLOAD(priv
->regs
->cfg_stat
);
198 REGSTORE(priv
->regs
->cfg_stat
, (cfg
& ~(0xf << 23)) | (bus
<< 23));
200 pci_conf
= (unsigned int *) (priv
->pci_conf
|
201 (devfn
<< 8) | (where
& 0xfc));
202 LEON3_BYPASS_STORE_PA(pci_conf
, swab32(val
));
207 static int grpci1_cfg_w16(struct grpci1_priv
*priv
, unsigned int bus
,
208 unsigned int devfn
, int where
, u32 val
)
215 ret
= grpci1_cfg_r32(priv
, bus
, devfn
, where
&~3, &v
);
218 v
= (v
& ~(0xffff << (8 * (where
& 0x3)))) |
219 ((0xffff & val
) << (8 * (where
& 0x3)));
220 return grpci1_cfg_w32(priv
, bus
, devfn
, where
& ~0x3, v
);
223 static int grpci1_cfg_w8(struct grpci1_priv
*priv
, unsigned int bus
,
224 unsigned int devfn
, int where
, u32 val
)
229 ret
= grpci1_cfg_r32(priv
, bus
, devfn
, where
& ~0x3, &v
);
232 v
= (v
& ~(0xff << (8 * (where
& 0x3)))) |
233 ((0xff & val
) << (8 * (where
& 0x3)));
234 return grpci1_cfg_w32(priv
, bus
, devfn
, where
& ~0x3, v
);
237 /* Read from Configuration Space. When entering here the PCI layer has taken
238 * the pci_lock spinlock and IRQ is off.
240 static int grpci1_read_config(struct pci_bus
*bus
, unsigned int devfn
,
241 int where
, int size
, u32
*val
)
243 struct grpci1_priv
*priv
= grpci1priv
;
244 unsigned int busno
= bus
->number
;
247 if (PCI_SLOT(devfn
) > 15 || busno
> 15) {
254 ret
= grpci1_cfg_r8(priv
, busno
, devfn
, where
, val
);
257 ret
= grpci1_cfg_r16(priv
, busno
, devfn
, where
, val
);
260 ret
= grpci1_cfg_r32(priv
, busno
, devfn
, where
, val
);
267 #ifdef GRPCI1_DEBUG_CFGACCESS
269 "grpci1_read_config: [%02x:%02x:%x] ofs=%d val=%x size=%d\n",
270 busno
, PCI_SLOT(devfn
), PCI_FUNC(devfn
), where
, *val
, size
);
276 /* Write to Configuration Space. When entering here the PCI layer has taken
277 * the pci_lock spinlock and IRQ is off.
279 static int grpci1_write_config(struct pci_bus
*bus
, unsigned int devfn
,
280 int where
, int size
, u32 val
)
282 struct grpci1_priv
*priv
= grpci1priv
;
283 unsigned int busno
= bus
->number
;
285 if (PCI_SLOT(devfn
) > 15 || busno
> 15)
288 #ifdef GRPCI1_DEBUG_CFGACCESS
290 "grpci1_write_config: [%02x:%02x:%x] ofs=%d size=%d val=%x\n",
291 busno
, PCI_SLOT(devfn
), PCI_FUNC(devfn
), where
, size
, val
);
298 return grpci1_cfg_w8(priv
, busno
, devfn
, where
, val
);
300 return grpci1_cfg_w16(priv
, busno
, devfn
, where
, val
);
302 return grpci1_cfg_w32(priv
, busno
, devfn
, where
, val
);
306 static struct pci_ops grpci1_ops
= {
307 .read
= grpci1_read_config
,
308 .write
= grpci1_write_config
,
311 /* GENIRQ IRQ chip implementation for grpci1 irqmode=0..2. In configuration
312 * 3 where all PCI Interrupts has a separate IRQ on the system IRQ controller
313 * this is not needed and the standard IRQ controller can be used.
316 static void grpci1_mask_irq(struct irq_data
*data
)
319 struct grpci1_priv
*priv
= grpci1priv
;
321 irqidx
= (u32
)data
->chip_data
- 1;
322 if (irqidx
> 3) /* only mask PCI interrupts here */
324 irqidx
+= IRQ_MASK_BIT
;
326 REGSTORE(priv
->regs
->irq
, REGLOAD(priv
->regs
->irq
) & ~(1 << irqidx
));
329 static void grpci1_unmask_irq(struct irq_data
*data
)
332 struct grpci1_priv
*priv
= grpci1priv
;
334 irqidx
= (u32
)data
->chip_data
- 1;
335 if (irqidx
> 3) /* only unmask PCI interrupts here */
337 irqidx
+= IRQ_MASK_BIT
;
339 REGSTORE(priv
->regs
->irq
, REGLOAD(priv
->regs
->irq
) | (1 << irqidx
));
342 static unsigned int grpci1_startup_irq(struct irq_data
*data
)
344 grpci1_unmask_irq(data
);
348 static void grpci1_shutdown_irq(struct irq_data
*data
)
350 grpci1_mask_irq(data
);
353 static struct irq_chip grpci1_irq
= {
355 .irq_startup
= grpci1_startup_irq
,
356 .irq_shutdown
= grpci1_shutdown_irq
,
357 .irq_mask
= grpci1_mask_irq
,
358 .irq_unmask
= grpci1_unmask_irq
,
361 /* Handle one or multiple IRQs from the PCI core */
362 static void grpci1_pci_flow_irq(struct irq_desc
*desc
)
364 struct grpci1_priv
*priv
= grpci1priv
;
368 irqreg
= REGLOAD(priv
->regs
->irq
);
369 irqreg
= (irqreg
>> IRQ_MASK_BIT
) & irqreg
;
371 /* Error Interrupt? */
372 if (irqreg
& IRQ_ALL_ERRORS
) {
373 generic_handle_irq(priv
->irq_err
);
378 if (irqreg
& IRQ_INTX
) {
379 /* Call respective PCI Interrupt handler */
380 for (i
= 0; i
< 4; i
++) {
381 if (irqreg
& (1 << i
))
382 generic_handle_irq(priv
->irq_map
[i
]);
388 * Call "first level" IRQ chip end-of-irq handler. It will ACK LEON IRQ
389 * Controller, this must be done after IRQ sources have been handled to
390 * avoid double IRQ generation
393 desc
->irq_data
.chip
->irq_eoi(&desc
->irq_data
);
396 /* Create a virtual IRQ */
397 static unsigned int grpci1_build_device_irq(unsigned int irq
)
399 unsigned int virq
= 0, pil
;
402 virq
= irq_alloc(irq
, pil
);
406 irq_set_chip_and_handler_name(virq
, &grpci1_irq
, handle_simple_irq
,
408 irq_set_chip_data(virq
, (void *)irq
);
415 * Initialize mappings AMBA<->PCI, clear IRQ state, setup PCI interface
418 * BAR0: unused in this implementation
419 * BAR1: peripheral DMA to host's memory (size at least 256MByte)
420 * BAR2..BAR5: not implemented in hardware
422 static void grpci1_hw_init(struct grpci1_priv
*priv
)
424 u32 ahbadr
, bar_sz
, data
, pciadr
;
425 struct grpci1_regs __iomem
*regs
= priv
->regs
;
427 /* set 1:1 mapping between AHB -> PCI memory space */
428 REGSTORE(regs
->cfg_stat
, priv
->pci_area
& 0xf0000000);
430 /* map PCI accesses to target BAR1 to Linux kernel memory 1:1 */
431 ahbadr
= 0xf0000000 & (u32
)__pa(PAGE_ALIGN((unsigned long) &_end
));
432 REGSTORE(regs
->page1
, ahbadr
);
434 /* translate I/O accesses to 0, I/O Space always @ PCI low 64Kbytes */
435 REGSTORE(regs
->iomap
, REGLOAD(regs
->iomap
) & 0x0000ffff);
437 /* disable and clear pending interrupts */
438 REGSTORE(regs
->irq
, 0);
440 /* Setup BAR0 outside access range so that it does not conflict with
441 * peripheral DMA. There is no need to set up the PAGE0 register.
443 grpci1_cfg_w32(priv
, TGT
, 0, PCI_BASE_ADDRESS_0
, 0xffffffff);
444 grpci1_cfg_r32(priv
, TGT
, 0, PCI_BASE_ADDRESS_0
, &bar_sz
);
445 bar_sz
= ~bar_sz
+ 1;
446 pciadr
= priv
->pci_area
- bar_sz
;
447 grpci1_cfg_w32(priv
, TGT
, 0, PCI_BASE_ADDRESS_0
, pciadr
);
450 * Setup the Host's PCI Target BAR1 for other peripherals to access,
451 * and do DMA to the host's memory.
453 grpci1_cfg_w32(priv
, TGT
, 0, PCI_BASE_ADDRESS_1
, ahbadr
);
456 * Setup Latency Timer and cache line size. Default cache line
457 * size will result in poor performance (256 word fetches), 0xff
458 * will set it according to the max size of the PCI FIFO.
460 grpci1_cfg_w8(priv
, TGT
, 0, PCI_CACHE_LINE_SIZE
, 0xff);
461 grpci1_cfg_w8(priv
, TGT
, 0, PCI_LATENCY_TIMER
, 0x40);
463 /* set as bus master, enable pci memory responses, clear status bits */
464 grpci1_cfg_r32(priv
, TGT
, 0, PCI_COMMAND
, &data
);
465 data
|= (PCI_COMMAND_MEMORY
| PCI_COMMAND_MASTER
);
466 grpci1_cfg_w32(priv
, TGT
, 0, PCI_COMMAND
, data
);
469 static irqreturn_t
grpci1_jump_interrupt(int irq
, void *arg
)
471 struct grpci1_priv
*priv
= arg
;
472 dev_err(priv
->dev
, "Jump IRQ happened\n");
476 /* Handle GRPCI1 Error Interrupt */
477 static irqreturn_t
grpci1_err_interrupt(int irq
, void *arg
)
479 struct grpci1_priv
*priv
= arg
;
482 grpci1_cfg_r16(priv
, TGT
, 0, PCI_STATUS
, &status
);
483 status
&= priv
->pci_err_mask
;
488 if (status
& PCI_STATUS_PARITY
)
489 dev_err(priv
->dev
, "Data Parity Error\n");
491 if (status
& PCI_STATUS_SIG_TARGET_ABORT
)
492 dev_err(priv
->dev
, "Signalled Target Abort\n");
494 if (status
& PCI_STATUS_REC_TARGET_ABORT
)
495 dev_err(priv
->dev
, "Received Target Abort\n");
497 if (status
& PCI_STATUS_REC_MASTER_ABORT
)
498 dev_err(priv
->dev
, "Received Master Abort\n");
500 if (status
& PCI_STATUS_SIG_SYSTEM_ERROR
)
501 dev_err(priv
->dev
, "Signalled System Error\n");
503 if (status
& PCI_STATUS_DETECTED_PARITY
)
504 dev_err(priv
->dev
, "Parity Error\n");
506 /* Clear handled INT TYPE IRQs */
507 grpci1_cfg_w16(priv
, TGT
, 0, PCI_STATUS
, status
);
512 static int grpci1_of_probe(struct platform_device
*ofdev
)
514 struct grpci1_regs __iomem
*regs
;
515 struct grpci1_priv
*priv
;
518 u32 cfg
, size
, err_mask
;
519 struct resource
*res
;
522 dev_err(&ofdev
->dev
, "only one GRPCI1 supported\n");
526 if (ofdev
->num_resources
< 3) {
527 dev_err(&ofdev
->dev
, "not enough APB/AHB resources\n");
531 priv
= devm_kzalloc(&ofdev
->dev
, sizeof(*priv
), GFP_KERNEL
);
533 dev_err(&ofdev
->dev
, "memory allocation failed\n");
536 platform_set_drvdata(ofdev
, priv
);
537 priv
->dev
= &ofdev
->dev
;
539 /* find device register base address */
540 res
= platform_get_resource(ofdev
, IORESOURCE_MEM
, 0);
541 regs
= devm_ioremap_resource(&ofdev
->dev
, res
);
543 return PTR_ERR(regs
);
546 * check that we're in Host Slot and that we can act as a Host Bridge
547 * and not only as target/peripheral.
549 cfg
= REGLOAD(regs
->cfg_stat
);
550 if ((cfg
& CFGSTAT_HOST
) == 0) {
551 dev_err(&ofdev
->dev
, "not in host system slot\n");
555 /* check that BAR1 support 256 MByte so that we can map kernel space */
556 REGSTORE(regs
->page1
, 0xffffffff);
557 size
= ~REGLOAD(regs
->page1
) + 1;
558 if (size
< 0x10000000) {
559 dev_err(&ofdev
->dev
, "BAR1 must be at least 256MByte\n");
563 /* hardware must support little-endian PCI (byte-twisting) */
564 if ((REGLOAD(regs
->page0
) & PAGE0_BTEN
) == 0) {
565 dev_err(&ofdev
->dev
, "byte-twisting is required\n");
570 priv
->irq
= irq_of_parse_and_map(ofdev
->dev
.of_node
, 0);
571 dev_info(&ofdev
->dev
, "host found at 0x%p, irq%d\n", regs
, priv
->irq
);
573 /* Find PCI Memory, I/O and Configuration Space Windows */
574 priv
->pci_area
= ofdev
->resource
[1].start
;
575 priv
->pci_area_end
= ofdev
->resource
[1].end
+1;
576 priv
->pci_io
= ofdev
->resource
[2].start
;
577 priv
->pci_conf
= ofdev
->resource
[2].start
+ 0x10000;
578 priv
->pci_conf_end
= priv
->pci_conf
+ 0x10000;
579 priv
->pci_io_va
= (unsigned long)ioremap(priv
->pci_io
, 0x10000);
580 if (!priv
->pci_io_va
) {
581 dev_err(&ofdev
->dev
, "unable to map PCI I/O area\n");
586 "GRPCI1: MEMORY SPACE [0x%08lx - 0x%08lx]\n"
587 " I/O SPACE [0x%08lx - 0x%08lx]\n"
588 " CONFIG SPACE [0x%08lx - 0x%08lx]\n",
589 priv
->pci_area
, priv
->pci_area_end
-1,
590 priv
->pci_io
, priv
->pci_conf
-1,
591 priv
->pci_conf
, priv
->pci_conf_end
-1);
594 * I/O Space resources in I/O Window mapped into Virtual Adr Space
595 * We never use low 4KB because some devices seem have problems using
598 priv
->info
.io_space
.name
= "GRPCI1 PCI I/O Space";
599 priv
->info
.io_space
.start
= priv
->pci_io_va
+ 0x1000;
600 priv
->info
.io_space
.end
= priv
->pci_io_va
+ 0x10000 - 1;
601 priv
->info
.io_space
.flags
= IORESOURCE_IO
;
604 * grpci1 has no prefetchable memory, map everything as
605 * non-prefetchable memory
607 priv
->info
.mem_space
.name
= "GRPCI1 PCI MEM Space";
608 priv
->info
.mem_space
.start
= priv
->pci_area
;
609 priv
->info
.mem_space
.end
= priv
->pci_area_end
- 1;
610 priv
->info
.mem_space
.flags
= IORESOURCE_MEM
;
612 if (request_resource(&iomem_resource
, &priv
->info
.mem_space
) < 0) {
613 dev_err(&ofdev
->dev
, "unable to request PCI memory area\n");
618 if (request_resource(&ioport_resource
, &priv
->info
.io_space
) < 0) {
619 dev_err(&ofdev
->dev
, "unable to request PCI I/O area\n");
624 /* setup maximum supported PCI buses */
625 priv
->info
.busn
.name
= "GRPCI1 busn";
626 priv
->info
.busn
.start
= 0;
627 priv
->info
.busn
.end
= 15;
631 /* Initialize hardware */
632 grpci1_hw_init(priv
);
635 * Get PCI Interrupt to System IRQ mapping and setup IRQ handling
636 * Error IRQ. All PCI and PCI-Error interrupts are shared using the
639 leon_update_virq_handling(priv
->irq
, grpci1_pci_flow_irq
, "pcilvl", 0);
641 priv
->irq_map
[0] = grpci1_build_device_irq(1);
642 priv
->irq_map
[1] = grpci1_build_device_irq(2);
643 priv
->irq_map
[2] = grpci1_build_device_irq(3);
644 priv
->irq_map
[3] = grpci1_build_device_irq(4);
645 priv
->irq_err
= grpci1_build_device_irq(5);
647 printk(KERN_INFO
" PCI INTA..D#: IRQ%d, IRQ%d, IRQ%d, IRQ%d\n",
648 priv
->irq_map
[0], priv
->irq_map
[1], priv
->irq_map
[2],
651 /* Enable IRQs on LEON IRQ controller */
652 err
= devm_request_irq(&ofdev
->dev
, priv
->irq
, grpci1_jump_interrupt
, 0,
653 "GRPCI1_JUMP", priv
);
655 dev_err(&ofdev
->dev
, "ERR IRQ request failed: %d\n", err
);
659 /* Setup IRQ handler for access errors */
660 err
= devm_request_irq(&ofdev
->dev
, priv
->irq_err
,
661 grpci1_err_interrupt
, IRQF_SHARED
, "GRPCI1_ERR",
664 dev_err(&ofdev
->dev
, "ERR VIRQ request failed: %d\n", err
);
668 tmp
= of_get_property(ofdev
->dev
.of_node
, "all_pci_errors", &len
);
669 if (tmp
&& (len
== 4)) {
670 priv
->pci_err_mask
= ALL_PCI_ERRORS
;
671 err_mask
= IRQ_ALL_ERRORS
<< IRQ_MASK_BIT
;
673 priv
->pci_err_mask
= DEF_PCI_ERRORS
;
674 err_mask
= IRQ_DEF_ERRORS
<< IRQ_MASK_BIT
;
678 * Enable Error Interrupts. PCI interrupts are unmasked once request_irq
679 * is called by the PCI Device drivers
681 REGSTORE(regs
->irq
, err_mask
);
683 /* Init common layer and scan buses */
684 priv
->info
.ops
= &grpci1_ops
;
685 priv
->info
.map_irq
= grpci1_map_irq
;
686 leon_pci_init(ofdev
, &priv
->info
);
691 release_resource(&priv
->info
.io_space
);
693 release_resource(&priv
->info
.mem_space
);
695 iounmap((void __iomem
*)priv
->pci_io_va
);
700 static const struct of_device_id grpci1_of_match
[] = {
702 .name
= "GAISLER_PCIFBRG",
710 static struct platform_driver grpci1_of_driver
= {
713 .of_match_table
= grpci1_of_match
,
715 .probe
= grpci1_of_probe
,
718 static int __init
grpci1_init(void)
720 return platform_driver_register(&grpci1_of_driver
);
723 subsys_initcall(grpci1_init
);