[ramips] add support for Allnet ALL5002 to kernel
[openwrt/svn-archive/archive.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / mach-all5002.c
1 /*
2 * Allnet ALL5002
3 *
4 * Copyright (C) 2012 Daniel Golle <dgolle@allnet.de>
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 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
17 #include <linux/mtd/physmap.h>
18
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>
24
25 #include "devices.h"
26
27 // #define ALL5002_GPIO_BUTTON_RESET 0
28 // #define ALL5002_GPIO_LED_RSSI_LOW 14
29 // #define ALL5002_GPIO_LED_RSSI_MED 12
30 // #define ALL5002_GPIO_LED_RSSI_HIGH 13
31 // #define ALL5002_BUTTONS_POLL_INTERVAL 20
32
33 const struct flash_platform_data all5002_flash = {
34 .type = "mx25l25635e",
35 };
36
37 struct spi_board_info all5002_spi_slave_info[] __initdata = {
38 {
39 .modalias = "m25p80",
40 .platform_data = &all5002_flash,
41 .irq = -1,
42 .max_speed_hz = 10000000,
43 .bus_num = 0,
44 .chip_select = 0,
45 },
46 };
47
48 static void __init all5002_init(void)
49 {
50 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
51 rt305x_register_spi(all5002_spi_slave_info,
52 ARRAY_SIZE(all5002_spi_slave_info));
53 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
54 rt305x_register_ethernet();
55 rt305x_register_wifi();
56 rt305x_register_wdt();
57 rt305x_register_usb();
58 }
59
60 MIPS_MACHINE(RAMIPS_MACH_ALL5002, "ALL5002", "Allnet ALL5002",
61 all5002_init);