ar71xx: add Abicom SC300M support
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / 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-ath79/ath79.h>
12
13 #include "dev-eth.h"
14 #include "dev-gpio-buttons.h"
15 #include "dev-leds-gpio.h"
16 #include "dev-m25p80.h"
17 #include "dev-usb.h"
18 #include "machtypes.h"
19 #include "pci.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 .active_low = 1,
63 }
64 };
65
66 static const char *wpe72_part_probes[] = {
67 "MyLoader",
68 NULL,
69 };
70
71 static struct flash_platform_data wpe72_flash_data = {
72 .part_probes = wpe72_part_probes,
73 };
74
75 static void __init wpe72_setup(void)
76 {
77 ath79_register_m25p80(&wpe72_flash_data);
78 ath79_register_mdio(0, 0x0);
79
80 ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
81 ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
82
83 ath79_register_eth(0);
84 ath79_register_eth(1);
85
86 ath79_register_usb();
87 ath79_register_pci();
88
89 ath79_register_leds_gpio(-1, ARRAY_SIZE(wpe72_leds_gpio),
90 wpe72_leds_gpio);
91
92 ath79_register_gpio_keys_polled(-1, WPE72_KEYS_POLL_INTERVAL,
93 ARRAY_SIZE(wpe72_gpio_keys),
94 wpe72_gpio_keys);
95 }
96
97 MIPS_MACHINE(ATH79_MACH_WPE72, "WPE72", "Compex WPE72", wpe72_setup);