2 * NETGEAR R6100 board support
4 * Copyright (C) 2014 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2014 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/pci.h>
13 #include <linux/phy.h>
14 #include <linux/gpio.h>
15 #include <linux/platform_device.h>
16 #include <linux/ath9k_platform.h>
17 #include <linux/platform/ar934x_nfc.h>
19 #include <asm/mach-ath79/ar71xx_regs.h>
22 #include "dev-ap9x-pci.h"
24 #include "dev-gpio-buttons.h"
25 #include "dev-leds-gpio.h"
29 #include "machtypes.h"
31 #define R6100_GPIO_LED_WLAN 0
32 #define R6100_GPIO_LED_USB 11
33 #define R6100_GPIO_LED_WAN_GREEN 13
34 #define R6100_GPIO_LED_POWER_AMBER 14
35 #define R6100_GPIO_LED_WAN_AMBER 15
36 #define R6100_GPIO_LED_POWER_GREEN 17
38 #define R6100_GPIO_BTN_WIRELESS 1
39 #define R6100_GPIO_BTN_WPS 3
40 #define R6100_GPIO_BTN_RESET 12
42 #define R6100_GPIO_USB_POWER 16
44 #define R6100_KEYS_POLL_INTERVAL 20 /* msecs */
45 #define R6100_KEYS_DEBOUNCE_INTERVAL (3 * R6100_KEYS_POLL_INTERVAL)
47 static struct gpio_led r6100_leds_gpio
[] __initdata
= {
49 .name
= "netgear:green:power",
50 .gpio
= R6100_GPIO_LED_POWER_GREEN
,
54 .name
= "netgear:amber:power",
55 .gpio
= R6100_GPIO_LED_POWER_AMBER
,
59 .name
= "netgear:green:wan",
60 .gpio
= R6100_GPIO_LED_WAN_GREEN
,
64 .name
= "netgear:amber:wan",
65 .gpio
= R6100_GPIO_LED_WAN_AMBER
,
69 .name
= "netgear:blue:usb",
70 .gpio
= R6100_GPIO_LED_USB
,
74 .name
= "netgear:blue:wlan",
75 .gpio
= R6100_GPIO_LED_WLAN
,
80 static struct gpio_keys_button r6100_gpio_keys
[] __initdata
= {
82 .desc
= "Reset button",
85 .debounce_interval
= R6100_KEYS_DEBOUNCE_INTERVAL
,
86 .gpio
= R6100_GPIO_BTN_RESET
,
92 .code
= KEY_WPS_BUTTON
,
93 .debounce_interval
= R6100_KEYS_DEBOUNCE_INTERVAL
,
94 .gpio
= R6100_GPIO_BTN_WPS
,
98 .desc
= "RFKILL switch",
101 .debounce_interval
= R6100_KEYS_DEBOUNCE_INTERVAL
,
102 .gpio
= R6100_GPIO_BTN_WIRELESS
,
107 static void __init
r6100_setup(void)
109 ath79_register_leds_gpio(-1, ARRAY_SIZE(r6100_leds_gpio
),
111 ath79_register_gpio_keys_polled(-1, R6100_KEYS_POLL_INTERVAL
,
112 ARRAY_SIZE(r6100_gpio_keys
),
115 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP
);
117 ath79_register_mdio(1, 0x0);
119 /* GMAC0 is connected to the PHY0 of the internal switch */
120 ath79_switch_data
.phy4_mii_en
= 1;
121 ath79_switch_data
.phy_poll_mask
= BIT(0);
122 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
123 ath79_eth0_data
.phy_mask
= BIT(0);
124 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
125 ath79_register_eth(0);
127 /* GMAC1 is connected to the internal switch */
128 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
129 ath79_register_eth(1);
131 gpio_request_one(R6100_GPIO_USB_POWER
,
132 GPIOF_OUT_INIT_HIGH
| GPIOF_EXPORT_DIR_FIXED
,
135 ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW
);
136 ath79_register_nfc();
138 ath79_register_usb();
140 ath79_register_wmac_simple();
142 ap91_pci_init_simple();
145 MIPS_MACHINE(ATH79_MACH_R6100
, "R6100", "NETGEAR R6100",