ramips: rt305x: remove CONFIG_MTD_PARTITION ifdefery from machine files
[openwrt/svn-archive/archive.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-rt-g32-revb.c
1 /*
2 * Asus RT-G32 rev B board support
3 *
4 * Copyright (C) 2011 Sergiy <piratfm@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/spi/spi.h>
14 #include <linux/spi/flash.h>
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
17
18 #include <asm/mach-ralink/machine.h>
19 #include <asm/mach-ralink/dev-gpio-buttons.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
22
23 #include "devices.h"
24
25 #define RT_G32B_GPIO_BUTTON_WPS 0 /* active low */
26 #define RT_G32B_GPIO_BUTTON_RESET 10 /* active low */
27
28 #define RT_G32B_BUTTONS_POLL_INTERVAL 20
29
30 static struct mtd_partition rt_g32b_partitions[] = {
31 {
32 .name = "u-boot",
33 .offset = 0,
34 .size = 0x030000,
35 .mask_flags = MTD_WRITEABLE,
36 }, {
37 .name = "devdata",
38 .offset = 0x030000,
39 .size = 0x010000,
40 .mask_flags = MTD_WRITEABLE,
41 }, {
42 .name = "devconf",
43 .offset = 0x040000,
44 .size = 0x010000,
45 .mask_flags = MTD_WRITEABLE,
46 }, {
47 .name = "kernel",
48 .offset = 0x050000,
49 .size = 0x0d0000,
50 }, {
51 .name = "rootfs",
52 .offset = 0x120000,
53 .size = 0x2e0000,
54 }, {
55 .name = "firmware",
56 .offset = 0x050000,
57 .size = 0x3b0000,
58 }
59 };
60
61 const struct flash_platform_data rt_g32b_flash = {
62 .type = "mx25l3205d",
63 .parts = rt_g32b_partitions,
64 .nr_parts = ARRAY_SIZE(rt_g32b_partitions),
65 };
66
67 struct spi_board_info __initdata rt_g32b_spi_slave_info[] = {
68 {
69 .modalias = "m25p80",
70 .platform_data = &rt_g32b_flash,
71 .irq = -1,
72 .max_speed_hz = 10000000,
73 .bus_num = 0,
74 .chip_select = 0,
75 },
76 };
77
78 static struct gpio_button rt_g32b_gpio_buttons[] __initdata = {
79 {
80 .desc = "reset",
81 .type = EV_KEY,
82 .code = KEY_RESTART,
83 .threshold = 3,
84 .gpio = RT_G32B_GPIO_BUTTON_RESET,
85 .active_low = 1,
86 }, {
87 .desc = "wps",
88 .type = EV_KEY,
89 .code = KEY_WPS_BUTTON,
90 .threshold = 3,
91 .gpio = RT_G32B_GPIO_BUTTON_WPS,
92 .active_low = 1,
93 }
94 };
95
96 static void __init rt_g32b_init(void)
97 {
98 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
99 rt305x_register_spi(rt_g32b_spi_slave_info,
100 ARRAY_SIZE(rt_g32b_spi_slave_info));
101
102 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
103 rt305x_register_ethernet();
104 ramips_register_gpio_buttons(-1, RT_G32B_BUTTONS_POLL_INTERVAL,
105 ARRAY_SIZE(rt_g32b_gpio_buttons),
106 rt_g32b_gpio_buttons);
107 rt305x_register_wifi();
108 rt305x_register_wdt();
109 }
110
111 MIPS_MACHINE(RAMIPS_MACH_RT_G32_B1, "RT-G32-B1", "Asus RT-G32 B1",
112 rt_g32b_init);