a184cbce44f7bc58e23cc836fda19dd1b106a70d
[librecmc/librecmc.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / edimax.c
1 /*
2  *  $Id$
3  *
4  *  Edimax boards
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 br6104k_partitions[] = {
36         {
37                 .name   = "admboot",
38                 .offset = 0,
39                 .size   = 32*1024,
40                 .mask_flags = MTD_WRITEABLE,
41         } , {
42                 .name   = "config",
43                 .offset = MTDPART_OFS_APPEND,
44                 .size   = 32*1024,
45         } , {
46                 .name   = "firmware",
47                 .offset = MTDPART_OFS_APPEND,
48                 .size   = MTDPART_SIZ_FULL,
49         }
50 };
51
52 static struct platform_device *br6104k_devices[] __initdata = {
53         &adm5120_flash0_device,
54 };
55
56 static void __init br6104k_setup(void) {
57         /* setup data for flash0 device */
58         adm5120_flash0_data.nr_parts = ARRAY_SIZE(br6104k_partitions);
59         adm5120_flash0_data.parts = br6104k_partitions;
60
61         /* TODO: setup mac addresses, if possible */
62 }
63
64 unsigned char br6104k_vlans[6] = {
65         0x41, 0x42, 0x44, 0x48, 0x50, 0x00
66 };
67
68 static struct adm5120_board br6104k_board __initdata = {
69         .mach_type      = MACH_ADM5120_BR6104K,
70         .name           = "Edimax BR-6104K",
71         .board_setup    = br6104k_setup,
72         .eth_num_ports  = 5,
73         .eth_vlans      = br6104k_vlans,
74         .num_devices    = ARRAY_SIZE(br6104k_devices),
75         .devices        = br6104k_devices,
76 };
77
78 static int __init register_boards(void)
79 {
80         adm5120_board_register(&br6104k_board);
81         return 0;
82 }
83
84 pure_initcall(register_boards);