ar71xx: add support for Compex WPE72/WPE72NX
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files-2.6.39 / arch / mips / ar71xx / mach-wpe72.c
1 /*
2 * Compex WPE72 board support
3 *
4 * Copyright (C) 2012 Johnathan Boyce<jon.boyce@globalreach.eu.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11 #include<asm/mach-ar71xx/ar71xx.h>
12
13 #include "machtype.h"
14 #include "devices.h"
15 #include "dev-m25p80.h"
16 #include "dev-pb42-pci.h"
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-usb.h"
20
21 #define WPE72_GPIO_RESET 12
22 #define WPE72_GPIO_LED_DIAG 13
23 #define WPE72_GPIO_LED_1 14
24 #define WPE72_GPIO_LED_2 15
25 #define WPE72_GPIO_LED_3 16
26 #define WPE72_GPIO_LED_4 17
27
28 #define WPE72_KEYS_POLL_INTERVAL 20 /* msecs */
29 #define WPE72_KEYS_DEBOUNCE_INTERVAL (3 * WPE72_KEYS_POLL_INTERVAL)
30
31 static struct gpio_led wpe72_leds_gpio[] __initdata = {
32 {
33 .name = "wpe72:green:led1",
34 .gpio = WPE72_GPIO_LED_1,
35 .active_low = 1,
36 }, {
37 .name = "wpe72:green:led2",
38 .gpio = WPE72_GPIO_LED_2,
39 .active_low = 1,
40 }, {
41 .name = "wpe72:green:led3",
42 .gpio = WPE72_GPIO_LED_3,
43 .active_low = 1,
44 }, {
45 .name = "wpe72:green:led4",
46 .gpio = WPE72_GPIO_LED_4,
47 .active_low = 1,
48 }, {
49 .name = "wpe72:green:diag",
50 .gpio = WPE72_GPIO_LED_DIAG,
51 .active_low = 1,
52 }
53 };
54
55 static struct gpio_keys_button wpe72_gpio_keys[] __initdata = {
56 {
57 .desc = "reset",
58 .type = EV_KEY,
59 .code = KEY_RESTART,
60 .debounce_interval = WPE72_KEYS_DEBOUNCE_INTERVAL,
61 .gpio = WPE72_GPIO_RESET,
62 }
63 };
64
65 static const char *wpe72_part_probes[] = {
66 "MyLoader",
67 NULL,
68 };
69
70 static struct flash_platform_data wpe72_flash_data = {
71 .part_probes = wpe72_part_probes,
72 };
73
74 static void __init wpe72_setup(void)
75 {
76 ar71xx_add_device_m25p80(&wpe72_flash_data);
77 ar71xx_add_device_mdio(0, 0x0);
78
79 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, ar71xx_mac_base, 0);
80 ar71xx_init_mac(ar71xx_eth1_data.mac_addr, ar71xx_mac_base, 1);
81
82 ar71xx_add_device_eth(0);
83 ar71xx_add_device_eth(1);
84
85 ar71xx_add_device_usb();
86
87 pb42_pci_init();
88
89 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wpe72_leds_gpio),
90 wpe72_leds_gpio);
91
92 ar71xx_register_gpio_keys_polled(-1, WPE72_KEYS_POLL_INTERVAL,
93 ARRAY_SIZE(wpe72_gpio_keys),
94 wpe72_gpio_keys);
95 }
96
97 MIPS_MACHINE(AR71XX_MACH_WPE72, "WPE72", "Compex WPE72", wpe72_setup);