[adm5120] add preliminary support for the Mikrotik RouterBOARD 192
[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 <asm/mach-adm5120/adm5120_board.h>
33 #include <asm/mach-adm5120/adm5120_platform.h>
34
35 static struct mtd_partition rb1xx_partitions[] = {
36 {
37 .name = "booter",
38 .offset = 0,
39 .size = 64*1024,
40 .mask_flags = MTD_WRITEABLE,
41 } , {
42 .name = "firmware",
43 .offset = MTDPART_OFS_APPEND,
44 .size = MTDPART_SIZ_FULL,
45 }
46 };
47
48 static struct platform_device *rb1xx_devices[] __initdata = {
49 &adm5120_flash0_device,
50 &adm5120_nand_device,
51 };
52
53 static struct platform_device *rb150_devices[] __initdata = {
54 &adm5120_flash0_device,
55 /* TODO: nand device is not yet supported */
56 };
57
58 static void __init rb1xx_setup(void)
59 {
60 /* setup data for flash0 device */
61 adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_partitions);
62 adm5120_flash0_data.parts = rb1xx_partitions;
63
64 /* TODO: setup mac address */
65 }
66
67 #if 0
68 /*
69 * RB1xx boards have bad network performance with the default VLAN matrixes.
70 * Disable it while the ethernet driver gets fixed.
71 */
72 static unsigned char rb11x_vlans[6] __initdata = {
73 /* FIXME: untested */
74 0x41, 0x00, 0x00, 0x00, 0x00, 0x00
75 };
76
77 static unsigned char rb133_vlans[6] __initdata = {
78 /* FIXME: untested */
79 0x44, 0x42, 0x41, 0x00, 0x00, 0x00
80 };
81
82 static unsigned char rb133c_vlans[6] __initdata = {
83 /* FIXME: untested */
84 0x44, 0x00, 0x00, 0x00, 0x00, 0x00
85 };
86
87 static unsigned char rb15x_vlans[6] __initdata = {
88 /* FIXME: untested */
89 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
90
91 static unsigned char rb192_vlans[6] __initdata = {
92 /* FIXME: untested */
93 0x41, 0x50, 0x48, 0x44, 0x42, 0x00
94 };
95 #else
96 static unsigned char rb_vlans[6] __initdata = {
97 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00
98 };
99 #define rb11x_vlans rb_vlans
100 #define rb133_vlans rb_vlans
101 #define rb133c_vlans rb_vlans
102 #define rb15x_vlans rb_vlans
103 #define rb192_vlans rb_vlans
104 #endif
105
106 static struct adm5120_board rb111_board __initdata = {
107 .mach_type = MACH_ADM5120_RB_111,
108 .name = "Mikrotik RouterBOARD 111",
109 .board_setup = rb1xx_setup,
110 .eth_num_ports = 1,
111 .eth_vlans = rb11x_vlans,
112 .num_devices = ARRAY_SIZE(rb1xx_devices),
113 .devices = rb1xx_devices,
114 };
115
116 static struct adm5120_board rb112_board __initdata = {
117 .mach_type = MACH_ADM5120_RB_112,
118 .name = "Mikrotik RouterBOARD 112",
119 .board_setup = rb1xx_setup,
120 .eth_num_ports = 1,
121 .eth_vlans = rb11x_vlans,
122 .num_devices = ARRAY_SIZE(rb1xx_devices),
123 .devices = rb1xx_devices,
124 };
125
126 static struct adm5120_board rb133_board __initdata = {
127 .mach_type = MACH_ADM5120_RB_133,
128 .name = "Mikrotik RouterBOARD 133",
129 .board_setup = rb1xx_setup,
130 .eth_num_ports = 3,
131 .eth_vlans = rb133_vlans,
132 .num_devices = ARRAY_SIZE(rb1xx_devices),
133 .devices = rb1xx_devices,
134 };
135
136 static struct adm5120_board rb133c_board __initdata = {
137 .mach_type = MACH_ADM5120_RB_133C,
138 .name = "Mikrotik RouterBOARD 133C",
139 .board_setup = rb1xx_setup,
140 .eth_num_ports = 1,
141 .eth_vlans = rb133c_vlans,
142 .num_devices = ARRAY_SIZE(rb1xx_devices),
143 .devices = rb1xx_devices,
144 };
145
146 static struct adm5120_board rb150_board __initdata = {
147 .mach_type = MACH_ADM5120_RB_150,
148 .name = "Mikrotik RouterBOARD 150",
149 .board_setup = rb1xx_setup,
150 .eth_num_ports = 5,
151 .eth_vlans = rb15x_vlans,
152 .num_devices = ARRAY_SIZE(rb150_devices),
153 .devices = rb150_devices,
154 };
155
156 static struct adm5120_board rb153_board __initdata = {
157 .mach_type = MACH_ADM5120_RB_153,
158 .name = "Mikrotik RouterBOARD 153",
159 .board_setup = rb1xx_setup,
160 .eth_num_ports = 5,
161 .eth_vlans = rb15x_vlans,
162 .num_devices = ARRAY_SIZE(rb1xx_devices),
163 .devices = rb1xx_devices,
164 };
165
166 static struct adm5120_board rb153_board __initdata = {
167 .mach_type = MACH_ADM5120_RB_192,
168 .name = "Mikrotik RouterBOARD 192",
169 .board_setup = rb1xx_setup,
170 .eth_num_ports = 5,
171 .eth_vlans = rb192_vlans,
172 .num_devices = ARRAY_SIZE(rb1xx_devices),
173 .devices = rb1xx_devices,
174 };
175
176 static int __init register_boards(void)
177 {
178 adm5120_board_register(&rb111_board);
179 adm5120_board_register(&rb112_board);
180 adm5120_board_register(&rb133_board);
181 adm5120_board_register(&rb133c_board);
182 adm5120_board_register(&rb150_board);
183 adm5120_board_register(&rb153_board);
184 adm5120_board_register(&rb192_board);
185 return 0;
186 }
187
188 pure_initcall(register_boards);