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