2 * Sparklan WCR-150GN 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 <asm/mach-ralink/machine.h>
18 #include <asm/mach-ralink/dev-gpio-buttons.h>
19 #include <asm/mach-ralink/dev-gpio-leds.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
25 #define WCR150GN_GPIO_LED_USER 12
26 #define WCR150GN_GPIO_LED_POWER 8
27 #define WCR150GN_GPIO_BUTTON_WPS 10
28 #define WCR150GN_GPIO_BUTTON_RESET 0
29 #define WCR150GN_BUTTONS_POLL_INTERVAL 20
31 static struct gpio_led wcr150gn_leds_gpio
[] __initdata
= {
33 .name
= "wcr150gn:amber:user",
34 .gpio
= WCR150GN_GPIO_LED_USER
,
38 .name
= "wcr150gn:amber:power",
39 .gpio
= WCR150GN_GPIO_LED_POWER
,
44 static struct gpio_button wcr150gn_gpio_buttons
[] __initdata
= {
48 .code
= KEY_WPS_BUTTON
,
50 .gpio
= WCR150GN_GPIO_BUTTON_WPS
,
58 .gpio
= WCR150GN_GPIO_BUTTON_RESET
,
63 #ifdef CONFIG_MTD_PARTITIONS
64 static struct mtd_partition wcr150gn_partitions
[] = {
69 .mask_flags
= MTD_WRITEABLE
,
74 .mask_flags
= MTD_WRITEABLE
,
79 .mask_flags
= MTD_WRITEABLE
,
94 #endif /* CONFIG_MTD_PARTITIONS */
96 static struct physmap_flash_data wcr150gn_flash_data
= {
97 #ifdef CONFIG_MTD_PARTITIONS
98 .nr_parts
= ARRAY_SIZE(wcr150gn_partitions
),
99 .parts
= wcr150gn_partitions
,
103 static void __init
wcr150gn_init(void)
105 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
106 rt305x_register_flash(0, &wcr150gn_flash_data
);
107 ramips_register_gpio_leds(-1, ARRAY_SIZE(wcr150gn_leds_gpio
),
109 ramips_register_gpio_buttons(-1, WCR150GN_BUTTONS_POLL_INTERVAL
,
110 ARRAY_SIZE(wcr150gn_gpio_buttons
),
111 wcr150gn_gpio_buttons
);
112 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_LLLLW
;
113 rt305x_register_ethernet();
114 rt305x_register_wifi();
115 rt305x_register_wdt();
116 rt305x_register_usb();
119 MIPS_MACHINE(RAMIPS_MACH_WCR150GN
, "WCR150GN", "Sparklan WCR-150GN",