2 * Ralink V11ST-FE board support
4 * Copyright (C) 2012 Florian Fainelli <florian@openwrt.org>
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>
16 #include <linux/ethtool.h>
18 #include <asm/mach-ralink/machine.h>
19 #include <asm/mach-ralink/dev-gpio-buttons.h>
20 #include <asm/mach-ralink/dev-gpio-leds.h>
21 #include <asm/mach-ralink/rt288x.h>
22 #include <asm/mach-ralink/rt288x_regs.h>
23 #include <asm/mach-ralink/ramips_eth_platform.h>
27 #define V11ST_FE_GPIO_STATUS_LED 12
28 #define V11ST_FE_GPIO_BUTTON_WPS 0
30 #define V11ST_FE_KEYS_POLL_INTERVAL 20
31 #define V11ST_FE_KEYS_DEBOUNCE_INTERVAL (3 * V11ST_FE_KEYS_POLL_INTERVAL)
33 static struct gpio_led v11st_fe_leds_gpio
[] __initdata
= {
35 .name
= "v11st-fe:green:status",
36 .gpio
= V11ST_FE_GPIO_STATUS_LED
,
41 static struct gpio_keys_button v11st_fe_gpio_buttons
[] __initdata
= {
45 .code
= KEY_WPS_BUTTON
,
46 .debounce_interval
= V11ST_FE_KEYS_DEBOUNCE_INTERVAL
,
47 .gpio
= V11ST_FE_GPIO_BUTTON_WPS
,
51 static struct mtd_partition v11st_fe_partitions
[] = {
56 .mask_flags
= MTD_WRITEABLE
,
61 .mask_flags
= MTD_WRITEABLE
,
66 .mask_flags
= MTD_WRITEABLE
,
78 static void __init
rt_v11st_fe_init(void)
80 rt288x_gpio_init(RT2880_GPIO_MODE_UART0
);
82 rt288x_flash0_data
.nr_parts
= ARRAY_SIZE(v11st_fe_partitions
);
83 rt288x_flash0_data
.parts
= v11st_fe_partitions
;
84 rt288x_register_flash(0);
86 ramips_register_gpio_leds(-1, ARRAY_SIZE(v11st_fe_leds_gpio
),
89 ramips_register_gpio_buttons(-1, V11ST_FE_KEYS_POLL_INTERVAL
,
90 ARRAY_SIZE(v11st_fe_gpio_buttons
),
91 v11st_fe_gpio_buttons
);
93 rt288x_register_wifi();
95 /* Board is connected to an IC+ IP175C Fast Ethernet switch */
96 rt288x_eth_data
.speed
= SPEED_100
;
97 rt288x_eth_data
.duplex
= DUPLEX_FULL
;
98 rt288x_eth_data
.tx_fc
= 1;
99 rt288x_eth_data
.rx_fc
= 1;
100 rt288x_eth_data
.phy_mask
= BIT(0);
101 rt288x_register_ethernet();
103 rt288x_register_wdt();
104 rt288x_register_pci();
107 MIPS_MACHINE(RAMIPS_MACH_V11ST_FE
, "V11ST-FE", "Ralink V11ST-FE", rt_v11st_fe_init
);