2 * Planex MZK-W04NU board support
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.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 <asm/mach-ar71xx/ar71xx.h>
15 #include "dev-ar9xxx-wmac.h"
16 #include "dev-gpio-buttons.h"
17 #include "dev-leds-gpio.h"
18 #include "dev-m25p80.h"
21 #define MZK_W04NU_GPIO_LED_USB 0
22 #define MZK_W04NU_GPIO_LED_STATUS 1
23 #define MZK_W04NU_GPIO_LED_WPS 3
24 #define MZK_W04NU_GPIO_LED_WLAN 6
25 #define MZK_W04NU_GPIO_LED_AP 15
26 #define MZK_W04NU_GPIO_LED_ROUTER 16
28 #define MZK_W04NU_GPIO_BTN_APROUTER 5
29 #define MZK_W04NU_GPIO_BTN_WPS 12
30 #define MZK_W04NU_GPIO_BTN_RESET 21
32 #define MZK_W04NU_KEYS_POLL_INTERVAL 20 /* msecs */
33 #define MZK_W04NU_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W04NU_KEYS_POLL_INTERVAL)
35 static struct gpio_led mzk_w04nu_leds_gpio
[] __initdata
= {
37 .name
= "planex:green:status",
38 .gpio
= MZK_W04NU_GPIO_LED_STATUS
,
41 .name
= "planex:blue:wps",
42 .gpio
= MZK_W04NU_GPIO_LED_WPS
,
45 .name
= "planex:green:wlan",
46 .gpio
= MZK_W04NU_GPIO_LED_WLAN
,
49 .name
= "planex:green:usb",
50 .gpio
= MZK_W04NU_GPIO_LED_USB
,
53 .name
= "planex:green:ap",
54 .gpio
= MZK_W04NU_GPIO_LED_AP
,
57 .name
= "planex:green:router",
58 .gpio
= MZK_W04NU_GPIO_LED_ROUTER
,
63 static struct gpio_keys_button mzk_w04nu_gpio_keys
[] __initdata
= {
68 .debounce_interval
= MZK_W04NU_KEYS_DEBOUNCE_INTERVAL
,
69 .gpio
= MZK_W04NU_GPIO_BTN_RESET
,
74 .code
= KEY_WPS_BUTTON
,
75 .debounce_interval
= MZK_W04NU_KEYS_DEBOUNCE_INTERVAL
,
76 .gpio
= MZK_W04NU_GPIO_BTN_WPS
,
82 .debounce_interval
= MZK_W04NU_KEYS_DEBOUNCE_INTERVAL
,
83 .gpio
= MZK_W04NU_GPIO_BTN_APROUTER
,
88 #define MZK_W04NU_WAN_PHYMASK BIT(4)
89 #define MZK_W04NU_MDIO_MASK (~MZK_W04NU_WAN_PHYMASK)
91 static void __init
mzk_w04nu_setup(void)
93 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff1000);
95 ar71xx_add_device_mdio(0, MZK_W04NU_MDIO_MASK
);
97 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, eeprom
, 0);
98 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
99 ar71xx_eth0_data
.speed
= SPEED_100
;
100 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
101 ar71xx_eth0_data
.has_ar8216
= 1;
103 ar71xx_init_mac(ar71xx_eth1_data
.mac_addr
, eeprom
, 1);
104 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
105 ar71xx_eth1_data
.phy_mask
= MZK_W04NU_WAN_PHYMASK
;
107 ar71xx_add_device_eth(0);
108 ar71xx_add_device_eth(1);
110 ar71xx_add_device_m25p80(NULL
);
112 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(mzk_w04nu_leds_gpio
),
113 mzk_w04nu_leds_gpio
);
115 ar71xx_register_gpio_keys_polled(-1, MZK_W04NU_KEYS_POLL_INTERVAL
,
116 ARRAY_SIZE(mzk_w04nu_gpio_keys
),
117 mzk_w04nu_gpio_keys
);
118 ar71xx_add_device_usb();
120 ar9xxx_add_device_wmac(eeprom
, NULL
);
123 MIPS_MACHINE(AR71XX_MACH_MZK_W04NU
, "MZK-W04NU", "Planex MZK-W04NU",