ar71xx: add support for YunCore CPE830
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-gs-minibox-v1.c
1 /*
2 * Gainstrong MiniBox V1.0 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-usb.h"
21 #include "dev-wmac.h"
22 #include "machtypes.h"
23
24 #define GS_MINIBOX_V1_GPIO_BTN_RESET 11
25
26 #define GS_MINIBOX_V1_GPIO_LED_SYSTEM 1
27
28 #define GS_MINIBOX_V1_KEYS_POLL_INTERVAL 20 /* msecs */
29 #define GS_MINIBOX_V1_KEYS_DEBOUNCE_INTERVAL (3 * GS_MINIBOX_V1_KEYS_POLL_INTERVAL)
30
31 static const char *gs_minibox_v1_part_probes[] = {
32 "tp-link",
33 NULL,
34 };
35
36 static struct flash_platform_data gs_minibox_v1_flash_data = {
37 .part_probes = gs_minibox_v1_part_probes,
38 };
39
40 static struct gpio_led gs_minibox_v1_leds_gpio[] __initdata = {
41 {
42 .name = "minibox-v1:green:system",
43 .gpio = GS_MINIBOX_V1_GPIO_LED_SYSTEM,
44 .active_low = 1,
45 },
46 };
47
48 static struct gpio_keys_button gs_minibox_v1_gpio_keys[] __initdata = {
49 {
50 .desc = "reset",
51 .type = EV_KEY,
52 .code = KEY_RESTART,
53 .debounce_interval = GS_MINIBOX_V1_KEYS_DEBOUNCE_INTERVAL,
54 .gpio = GS_MINIBOX_V1_GPIO_BTN_RESET,
55 .active_low = 0,
56 },
57 };
58
59 static void __init gs_minibox_v1_setup(void)
60 {
61 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
62 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
63
64 ath79_register_leds_gpio(-1, ARRAY_SIZE(gs_minibox_v1_leds_gpio),
65 gs_minibox_v1_leds_gpio);
66
67 ath79_register_gpio_keys_polled(-1, GS_MINIBOX_V1_KEYS_POLL_INTERVAL,
68 ARRAY_SIZE(gs_minibox_v1_gpio_keys),
69 gs_minibox_v1_gpio_keys);
70
71 ath79_register_usb();
72
73 ath79_register_m25p80(&gs_minibox_v1_flash_data);
74 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
75 ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
76
77 ath79_register_mdio(0, 0x0);
78 ath79_register_eth(1);
79 ath79_register_eth(0);
80
81 ath79_register_wmac(ee, mac);
82 }
83
84 MIPS_MACHINE(ATH79_MACH_GS_MINIBOX_V1, "MINIBOX-V1",
85 "MiniBox V1.0", gs_minibox_v1_setup);