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 static struct mtd_partition wcr150gn_partitions[] = {
68 .mask_flags = MTD_WRITEABLE,
73 .mask_flags = MTD_WRITEABLE,
78 .mask_flags = MTD_WRITEABLE,
94 static struct physmap_flash_data wcr150gn_flash_data = {
95 #ifdef CONFIG_MTD_PARTITIONS
96 .nr_parts = ARRAY_SIZE(wcr150gn_partitions),
97 .parts = wcr150gn_partitions,
101 static void __init wcr150gn_init(void)
103 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
104 rt305x_register_flash(0, &wcr150gn_flash_data);
105 ramips_register_gpio_leds(-1, ARRAY_SIZE(wcr150gn_leds_gpio),
107 ramips_register_gpio_buttons(-1, WCR150GN_BUTTONS_POLL_INTERVAL,
108 ARRAY_SIZE(wcr150gn_gpio_buttons),
109 wcr150gn_gpio_buttons);
110 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
111 rt305x_register_ethernet();
112 rt305x_register_wifi();
113 rt305x_register_wdt();
114 rt305x_register_usb();
117 MIPS_MACHINE(RAMIPS_MACH_WCR150GN, "WCR150GN", "Sparklan WCR-150GN",