2 * Sitecom WL-351 v1 002 board support
4 * Copyright (C) 2011 Tobias Diedrich <ranma+openwrt@tdiedrich.de>
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/rtl8366.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 WL351_GPIO_LED_POWER_AMBER 8
28 #define WL351_GPIO_LED_UNPOPULATED_AMBER 12
29 #define WL351_GPIO_LED_UNPOPULATED_BLUE 13
31 #define WL351_GPIO_BUTTON_RESET 10
32 #define WL351_GPIO_BUTTON_WPS 0
34 #define WL351_KEYS_POLL_INTERVAL 20
35 #define WL351_KEYS_DEBOUNCE_INTERVAL (3 * WL351_KEYS_POLL_INTERVAL)
37 static struct gpio_led wl351_leds_gpio
[] __initdata
= {
39 .name
= "wl-351:amber:power",
40 .gpio
= WL351_GPIO_LED_POWER_AMBER
,
43 .name
= "wl-351:amber:unpopulated",
44 .gpio
= WL351_GPIO_LED_UNPOPULATED_AMBER
,
47 .name
= "wl-351:blue:unpopulated",
48 .gpio
= WL351_GPIO_LED_UNPOPULATED_BLUE
,
54 static struct gpio_keys_button wl351_gpio_buttons
[] __initdata
= {
59 .debounce_interval
= WL351_KEYS_DEBOUNCE_INTERVAL
,
60 .gpio
= WL351_GPIO_BUTTON_RESET
,
65 .code
= KEY_WPS_BUTTON
,
66 .debounce_interval
= WL351_KEYS_DEBOUNCE_INTERVAL
,
67 .gpio
= WL351_GPIO_BUTTON_WPS
,
72 static struct mtd_partition wl351_partitions
[] = {
77 .mask_flags
= MTD_WRITEABLE
,
82 .mask_flags
= MTD_WRITEABLE
,
87 .mask_flags
= MTD_WRITEABLE
,
97 .name
= "user (jffs2)",
107 static struct rtl8366_platform_data wl351_switch_data
= {
108 .gpio_sda
= RT305X_GPIO_I2C_SD
,
109 .gpio_sck
= RT305X_GPIO_I2C_SCLK
,
112 static struct platform_device wl351_switch
= {
113 .name
= RTL8366RB_DRIVER_NAME
,
116 .platform_data
= &wl351_switch_data
,
120 static void __init
wl351_init(void)
122 rt305x_gpio_init((RT305X_GPIO_MODE_GPIO
<<
123 RT305X_GPIO_MODE_UART0_SHIFT
) |
124 RT305X_GPIO_MODE_I2C
|
125 RT305X_GPIO_MODE_SPI
|
126 RT305X_GPIO_MODE_MDIO
);
128 rt305x_flash0_data
.nr_parts
= ARRAY_SIZE(wl351_partitions
);
129 rt305x_flash0_data
.parts
= wl351_partitions
;
130 rt305x_register_flash(0);
132 ramips_register_gpio_leds(-1, ARRAY_SIZE(wl351_leds_gpio
),
134 ramips_register_gpio_buttons(-1, WL351_KEYS_POLL_INTERVAL
,
135 ARRAY_SIZE(wl351_gpio_buttons
),
137 // external rtl8366rb
138 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_BYPASS
;
139 rt305x_esw_data
.reg_initval_fct2
= 0x0002500c;
140 rt305x_esw_data
.reg_initval_fpa2
= 0x1f003fff;
141 rt305x_register_ethernet();
142 platform_device_register(&wl351_switch
);
143 rt305x_register_wifi();
144 rt305x_register_wdt();
145 rt305x_register_usb();
148 MIPS_MACHINE(RAMIPS_MACH_WL351
, "WL-351", "Sitecom WL-351 v1 002",