| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * linux/arch/arm/mach-footbridge/cats-pci.c | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * PCI bios-type initialisation for PCI machines | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Bits taken from various places. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #include <linux/kernel.h>
 | 
					
						
							|  |  |  | #include <linux/pci.h>
 | 
					
						
							|  |  |  | #include <linux/init.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <asm/irq.h>
 | 
					
						
							|  |  |  | #include <asm/mach/pci.h>
 | 
					
						
							|  |  |  | #include <asm/mach-types.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* cats host-specific stuff */ | 
					
						
							|  |  |  | static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-10 11:29:34 +00:00
										 |  |  | static u8 cats_no_swizzle(struct pci_dev *dev, u8 *pin) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-06-10 15:30:21 +01:00
										 |  |  | static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-08-08 21:22:35 +01:00
										 |  |  | 	if (dev->irq >= 255) | 
					
						
							|  |  |  | 		return -1;	/* not a valid interrupt. */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	if (dev->irq >= 128) | 
					
						
							|  |  |  | 		return dev->irq & 0x1f; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (dev->irq >= 1 && dev->irq <= 4) | 
					
						
							|  |  |  | 		return irqmap_cats[dev->irq - 1]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (dev->irq != 0) | 
					
						
							|  |  |  | 		printk("PCI: device %02x:%02x has unknown irq line %x\n", | 
					
						
							|  |  |  | 		       dev->bus->number, dev->devfn, dev->irq); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return -1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * why not the standard PCI swizzle?  does this prevent 4-port tulip | 
					
						
							|  |  |  |  * cards being used (ie, pci-pci bridge based cards)? | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static struct hw_pci cats_pci __initdata = { | 
					
						
							| 
									
										
										
										
											2012-03-10 11:29:34 +00:00
										 |  |  | 	.swizzle		= cats_no_swizzle, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	.map_irq		= cats_map_irq, | 
					
						
							|  |  |  | 	.nr_controllers		= 1, | 
					
						
							| 
									
										
										
										
											2012-03-10 12:49:16 +00:00
										 |  |  | 	.ops			= &dc21285_ops, | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 	.setup			= dc21285_setup, | 
					
						
							|  |  |  | 	.preinit		= dc21285_preinit, | 
					
						
							|  |  |  | 	.postinit		= dc21285_postinit, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-30 17:48:45 +01:00
										 |  |  | static int __init cats_pci_init(void) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | 	if (machine_is_cats()) | 
					
						
							|  |  |  | 		pci_common_init(&cats_pci); | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | subsys_initcall(cats_pci_init); |