2 * Planex MZK-W300NH board support
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
19 #include "dev-m25p80.h"
20 #include "dev-ar9xxx-wmac.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
24 #define MZK_W300NH_GPIO_LED_STATUS 1
25 #define MZK_W300NH_GPIO_LED_WPS 3
26 #define MZK_W300NH_GPIO_LED_WLAN 6
27 #define MZK_W300NH_GPIO_LED_AP 15
28 #define MZK_W300NH_GPIO_LED_ROUTER 16
30 #define MZK_W300NH_GPIO_BTN_APROUTER 5
31 #define MZK_W300NH_GPIO_BTN_WPS 12
32 #define MZK_W300NH_GPIO_BTN_RESET 21
34 #define MZK_W300NH_KEYS_POLL_INTERVAL 20 /* msecs */
35 #define MZK_W300NH_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W300NH_KEYS_POLL_INTERVAL)
37 #ifdef CONFIG_MTD_PARTITIONS
38 static struct mtd_partition mzk_w300nh_partitions[] = {
43 .mask_flags = MTD_WRITEABLE,
60 .mask_flags = MTD_WRITEABLE,
67 #endif /* CONFIG_MTD_PARTITIONS */
69 static struct flash_platform_data mzk_w300nh_flash_data = {
70 #ifdef CONFIG_MTD_PARTITIONS
71 .parts = mzk_w300nh_partitions,
72 .nr_parts = ARRAY_SIZE(mzk_w300nh_partitions),
76 static struct gpio_led mzk_w300nh_leds_gpio[] __initdata = {
78 .name = "mzk-w300nh:green:status",
79 .gpio = MZK_W300NH_GPIO_LED_STATUS,
82 .name = "mzk-w300nh:blue:wps",
83 .gpio = MZK_W300NH_GPIO_LED_WPS,
86 .name = "mzk-w300nh:green:wlan",
87 .gpio = MZK_W300NH_GPIO_LED_WLAN,
90 .name = "mzk-w300nh:green:ap",
91 .gpio = MZK_W300NH_GPIO_LED_AP,
94 .name = "mzk-w300nh:green:router",
95 .gpio = MZK_W300NH_GPIO_LED_ROUTER,
100 static struct gpio_keys_button mzk_w300nh_gpio_keys[] __initdata = {
105 .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
106 .gpio = MZK_W300NH_GPIO_BTN_RESET,
111 .code = KEY_WPS_BUTTON,
112 .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
113 .gpio = MZK_W300NH_GPIO_BTN_WPS,
119 .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
120 .gpio = MZK_W300NH_GPIO_BTN_APROUTER,
125 #define MZK_W300NH_WAN_PHYMASK BIT(4)
126 #define MZK_W300NH_MDIO_MASK (~MZK_W300NH_WAN_PHYMASK)
128 static void __init mzk_w300nh_setup(void)
130 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
132 ar71xx_add_device_mdio(MZK_W300NH_MDIO_MASK);
134 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, eeprom, 0);
135 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
136 ar71xx_eth0_data.speed = SPEED_100;
137 ar71xx_eth0_data.duplex = DUPLEX_FULL;
138 ar71xx_eth0_data.has_ar8216 = 1;
140 ar71xx_init_mac(ar71xx_eth1_data.mac_addr, eeprom, 1);
141 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
142 ar71xx_eth1_data.phy_mask = MZK_W300NH_WAN_PHYMASK;
144 ar71xx_add_device_eth(0);
145 ar71xx_add_device_eth(1);
147 ar71xx_add_device_m25p80(&mzk_w300nh_flash_data);
149 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(mzk_w300nh_leds_gpio),
150 mzk_w300nh_leds_gpio);
152 ar71xx_register_gpio_keys_polled(-1, MZK_W300NH_KEYS_POLL_INTERVAL,
153 ARRAY_SIZE(mzk_w300nh_gpio_keys),
154 mzk_w300nh_gpio_keys);
155 ar9xxx_add_device_wmac(eeprom, NULL);
158 MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "MZK-W300NH", "Planex MZK-W300NH",