fccb284d6c2c0371f292dbdf59494961d4d8cdfa
[openwrt/svn-archive/archive.git] / target / linux / adm5120-2.6 / files / arch / mips / adm5120 / boards / mikrotik.c
1 /*
2 * $Id$
3 *
4 * Mikrotik RouterBOARDs 111/112/133/133C/153
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Gabor Juhos <juhosg@freemail.hu>
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 void __init rb1xx_setup(void)
54 {
55 /* setup data for flash0 device */
56 adm5120_flash0_data.nr_parts = ARRAY_SIZE(rb1xx_partitions);
57 adm5120_flash0_data.parts = rb1xx_partitions;
58
59 /* TODO: setup mac address */
60 }
61
62 static struct adm5120_board rb111_board __initdata = {
63 .mach_type = MACH_ADM5120_RB_111,
64 .name = "Mikrotik RouterBOARD 111",
65 .board_setup = rb1xx_setup,
66 .num_eth_ports = 1,
67 .num_devices = ARRAY_SIZE(rb1xx_devices),
68 .devices = rb1xx_devices,
69 };
70
71 static struct adm5120_board rb112_board __initdata = {
72 .mach_type = MACH_ADM5120_RB_112,
73 .name = "Mikrotik RouterBOARD 112",
74 .board_setup = rb1xx_setup,
75 .num_eth_ports = 1,
76 .num_devices = ARRAY_SIZE(rb1xx_devices),
77 .devices = rb1xx_devices,
78 };
79
80 static struct adm5120_board rb133_board __initdata = {
81 .mach_type = MACH_ADM5120_RB_133,
82 .name = "Mikrotik RouterBOARD 133",
83 .board_setup = rb1xx_setup,
84 .num_eth_ports = 3,
85 .num_devices = ARRAY_SIZE(rb1xx_devices),
86 .devices = rb1xx_devices,
87 };
88
89 static struct adm5120_board rb133c_board __initdata = {
90 .mach_type = MACH_ADM5120_RB_133C,
91 .name = "Mikrotik RouterBOARD 133C",
92 .board_setup = rb1xx_setup,
93 .num_eth_ports = 1,
94 .num_devices = ARRAY_SIZE(rb1xx_devices),
95 .devices = rb1xx_devices,
96 };
97
98 static struct adm5120_board rb153_board __initdata = {
99 .mach_type = MACH_ADM5120_RB_153,
100 .name = "Mikrotik RouterBOARD 153",
101 .board_setup = rb1xx_setup,
102 .num_eth_ports = 5,
103 .num_devices = ARRAY_SIZE(rb1xx_devices),
104 .devices = rb1xx_devices,
105 };
106
107 static int __init register_boards(void)
108 {
109 adm5120_board_register(&rb111_board);
110 adm5120_board_register(&rb112_board);
111 adm5120_board_register(&rb133_board);
112 adm5120_board_register(&rb133c_board);
113 adm5120_board_register(&rb153_board);
114 return 0;
115 }
116
117 pure_initcall(register_boards);