ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / mips / pci / fixup-tb0229.c
1 /*
2  * FILE NAME
3  *      arch/mips/vr41xx/tanbac-tb0229/pci_fixup.c
4  *
5  * BRIEF MODULE DESCRIPTION
6  *      The TANBAC TB0229(VR4131DIMM) specific PCI fixups.
7  *
8  * Copyright 2003 Megasolution Inc.
9  *                matsu@megasolution.jp
10  *
11  *  This program is free software; you can redistribute it and/or modify it
12  *  under the terms of the GNU General Public License as published by the
13  *  Free Software Foundation; either version 2 of the License, or (at your
14  *  option) any later version.
15  */
16 #include <linux/config.h>
17 #include <linux/init.h>
18 #include <linux/pci.h>
19
20 #include <asm/vr41xx/tb0229.h>
21
22 void __init pcibios_fixup_irqs(void)
23 {
24 #ifdef CONFIG_TANBAC_TB0219
25         struct pci_dev *dev = NULL;
26         u8 slot;
27
28         while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
29                 slot = PCI_SLOT(dev->devfn);
30                 dev->irq = 0;
31
32                 switch (slot) {
33                 case 12:
34                         vr41xx_set_irq_trigger(TB0219_PCI_SLOT1_PIN,
35                                                TRIGGER_LEVEL,
36                                                SIGNAL_THROUGH);
37                         vr41xx_set_irq_level(TB0219_PCI_SLOT1_PIN,
38                                              LEVEL_LOW);
39                         dev->irq = TB0219_PCI_SLOT1_IRQ;
40                         break;
41                 case 13:
42                         vr41xx_set_irq_trigger(TB0219_PCI_SLOT2_PIN,
43                                                TRIGGER_LEVEL,
44                                                SIGNAL_THROUGH);
45                         vr41xx_set_irq_level(TB0219_PCI_SLOT2_PIN,
46                                              LEVEL_LOW);
47                         dev->irq = TB0219_PCI_SLOT2_IRQ;
48                         break;
49                 case 14:
50                         vr41xx_set_irq_trigger(TB0219_PCI_SLOT3_PIN,
51                                                TRIGGER_LEVEL,
52                                                SIGNAL_THROUGH);
53                         vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN,
54                                              LEVEL_LOW);
55                         dev->irq = TB0219_PCI_SLOT3_IRQ;
56                         break;
57                 default:
58                         break;
59                 }
60
61                 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
62         }
63 #endif
64 }