[adm5120] add button devices to several boards
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / edimax.c
1 /*
2 * $Id$
3 *
4 * Edimax boards
5 *
6 * Copyright (C) 2007-2008 OpenWrt.org
7 * Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
12 *
13 */
14
15 #include <linux/kernel.h>
16 #include <linux/init.h>
17
18 #include <asm/bootinfo.h>
19 #include <asm/gpio.h>
20
21 #include <adm5120_board.h>
22 #include <adm5120_irq.h>
23 #include <adm5120_platform.h>
24
25 static struct adm5120_pci_irq br61xx_pci_irqs[] __initdata = {
26 PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
27 };
28
29 static struct mtd_partition br61xx_partitions[] = {
30 {
31 .name = "admboot",
32 .offset = 0,
33 .size = 32*1024,
34 .mask_flags = MTD_WRITEABLE,
35 } , {
36 .name = "config",
37 .offset = MTDPART_OFS_APPEND,
38 .size = 32*1024,
39 } , {
40 .name = "firmware",
41 .offset = MTDPART_OFS_APPEND,
42 .size = MTDPART_SIZ_FULL,
43 }
44 };
45
46 static struct platform_device *br6104k_devices[] __initdata = {
47 &adm5120_flash0_device,
48 &adm5120_hcd_device,
49 &adm5120_buttons_device,
50 };
51
52 static struct platform_device *br61x4wg_devices[] __initdata = {
53 &adm5120_flash0_device,
54 };
55
56 static void __init br61xx_setup(void) {
57 /* setup data for flash0 device */
58 adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions);
59 adm5120_flash0_data.parts = br61xx_partitions;
60
61 adm5120_buttons_data.nbuttons = 1;
62 adm5120_buttons[0].desc = "reset button";
63 adm5120_buttons[0].gpio = ADM5120_GPIO_PIN2;
64
65 /* TODO: setup mac addresses, if possible */
66 }
67
68 unsigned char br61xx_vlans[6] = {
69 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
70 };
71
72 /*--------------------------------------------------------------------------*/
73
74 ADM5120_BOARD_START(BR6104K, "Edimax BR-6104K/6104KP")
75 .board_setup = br61xx_setup,
76 .eth_num_ports = 5,
77 .eth_vlans = br61xx_vlans,
78 .num_devices = ARRAY_SIZE(br6104k_devices),
79 .devices = br6104k_devices,
80 ADM5120_BOARD_END
81
82 ADM5120_BOARD_START(BR61x4WG, "Edimax BR-6104WG/6114WG")
83 .board_setup = br61xx_setup,
84 .eth_num_ports = 5,
85 .eth_vlans = br61xx_vlans,
86 .num_devices = ARRAY_SIZE(br61x4wg_devices),
87 .devices = br61x4wg_devices,
88 .pci_nr_irqs = ARRAY_SIZE(br61xx_pci_irqs),
89 .pci_irq_map = br61xx_pci_irqs,
90 ADM5120_BOARD_END