2 * Buffalo WLAE-AG300N board support
5 #include <linux/gpio.h>
6 #include <linux/mtd/mtd.h>
7 #include <linux/mtd/partitions.h>
9 #include <asm/mach-ath79/ath79.h>
12 #include "dev-ap9x-pci.h"
13 #include "dev-gpio-buttons.h"
14 #include "dev-leds-gpio.h"
15 #include "dev-m25p80.h"
17 #include "machtypes.h"
19 #define WLAEAG300N_MAC_OFFSET 0x20c
20 #define WLAEAG300N_KEYS_POLL_INTERVAL 20 /* msecs */
21 #define WLAEAG300N_KEYS_DEBOUNCE_INTERVAL (3 * WLAEAG300N_KEYS_POLL_INTERVAL)
24 static struct gpio_led wlaeag300n_leds_gpio[] __initdata = {
26 * Note: Writing 1 into GPIO 13 will power down the device.
29 .name = "buffalo:green:wireless",
33 .name = "buffalo:red:wireless",
37 .name = "buffalo:green:status",
41 .name = "buffalo:red:status",
48 static struct gpio_keys_button wlaeag300n_gpio_keys[] __initdata = {
53 .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
60 .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
67 .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
73 .code = KEY_WPS_BUTTON,
74 .debounce_interval = WLAEAG300N_KEYS_DEBOUNCE_INTERVAL,
80 static void __init wlaeag300n_setup(void)
82 u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1fff1000);
83 u8 *mac1 = eeprom1 + WLAEAG300N_MAC_OFFSET;
85 ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
86 ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 1);
88 ath79_register_mdio(0, ~(BIT(0) | BIT(4)));
90 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
91 ath79_eth0_data.speed = SPEED_1000;
92 ath79_eth0_data.duplex = DUPLEX_FULL;
93 ath79_eth0_data.phy_mask = BIT(0);
95 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
96 ath79_eth1_data.phy_mask = BIT(4);
98 ath79_register_eth(0);
99 ath79_register_eth(1);
101 ath79_register_leds_gpio(-1, ARRAY_SIZE(wlaeag300n_leds_gpio),
102 wlaeag300n_leds_gpio);
104 ath79_register_gpio_keys_polled(-1, WLAEAG300N_KEYS_POLL_INTERVAL,
105 ARRAY_SIZE(wlaeag300n_gpio_keys),
106 wlaeag300n_gpio_keys);
108 ath79_register_m25p80(NULL);
110 ap91_pci_init(eeprom1, mac1);
113 MIPS_MACHINE(ATH79_MACH_WLAE_AG300N, "WLAE-AG300N",
114 "Buffalo WLAE-AG300N", wlaeag300n_setup);