Root/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
37static 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#ifdef CONFIG_MTD_PARTITIONS
78static struct mtd_partition f5d8235v2_partitions[] = {
79    {
80        .name = "u-boot",
81        .offset = 0,
82        .size = 0x050000,
83        .mask_flags = MTD_WRITEABLE,
84    }, {
85        .name = "kernel and rootfs",
86        .offset = 0x050000,
87        .size = 0x790000,
88    }, {
89        .name = "rootfs",
90        .offset = 0x1D0000,
91        .size = 0x610000,
92    }, {
93        .name = "nvram",
94        .offset = 0x7E0000,
95        .size = 0x010000,
96    }, {
97        .name = "factory",
98        .offset = 0x7F0000,
99        .size = 0x010000,
100    }
101};
102#endif /* CONFIG_MTD_PARTITIONS */
103
104static struct physmap_flash_data f5d8235v2_flash_data = {
105#ifdef CONFIG_MTD_PARTITIONS
106    .nr_parts = ARRAY_SIZE(f5d8235v2_partitions),
107    .parts = f5d8235v2_partitions,
108#endif
109};
110
111
112static struct rtl8366_platform_data f5d8235v2_switch_data = {
113    .gpio_sda = RT305X_GPIO_I2C_SD,
114    .gpio_sck = RT305X_GPIO_I2C_SCLK,
115};
116
117static struct platform_device f5d8235v2_switch = {
118    .name = RTL8366RB_DRIVER_NAME,
119    .id = -1,
120    .dev = {
121        .platform_data = &f5d8235v2_switch_data,
122    }
123};
124
125static void __init f5d8235v2_init(void)
126{
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_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE;
136    rt305x_register_ethernet();
137    platform_device_register(&f5d8235v2_switch);
138    rt305x_register_wifi();
139    rt305x_register_wdt();
140    rt305x_register_usb();
141}
142
143MIPS_MACHINE(RAMIPS_MACH_F5D8235_V2, "F5D8235_V2", "Belkin F5D8235 v2",
144         f5d8235v2_init);
145

Archive Download this file



interactive