2 * Unknown router name/model, PCB marked with XDX-RN502J
4 * Copyright (C) 2011 Bruno Schwander bruno@tinkerbox.org
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>
14 #include <asm/mach-ralink/machine.h>
15 #include <asm/mach-ralink/dev-gpio-buttons.h>
16 #include <asm/mach-ralink/dev-gpio-leds.h>
17 #include <asm/mach-ralink/rt305x.h>
18 #include <asm/mach-ralink/rt305x_regs.h>
22 #define XDXRN502J_GPIO_BUTTON_RESET 12
23 #define XDXRN502J_GPIO_LED_WIFI 7
24 #define XDXRN502J_GPIO_LED_POWER 9
26 #define XDXRN502J_BUTTONS_POLL_INTERVAL 20
27 #define XDXRN502J_BUTTONS_DEBOUNCE_INTERVAL (3 * XDXRN502J_BUTTONS_POLL_INTERVAL)
30 static struct gpio_led xdxrn502j_leds_gpio
[] __initdata
= {
32 .name
= "xdxrn502j:green:wifi",
33 .gpio
= XDXRN502J_GPIO_LED_WIFI
,
36 .name
= "xdxrn502j:green:power",
37 .gpio
= XDXRN502J_GPIO_LED_POWER
,
42 static struct gpio_keys_button xdxrn502j_gpio_buttons
[] __initdata
= {
47 .debounce_interval
= XDXRN502J_BUTTONS_DEBOUNCE_INTERVAL
,
48 .gpio
= XDXRN502J_GPIO_BUTTON_RESET
,
53 #define XDXRN502J_GPIO_MODE \
54 ((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) | \
55 RT305X_GPIO_MODE_MDIO)
57 static void __init
xdxrn502j_init(void)
59 rt305x_gpio_init(XDXRN502J_GPIO_MODE
);
61 rt305x_register_flash(0);
63 rt305x_esw_data
.vlan_config
= RT305X_ESW_VLAN_CONFIG_WLLLL
;
64 rt305x_register_ethernet();
66 ramips_register_gpio_leds(-1, ARRAY_SIZE(xdxrn502j_leds_gpio
),
69 ramips_register_gpio_buttons(-1, XDXRN502J_BUTTONS_POLL_INTERVAL
,
70 ARRAY_SIZE(xdxrn502j_gpio_buttons
),
71 xdxrn502j_gpio_buttons
);
73 rt305x_register_wifi();
74 rt305x_register_wdt();
75 rt305x_register_usb();
78 MIPS_MACHINE(RAMIPS_MACH_XDXRN502J
, "XDXRN502J", "XDX RN502J",