11867632790a12cc84d777f86802d539fb5e0f89
[openwrt/svn-archive/archive.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-v22rw-2x2.c
1 /*
2 * Ralink AP-RT3052-V22RW-2X2 board support
3 *
4 * Copyright (C) 2009 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 #include <linux/leds.h>
17
18 #include <asm/mips_machine.h>
19 #include <asm/mach-ralink/machine.h>
20 #include <asm/mach-ralink/dev_gpio_leds.h>
21
22 #include "devices.h"
23
24 #define V22RW_2X2_GPIO_LED_SECURITY 13
25 #define V22RW_2X2_GPIO_LED_WPS 14
26
27 #ifdef CONFIG_MTD_PARTITIONS
28 static struct mtd_partition v22rw_2x2_partitions[] = {
29 {
30 .name = "u-boot",
31 .offset = 0,
32 .size = 0x030000,
33 .mask_flags = MTD_WRITEABLE,
34 }, {
35 .name = "u-boot-env",
36 .offset = 0x030000,
37 .size = 0x010000,
38 .mask_flags = MTD_WRITEABLE,
39 }, {
40 .name = "factory",
41 .offset = 0x040000,
42 .size = 0x010000,
43 .mask_flags = MTD_WRITEABLE,
44 }, {
45 .name = "kernel",
46 .offset = 0x050000,
47 .size = 0x0a0000,
48 }, {
49 .name = "rootfs",
50 .offset = 0x150000,
51 .size = 0x2b0000,
52 }, {
53 .name = "openwrt",
54 .offset = 0x050000,
55 .size = 0x3b0000,
56 }
57 };
58 #endif /* CONFIG_MTD_PARTITIONS */
59
60 static struct physmap_flash_data v22rw_2x2_flash_data = {
61 #ifdef CONFIG_MTD_PARTITIONS
62 .nr_parts = ARRAY_SIZE(v22rw_2x2_partitions),
63 .parts = v22rw_2x2_partitions,
64 #endif
65 };
66
67 static struct gpio_led v22rw_2x2_leds_gpio[] __initdata = {
68 {
69 .name = "v22rw-2x2:green:security",
70 .gpio = V22RW_2X2_GPIO_LED_SECURITY,
71 .active_low = 1,
72 }, {
73 .name = "v22rw-2x2:red:wps",
74 .gpio = V22RW_2X2_GPIO_LED_WPS,
75 .active_low = 1,
76 }
77 };
78
79 static void __init v22rw_2x2_init(void)
80 {
81 rt305x_register_flash(0, &v22rw_2x2_flash_data);
82
83 ramips_register_gpio_leds(-1, ARRAY_SIZE(v22rw_2x2_leds_gpio),
84 v22rw_2x2_leds_gpio);
85 }
86
87 MIPS_MACHINE(RAMIPS_MACH_V22RW_2X2, "Ralink AP-RT3052-V22RW-2X2",
88 v22rw_2x2_init);