2 * Belkin F5D8235 v2 board support
4 * Copyright (C) 2010 Roman Yeryomin <roman@advem.lv>
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.
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>
17 #include <linux/rtl8366rb.h>
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>
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
37 static struct gpio_led f5d8235v2_leds_gpio[] __initdata = {
39 .name = "f5d8235v2:blue:internet",
40 .gpio = F5D8235_V2_GPIO_LED_INTERNET_BLUE,
43 .name = "f5d8235v2:amber:internet",
44 .gpio = F5D8235_V2_GPIO_LED_INTERNET_AMBER,
47 .name = "f5d8235v2:blue:modem",
48 .gpio = F5D8235_V2_GPIO_LED_MODEM_BLUE,
51 .name = "f5d8235v2:amber:modem",
52 .gpio = F5D8235_V2_GPIO_LED_MODEM_AMBER,
55 .name = "f5d8235v2:blue:router",
56 .gpio = F5D8235_V2_GPIO_LED_ROUTER,
59 .name = "f5d8235v2:blue:storage",
60 .gpio = F5D8235_V2_GPIO_LED_STORAGE_BLUE,
63 .name = "f5d8235v2:amber:storage",
64 .gpio = F5D8235_V2_GPIO_LED_STORAGE_AMBER,
67 .name = "f5d8235v2:blue:security",
68 .gpio = F5D8235_V2_GPIO_LED_SECURITY_BLUE,
71 .name = "f5d8235v2:amber:security",
72 .gpio = F5D8235_V2_GPIO_LED_SECURITY_AMBER,
77 #ifdef CONFIG_MTD_PARTITIONS
78 static struct mtd_partition f5d8235v2_partitions[] = {
83 .mask_flags = MTD_WRITEABLE,
85 .name = "kernel and rootfs",
102 #endif /* CONFIG_MTD_PARTITIONS */
104 static struct physmap_flash_data f5d8235v2_flash_data = {
105 #ifdef CONFIG_MTD_PARTITIONS
106 .nr_parts = ARRAY_SIZE(f5d8235v2_partitions),
107 .parts = f5d8235v2_partitions,
112 static struct rtl8366rb_platform_data f5d8235v2_switch_data = {
113 .gpio_sda = RT305X_GPIO_I2C_SD,
114 .gpio_sck = RT305X_GPIO_I2C_SCLK,
117 static struct platform_device f5d8235v2_switch = {
118 .name = RTL8366RB_DRIVER_NAME,
121 .platform_data = &f5d8235v2_switch_data,
125 static void __init f5d8235v2_init(void)
127 rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
128 RT305X_GPIO_MODE_UART0_SHIFT) |
129 RT305X_GPIO_MODE_I2C |
130 RT305X_GPIO_MODE_SPI |
131 RT305X_GPIO_MODE_MDIO);
132 rt305x_register_flash(0, &f5d8235v2_flash_data);
133 ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235v2_leds_gpio),
134 f5d8235v2_leds_gpio);
135 rt305x_register_ethernet();
136 platform_device_register(&f5d8235v2_switch);
137 rt305x_register_wifi();
140 MIPS_MACHINE(RAMIPS_MACH_F5D8235_V2, "F5D8235_V2", "Belkin F5D8235 v2",