ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / mips / pci / pci-lasat.c
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2000, 2001 Keith M Wesolowski
7  */
8 #include <linux/kernel.h>
9 #include <linux/init.h>
10 #include <linux/interrupt.h>
11 #include <linux/pci.h>
12 #include <linux/types.h>
13 #include <linux/interrupt.h>
14 #include <linux/pci.h>
15 #include <asm/pci_channel.h>
16 #include <linux/delay.h>
17 #include <asm/bootinfo.h>
18
19 extern struct pci_ops nile4_pci_ops;
20 extern struct pci_ops gt64120_pci_ops;
21 static struct resource lasat_pci_mem_resource = {
22         .name   = "LASAT PCI MEM",
23         .start  = 0x18000000,
24         .end    = 0x19FFFFFF,
25         .flags  = IORESOURCE_MEM,
26 };
27
28 static struct resource lasat_pci_io_resource = {
29         .name   = "LASAT PCI IO",
30         .start  = 0x1a000000,
31         .end    = 0x1bFFFFFF,
32         .flags  = IORESOURCE_IO,
33 };
34
35 static struct pci_controller lasat_pci_controller = {
36         .mem_resource   = &lasat_pci_mem_resource,
37         .io_resource    = &lasat_pci_io_resource,
38 };
39
40 static int __init lasat_pci_setup(void)
41 {
42         printk("PCI: starting\n");
43
44         switch (mips_machtype) {
45             case MACH_LASAT_100:
46                 lasat_pci_controller.pci_ops = &gt64120_pci_ops;
47                 break;
48             case MACH_LASAT_200:
49                 lasat_pci_controller.pci_ops = &nile4_pci_ops;
50                 break;
51             default:
52                 panic("pcibios_init: mips_machtype incorrect");
53         }
54
55         register_pci_controller(&lasat_pci_controller);
56         return 0;
57 }
58 early_initcall(lasat_pci_setup);
59
60 #define LASATINT_ETH1   0
61 #define LASATINT_ETH0   1
62 #define LASATINT_HDC    2
63 #define LASATINT_COMP   3
64 #define LASATINT_HDLC   4
65 #define LASATINT_PCIA   5
66 #define LASATINT_PCIB   6
67 #define LASATINT_PCIC   7
68 #define LASATINT_PCID   8
69 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
70 {
71     switch (slot) {
72         case 1:
73             return LASATINT_PCIA;   /* Expansion Module 0 */
74         case 2:
75             return LASATINT_PCIB;   /* Expansion Module 1 */
76         case 3:
77             return LASATINT_PCIC;   /* Expansion Module 2 */
78         case 4:
79             return LASATINT_ETH1;   /* Ethernet 1 (LAN 2) */
80         case 5:
81             return LASATINT_ETH0;   /* Ethernet 0 (LAN 1) */
82         case 6:
83             return LASATINT_HDC;    /* IDE controller */
84         default:
85             return 0xff;            /* Illegal */
86     }
87
88     return -1;
89 }