2 * AWB WR6202 board support
4 * Copyright (C) 2012 Johnathan Boyce<jon.boyce@globalreach.eu.com>
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.
11 #include<linux/init.h>
12 #include<linux/platform_device.h>
13 #include<linux/gpio.h>
15 #include<asm/mach-ralink/machine.h>
16 #include<asm/mach-ralink/dev-gpio-buttons.h>
17 #include<asm/mach-ralink/dev-gpio-leds.h>
18 #include<asm/mach-ralink/rt305x.h>
19 #include<asm/mach-ralink/rt305x_regs.h>
23 #define WR6202_GPIO_BUTTON_RESET 10 /* active low */
24 #define WR6202_GPIO_BUTTON_WPS 0 /* active low */
26 #define WR6202_KEYS_POLL_INTERVAL 20
27 #define WR6202_KEYS_DEBOUNCE_INTERVAL (3 * WR6202_KEYS_POLL_INTERVAL)
29 #define WR6202_GPIO_USB_POWER 11
31 #define WR6202_GPIO_LED_3G 13
32 #define WR6202_GPIO_LED_WPS 14
34 static struct gpio_led wr6202_leds_gpio
[] __initdata
= {
36 .name
= "wr6202:blue:wps",
37 .gpio
= WR6202_GPIO_LED_WPS
,
40 .name
= "wr6202:blue:3g",
41 .gpio
= WR6202_GPIO_LED_3G
,
46 static struct gpio_keys_button wr6202_gpio_buttons
[] __initdata
= {
51 .debounce_interval
= WR6202_KEYS_DEBOUNCE_INTERVAL
,
52 .gpio
= WR6202_GPIO_BUTTON_RESET
,
57 .code
= KEY_WPS_BUTTON
,
58 .debounce_interval
= WR6202_KEYS_DEBOUNCE_INTERVAL
,
59 .gpio
= WR6202_GPIO_BUTTON_WPS
,
64 static void __init
wr6202_init(void)
66 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
68 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
70 ramips_register_gpio_leds(-1, ARRAY_SIZE(wr6202_leds_gpio
),
72 ramips_register_gpio_buttons(-1, WR6202_KEYS_POLL_INTERVAL
,
73 ARRAY_SIZE(wr6202_gpio_buttons
),
76 /* Power to the USB port is controlled by GPIO line */
77 gpio_request(WR6202_GPIO_USB_POWER
, "WR6202_GPIO_USB_POWER");
78 gpio_direction_output(WR6202_GPIO_USB_POWER
, 0);
79 gpio_free(WR6202_GPIO_USB_POWER
);
81 rt305x_register_flash(0);
83 rt305x_register_ethernet();
84 rt305x_register_wifi();
85 rt305x_register_wdt();
86 rt305x_register_usb();
89 MIPS_MACHINE(RAMIPS_MACH_WR6202
, "WR6202", "AWB WR6202",