2 * Toshiba rbtx4938 pci routines
3 * Copyright (C) 2000-2001 Toshiba Corporation
5 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
6 * terms of the GNU General Public License version 2. This program is
7 * licensed "as is" without any warranty of any kind, whether express
10 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
12 #include <linux/types.h>
13 #include <linux/pci.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
17 #include <asm/tx4938/rbtx4938.h>
19 extern struct pci_controller tx4938_pci_controller
[];
21 int pci_get_irq(struct pci_dev
*dev
, int pin
)
24 u8 slot
= PCI_SLOT(dev
->devfn
);
25 struct pci_controller
*controller
= (struct pci_controller
*)dev
->sysdata
;
27 if (controller
== &tx4938_pci_controller
[1]) {
30 case TX4938_PCIC_IDSEL_AD_TO_SLOT(31):
31 if (tx4938_ccfgptr
->pcfg
& TX4938_PCFG_ETH0_SEL
)
32 return RBTX4938_IRQ_IRC
+ TX4938_IR_ETH0
;
34 case TX4938_PCIC_IDSEL_AD_TO_SLOT(30):
35 if (tx4938_ccfgptr
->pcfg
& TX4938_PCFG_ETH1_SEL
)
36 return RBTX4938_IRQ_IRC
+ TX4938_IR_ETH1
;
44 if (dev
->bus
->parent
== NULL
&&
45 (slot
== TX4938_PCIC_IDSEL_AD_TO_SLOT(23))) {
46 /* PCI CardSlot (IDSEL=A23) */
47 /* PCIA => PCIA (IDSEL=A23) */
48 irq
= (irq
+ 0 + slot
) % 4;
51 irq
= (irq
+ 33 - slot
) % 4;
57 irq
= RBTX4938_IRQ_IOC_PCIA
;
60 irq
= RBTX4938_IRQ_IOC_PCIB
;
63 irq
= RBTX4938_IRQ_IOC_PCIC
;
66 irq
= RBTX4938_IRQ_IOC_PCID
;
72 int __init
pcibios_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
74 unsigned char irq
= 0;
76 irq
= pci_get_irq(dev
, pin
);
78 printk(KERN_INFO
"PCI: 0x%02x:0x%02x(0x%02x,0x%02x) IRQ=%d\n",
79 dev
->bus
->number
, dev
->devfn
, PCI_SLOT(dev
->devfn
),
80 PCI_FUNC(dev
->devfn
), irq
);
86 * Do platform specific device initialization at pci_enable_device() time
88 int pcibios_plat_dev_init(struct pci_dev
*dev
)