ramips: rt3883: change eeprom file name
[openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-w502u.c
1 /*
2 * ALFA Networks W502U board support
3 *
4 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
5 *
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.
9 */
10
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
17 #include <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/dev-gpio-buttons.h>
19 #include <asm/mach-ralink/dev-gpio-leds.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
22
23 #include "devices.h"
24
25 #define W502U_GPIO_LED_USB 13
26 #define W502U_GPIO_LED_WPS 14
27
28 #define W502U_GPIO_BUTTON_WPS 0
29 #define W502U_GPIO_BUTTON_RESET 10
30
31 #define W502U_KEYS_POLL_INTERVAL 20
32 #define W502U_KEYS_DEBOUNCE_INTERVAL (3 * W502U_KEYS_POLL_INTERVAL)
33
34 static struct mtd_partition w502u_partitions[] = {
35 {
36 .name = "u-boot",
37 .offset = 0,
38 .size = 0x030000,
39 .mask_flags = MTD_WRITEABLE,
40 }, {
41 .name = "config",
42 .offset = 0x030000,
43 .size = 0x010000,
44 .mask_flags = MTD_WRITEABLE,
45 }, {
46 .name = "factory",
47 .offset = 0x040000,
48 .size = 0x010000,
49 .mask_flags = MTD_WRITEABLE,
50 }, {
51 .name = "kernel",
52 .offset = 0x050000,
53 .size = 0x0d0000,
54 }, {
55 .name = "rootfs",
56 .offset = 0x120000,
57 .size = 0x6d0000,
58 }, {
59 .name = "data3g",
60 .offset = 0x7f0000,
61 .size = 0x010000,
62 .mask_flags = MTD_WRITEABLE,
63 }, {
64 .name = "firmware",
65 .offset = 0x050000,
66 .size = 0x7a0000,
67 }
68 };
69
70 static struct gpio_led w502u_leds_gpio[] __initdata = {
71 {
72 .name = "alfa:blue:usb",
73 .gpio = W502U_GPIO_LED_USB,
74 .active_low = 1,
75 },
76 {
77 .name = "alfa:blue:wps",
78 .gpio = W502U_GPIO_LED_WPS,
79 .active_low = 1,
80 },
81 };
82
83 static struct gpio_keys_button w502u_gpio_buttons[] __initdata = {
84 {
85 .desc = "Reset button",
86 .type = EV_KEY,
87 .code = KEY_RESTART,
88 .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL,
89 .gpio = W502U_GPIO_BUTTON_RESET,
90 .active_low = 1,
91 },
92 {
93 .desc = "WPS button",
94 .type = EV_KEY,
95 .code = KEY_WPS_BUTTON,
96 .debounce_interval = W502U_KEYS_DEBOUNCE_INTERVAL,
97 .gpio = W502U_GPIO_BUTTON_WPS,
98 .active_low = 1,
99 },
100 };
101
102 static void __init w502u_init(void)
103 {
104 rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
105 RT305X_GPIO_MODE_UART0_SHIFT));
106
107 rt305x_flash0_data.nr_parts = ARRAY_SIZE(w502u_partitions);
108 rt305x_flash0_data.parts = w502u_partitions;
109 rt305x_register_flash(0);
110
111 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
112 rt305x_register_ethernet();
113 ramips_register_gpio_leds(-1, ARRAY_SIZE(w502u_leds_gpio),
114 w502u_leds_gpio);
115 ramips_register_gpio_buttons(-1, W502U_KEYS_POLL_INTERVAL,
116 ARRAY_SIZE(w502u_gpio_buttons),
117 w502u_gpio_buttons);
118 rt305x_register_wifi();
119 rt305x_register_wdt();
120 rt305x_register_usb();
121 }
122
123 MIPS_MACHINE(RAMIPS_MACH_W502U, "W502U", "ALFA Networks W502U",
124 w502u_init);
This page took 0.045378 seconds and 5 git commands to generate.