OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * NETGEAR R6100 board support |
||
3 | * |
||
4 | * Copyright (C) 2014 Gabor Juhos <juhosg@openwrt.org> |
||
5 | * Copyright (C) 2014 Imre Kaloz <kaloz@openwrt.org> |
||
6 | * |
||
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. |
||
10 | */ |
||
11 | |||
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> |
||
18 | |||
19 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
20 | |||
21 | #include "common.h" |
||
22 | #include "dev-ap9x-pci.h" |
||
23 | #include "dev-eth.h" |
||
24 | #include "dev-gpio-buttons.h" |
||
25 | #include "dev-leds-gpio.h" |
||
26 | #include "dev-nfc.h" |
||
27 | #include "dev-usb.h" |
||
28 | #include "dev-wmac.h" |
||
29 | #include "machtypes.h" |
||
30 | |||
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 |
||
37 | |||
38 | #define R6100_GPIO_BTN_WIRELESS 1 |
||
39 | #define R6100_GPIO_BTN_WPS 3 |
||
40 | #define R6100_GPIO_BTN_RESET 12 |
||
41 | |||
42 | #define R6100_GPIO_USB_POWER 16 |
||
43 | |||
44 | #define R6100_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
45 | #define R6100_KEYS_DEBOUNCE_INTERVAL (3 * R6100_KEYS_POLL_INTERVAL) |
||
46 | |||
47 | static struct gpio_led r6100_leds_gpio[] __initdata = { |
||
48 | { |
||
49 | .name = "netgear:green:power", |
||
50 | .gpio = R6100_GPIO_LED_POWER_GREEN, |
||
51 | .active_low = 1, |
||
52 | }, |
||
53 | { |
||
54 | .name = "netgear:amber:power", |
||
55 | .gpio = R6100_GPIO_LED_POWER_AMBER, |
||
56 | .active_low = 1, |
||
57 | }, |
||
58 | { |
||
59 | .name = "netgear:green:wan", |
||
60 | .gpio = R6100_GPIO_LED_WAN_GREEN, |
||
61 | .active_low = 1, |
||
62 | }, |
||
63 | { |
||
64 | .name = "netgear:amber:wan", |
||
65 | .gpio = R6100_GPIO_LED_WAN_AMBER, |
||
66 | .active_low = 1, |
||
67 | }, |
||
68 | { |
||
69 | .name = "netgear:blue:usb", |
||
70 | .gpio = R6100_GPIO_LED_USB, |
||
71 | .active_low = 1, |
||
72 | }, |
||
73 | { |
||
74 | .name = "netgear:blue:wlan", |
||
75 | .gpio = R6100_GPIO_LED_WLAN, |
||
76 | .active_low = 1, |
||
77 | }, |
||
78 | }; |
||
79 | |||
80 | static struct gpio_keys_button r6100_gpio_keys[] __initdata = { |
||
81 | { |
||
82 | .desc = "Reset button", |
||
83 | .type = EV_KEY, |
||
84 | .code = KEY_RESTART, |
||
85 | .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL, |
||
86 | .gpio = R6100_GPIO_BTN_RESET, |
||
87 | .active_low = 0, |
||
88 | }, |
||
89 | { |
||
90 | .desc = "WPS button", |
||
91 | .type = EV_KEY, |
||
92 | .code = KEY_WPS_BUTTON, |
||
93 | .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL, |
||
94 | .gpio = R6100_GPIO_BTN_WPS, |
||
95 | .active_low = 0, |
||
96 | }, |
||
97 | { |
||
98 | .desc = "RFKILL switch", |
||
99 | .type = EV_SW, |
||
100 | .code = KEY_RFKILL, |
||
101 | .debounce_interval = R6100_KEYS_DEBOUNCE_INTERVAL, |
||
102 | .gpio = R6100_GPIO_BTN_WIRELESS, |
||
103 | .active_low = 0, |
||
104 | }, |
||
105 | }; |
||
106 | |||
107 | static void __init r6100_setup(void) |
||
108 | { |
||
109 | ath79_register_leds_gpio(-1, ARRAY_SIZE(r6100_leds_gpio), |
||
110 | r6100_leds_gpio); |
||
111 | ath79_register_gpio_keys_polled(-1, R6100_KEYS_POLL_INTERVAL, |
||
112 | ARRAY_SIZE(r6100_gpio_keys), |
||
113 | r6100_gpio_keys); |
||
114 | |||
115 | ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP); |
||
116 | |||
117 | ath79_register_mdio(1, 0x0); |
||
118 | |||
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); |
||
126 | |||
127 | /* GMAC1 is connected to the internal switch */ |
||
128 | ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; |
||
129 | ath79_register_eth(1); |
||
130 | |||
131 | gpio_request_one(R6100_GPIO_USB_POWER, |
||
132 | GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, |
||
133 | "USB power"); |
||
134 | |||
135 | ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW); |
||
136 | ath79_register_nfc(); |
||
137 | |||
138 | ath79_register_usb(); |
||
139 | |||
140 | ath79_register_wmac_simple(); |
||
141 | |||
142 | ap91_pci_init_simple(); |
||
143 | } |
||
144 | |||
145 | MIPS_MACHINE(ATH79_MACH_R6100, "R6100", "NETGEAR R6100", |
||
146 | r6100_setup); |