| 1 | /* |
| 2 | * Asus RT-G32 rev B board support |
| 3 | * |
| 4 | * Copyright (C) 2011 Sergiy <piratfm@gmail.com> |
| 5 | * |
| 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. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/platform_device.h> |
| 13 | #include <linux/spi/spi.h> |
| 14 | #include <linux/spi/flash.h> |
| 15 | |
| 16 | #include <asm/mach-ralink/machine.h> |
| 17 | #include <asm/mach-ralink/dev-gpio-buttons.h> |
| 18 | #include <asm/mach-ralink/rt305x.h> |
| 19 | #include <asm/mach-ralink/rt305x_regs.h> |
| 20 | |
| 21 | #include "devices.h" |
| 22 | |
| 23 | #define RT_G32B_GPIO_BUTTON_WPS 0 /* active low */ |
| 24 | #define RT_G32B_GPIO_BUTTON_RESET 10 /* active low */ |
| 25 | |
| 26 | #define RT_G32B_KEYS_POLL_INTERVAL 20 |
| 27 | #define RT_G32B_KEYS_DEBOUNCE_INTERVAL (3 * RT_G32B_KEYS_POLL_INTERVAL) |
| 28 | |
| 29 | const struct flash_platform_data rt_g32b_flash = { |
| 30 | .type = "mx25l3205d", |
| 31 | }; |
| 32 | |
| 33 | struct spi_board_info __initdata rt_g32b_spi_slave_info[] = { |
| 34 | { |
| 35 | .modalias = "m25p80", |
| 36 | .platform_data = &rt_g32b_flash, |
| 37 | .irq = -1, |
| 38 | .max_speed_hz = 10000000, |
| 39 | .bus_num = 0, |
| 40 | .chip_select = 0, |
| 41 | }, |
| 42 | }; |
| 43 | |
| 44 | static struct gpio_keys_button rt_g32b_gpio_buttons[] __initdata = { |
| 45 | { |
| 46 | .desc = "reset", |
| 47 | .type = EV_KEY, |
| 48 | .code = KEY_RESTART, |
| 49 | .debounce_interval = RT_G32B_KEYS_DEBOUNCE_INTERVAL, |
| 50 | .gpio = RT_G32B_GPIO_BUTTON_RESET, |
| 51 | .active_low = 1, |
| 52 | }, { |
| 53 | .desc = "wps", |
| 54 | .type = EV_KEY, |
| 55 | .code = KEY_WPS_BUTTON, |
| 56 | .debounce_interval = RT_G32B_KEYS_DEBOUNCE_INTERVAL, |
| 57 | .gpio = RT_G32B_GPIO_BUTTON_WPS, |
| 58 | .active_low = 1, |
| 59 | } |
| 60 | }; |
| 61 | |
| 62 | static void __init rt_g32b_init(void) |
| 63 | { |
| 64 | rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT); |
| 65 | rt305x_register_spi(rt_g32b_spi_slave_info, |
| 66 | ARRAY_SIZE(rt_g32b_spi_slave_info)); |
| 67 | |
| 68 | rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW; |
| 69 | rt305x_register_ethernet(); |
| 70 | ramips_register_gpio_buttons(-1, RT_G32B_KEYS_POLL_INTERVAL, |
| 71 | ARRAY_SIZE(rt_g32b_gpio_buttons), |
| 72 | rt_g32b_gpio_buttons); |
| 73 | rt305x_register_wifi(); |
| 74 | rt305x_register_wdt(); |
| 75 | } |
| 76 | |
| 77 | MIPS_MACHINE(RAMIPS_MACH_RT_G32_B1, "RT-G32-B1", "Asus RT-G32 B1", |
| 78 | rt_g32b_init); |
| 79 | |