2 * Argus ATP-52B router support
3 * http://www.argus-co.com/english/productsview.php?id=70&cid=81
5 * Copyright (C) 2011 Roman Yeryomin <roman@advem.lv>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
18 #include <asm/mach-ralink/machine.h>
19 #include <asm/mach-ralink/dev-gpio-buttons.h>
20 #include <asm/mach-ralink/dev-gpio-leds.h>
21 #include <asm/mach-ralink/rt305x.h>
22 #include <asm/mach-ralink/rt305x_regs.h>
26 #define ARGUS_ATP52B_GPIO_LED_RUN 9
27 #define ARGUS_ATP52B_GPIO_LED_NET 13
28 #define ARGUS_ATP52B_GPIO_BUTTON_WPS 0
29 #define ARGUS_ATP52B_GPIO_BUTTON_RESET 10
30 #define ARGUS_ATP52B_BUTTONS_POLL_INTERVAL 20
32 static struct gpio_led argus_atp52b_leds_gpio
[] __initdata
= {
34 .name
= "argus_atp52b:green:run",
35 .gpio
= ARGUS_ATP52B_GPIO_LED_RUN
,
39 .name
= "argus_atp52b:amber:net",
40 .gpio
= ARGUS_ATP52B_GPIO_LED_NET
,
45 static struct gpio_button argus_atp52b_gpio_buttons
[] __initdata
= {
49 .code
= KEY_WPS_BUTTON
,
51 .gpio
= ARGUS_ATP52B_GPIO_BUTTON_WPS
,
59 .gpio
= ARGUS_ATP52B_GPIO_BUTTON_RESET
,
64 #ifdef CONFIG_MTD_PARTITIONS
65 static struct mtd_partition argus_atp52b_partitions
[] = {
70 .mask_flags
= MTD_WRITEABLE
,
75 .mask_flags
= MTD_WRITEABLE
,
80 .mask_flags
= MTD_WRITEABLE
,
91 #endif /* CONFIG_MTD_PARTITIONS */
93 static struct physmap_flash_data argus_atp52b_flash_data
= {
94 #ifdef CONFIG_MTD_PARTITIONS
95 .nr_parts
= ARRAY_SIZE(argus_atp52b_partitions
),
96 .parts
= argus_atp52b_partitions
,
100 static void __init
argus_atp52b_init(void)
102 rt305x_gpio_init(RT305X_GPIO_MODE_GPIO
<< RT305X_GPIO_MODE_UART0_SHIFT
);
103 rt305x_register_flash(0, &argus_atp52b_flash_data
);
104 ramips_register_gpio_leds(-1, ARRAY_SIZE(argus_atp52b_leds_gpio
),
105 argus_atp52b_leds_gpio
);
106 ramips_register_gpio_buttons(-1, ARGUS_ATP52B_BUTTONS_POLL_INTERVAL
,
107 ARRAY_SIZE(argus_atp52b_gpio_buttons
),
108 argus_atp52b_gpio_buttons
);
109 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
110 rt305x_register_ethernet();
111 rt305x_register_wifi();
112 rt305x_register_wdt();
113 rt305x_register_usb();
116 MIPS_MACHINE(RAMIPS_MACH_ARGUS_ATP52B
, "ARGUS_ATP52B", "Argus ATP-52B",