2 * Allnet ALL0256N board support
4 * Copyright (C) 2012 Daniel Golle <dgolle@allnet.de>
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>
16 #include <asm/mach-ralink/machine.h>
17 #include <asm/mach-ralink/dev-gpio-buttons.h>
18 #include <asm/mach-ralink/dev-gpio-leds.h>
19 #include <asm/mach-ralink/rt305x.h>
20 #include <asm/mach-ralink/rt305x_regs.h>
24 #define ALL0256N_GPIO_BUTTON_RESET 0
25 #define ALL0256N_GPIO_LED_RSSI_LOW 14
26 #define ALL0256N_GPIO_LED_RSSI_MED 12
27 #define ALL0256N_GPIO_LED_RSSI_HIGH 13
28 #define ALL0256N_KEYS_POLL_INTERVAL 20
29 #define ALL0256N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0256N_KEYS_POLL_INTERVAL)
31 const struct flash_platform_data all0256n_flash
= {
35 struct spi_board_info all0256n_spi_slave_info
[] __initdata
= {
38 .platform_data
= &all0256n_flash
,
40 .max_speed_hz
= 10000000,
46 static struct gpio_keys_button all0256n_gpio_buttons
[] __initdata
= {
51 .debounce_interval
= ALL0256N_KEYS_DEBOUNCE_INTERVAL
,
52 .gpio
= ALL0256N_GPIO_BUTTON_RESET
,
57 static struct gpio_led all0256n_leds_gpio
[] __initdata
= {
59 .name
= "all0256n:green:rssilow",
60 .gpio
= ALL0256N_GPIO_LED_RSSI_LOW
,
63 .name
= "all0256n:green:rssimed",
64 .gpio
= ALL0256N_GPIO_LED_RSSI_MED
,
67 .name
= "all0256n:green:rssihigh",
68 .gpio
= ALL0256N_GPIO_LED_RSSI_HIGH
,
73 static void __init
all0256n_init(void)
75 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
76 rt305x_register_spi(all0256n_spi_slave_info
,
77 ARRAY_SIZE(all0256n_spi_slave_info
));
78 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
79 rt305x_register_ethernet();
80 ramips_register_gpio_leds(-1, ARRAY_SIZE(all0256n_leds_gpio
),
82 ramips_register_gpio_buttons(-1, ALL0256N_KEYS_POLL_INTERVAL
,
83 ARRAY_SIZE(all0256n_gpio_buttons
),
84 all0256n_gpio_buttons
);
85 rt305x_register_wifi();
86 rt305x_register_wdt();
89 MIPS_MACHINE(RAMIPS_MACH_ALL0256N
, "ALL0256N", "Allnet ALL0256N",