ar71xx: add kernel support for the Oolite v1 board
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-gs-oolite.c
1 /*
2 * Oolite board support
3 *
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
8 */
9
10 #include <linux/gpio.h>
11
12 #include <asm/mach-ath79/ath79.h>
13 #include <asm/mach-ath79/ar71xx_regs.h>
14
15 #include "common.h"
16 #include "dev-eth.h"
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-m25p80.h"
20 #include "dev-wmac.h"
21 #include "machtypes.h"
22 #include "dev-usb.h"
23
24 #define GS_OOLITE_GPIO_BTN6 6
25 #define GS_OOLITE_GPIO_BTN7 7
26 #define GS_OOLITE_GPIO_BTN_RESET 11
27
28 #define GS_OOLITE_GPIO_LED_SYSTEM 27
29
30 #define GS_OOLITE_KEYS_POLL_INTERVAL 20 /* msecs */
31 #define GS_OOLITE_KEYS_DEBOUNCE_INTERVAL (3 * GS_OOLITE_KEYS_POLL_INTERVAL)
32
33 static const char *gs_oolite_part_probes[] = {
34 "tp-link",
35 NULL,
36 };
37
38 static struct flash_platform_data gs_oolite_flash_data = {
39 .part_probes = gs_oolite_part_probes,
40 };
41
42 static struct gpio_led gs_oolite_leds_gpio[] __initdata = {
43 {
44 .name = "oolite:red:system",
45 .gpio = GS_OOLITE_GPIO_LED_SYSTEM,
46 .active_low = 1,
47 },
48 };
49
50 static struct gpio_keys_button gs_oolite_gpio_keys[] __initdata = {
51 {
52 .desc = "reset",
53 .type = EV_KEY,
54 .code = KEY_RESTART,
55 .debounce_interval = GS_OOLITE_KEYS_DEBOUNCE_INTERVAL,
56 .gpio = GS_OOLITE_GPIO_BTN_RESET,
57 .active_low = 1,
58 },
59 {
60 .desc = "BTN_6",
61 .type = EV_KEY,
62 .code = BTN_6,
63 .debounce_interval = GS_OOLITE_KEYS_DEBOUNCE_INTERVAL,
64 .gpio = GS_OOLITE_GPIO_BTN6,
65 .active_low = 1,
66 },
67 {
68 .desc = "BTN_7",
69 .type = EV_KEY,
70 .code = BTN_7,
71 .debounce_interval = GS_OOLITE_KEYS_DEBOUNCE_INTERVAL,
72 .gpio = GS_OOLITE_GPIO_BTN7,
73 .active_low = 1,
74 },
75 };
76
77 static void __init gs_oolite_setup(void)
78 {
79 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
80 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
81
82 ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_oolite_leds_gpio),
83 gs_oolite_leds_gpio);
84
85 ath79_register_gpio_keys_polled(-1, GS_OOLITE_KEYS_POLL_INTERVAL,
86 ARRAY_SIZE(gs_oolite_gpio_keys),
87 gs_oolite_gpio_keys);
88
89 ath79_register_usb();
90
91 ath79_register_m25p80(&gs_oolite_flash_data);
92 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
93 ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
94
95 ath79_register_mdio(0, 0x0);
96 ath79_register_eth(1);
97 ath79_register_eth(0);
98
99 ath79_register_wmac(ee, mac);
100 }
101
102 MIPS_MACHINE(ATH79_MACH_GS_OOLITE, "GS-OOLITE",
103 "Oolite V1.0", gs_oolite_setup);