2 * NETGEAR WNR2000v3 board support
4 * Copytight (C) 2013 Mathieu Olivari <mathieu.olivari@gmail.com>
5 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
6 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 * Copyright (C) 2008-2009 Andy Boyett <agb@openwrt.org>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
17 #include <asm/mach-ath79/ath79.h>
19 #include "dev-ap9x-pci.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-m25p80.h"
24 #include "machtypes.h"
26 #define WNR2000V3_GPIO_LED_WAN_GREEN 0
27 #define WNR2000V3_GPIO_LED_LAN1_AMBER 1
28 #define WNR2000V3_GPIO_LED_LAN4_AMBER 12
29 #define WNR2000V3_GPIO_LED_PWR_GREEN 14
30 #define WNR2000V3_GPIO_BTN_WPS 11
32 #define WNR2000V3_KEYS_POLL_INTERVAL 20 /* msecs */
33 #define WNR2000V3_KEYS_DEBOUNCE_INTERVAL (3 * WNR2000V3_KEYS_POLL_INTERVAL)
35 #define WNR2000V3_MAC0_OFFSET 0
36 #define WNR2000V3_MAC1_OFFSET 6
37 #define WNR2000V3_PCIE_CALDATA_OFFSET 0x1000
39 static struct gpio_led wnr2000v3_leds_gpio[] __initdata = {
41 .name = "wnr2000v3:green:power",
42 .gpio = WNR2000V3_GPIO_LED_PWR_GREEN,
45 .name = "wnr2000v3:green:wan",
46 .gpio = WNR2000V3_GPIO_LED_WAN_GREEN,
51 static struct gpio_keys_button wnr2000v3_gpio_keys[] __initdata = {
55 .code = KEY_WPS_BUTTON,
56 .debounce_interval = WNR2000V3_KEYS_DEBOUNCE_INTERVAL,
57 .gpio = WNR2000V3_GPIO_BTN_WPS,
61 static void __init wnr2000v3_setup(void)
63 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
65 ath79_register_mdio(0, 0x0);
67 ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V3_MAC0_OFFSET, 0);
68 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
69 ath79_eth0_data.speed = SPEED_100;
70 ath79_eth0_data.duplex = DUPLEX_FULL;
72 ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V3_MAC1_OFFSET, 0);
73 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
74 ath79_eth1_data.phy_mask = 0x10;
76 ath79_register_eth(0);
77 ath79_register_eth(1);
79 ath79_register_m25p80(NULL);
81 ath79_register_leds_gpio(-1, ARRAY_SIZE(wnr2000v3_leds_gpio),
84 ath79_register_gpio_keys_polled(-1, WNR2000V3_KEYS_POLL_INTERVAL,
85 ARRAY_SIZE(wnr2000v3_gpio_keys),
88 ap91_pci_init(art + WNR2000V3_PCIE_CALDATA_OFFSET, NULL);
91 MIPS_MACHINE(ATH79_MACH_WNR2000_V3, "WNR2000V3", "NETGEAR WNR2000 V3", wnr2000v3_setup);