589ed3c5273993494cb00313d7abb6820a983867
[openwrt.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 <adm5120_board.h>
33 #include <adm5120_irq.h>
34 #include <adm5120_platform.h>
35
36 static struct adm5120_pci_irq br61xx_pci_irqs[] __initdata = {
37         PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
38 };
39
40 static struct mtd_partition br61xx_partitions[] = {
41         {
42                 .name   = "admboot",
43                 .offset = 0,
44                 .size   = 32*1024,
45                 .mask_flags = MTD_WRITEABLE,
46         } , {
47                 .name   = "config",
48                 .offset = MTDPART_OFS_APPEND,
49                 .size   = 32*1024,
50         } , {
51                 .name   = "firmware",
52                 .offset = MTDPART_OFS_APPEND,
53                 .size   = MTDPART_SIZ_FULL,
54         }
55 };
56
57 static struct platform_device *br6104k_devices[] __initdata = {
58         &adm5120_flash0_device,
59         &adm5120_hcd_device,
60 };
61
62 static struct platform_device *br61x4wg_devices[] __initdata = {
63         &adm5120_flash0_device,
64 };
65
66 static void __init br61xx_setup(void) {
67         /* setup data for flash0 device */
68         adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions);
69         adm5120_flash0_data.parts = br61xx_partitions;
70
71         /* TODO: setup mac addresses, if possible */
72 }
73
74 unsigned char br61xx_vlans[6] = {
75         0x41, 0x42, 0x44, 0x48, 0x50, 0x00
76 };
77
78 /*--------------------------------------------------------------------------*/
79
80 ADM5120_BOARD_START(BR6104K, "Edimax BR-6104K/6104KP")
81         .board_setup    = br61xx_setup,
82         .eth_num_ports  = 5,
83         .eth_vlans      = br61xx_vlans,
84         .num_devices    = ARRAY_SIZE(br6104k_devices),
85         .devices        = br6104k_devices,
86 ADM5120_BOARD_END
87
88 ADM5120_BOARD_START(BR61x4WG, "Edimax BR-6104WG/6114WG")
89         .board_setup    = br61xx_setup,
90         .eth_num_ports  = 5,
91         .eth_vlans      = br61xx_vlans,
92         .num_devices    = ARRAY_SIZE(br61x4wg_devices),
93         .devices        = br61x4wg_devices,
94         .pci_nr_irqs    = ARRAY_SIZE(br61xx_pci_irqs),
95         .pci_irq_map    = br61xx_pci_irqs,
96 ADM5120_BOARD_END