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
14#include <linux/rtl8366.h>
15
16#include <asm/mach-ralink/machine.h>
17#include <asm/mach-ralink/dev-gpio-buttons.h>
18#include <asm/mach-ralink/dev-gpio-leds.h>
19#include <asm/mach-ralink/rt305x.h>
20#include <asm/mach-ralink/rt305x_regs.h>
21
22#include "devices.h"
23
24#define F5D8235_V2_GPIO_LED_INTERNET_BLUE 5
25#define F5D8235_V2_GPIO_LED_INTERNET_AMBER 6
26#define F5D8235_V2_GPIO_LED_MODEM_BLUE 11
27#define F5D8235_V2_GPIO_LED_MODEM_AMBER 8
28#define F5D8235_V2_GPIO_LED_ROUTER 9
29#define F5D8235_V2_GPIO_LED_STORAGE_BLUE 23
30#define F5D8235_V2_GPIO_LED_STORAGE_AMBER 22
31#define F5D8235_V2_GPIO_LED_SECURITY_BLUE 13
32#define F5D8235_V2_GPIO_LED_SECURITY_AMBER 12
33
34static struct gpio_led f5d8235v2_leds_gpio[] __initdata = {
35    {
36        .name = "f5d8235v2:blue:internet",
37        .gpio = F5D8235_V2_GPIO_LED_INTERNET_BLUE,
38        .active_low = 1,
39    }, {
40        .name = "f5d8235v2:amber:internet",
41        .gpio = F5D8235_V2_GPIO_LED_INTERNET_AMBER,
42        .active_low = 1,
43    }, {
44        .name = "f5d8235v2:blue:modem",
45        .gpio = F5D8235_V2_GPIO_LED_MODEM_BLUE,
46        .active_low = 1,
47    }, {
48        .name = "f5d8235v2:amber:modem",
49        .gpio = F5D8235_V2_GPIO_LED_MODEM_AMBER,
50        .active_low = 1,
51    }, {
52        .name = "f5d8235v2:blue:router",
53        .gpio = F5D8235_V2_GPIO_LED_ROUTER,
54        .active_low = 1,
55    }, {
56        .name = "f5d8235v2:blue:storage",
57        .gpio = F5D8235_V2_GPIO_LED_STORAGE_BLUE,
58        .active_low = 1,
59    }, {
60        .name = "f5d8235v2:amber:storage",
61        .gpio = F5D8235_V2_GPIO_LED_STORAGE_AMBER,
62        .active_low = 1,
63    }, {
64        .name = "f5d8235v2:blue:security",
65        .gpio = F5D8235_V2_GPIO_LED_SECURITY_BLUE,
66        .active_low = 1,
67    }, {
68        .name = "f5d8235v2:amber:security",
69        .gpio = F5D8235_V2_GPIO_LED_SECURITY_AMBER,
70        .active_low = 1,
71    }
72};
73
74static struct rtl8366_platform_data f5d8235v2_switch_data = {
75    .gpio_sda = RT305X_GPIO_I2C_SD,
76    .gpio_sck = RT305X_GPIO_I2C_SCLK,
77};
78
79static struct platform_device f5d8235v2_switch = {
80    .name = RTL8366RB_DRIVER_NAME,
81    .id = -1,
82    .dev = {
83        .platform_data = &f5d8235v2_switch_data,
84    }
85};
86
87static void __init f5d8235v2_init(void)
88{
89    rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
90                    RT305X_GPIO_MODE_UART0_SHIFT) |
91                    RT305X_GPIO_MODE_I2C |
92                    RT305X_GPIO_MODE_SPI |
93                    RT305X_GPIO_MODE_MDIO);
94
95    rt305x_register_flash(0);
96
97    ramips_register_gpio_leds(-1, ARRAY_SIZE(f5d8235v2_leds_gpio),
98                        f5d8235v2_leds_gpio);
99    rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_NONE;
100    rt305x_register_ethernet();
101    platform_device_register(&f5d8235v2_switch);
102    rt305x_register_wifi();
103    rt305x_register_wdt();
104    rt305x_register_usb();
105}
106
107MIPS_MACHINE(RAMIPS_MACH_F5D8235_V2, "F5D8235_V2", "Belkin F5D8235 v2",
108         f5d8235v2_init);
109

Archive Download this file



interactive