| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * arch/arm/mach-ixp4xx/ixdp425-pci.c  | 
 | 3 |  * | 
 | 4 |  * IXDP425 board-level PCI initialization | 
 | 5 |  * | 
 | 6 |  * Copyright (C) 2002 Intel Corporation. | 
 | 7 |  * Copyright (C) 2003-2004 MontaVista Software, Inc. | 
 | 8 |  * | 
 | 9 |  * Maintainer: Deepak Saxena <dsaxena@plexity.net> | 
 | 10 |  * | 
 | 11 |  * This program is free software; you can redistribute it and/or modify | 
 | 12 |  * it under the terms of the GNU General Public License version 2 as | 
 | 13 |  * published by the Free Software Foundation. | 
 | 14 |  * | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #include <linux/kernel.h> | 
 | 18 | #include <linux/config.h> | 
 | 19 | #include <linux/pci.h> | 
 | 20 | #include <linux/init.h> | 
 | 21 | #include <linux/delay.h> | 
 | 22 |  | 
 | 23 | #include <asm/mach/pci.h> | 
 | 24 | #include <asm/irq.h> | 
 | 25 | #include <asm/hardware.h> | 
 | 26 | #include <asm/mach-types.h> | 
 | 27 |  | 
 | 28 | void __init ixdp425_pci_preinit(void) | 
 | 29 | { | 
| Deepak Saxena | bdf82b5 | 2005-08-29 22:46:30 +0100 | [diff] [blame] | 30 | 	set_irq_type(IRQ_IXDP425_PCI_INTA, IRQT_LOW); | 
 | 31 | 	set_irq_type(IRQ_IXDP425_PCI_INTB, IRQT_LOW); | 
 | 32 | 	set_irq_type(IRQ_IXDP425_PCI_INTC, IRQT_LOW); | 
 | 33 | 	set_irq_type(IRQ_IXDP425_PCI_INTD, IRQT_LOW); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | 	ixp4xx_pci_preinit(); | 
 | 36 | } | 
 | 37 |  | 
 | 38 | static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) | 
 | 39 | { | 
 | 40 | 	static int pci_irq_table[IXDP425_PCI_IRQ_LINES] = { | 
 | 41 | 		IRQ_IXDP425_PCI_INTA, | 
 | 42 | 		IRQ_IXDP425_PCI_INTB, | 
 | 43 | 		IRQ_IXDP425_PCI_INTC, | 
 | 44 | 		IRQ_IXDP425_PCI_INTD | 
 | 45 | 	}; | 
 | 46 |  | 
 | 47 | 	int irq = -1; | 
 | 48 |  | 
 | 49 | 	if (slot >= 1 && slot <= IXDP425_PCI_MAX_DEV &&  | 
 | 50 | 		pin >= 1 && pin <= IXDP425_PCI_IRQ_LINES) { | 
 | 51 | 		irq = pci_irq_table[(slot + pin - 2) % 4]; | 
 | 52 | 	} | 
 | 53 |  | 
 | 54 | 	return irq; | 
 | 55 | } | 
 | 56 |  | 
 | 57 | struct hw_pci ixdp425_pci __initdata = { | 
 | 58 | 	.nr_controllers = 1, | 
 | 59 | 	.preinit	= ixdp425_pci_preinit, | 
 | 60 | 	.swizzle	= pci_std_swizzle, | 
 | 61 | 	.setup		= ixp4xx_setup, | 
 | 62 | 	.scan		= ixp4xx_scan_bus, | 
 | 63 | 	.map_irq	= ixdp425_map_irq, | 
 | 64 | }; | 
 | 65 |  | 
 | 66 | int __init ixdp425_pci_init(void) | 
 | 67 | { | 
 | 68 | 	if (machine_is_ixdp425() || machine_is_ixcdp1100() || | 
 | 69 | 			machine_is_avila() || machine_is_ixdp465()) | 
 | 70 | 		pci_common_init(&ixdp425_pci); | 
 | 71 | 	return 0; | 
 | 72 | } | 
 | 73 |  | 
 | 74 | subsys_initcall(ixdp425_pci_init); | 
 | 75 |  |