2 * DRAGINO V2 board support, based on Atheros AP121 board support
4 * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2012 Elektra Wagenrad <elektra@villagetelco.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/gpio.h>
13 #include <asm/mach-ath79/ath79.h>
14 #include <asm/mach-ath79/ar71xx_regs.h>
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-m25p80.h"
23 #include "machtypes.h"
25 #define DRAGINO2_GPIO_LED_WLAN 0
26 #define DRAGINO2_GPIO_LED_LAN 13
27 #define DRAGINO2_GPIO_LED_WAN 17
30 * The following GPIO is actually named "Router" on the board.
31 * However, since the "Router" feature is not supported as of yet
32 * we use it to display USB activity.
35 #define DRAGINO2_GPIO_LED_USB 28
36 #define DRAGINO2_GPIO_BTN_JUMPSTART 11
37 #define DRAGINO2_GPIO_BTN_RESET 12
39 #define DRAGINO2_KEYS_POLL_INTERVAL 20 /* msecs */
40 #define DRAGINO2_KEYS_DEBOUNCE_INTERVAL (3 * DRAGINO2_KEYS_POLL_INTERVAL)
42 #define DRAGINO2_MAC0_OFFSET 0x0000
43 #define DRAGINO2_MAC1_OFFSET 0x0006
44 #define DRAGINO2_CALDATA_OFFSET 0x1000
45 #define DRAGINO2_WMAC_MAC_OFFSET 0x1002
47 static struct gpio_led dragino2_leds_gpio
[] __initdata
= {
49 .name
= "dragino2:red:lan",
50 .gpio
= DRAGINO2_GPIO_LED_LAN
,
54 .name
= "dragino2:red:wlan",
55 .gpio
= DRAGINO2_GPIO_LED_WLAN
,
59 .name
= "dragino2:red:wan",
60 .gpio
= DRAGINO2_GPIO_LED_WAN
,
64 .name
= "dragino2:red:usb",
65 .gpio
= DRAGINO2_GPIO_LED_USB
,
70 static struct gpio_keys_button dragino2_gpio_keys
[] __initdata
= {
72 .desc
= "jumpstart button",
74 .code
= KEY_WPS_BUTTON
,
75 .debounce_interval
= DRAGINO2_KEYS_DEBOUNCE_INTERVAL
,
76 .gpio
= DRAGINO2_GPIO_BTN_JUMPSTART
,
80 .desc
= "reset button",
83 .debounce_interval
= DRAGINO2_KEYS_DEBOUNCE_INTERVAL
,
84 .gpio
= DRAGINO2_GPIO_BTN_RESET
,
89 static void __init
dragino2_common_setup(void)
91 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
93 ath79_register_m25p80(NULL
);
94 ath79_register_wmac(art
+ DRAGINO2_CALDATA_OFFSET
,
95 art
+ DRAGINO2_WMAC_MAC_OFFSET
);
97 ath79_init_mac(ath79_eth0_data
.mac_addr
, art
+ DRAGINO2_MAC0_OFFSET
, 0);
98 ath79_init_mac(ath79_eth1_data
.mac_addr
, art
+ DRAGINO2_MAC1_OFFSET
, 0);
100 ath79_register_mdio(0, 0x0);
102 /* Enable GPIO15 and GPIO16 and possibly GPIO26 and GPIO27 */
103 ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN
|
104 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN
);
107 ath79_register_eth(1);
110 ath79_register_eth(0);
113 static void __init
dragino2_setup(void)
115 dragino2_common_setup();
117 ath79_register_leds_gpio(-1, ARRAY_SIZE(dragino2_leds_gpio
),
119 ath79_register_gpio_keys_polled(-1, DRAGINO2_KEYS_POLL_INTERVAL
,
120 ARRAY_SIZE(dragino2_gpio_keys
),
122 ath79_register_usb();
125 MIPS_MACHINE(ATH79_MACH_DRAGINO2
, "DRAGINO2", "Dragino Dragino v2",