OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
1 | |
1 | |
|
2 | /* |
2 | /* |
|
3 | * Atheros ARCHER_C7 reference board support |
3 | * Atheros ARCHER_C7 reference board support |
|
4 | * |
4 | * |
|
5 | * Copyright (c) 2017 Felix Fietkau <nbd@nbd.name> |
5 | * Copyright (c) 2017 Felix Fietkau <nbd@nbd.name> |
|
6 | * Copyright (c) 2014 The Linux Foundation. All rights reserved. |
6 | * Copyright (c) 2014 The Linux Foundation. All rights reserved. |
|
7 | * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org> |
7 | * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org> |
|
8 | * |
8 | * |
|
9 | * Permission to use, copy, modify, and/or distribute this software for any |
9 | * Permission to use, copy, modify, and/or distribute this software for any |
|
10 | * purpose with or without fee is hereby granted, provided that the above |
10 | * purpose with or without fee is hereby granted, provided that the above |
|
11 | * copyright notice and this permission notice appear in all copies. |
11 | * copyright notice and this permission notice appear in all copies. |
|
12 | * |
12 | * |
|
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|
14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|
15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|
16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|
17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|
18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|
19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|
20 | * |
20 | * |
|
21 | */ |
21 | */ |
|
22 | |
22 | |
|
23 | #include <linux/platform_device.h> |
23 | #include <linux/platform_device.h> |
|
24 | #include <linux/ath9k_platform.h> |
24 | #include <linux/ath9k_platform.h> |
|
25 | #include <linux/ar8216_platform.h> |
25 | #include <linux/ar8216_platform.h> |
|
26 | #include <linux/proc_fs.h> |
26 | #include <linux/proc_fs.h> |
|
27 | #include <linux/gpio.h> |
27 | #include <linux/gpio.h> |
|
28 | #include <linux/spi/spi_gpio.h> |
28 | #include <linux/spi/spi_gpio.h> |
|
29 | #include <linux/spi/74x164.h> |
29 | #include <linux/spi/74x164.h> |
|
30 | |
30 | |
|
31 | #include <asm/mach-ath79/ar71xx_regs.h> |
31 | #include <asm/mach-ath79/ar71xx_regs.h> |
|
32 | |
32 | |
|
33 | #include "common.h" |
33 | #include "common.h" |
|
34 | #include "dev-m25p80.h" |
34 | #include "dev-m25p80.h" |
|
35 | #include "machtypes.h" |
35 | #include "machtypes.h" |
|
36 | #include "pci.h" |
36 | #include "pci.h" |
|
37 | #include "dev-eth.h" |
37 | #include "dev-eth.h" |
|
38 | #include "dev-gpio-buttons.h" |
38 | #include "dev-gpio-buttons.h" |
|
39 | #include "dev-leds-gpio.h" |
39 | #include "dev-leds-gpio.h" |
|
40 | #include "dev-spi.h" |
40 | #include "dev-spi.h" |
|
41 | #include "dev-usb.h" |
41 | #include "dev-usb.h" |
|
42 | #include "dev-wmac.h" |
42 | #include "dev-wmac.h" |
|
43 | |
43 | |
|
44 | |
44 | |
|
45 | #define ARCHER_C7_GPIO_SHIFT_OE 1 |
45 | #define ARCHER_C7_GPIO_SHIFT_OE 1 |
|
46 | #define ARCHER_C7_GPIO_SHIFT_SER 14 |
46 | #define ARCHER_C7_GPIO_SHIFT_SER 14 |
|
47 | #define ARCHER_C7_GPIO_SHIFT_SRCLK 15 |
47 | #define ARCHER_C7_GPIO_SHIFT_SRCLK 15 |
|
48 | #define ARCHER_C7_GPIO_SHIFT_RCLK 16 |
48 | #define ARCHER_C7_GPIO_SHIFT_RCLK 16 |
|
49 | #define ARCHER_C7_GPIO_SHIFT_SRCLR 21 |
49 | #define ARCHER_C7_GPIO_SHIFT_SRCLR 21 |
|
50 | |
50 | |
|
51 | #define ARCHER_C7_GPIO_BTN_RESET 5 |
51 | #define ARCHER_C7_GPIO_BTN_RESET 5 |
|
52 | #define ARCHER_C7_GPIO_BTN_WPS_WIFI 2 |
52 | #define ARCHER_C7_GPIO_BTN_WPS_WIFI 2 |
|
53 | |
53 | |
|
54 | #define ARCHER_C7_GPIO_LED_WLAN5 9 |
54 | #define ARCHER_C7_GPIO_LED_WLAN5 9 |
|
55 | #define ARCHER_C7_GPIO_LED_POWER 6 |
55 | #define ARCHER_C7_GPIO_LED_POWER 6 |
|
56 | #define ARCHER_C7_GPIO_LED_USB1 7 |
56 | #define ARCHER_C7_GPIO_LED_USB1 7 |
|
57 | #define ARCHER_C7_GPIO_LED_USB2 8 |
57 | #define ARCHER_C7_GPIO_LED_USB2 8 |
|
58 | |
58 | |
|
59 | #define ARCHER_C7_74HC_GPIO_BASE 32 |
59 | #define ARCHER_C7_74HC_GPIO_BASE 32 |
|
60 | #define ARCHER_C7_GPIO_LED_WPS (ARCHER_C7_74HC_GPIO_BASE + 0) |
60 | #define ARCHER_C7_GPIO_LED_WPS (ARCHER_C7_74HC_GPIO_BASE + 0) |
|
61 | #define ARCHER_C7_GPIO_LED_LAN1 (ARCHER_C7_74HC_GPIO_BASE + 1) |
61 | #define ARCHER_C7_GPIO_LED_LAN1 (ARCHER_C7_74HC_GPIO_BASE + 1) |
|
62 | #define ARCHER_C7_GPIO_LED_LAN2 (ARCHER_C7_74HC_GPIO_BASE + 2) |
62 | #define ARCHER_C7_GPIO_LED_LAN2 (ARCHER_C7_74HC_GPIO_BASE + 2) |
|
63 | #define ARCHER_C7_GPIO_LED_LAN3 (ARCHER_C7_74HC_GPIO_BASE + 3) |
63 | #define ARCHER_C7_GPIO_LED_LAN3 (ARCHER_C7_74HC_GPIO_BASE + 3) |
|
64 | #define ARCHER_C7_GPIO_LED_LAN4 (ARCHER_C7_74HC_GPIO_BASE + 4) |
64 | #define ARCHER_C7_GPIO_LED_LAN4 (ARCHER_C7_74HC_GPIO_BASE + 4) |
|
65 | #define ARCHER_C7_GPIO_LED_WAN_GREEN (ARCHER_C7_74HC_GPIO_BASE + 5) |
65 | #define ARCHER_C7_GPIO_LED_WAN_GREEN (ARCHER_C7_74HC_GPIO_BASE + 5) |
|
66 | #define ARCHER_C7_GPIO_LED_WAN_AMBER (ARCHER_C7_74HC_GPIO_BASE + 6) |
66 | #define ARCHER_C7_GPIO_LED_WAN_AMBER (ARCHER_C7_74HC_GPIO_BASE + 6) |
|
67 | #define ARCHER_C7_GPIO_LED_WLAN2 (ARCHER_C7_74HC_GPIO_BASE + 7) |
67 | #define ARCHER_C7_GPIO_LED_WLAN2 (ARCHER_C7_74HC_GPIO_BASE + 7) |
|
68 | |
68 | |
|
69 | #define ARCHER_C7_KEYS_POLL_INTERVAL 20 /* msecs */ |
69 | #define ARCHER_C7_KEYS_POLL_INTERVAL 20 /* msecs */ |
|
70 | #define ARCHER_C7_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C7_KEYS_POLL_INTERVAL) |
70 | #define ARCHER_C7_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C7_KEYS_POLL_INTERVAL) |
|
71 | |
71 | |
|
72 | #define ARCHER_C7_MAC0_OFFSET 0 |
72 | #define ARCHER_C7_MAC0_OFFSET 0 |
|
73 | #define ARCHER_C7_MAC1_OFFSET 6 |
73 | #define ARCHER_C7_MAC1_OFFSET 6 |
|
74 | #define ARCHER_C7_WMAC_CALDATA_OFFSET 0x1000 |
74 | #define ARCHER_C7_WMAC_CALDATA_OFFSET 0x1000 |
|
75 | |
75 | |
|
76 | #define ARCHER_C7_GPIO_MDC 3 |
76 | #define ARCHER_C7_GPIO_MDC 3 |
|
77 | #define ARCHER_C7_GPIO_MDIO 4 |
77 | #define ARCHER_C7_GPIO_MDIO 4 |
|
78 | |
78 | |
|
79 | static struct spi_gpio_platform_data archer_c7_v4_spi_data = { |
79 | static struct spi_gpio_platform_data archer_c7_v4_spi_data = { |
|
80 | .sck = ARCHER_C7_GPIO_SHIFT_SRCLK, |
80 | .sck = ARCHER_C7_GPIO_SHIFT_SRCLK, |
|
81 | .miso = SPI_GPIO_NO_MISO, |
81 | .miso = SPI_GPIO_NO_MISO, |
|
82 | .mosi = ARCHER_C7_GPIO_SHIFT_SER, |
82 | .mosi = ARCHER_C7_GPIO_SHIFT_SER, |
|
83 | .num_chipselect = 1, |
83 | .num_chipselect = 1, |
|
84 | }; |
84 | }; |
|
85 | |
85 | |
|
86 | static u8 archer_c7_v4_ssr_initdata = 0xff; |
86 | static u8 archer_c7_v4_ssr_initdata = 0xff; |
|
87 | |
87 | |
|
88 | static struct gen_74x164_chip_platform_data archer_c7_v4_ssr_data = { |
88 | static struct gen_74x164_chip_platform_data archer_c7_v4_ssr_data = { |
|
89 | .base = ARCHER_C7_74HC_GPIO_BASE, |
89 | .base = ARCHER_C7_74HC_GPIO_BASE, |
|
90 | .num_registers = 1, |
90 | .num_registers = 1, |
|
91 | .init_data = &archer_c7_v4_ssr_initdata, |
91 | .init_data = &archer_c7_v4_ssr_initdata, |
|
92 | }; |
92 | }; |
|
93 | |
93 | |
|
94 | static struct platform_device archer_c7_v4_spi_device = { |
94 | static struct platform_device archer_c7_v4_spi_device = { |
|
95 | .name = "spi_gpio", |
95 | .name = "spi_gpio", |
|
96 | .id = 1, |
96 | .id = 1, |
|
97 | .dev = { |
97 | .dev = { |
|
98 | .platform_data = &archer_c7_v4_spi_data, |
98 | .platform_data = &archer_c7_v4_spi_data, |
|
99 | }, |
99 | }, |
|
100 | }; |
100 | }; |
|
101 | |
101 | |
|
102 | static struct spi_board_info archer_c7_v4_spi_info[] = { |
102 | static struct spi_board_info archer_c7_v4_spi_info[] = { |
|
103 | { |
103 | { |
|
104 | .bus_num = 1, |
104 | .bus_num = 1, |
|
105 | .chip_select = 0, |
105 | .chip_select = 0, |
|
106 | .max_speed_hz = 10000000, |
106 | .max_speed_hz = 10000000, |
|
107 | .modalias = "74x164", |
107 | .modalias = "74x164", |
|
108 | .platform_data = &archer_c7_v4_ssr_data, |
108 | .platform_data = &archer_c7_v4_ssr_data, |
|
109 | .controller_data = (void *) ARCHER_C7_GPIO_SHIFT_RCLK, |
109 | .controller_data = (void *) ARCHER_C7_GPIO_SHIFT_RCLK, |
|
110 | }, |
110 | }, |
|
111 | }; |
111 | }; |
|
112 | |
112 | |
|
113 | static struct gpio_led archer_c7_v4_leds_gpio[] __initdata = { |
113 | static struct gpio_led archer_c7_v4_leds_gpio[] __initdata = { |
|
114 | { |
114 | { |
|
115 | .name = "archer-c7-v4:green:power", |
115 | .name = "archer-c7-v4:green:power", |
|
116 | .gpio = ARCHER_C7_GPIO_LED_POWER, |
116 | .gpio = ARCHER_C7_GPIO_LED_POWER, |
|
117 | .active_low = 1, |
117 | .active_low = 1, |
|
118 | }, { |
118 | }, { |
|
119 | .name = "archer-c7-v4:green:wps", |
119 | .name = "archer-c7-v4:green:wps", |
|
120 | .gpio = ARCHER_C7_GPIO_LED_WPS, |
120 | .gpio = ARCHER_C7_GPIO_LED_WPS, |
|
121 | .active_low = 1, |
121 | .active_low = 1, |
|
122 | }, { |
122 | }, { |
|
123 | .name = "archer-c7-v4:green:wlan2g", |
123 | .name = "archer-c7-v4:green:wlan2g", |
|
124 | .gpio = ARCHER_C7_GPIO_LED_WLAN2, |
124 | .gpio = ARCHER_C7_GPIO_LED_WLAN2, |
|
125 | .active_low = 1, |
125 | .active_low = 1, |
|
126 | }, { |
126 | }, { |
|
127 | .name = "archer-c7-v4:green:wlan5g", |
127 | .name = "archer-c7-v4:green:wlan5g", |
|
128 | .gpio = ARCHER_C7_GPIO_LED_WLAN5, |
128 | .gpio = ARCHER_C7_GPIO_LED_WLAN5, |
|
129 | .active_low = 1, |
129 | .active_low = 1, |
|
130 | }, { |
130 | }, { |
|
131 | .name = "archer-c7-v4:green:lan1", |
131 | .name = "archer-c7-v4:green:lan1", |
|
132 | .gpio = ARCHER_C7_GPIO_LED_LAN1, |
132 | .gpio = ARCHER_C7_GPIO_LED_LAN1, |
|
133 | .active_low = 1, |
133 | .active_low = 1, |
|
134 | }, { |
134 | }, { |
|
135 | .name = "archer-c7-v4:green:lan2", |
135 | .name = "archer-c7-v4:green:lan2", |
|
136 | .gpio = ARCHER_C7_GPIO_LED_LAN2, |
136 | .gpio = ARCHER_C7_GPIO_LED_LAN2, |
|
137 | .active_low = 1, |
137 | .active_low = 1, |
|
138 | }, { |
138 | }, { |
|
139 | .name = "archer-c7-v4:green:lan3", |
139 | .name = "archer-c7-v4:green:lan3", |
|
140 | .gpio = ARCHER_C7_GPIO_LED_LAN3, |
140 | .gpio = ARCHER_C7_GPIO_LED_LAN3, |
|
141 | .active_low = 1, |
141 | .active_low = 1, |
|
142 | }, { |
142 | }, { |
|
143 | .name = "archer-c7-v4:green:lan4", |
143 | .name = "archer-c7-v4:green:lan4", |
|
144 | .gpio = ARCHER_C7_GPIO_LED_LAN4, |
144 | .gpio = ARCHER_C7_GPIO_LED_LAN4, |
|
145 | .active_low = 1, |
145 | .active_low = 1, |
|
146 | }, { |
146 | }, { |
|
147 | .name = "archer-c7-v4:green:wan", |
147 | .name = "archer-c7-v4:green:wan", |
|
148 | .gpio = ARCHER_C7_GPIO_LED_WAN_GREEN, |
148 | .gpio = ARCHER_C7_GPIO_LED_WAN_GREEN, |
|
149 | .active_low = 1, |
149 | .active_low = 1, |
|
150 | }, { |
150 | }, { |
|
151 | .name = "archer-c7-v4:amber:wan", |
151 | .name = "archer-c7-v4:amber:wan", |
|
152 | .gpio = ARCHER_C7_GPIO_LED_WAN_AMBER, |
152 | .gpio = ARCHER_C7_GPIO_LED_WAN_AMBER, |
|
153 | .active_low = 1, |
153 | .active_low = 1, |
|
154 | }, { |
154 | }, { |
|
155 | .name = "archer-c7-v4:green:usb1", |
155 | .name = "archer-c7-v4:green:usb1", |
|
156 | .gpio = ARCHER_C7_GPIO_LED_USB1, |
156 | .gpio = ARCHER_C7_GPIO_LED_USB1, |
|
157 | .active_low = 1, |
157 | .active_low = 1, |
|
158 | }, { |
158 | }, { |
|
159 | .name = "archer-c7-v4:green:usb2", |
159 | .name = "archer-c7-v4:green:usb2", |
|
160 | .gpio = ARCHER_C7_GPIO_LED_USB2, |
160 | .gpio = ARCHER_C7_GPIO_LED_USB2, |
|
161 | .active_low = 1, |
161 | .active_low = 1, |
|
162 | }, |
162 | }, |
|
163 | }; |
163 | }; |
|
164 | |
164 | |
|
165 | static struct gpio_keys_button archer_c7_v4_gpio_keys[] __initdata = { |
165 | static struct gpio_keys_button archer_c7_v4_gpio_keys[] __initdata = { |
|
166 | { |
166 | { |
|
167 | .desc = "WPS and WIFI button", |
167 | .desc = "WPS and WIFI button", |
|
168 | .type = EV_KEY, |
168 | .type = EV_KEY, |
|
169 | .code = KEY_WPS_BUTTON, |
169 | .code = KEY_WPS_BUTTON, |
|
170 | .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, |
170 | .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, |
|
171 | .gpio = ARCHER_C7_GPIO_BTN_WPS_WIFI, |
171 | .gpio = ARCHER_C7_GPIO_BTN_WPS_WIFI, |
|
172 | .active_low = 1, |
172 | .active_low = 1, |
|
173 | }, |
173 | }, |
|
174 | { |
174 | { |
|
175 | .desc = "Reset button", |
175 | .desc = "Reset button", |
|
176 | .type = EV_KEY, |
176 | .type = EV_KEY, |
|
177 | .code = KEY_RESTART, |
177 | .code = KEY_RESTART, |
|
178 | .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, |
178 | .debounce_interval = ARCHER_C7_KEYS_DEBOUNCE_INTERVAL, |
|
179 | .gpio = ARCHER_C7_GPIO_BTN_RESET, |
179 | .gpio = ARCHER_C7_GPIO_BTN_RESET, |
|
180 | .active_low = 1, |
180 | .active_low = 1, |
|
181 | }, |
181 | }, |
|
182 | }; |
182 | }; |
|
183 | |
183 | |
|
184 | static struct ar8327_pad_cfg archer_c7_v4_ar8337_pad0_cfg = { |
184 | static struct ar8327_pad_cfg archer_c7_v4_ar8337_pad0_cfg = { |
|
185 | .mode = AR8327_PAD_MAC_SGMII, |
185 | .mode = AR8327_PAD_MAC_SGMII, |
|
186 | .sgmii_delay_en = true, |
186 | .sgmii_delay_en = true, |
|
187 | }; |
187 | }; |
|
188 | |
188 | |
|
189 | static struct ar8327_platform_data archer_c7_v4_ar8337_data = { |
189 | static struct ar8327_platform_data archer_c7_v4_ar8337_data = { |
|
190 | .pad0_cfg = &archer_c7_v4_ar8337_pad0_cfg, |
190 | .pad0_cfg = &archer_c7_v4_ar8337_pad0_cfg, |
|
191 | .port0_cfg = { |
191 | .port0_cfg = { |
|
192 | .force_link = 1, |
192 | .force_link = 1, |
|
193 | .speed = AR8327_PORT_SPEED_1000, |
193 | .speed = AR8327_PORT_SPEED_1000, |
|
194 | .duplex = 1, |
194 | .duplex = 1, |
|
195 | .txpause = 1, |
195 | .txpause = 1, |
|
196 | .rxpause = 1, |
196 | .rxpause = 1, |
|
197 | }, |
197 | }, |
|
198 | }; |
198 | }; |
|
199 | |
199 | |
|
200 | static struct mdio_board_info archer_c7_v4_mdio0_info[] = { |
200 | static struct mdio_board_info archer_c7_v4_mdio0_info[] = { |
|
201 | { |
201 | { |
|
202 | .bus_id = "ag71xx-mdio.0", |
202 | .bus_id = "ag71xx-mdio.0", |
|
203 | .mdio_addr = 0, |
203 | .phy_addr = 0, |
|
204 | .platform_data = &archer_c7_v4_ar8337_data, |
204 | .platform_data = &archer_c7_v4_ar8337_data, |
|
205 | }, |
205 | }, |
|
206 | }; |
206 | }; |
|
207 | |
207 | |
|
208 | |
208 | |
|
209 | static void __init archer_c7_v4_setup(void) |
209 | static void __init archer_c7_v4_setup(void) |
|
210 | { |
210 | { |
|
211 | u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); |
211 | u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); |
|
212 | u8 *mac = (u8 *) KSEG1ADDR(0x1ff00008); |
212 | u8 *mac = (u8 *) KSEG1ADDR(0x1ff00008); |
|
213 | |
213 | |
|
214 | ath79_register_m25p80(NULL); |
214 | ath79_register_m25p80(NULL); |
|
215 | |
215 | |
|
216 | spi_register_board_info(archer_c7_v4_spi_info, |
216 | spi_register_board_info(archer_c7_v4_spi_info, |
|
217 | ARRAY_SIZE(archer_c7_v4_spi_info)); |
217 | ARRAY_SIZE(archer_c7_v4_spi_info)); |
|
218 | |
218 | |
|
219 | platform_device_register(&archer_c7_v4_spi_device); |
219 | platform_device_register(&archer_c7_v4_spi_device); |
|
220 | |
220 | |
|
221 | gpio_request_one(ARCHER_C7_GPIO_SHIFT_OE, |
221 | gpio_request_one(ARCHER_C7_GPIO_SHIFT_OE, |
|
222 | GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, |
222 | GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, |
|
223 | "LED control"); |
223 | "LED control"); |
|
224 | |
224 | |
|
225 | gpio_request_one(ARCHER_C7_GPIO_SHIFT_SRCLR, |
225 | gpio_request_one(ARCHER_C7_GPIO_SHIFT_SRCLR, |
|
226 | GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, |
226 | GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, |
|
227 | "LED reset"); |
227 | "LED reset"); |
|
228 | |
228 | |
|
229 | ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_v4_leds_gpio), |
229 | ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c7_v4_leds_gpio), |
|
230 | archer_c7_v4_leds_gpio); |
230 | archer_c7_v4_leds_gpio); |
|
231 | |
231 | |
|
232 | ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, |
232 | ath79_register_gpio_keys_polled(-1, ARCHER_C7_KEYS_POLL_INTERVAL, |
|
233 | ARRAY_SIZE(archer_c7_v4_gpio_keys), |
233 | ARRAY_SIZE(archer_c7_v4_gpio_keys), |
|
234 | archer_c7_v4_gpio_keys); |
234 | archer_c7_v4_gpio_keys); |
|
235 | |
235 | |
|
236 | ath79_register_usb(); |
236 | ath79_register_usb(); |
|
237 | |
237 | |
|
238 | ath79_gpio_output_select(ARCHER_C7_GPIO_MDC, QCA956X_GPIO_OUT_MUX_GE0_MDC); |
238 | ath79_gpio_output_select(ARCHER_C7_GPIO_MDC, QCA956X_GPIO_OUT_MUX_GE0_MDC); |
|
239 | ath79_gpio_output_select(ARCHER_C7_GPIO_MDIO, QCA956X_GPIO_OUT_MUX_GE0_MDO); |
239 | ath79_gpio_output_select(ARCHER_C7_GPIO_MDIO, QCA956X_GPIO_OUT_MUX_GE0_MDO); |
|
240 | |
240 | |
|
241 | ath79_register_mdio(0, 0x0); |
241 | ath79_register_mdio(0, 0x0); |
|
242 | |
242 | |
|
243 | mdiobus_register_board_info(archer_c7_v4_mdio0_info, |
243 | mdiobus_register_board_info(archer_c7_v4_mdio0_info, |
|
244 | ARRAY_SIZE(archer_c7_v4_mdio0_info)); |
244 | ARRAY_SIZE(archer_c7_v4_mdio0_info)); |
|
245 | |
245 | |
|
246 | ath79_register_wmac(art + ARCHER_C7_WMAC_CALDATA_OFFSET, mac); |
246 | ath79_register_wmac(art + ARCHER_C7_WMAC_CALDATA_OFFSET, mac); |
|
247 | ath79_register_pci(); |
247 | ath79_register_pci(); |
|
248 | |
248 | |
|
249 | /* GMAC0 is connected to an AR8337 switch */ |
249 | /* GMAC0 is connected to an AR8337 switch */ |
|
250 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
250 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
|
251 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; |
251 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII; |
|
252 | ath79_eth0_data.speed = SPEED_1000; |
252 | ath79_eth0_data.speed = SPEED_1000; |
|
253 | ath79_eth0_data.duplex = DUPLEX_FULL; |
253 | ath79_eth0_data.duplex = DUPLEX_FULL; |
|
254 | ath79_eth0_data.phy_mask = BIT(0); |
254 | ath79_eth0_data.phy_mask = BIT(0); |
|
255 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
255 | ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; |
|
256 | ath79_register_eth(0); |
256 | ath79_register_eth(0); |
|
257 | } |
257 | } |
|
258 | |
258 | |
|
259 | MIPS_MACHINE(ATH79_MACH_ARCHER_C7_V4, "ARCHER-C7-V4", "TP-LINK Archer C7 v4", |
259 | MIPS_MACHINE(ATH79_MACH_ARCHER_C7_V4, "ARCHER-C7-V4", "TP-LINK Archer C7 v4", |
|
260 | archer_c7_v4_setup); |
260 | archer_c7_v4_setup); |
|
261 | |
261 | |