Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/arch/arm/mach-footbridge/cats-pci.c
0004  *
0005  * PCI bios-type initialisation for PCI machines
0006  *
0007  * Bits taken from various places.
0008  */
0009 #include <linux/kernel.h>
0010 #include <linux/pci.h>
0011 #include <linux/init.h>
0012 
0013 #include <asm/irq.h>
0014 #include <asm/mach/pci.h>
0015 #include <asm/mach-types.h>
0016 
0017 /* cats host-specific stuff */
0018 static int irqmap_cats[] = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 };
0019 
0020 static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin)
0021 {
0022     return 0;
0023 }
0024 
0025 static int cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
0026 {
0027     if (dev->irq >= 255)
0028         return -1;  /* not a valid interrupt. */
0029 
0030     if (dev->irq >= 128)
0031         return dev->irq & 0x1f;
0032 
0033     if (dev->irq >= 1 && dev->irq <= 4)
0034         return irqmap_cats[dev->irq - 1];
0035 
0036     if (dev->irq != 0)
0037         printk("PCI: device %02x:%02x has unknown irq line %x\n",
0038                dev->bus->number, dev->devfn, dev->irq);
0039 
0040     return -1;
0041 }
0042 
0043 /*
0044  * why not the standard PCI swizzle?  does this prevent 4-port tulip
0045  * cards being used (ie, pci-pci bridge based cards)?
0046  */
0047 static struct hw_pci cats_pci __initdata = {
0048     .swizzle        = cats_no_swizzle,
0049     .map_irq        = cats_map_irq,
0050     .nr_controllers     = 1,
0051     .ops            = &dc21285_ops,
0052     .setup          = dc21285_setup,
0053     .preinit        = dc21285_preinit,
0054     .postinit       = dc21285_postinit,
0055 };
0056 
0057 static int __init cats_pci_init(void)
0058 {
0059     if (machine_is_cats())
0060         pci_common_init(&cats_pci);
0061     return 0;
0062 }
0063 
0064 subsys_initcall(cats_pci_init);