ramips: rt305x: remove per-board physmap_flash_data instances
[openwrt/openwrt.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-f5d8235-v2.c
1 /*
2 * Belkin F5D8235 v2 board support
3 *
4 * Copyright (C) 2010 Roman Yeryomin <roman@advem.lv>
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 <linux/rtl8366.h>
18
19 #include <asm/mach-ralink/machine.h>
20 #include <asm/mach-ralink/dev-gpio-buttons.h>
21 #include <asm/mach-ralink/dev-gpio-leds.h>
22 #include <asm/mach-ralink/rt305x.h>
23 #include <asm/mach-ralink/rt305x_regs.h>
24
25 #include "devices.h"
26
27 #define F5D8235_V2_GPIO_LED_INTERNET_BLUE 5
28 #define F5D8235_V2_GPIO_LED_INTERNET_AMBER 6
29 #define F5D8235_V2_GPIO_LED_MODEM_BLUE 11
30 #define F5D8235_V2_GPIO_LED_MODEM_AMBER 8
31 #define F5D8235_V2_GPIO_LED_ROUTER 9
32 #define F5D8235_V2_GPIO_LED_STORAGE_BLUE 23
33 #define F5D8235_V2_GPIO_LED_STORAGE_AMBER 22
34 #define F5D8235_V2_GPIO_LED_SECURITY_BLUE 13
35 #define F5D8235_V2_GPIO_LED_SECURITY_AMBER 12
36
37 static struct gpio_led f5d8235v2_leds_gpio[] __initdata = {
38 {
39 .name = "f5d8235v2:blue:internet",
40 .gpio = F5D8235_V2_GPIO_LED_INTERNET_BLUE,
41 .active_low = 1,
42 }, {
43 .name = "f5d8235v2:amber:internet",
44 .gpio = F5D8235_V2_GPIO_LED_INTERNET_AMBER,
45 .active_low = 1,
46 }, {
47 .name = "f5d8235v2:blue:modem",
48 .gpio = F5D8235_V2_GPIO_LED_MODEM_BLUE,
49 .active_low = 1,
50 }, {
51 .name = "f5d8235v2:amber:modem",
52 .gpio = F5D8235_V2_GPIO_LED_MODEM_AMBER,
53 .active_low = 1,
54 }, {
55 .name = "f5d8235v2:blue:router",
56 .gpio = F5D8235_V2_GPIO_LED_ROUTER,
57 .active_low = 1,
58 }, {
59 .name = "f5d8235v2:blue:storage",
60 .gpio = F5D8235_V2_GPIO_LED_STORAGE_BLUE,
61 .active_low = 1,
62 }, {
63 .name = "f5d8235v2:amber:storage",
64 .gpio = F5D8235_V2_GPIO_LED_STORAGE_AMBER,
65 .active_low = 1,
66 }, {
67 .name = "f5d8235v2:blue:security",
68 .gpio = F5D8235_V2_GPIO_LED_SECURITY_BLUE,
69 .active_low = 1,
70 }, {
71 .name = "f5d8235v2:amber:security",
72 .gpio = F5D8235_V2_GPIO_LED_SECURITY_AMBER,
73 .active_low = 1,
74 }
75 };
76
77 static struct mtd_partition f5d8235v2_partitions[] = {
78 {
79 .name = "u-boot",
80 .offset = 0,
81 .size = 0x050000,
82 .mask_flags = MTD_WRITEABLE,
83 }, {
84 .name = "kernel and rootfs",
85 .offset = 0x050000,
86 .size = 0x790000,
87 }, {
88 .name = "rootfs",
89 .offset = 0x1D0000,
90 .size = 0x610000,
91 }, {
92 .name = "nvram",
93 .offset = 0x7E0000,
94 .size = 0x010000,
95 }, {
96 .name = "factory",
97 .offset = 0x7F0000,
98 .size = 0x010000,
99 }
100 };
101
102 static struct rtl8366_platform_data f5d8235v2_switch_data = {
103 .gpio_sda = RT305X_GPIO_I2C_SD,
104 .gpio_sck = RT305X_GPIO_I2C_SCLK,
105 };
106
107 static struct platform_device f5d8235v2_switch = {
108 .name = RTL8366RB_DRIVER_NAME,
109 .id = -1,
110 .dev = {
111 .platform_data = &f5d8235v2_switch_data,
112 }
113 };
114
115 static void __init f5d8235v2_init(void)
116 {
117 rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
118 RT305X_GPIO_MODE_UART0_SHIFT) |
119 RT305X_GPIO_MODE_I2C |
120 RT305X_GPIO_MODE_SPI |
121 RT305X_GPIO_MODE_MDIO);
122
123 rt305x_flash0_data.nr_parts = ARRAY_SIZE(f5d8235v2_partitions);
124 rt305x_flash0_data.parts = f5d8235v2_partitions;
125 rt305x_register_flash(0);
126
127 ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235v2_leds_gpio),
128 f5d8235v2_leds_gpio);
129 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE;
130 rt305x_register_ethernet();
131 platform_device_register(&f5d8235v2_switch);
132 rt305x_register_wifi();
133 rt305x_register_wdt();
134 rt305x_register_usb();
135 }
136
137 MIPS_MACHINE(RAMIPS_MACH_F5D8235_V2, "F5D8235_V2", "Belkin F5D8235 v2",
138 f5d8235v2_init);