ramips: rt305x: remove CONFIG_MTD_PARTITION ifdefery from machine files
[openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-wl341v3.c
1 /*
2 * Sitecom WL341v3 board support
3 *
4 * Copyright (C) 2012 Marco Antonio Mauro <marcus90@gmail.com>
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 WL341V3_GPIO_LED_FIRST_AMBER 9
26 #define WL341V3_GPIO_LED_FIRST_BLUE 13
27 #define WL341V3_GPIO_LED_THIRD_AMBER 11
28 #define WL341V3_GPIO_LED_THIRD_BLUE 14
29 #define WL341V3_GPIO_LED_FOURTH_BLUE 10
30 #define WL341V3_GPIO_LED_FIFTH_AMBER 12
31 #define WL341V3_GPIO_LED_FIFTH_BLUE 8
32
33 #define WL341V3_GPIO_BUTTON_WPS 5 /* active low */
34 #define WL341V3_GPIO_BUTTON_RESET 7 /* active low */
35
36 #define WL341V3_BUTTONS_POLL_INTERVAL 20
37
38 static struct mtd_partition wl341v3_partitions[] = {
39 {
40 .name = "u-boot",
41 .offset = 0,
42 .size = 0x020000,
43 .mask_flags = MTD_WRITEABLE,
44 }, {
45 .name = "board-nvram",
46 .offset = 0x020000,
47 .size = 0x010000,
48 .mask_flags = MTD_WRITEABLE,
49 }, {
50 .name = "u-boot-env",
51 .offset = 0x030000,
52 .size = 0x010000,
53 .mask_flags = MTD_WRITEABLE,
54 }, {
55 .name = "kernel",
56 .offset = 0x040000,
57 .size = 0x0d0000,
58 }, {
59 .name = "rootfs",
60 .offset = 0x110000,
61 .size = 0x2e0000,
62 }, {
63 .name = "signature-eRcOmM",
64 .offset = 0x3f0000,
65 .size = 0x010000,
66 }, {
67 .name = "firmware",
68 .offset = 0x040000,
69 .size = 0x3b0000,
70 }, {
71 .name = "fullflash",
72 .offset = 0x000000,
73 .size = 0x400000,
74 }
75 };
76
77 static struct physmap_flash_data wl341v3_flash_data = {
78 .nr_parts = ARRAY_SIZE(wl341v3_partitions),
79 .parts = wl341v3_partitions,
80 };
81
82 static struct gpio_led wl341v3_leds_gpio[] __initdata = {
83 {
84 .name = "wl341v3:amber:first",
85 .gpio = WL341V3_GPIO_LED_FIRST_AMBER,
86 .active_low = 1,
87 }, {
88 .name = "wl341v3:blue:first",
89 .gpio = WL341V3_GPIO_LED_FIRST_BLUE,
90 .active_low = 1,
91 }, {
92 .name = "wl341v3:amber:third",
93 .gpio = WL341V3_GPIO_LED_THIRD_AMBER,
94 .active_low = 1,
95 }, {
96 .name = "wl341v3:blue:third",
97 .gpio = WL341V3_GPIO_LED_THIRD_BLUE,
98 .active_low = 1,
99 }, {
100 .name = "wl341v3:blue:fourth",
101 .gpio = WL341V3_GPIO_LED_FOURTH_BLUE,
102 .active_low = 1,
103 }, {
104 .name = "wl341v3:amber:fifth",
105 .gpio = WL341V3_GPIO_LED_FIFTH_AMBER,
106 .active_low = 1,
107 }, {
108 .name = "wl341v3:blue:fifth",
109 .gpio = WL341V3_GPIO_LED_FIFTH_BLUE,
110 .active_low = 1,
111 }
112 };
113
114 static struct gpio_button wl341v3_gpio_buttons[] __initdata = {
115 {
116 .desc = "reset",
117 .type = EV_KEY,
118 .code = KEY_RESTART,
119 .threshold = 3,
120 .gpio = WL341V3_GPIO_BUTTON_RESET,
121 .active_low = 1,
122 }, {
123 .desc = "wps",
124 .type = EV_KEY,
125 .code = KEY_WPS_BUTTON,
126 .threshold = 3,
127 .gpio = WL341V3_GPIO_BUTTON_WPS,
128 .active_low = 1,
129 }
130 };
131
132 static void __init wl341v3_init(void)
133 {
134 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
135
136 rt305x_register_flash(0, &wl341v3_flash_data);
137 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_WLLLL;
138 rt305x_register_ethernet();
139 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl341v3_leds_gpio),
140 wl341v3_leds_gpio);
141 ramips_register_gpio_buttons(-1, WL341V3_BUTTONS_POLL_INTERVAL,
142 ARRAY_SIZE(wl341v3_gpio_buttons),
143 wl341v3_gpio_buttons);
144 rt305x_register_wifi();
145 rt305x_register_wdt();
146 rt305x_register_usb();
147 }
148
149 MIPS_MACHINE(RAMIPS_MACH_WL341V3, "WL341V3", "Sitecom WL-341 v3",
150 wl341v3_init);
This page took 0.051371 seconds and 5 git commands to generate.