2 * Planex MZK-W300NH2 board support
4 * Copyright (C) 2012 Samir Ibradžić <sibradzic@gmail.com>
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 MZKW300NH2_GPIO_BUTTON_RESET 0 /* active low */
23 #define MZKW300NH2_GPIO_BUTTON_WPS 12 /* active low */
24 #define MZKW300NH2_GPIO_SWITCH_MODE_RT 13 /* active low */
26 #define MZKW300NH2_GPIO_LED_POWER 9
27 #define MZKW300NH2_GPIO_LED_WLAN 14
28 #define MZKW300NH2_GPIO_LED_WPS 11
30 #define MZKW300NH2_KEYS_POLL_INTERVAL 20
31 #define MZKW300NH2_KEYS_DEBOUNCE_INTERVAL (3 * MZKW300NH2_KEYS_POLL_INTERVAL)
33 static struct gpio_led mzkw300nh2_leds_gpio[] __initdata = {
35 .name = "mzkw300nh2:green:power",
36 .gpio = MZKW300NH2_GPIO_LED_POWER,
39 .name = "mzkw300nh2:amber:wlan",
40 .gpio = MZKW300NH2_GPIO_LED_WLAN,
43 .name = "mzkw300nh2:amber:wps",
44 .gpio = MZKW300NH2_GPIO_LED_WPS,
49 static struct gpio_keys_button mzkw300nh2_gpio_buttons[] __initdata = {
53 .code = KEY_WPS_BUTTON,
54 .debounce_interval = MZKW300NH2_KEYS_DEBOUNCE_INTERVAL,
55 .gpio = MZKW300NH2_GPIO_BUTTON_WPS,
61 .debounce_interval = MZKW300NH2_KEYS_DEBOUNCE_INTERVAL,
62 .gpio = MZKW300NH2_GPIO_BUTTON_RESET,
68 .debounce_interval = MZKW300NH2_KEYS_DEBOUNCE_INTERVAL,
69 .gpio = MZKW300NH2_GPIO_SWITCH_MODE_RT,
74 static void __init mzkw300nh2_init(void)
76 rt305x_gpio_init(RT305X_GPIO_MODE_UART0(RT305X_GPIO_MODE_GPIO) |
77 RT305X_GPIO_MODE_I2C |
78 RT305X_GPIO_MODE_SPI |
79 RT305X_GPIO_MODE_JTAG);
81 rt305x_register_flash(0);
82 rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
83 rt305x_register_ethernet();
84 ramips_register_gpio_leds(-1, ARRAY_SIZE(mzkw300nh2_leds_gpio),
85 mzkw300nh2_leds_gpio);
86 ramips_register_gpio_buttons(-1, MZKW300NH2_KEYS_POLL_INTERVAL,
87 ARRAY_SIZE(mzkw300nh2_gpio_buttons),
88 mzkw300nh2_gpio_buttons);
89 rt305x_register_wifi();
90 rt305x_register_wdt();
93 MIPS_MACHINE(RAMIPS_MACH_MZKW300NH2, "MZK-W300NH2", "Planex MZK-W300NH2",