I have new e-mail address. Thanks to Kaloz ;)
[15.05/openwrt.git] / target / linux / adm5120-2.6 / files / arch / mips / pci / pci-adm5120.c
1 /*
2  *  $Id$
3  *
4  *  ADM5120 PCI Host Controller driver
5  *
6  *  Copyright (C) ADMtek Incorporated.
7  *  Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
8  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
9  *  Copyright (C) 2007 OpenWrt.org
10  *
11  *  This program is free software; you can redistribute it and/or
12  *  modify it under the terms of the GNU General Public License
13  *  as published by the Free Software Foundation; either version 2
14  *  of the License, or (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the
23  *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  *  Boston, MA  02110-1301, USA.
25  *
26  */
27 #include <linux/types.h>
28 #include <linux/pci.h>
29 #include <linux/kernel.h>
30 #include <linux/init.h>
31
32 #include <asm/mach-adm5120/adm5120_info.h>
33 #include <asm/mach-adm5120/adm5120_defs.h>
34 #include <asm/mach-adm5120/adm5120_irq.h>
35
36 extern struct pci_ops adm5120_pci_ops;
37
38 static struct resource pci_io_resource = {
39         .name = "ADM5120 PCI I/O",
40         .start = ADM5120_PCIIO_BASE,
41         .end = ADM5120_PCICFG_ADDR-1,
42         .flags = IORESOURCE_IO
43 };
44
45 static struct resource pci_mem_resource = {
46         .name = "ADM5120 PCI MEM",
47         .start = ADM5120_PCIMEM_BASE,
48         .end = ADM5120_PCIIO_BASE-1,
49         .flags = IORESOURCE_MEM
50 };
51
52 static struct pci_controller adm5120_controller = {
53         .pci_ops        = &adm5120_pci_ops,
54         .io_resource    = &pci_io_resource,
55         .mem_resource   = &pci_mem_resource,
56 };
57
58 static int __init adm5120_pci_setup(void)
59 {
60         int pci_bios;
61
62         pci_bios = adm5120_has_pci();
63
64         printk("adm5120: system has %sPCI BIOS\n", pci_bios ? "" : "no ");
65         if (pci_bios == 0)
66                 return -1;
67
68         /* Avoid ISA compat ranges.  */
69         PCIBIOS_MIN_IO = 0x00000000;
70         PCIBIOS_MIN_MEM = 0x00000000;
71
72         /* Set I/O resource limits.  */
73         ioport_resource.end = 0x1fffffff;
74         iomem_resource.end = 0xffffffff;
75
76         register_pci_controller(&adm5120_controller);
77         return 0;
78 }
79
80 arch_initcall(adm5120_pci_setup);