[adm5120] move pci_irq_map definitions into the board specific files
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / mikrotik.c
1 /*
2 * $Id$
3 *
4 * Mikrotik RouterBOARDs 1xx series
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (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
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 *
24 */
25
26 #include <linux/kernel.h>
27 #include <linux/init.h>
28
29 #include <asm/bootinfo.h>
30 #include <asm/gpio.h>
31
32 #include <adm5120_board.h>
33 #include <adm5120_platform.h>
34 #include <adm5120_irq.h>
35
36 static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
37 PCIIRQ(1, 0, 1, ADM5120_IRQ_PCI0),
38 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI1),
39 PCIIRQ(3, 0, 1, ADM5120_IRQ_PCI2)
40 };
41
42 static struct mtd_partition rb1xx_partitions[] = {
43 {
44 .name = "booter",
45 .offset = 0,
46 .size = 64*1024,
47 .mask_flags = MTD_WRITEABLE,
48 } , {
49 .name = "firmware",
50 .offset = MTDPART_OFS_APPEND,
51 .size = MTDPART_SIZ_FULL,
52 }
53 };
54
55 static struct platform_device *rb1xx_devices[] __initdata = {
56 &adm5120_flash0_device,
57 &adm5120_nand_device,
58 };
59
60 static struct platform_device *rb150_devices[] __initdata = {
61 &adm5120_flash0_device,
62 /* TODO: nand device is not yet supported */
63 };
64
65 static void __init rb1xx_setup(void)
66 {
67 /* setup data for flash0 device */
68 adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_partitions);
69 adm5120_flash0_data.parts = rb1xx_partitions;
70
71 /* TODO: setup mac address */
72 }
73
74 #if 0
75 /*
76 * RB1xx boards have bad network performance with the default VLAN matrixes.
77 * Disable it while the ethernet driver gets fixed.
78 */
79 static unsigned char rb11x_vlans[6] __initdata = {
80 /* FIXME: untested */
81 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
82 };
83
84 static unsigned char rb133_vlans[6] __initdata = {
85 /* FIXME: untested */
86 0x44, 0x42, 0x41, 0x00, 0x00, 0x00
87 };
88
89 static unsigned char rb133c_vlans[6] __initdata = {
90 /* FIXME: untested */
91 0x44, 0x00, 0x00, 0x00, 0x00, 0x00
92 };
93
94 static unsigned char rb15x_vlans[6] __initdata = {
95 /* FIXME: untested */
96 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
97
98 static unsigned char rb192_vlans[6] __initdata = {
99 /* FIXME: untested */
100 0x41, 0x50, 0x48, 0x44, 0x42, 0x00
101 };
102 #else
103 static unsigned char rb_vlans[6] __initdata = {
104 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
105 };
106 #define rb11x_vlans rb_vlans
107 #define rb133_vlans rb_vlans
108 #define rb133c_vlans rb_vlans
109 #define rb15x_vlans rb_vlans
110 #define rb192_vlans rb_vlans
111 #endif
112
113 static struct adm5120_board rb111_board __initdata = {
114 .mach_type = MACH_ADM5120_RB_111,
115 .name = "Mikrotik RouterBOARD 111",
116 .board_setup = rb1xx_setup,
117 .eth_num_ports = 1,
118 .eth_vlans = rb11x_vlans,
119 .num_devices = ARRAY_SIZE(rb1xx_devices),
120 .devices = rb1xx_devices,
121 .pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
122 .pci_irq_map = rb1xx_pci_irqs,
123 };
124
125 static struct adm5120_board rb112_board __initdata = {
126 .mach_type = MACH_ADM5120_RB_112,
127 .name = "Mikrotik RouterBOARD 112",
128 .board_setup = rb1xx_setup,
129 .eth_num_ports = 1,
130 .eth_vlans = rb11x_vlans,
131 .num_devices = ARRAY_SIZE(rb1xx_devices),
132 .devices = rb1xx_devices,
133 .pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
134 .pci_irq_map = rb1xx_pci_irqs,
135 };
136
137 static struct adm5120_board rb133_board __initdata = {
138 .mach_type = MACH_ADM5120_RB_133,
139 .name = "Mikrotik RouterBOARD 133",
140 .board_setup = rb1xx_setup,
141 .eth_num_ports = 3,
142 .eth_vlans = rb133_vlans,
143 .num_devices = ARRAY_SIZE(rb1xx_devices),
144 .devices = rb1xx_devices,
145 };
146
147 static struct adm5120_board rb133c_board __initdata = {
148 .mach_type = MACH_ADM5120_RB_133C,
149 .name = "Mikrotik RouterBOARD 133C",
150 .board_setup = rb1xx_setup,
151 .eth_num_ports = 1,
152 .eth_vlans = rb133c_vlans,
153 .num_devices = ARRAY_SIZE(rb1xx_devices),
154 .devices = rb1xx_devices,
155 .pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
156 .pci_irq_map = rb1xx_pci_irqs,
157 };
158
159 static struct adm5120_board rb150_board __initdata = {
160 .mach_type = MACH_ADM5120_RB_150,
161 .name = "Mikrotik RouterBOARD 150",
162 .board_setup = rb1xx_setup,
163 .eth_num_ports = 5,
164 .eth_vlans = rb15x_vlans,
165 .num_devices = ARRAY_SIZE(rb150_devices),
166 .devices = rb150_devices,
167 };
168
169 static struct adm5120_board rb153_board __initdata = {
170 .mach_type = MACH_ADM5120_RB_153,
171 .name = "Mikrotik RouterBOARD 153",
172 .board_setup = rb1xx_setup,
173 .eth_num_ports = 5,
174 .eth_vlans = rb15x_vlans,
175 .num_devices = ARRAY_SIZE(rb1xx_devices),
176 .devices = rb1xx_devices,
177 .pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
178 .pci_irq_map = rb1xx_pci_irqs,
179 };
180
181 static struct adm5120_board rb192_board __initdata = {
182 .mach_type = MACH_ADM5120_RB_192,
183 .name = "Mikrotik RouterBOARD 192",
184 .board_setup = rb1xx_setup,
185 .eth_num_ports = 5,
186 .eth_vlans = rb192_vlans,
187 .num_devices = ARRAY_SIZE(rb1xx_devices),
188 .devices = rb1xx_devices,
189 .pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
190 .pci_irq_map = rb1xx_pci_irqs,
191 };
192
193 static int __init register_boards(void)
194 {
195 adm5120_board_register(&rb111_board);
196 adm5120_board_register(&rb112_board);
197 adm5120_board_register(&rb133_board);
198 adm5120_board_register(&rb133c_board);
199 adm5120_board_register(&rb150_board);
200 adm5120_board_register(&rb153_board);
201 adm5120_board_register(&rb192_board);
202 return 0;
203 }
204
205 pure_initcall(register_boards);