patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / mips / vr41xx / tanbac-tb0226 / setup.c
1 /*
2  *  setup.c, Setup for the TANBAC TB0226.
3  *
4  *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 #include <linux/config.h>
21 #include <linux/ioport.h>
22
23 #include <asm/io.h>
24 #include <asm/pci_channel.h>
25 #include <asm/vr41xx/tb0226.h>
26
27 #ifdef CONFIG_PCI
28 static struct resource vr41xx_pci_io_resource = {
29         .name   = "PCI I/O space",
30         .start  = VR41XX_PCI_IO_START,
31         .end    = VR41XX_PCI_IO_END,
32         .flags  = IORESOURCE_IO,
33 };
34
35 static struct resource vr41xx_pci_mem_resource = {
36         .name   = "PCI memory space",
37         .start  = VR41XX_PCI_MEM_START,
38         .end    = VR41XX_PCI_MEM_END,
39         .flags  = IORESOURCE_MEM,
40 };
41
42 extern struct pci_ops vr41xx_pci_ops;
43
44 struct pci_controller vr41xx_controller[] = {
45         .pci_ops        = &vr41xx_pci_ops,
46         .io_resource    = &vr41xx_pci_io_resource,
47         .mem_resource   = &vr41xx_pci_mem_resource,
48 };
49
50 struct vr41xx_pci_address_space vr41xx_pci_mem1 = {
51         .internal_base  = VR41XX_PCI_MEM1_BASE,
52         .address_mask   = VR41XX_PCI_MEM1_MASK,
53         .pci_base       = IO_MEM1_RESOURCE_START,
54 };
55
56 struct vr41xx_pci_address_space vr41xx_pci_mem2 = {
57         .internal_base  = VR41XX_PCI_MEM2_BASE,
58         .address_mask   = VR41XX_PCI_MEM2_MASK,
59         .pci_base       = IO_MEM2_RESOURCE_START,
60 };
61
62 struct vr41xx_pci_address_space vr41xx_pci_io = {
63         .internal_base  = VR41XX_PCI_IO_BASE,
64         .address_mask   = VR41XX_PCI_IO_MASK,
65         .pci_base       = IO_PORT_RESOURCE_START,
66 };
67
68 static struct vr41xx_pci_address_map pci_address_map = {
69         .mem1   = &vr41xx_pci_mem1,
70         .mem2   = &vr41xx_pci_mem2,
71         .io     = &vr41xx_pci_io,
72 };
73 #endif
74
75 const char *get_system_type(void)
76 {
77         return "TANBAC TB0226";
78 }
79
80 static int tanbac_tb0226_setup(void)
81 {
82         set_io_port_base(IO_PORT_BASE);
83         ioport_resource.start = IO_PORT_RESOURCE_START;
84         ioport_resource.end = IO_PORT_RESOURCE_END;
85
86 #ifdef CONFIG_SERIAL_8250
87         vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
88         vr41xx_siu_init();
89 #endif
90
91 #ifdef CONFIG_PCI
92         vr41xx_pciu_init(&pci_address_map);
93 #endif
94
95         return 0;
96 }
97
98 early_initcall(tanbac_tb0226_setup);