2 * WEIO Web Of Things Platform
4 * Copyright (C) 2013 Drasko DRASKOVIC and Uros PETREVSKI
6 * ## ## ######## #### #######
9 * ## ## ## ###### ## ## ##
10 * ## ## ## ## ## ## ##
11 * ## ## ## ## ## ## ##
12 * ### ### ######## #### #######
14 * Web Of Things Platform
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 * Drasko DRASKOVIC <drasko.draskovic@gmail.com>
32 * Uros PETREVSKI <uros@nodesign.net>
35 #include <asm/mach-ath79/ath79.h>
36 #include <asm/mach-ath79/ar71xx_regs.h>
37 #include <linux/i2c-gpio.h>
38 #include <linux/platform_device.h>
41 #include "dev-gpio-buttons.h"
42 #include "dev-leds-gpio.h"
43 #include "dev-m25p80.h"
47 #include "machtypes.h"
49 #define WEIO_GPIO_LED_STA 1
50 #define WEIO_GPIO_LED_AP 16
52 #define WEIO_GPIO_BTN_AP 20
53 #define WEIO_GPIO_BTN_RESET 23
55 #define WEIO_KEYS_POLL_INTERVAL 20 /* msecs */
56 #define WEIO_KEYS_DEBOUNCE_INTERVAL (3 * WEIO_KEYS_POLL_INTERVAL)
58 #define WEIO_MAC0_OFFSET 0x0000
59 #define WEIO_MAC1_OFFSET 0x0006
60 #define WEIO_CALDATA_OFFSET 0x1000
61 #define WEIO_WMAC_MAC_OFFSET 0x1002
63 static struct gpio_led weio_leds_gpio
[] __initdata
= {
65 .name
= "weio:green:sta",
66 .gpio
= WEIO_GPIO_LED_STA
,
68 .default_state
= LEDS_GPIO_DEFSTATE_ON
,
71 .name
= "weio:green:ap",
72 .gpio
= WEIO_GPIO_LED_AP
,
74 .default_state
= LEDS_GPIO_DEFSTATE_ON
,
78 static struct gpio_keys_button weio_gpio_keys
[] __initdata
= {
83 .debounce_interval
= WEIO_KEYS_DEBOUNCE_INTERVAL
,
84 .gpio
= WEIO_GPIO_BTN_AP
,
88 .desc
= "soft-reset button",
91 .debounce_interval
= WEIO_KEYS_DEBOUNCE_INTERVAL
,
92 .gpio
= WEIO_GPIO_BTN_RESET
,
97 static struct i2c_gpio_platform_data weio_i2c_gpio_data
= {
102 static struct platform_device weio_i2c_gpio
= {
106 .platform_data
= &weio_i2c_gpio_data
,
110 static void __init
weio_common_setup(void)
112 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
114 ath79_register_m25p80(NULL
);
115 ath79_register_wmac(art
+ WEIO_CALDATA_OFFSET
, art
+ WEIO_WMAC_MAC_OFFSET
);
118 static void __init
weio_setup(void)
122 ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN
|
123 AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN
|
124 AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN
|
125 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN
|
126 AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN
);
128 platform_device_register(&weio_i2c_gpio
);
130 ath79_register_leds_gpio(-1, ARRAY_SIZE(weio_leds_gpio
),
133 ath79_register_gpio_keys_polled(-1, WEIO_KEYS_POLL_INTERVAL
,
134 ARRAY_SIZE(weio_gpio_keys
),
137 ath79_register_usb();
140 MIPS_MACHINE(ATH79_MACH_WEIO
, "WEIO", "WeIO board", weio_setup
);