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/mtd/mtd.h>
14 #include<linux/mtd/partitions.h>
15 #include<linux/mtd/physmap.h>
16 #include<linux/gpio.h>
18 #include<asm/mach-ralink/machine.h>
19 #include<asm/mach-ralink/dev-gpio-buttons.h>
20 #include<asm/mach-ralink/dev-gpio-leds.h>
21 #include<asm/mach-ralink/rt305x.h>
22 #include<asm/mach-ralink/rt305x_regs.h>
26 #define WR6202_GPIO_BUTTON_RESET 10 /* active low */
27 #define WR6202_GPIO_BUTTON_WPS 0 /* active low */
29 #define WR6202_KEYS_POLL_INTERVAL 20
30 #define WR6202_KEYS_DEBOUNCE_INTERVAL (3 * WR6202_KEYS_POLL_INTERVAL)
32 #define WR6202_GPIO_USB_POWER 11
34 #define WR6202_GPIO_LED_3G 13
35 #define WR6202_GPIO_LED_WPS 14
37 static struct mtd_partition wr6202_partitions
[] = {
43 .name
= "uboot-config",
46 .mask_flags
= MTD_WRITEABLE
,
51 .mask_flags
= MTD_WRITEABLE
,
63 static struct gpio_led wr6202_leds_gpio
[] __initdata
= {
65 .name
= "wr6202:blue:wps",
66 .gpio
= WR6202_GPIO_LED_WPS
,
69 .name
= "wr6202:blue:3g",
70 .gpio
= WR6202_GPIO_LED_3G
,
75 static struct gpio_keys_button wr6202_gpio_buttons
[] __initdata
= {
80 .debounce_interval
= WR6202_KEYS_DEBOUNCE_INTERVAL
,
81 .gpio
= WR6202_GPIO_BUTTON_RESET
,
86 .code
= KEY_WPS_BUTTON
,
87 .debounce_interval
= WR6202_KEYS_DEBOUNCE_INTERVAL
,
88 .gpio
= WR6202_GPIO_BUTTON_WPS
,
93 static void __init
wr6202_init(void)
95 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
97 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
99 ramips_register_gpio_leds(-1, ARRAY_SIZE(wr6202_leds_gpio
),
101 ramips_register_gpio_buttons(-1, WR6202_KEYS_POLL_INTERVAL
,
102 ARRAY_SIZE(wr6202_gpio_buttons
),
103 wr6202_gpio_buttons
);
105 /* Power to the USB port is controlled by GPIO line */
106 gpio_request(WR6202_GPIO_USB_POWER
, "WR6202_GPIO_USB_POWER");
107 gpio_direction_output(WR6202_GPIO_USB_POWER
, 0);
108 gpio_free(WR6202_GPIO_USB_POWER
);
110 rt305x_flash0_data
.nr_parts
= ARRAY_SIZE(wr6202_partitions
);
111 rt305x_flash0_data
.parts
= wr6202_partitions
;
112 rt305x_register_flash(0);
114 rt305x_register_ethernet();
115 rt305x_register_wifi();
116 rt305x_register_wdt();
117 rt305x_register_usb();
120 MIPS_MACHINE(RAMIPS_MACH_WR6202
, "WR6202", "AWB WR6202",