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>
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
17 #include <linux/mtd/physmap.h>
19 #include <asm/mach-ralink/machine.h>
20 #include <asm/mach-ralink/dev-gpio-buttons.h>
21 #include <asm/mach-ralink/dev-gpio-leds.h>
22 #include <asm/mach-ralink/rt305x.h>
23 #include <asm/mach-ralink/rt305x_regs.h>
27 #define ALL0256N_GPIO_BUTTON_RESET 0
28 #define ALL0256N_GPIO_LED_RSSI_LOW 14
29 #define ALL0256N_GPIO_LED_RSSI_MED 12
30 #define ALL0256N_GPIO_LED_RSSI_HIGH 13
31 #define ALL0256N_BUTTONS_POLL_INTERVAL 20
33 #ifdef CONFIG_MTD_PARTITIONS
34 static struct mtd_partition all0256n_partitions
[] = {
39 .mask_flags
= MTD_WRITEABLE
,
62 #endif /* CONFIG_MTD_PARTITIONS */
65 const struct flash_platform_data all0256n_flash
= {
67 #ifdef CONFIG_MTD_PARTITIONS
68 .parts
= all0256n_partitions
,
69 .nr_parts
= ARRAY_SIZE(all0256n_partitions
),
73 struct spi_board_info all0256n_spi_slave_info
[] __initdata
= {
76 .platform_data
= &all0256n_flash
,
78 .max_speed_hz
= 10000000,
84 static struct gpio_button all0256n_gpio_buttons
[] __initdata
= {
90 .gpio
= ALL0256N_GPIO_BUTTON_RESET
,
95 static struct gpio_led all0256n_leds_gpio
[] __initdata
= {
97 .name
= "all0256n:green:rssilow",
98 .gpio
= ALL0256N_GPIO_LED_RSSI_LOW
,
101 .name
= "all0256n:green:rssimed",
102 .gpio
= ALL0256N_GPIO_LED_RSSI_MED
,
105 .name
= "all0256n:green:rssihigh",
106 .gpio
= ALL0256N_GPIO_LED_RSSI_HIGH
,
111 static void __init
all0256n_init(void)
113 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
114 rt305x_register_spi(all0256n_spi_slave_info
,
115 ARRAY_SIZE(all0256n_spi_slave_info
));
116 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
117 rt305x_register_ethernet();
118 ramips_register_gpio_leds(-1, ARRAY_SIZE(all0256n_leds_gpio
),
120 ramips_register_gpio_buttons(-1, ALL0256N_BUTTONS_POLL_INTERVAL
,
121 ARRAY_SIZE(all0256n_gpio_buttons
),
122 all0256n_gpio_buttons
);
123 rt305x_register_wifi();
124 rt305x_register_wdt();
127 MIPS_MACHINE(RAMIPS_MACH_ALL0256N
, "ALL0256N", "Allnet ALL0256N",