2 * Asus RT-G32 rev B board support
4 * Copyright (C) 2011 Sergiy <piratfm@gmail.com>
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/spi/spi.h>
14 #include <linux/spi/flash.h>
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
18 #include <asm/mach-ralink/machine.h>
19 #include <asm/mach-ralink/dev-gpio-buttons.h>
20 #include <asm/mach-ralink/rt305x.h>
21 #include <asm/mach-ralink/rt305x_regs.h>
25 #define RT_G32B_GPIO_BUTTON_WPS 0 /* active low */
26 #define RT_G32B_GPIO_BUTTON_RESET 10 /* active low */
28 #define RT_G32B_BUTTONS_POLL_INTERVAL 20
30 #ifdef CONFIG_MTD_PARTITIONS
31 static struct mtd_partition rt_g32b_partitions
[] = {
36 .mask_flags
= MTD_WRITEABLE
,
41 .mask_flags
= MTD_WRITEABLE
,
46 .mask_flags
= MTD_WRITEABLE
,
61 #endif /* CONFIG_MTD_PARTITIONS */
63 const struct flash_platform_data rt_g32b_flash
= {
65 #ifdef CONFIG_MTD_PARTITIONS
66 .parts
= rt_g32b_partitions
,
67 .nr_parts
= ARRAY_SIZE(rt_g32b_partitions
),
71 struct spi_board_info __initdata rt_g32b_spi_slave_info
[] = {
74 .platform_data
= &rt_g32b_flash
,
76 .max_speed_hz
= 10000000,
82 static struct gpio_button rt_g32b_gpio_buttons
[] __initdata
= {
88 .gpio
= RT_G32B_GPIO_BUTTON_RESET
,
93 .code
= KEY_WPS_BUTTON
,
95 .gpio
= RT_G32B_GPIO_BUTTON_WPS
,
100 static void __init
rt_g32b_init(void)
102 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
103 rt305x_register_spi(rt_g32b_spi_slave_info
,
104 ARRAY_SIZE(rt_g32b_spi_slave_info
));
106 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_LLLLW
;
107 rt305x_register_ethernet();
108 ramips_register_gpio_buttons(-1, RT_G32B_BUTTONS_POLL_INTERVAL
,
109 ARRAY_SIZE(rt_g32b_gpio_buttons
),
110 rt_g32b_gpio_buttons
);
111 rt305x_register_wifi();
112 rt305x_register_wdt();
115 MIPS_MACHINE(RAMIPS_MACH_RT_G32_B1
, "RT-G32-B1", "Asus RT-G32 B1",