2 * Support for COMFAST boards:
3 * - CF-E316N v2 (AR9341)
4 * - CF-E320N v2 (QCA9531)
5 * - CF-E355AC v1 (QCA9531 + QCA9882)
6 * - CF-E355AC v2 (QCA9531 + QCA9886)
7 * - CF-E375AC (QCA9563 + QCA9886 + QCA8337)
8 * - CF-E380AC v1/v2 (QCA9558)
9 * - CF-E520N/CF-E530N (QCA9531)
11 * Copyright (C) 2016 Piotr Dymacz <pepe2k@gmail.com>
12 * Copyright (C) 2016 Gareth Parker <gareth41@orcon.net.nz>
13 * Copyright (C) 2015 Paul Fertser <fercerpav@gmail.com>
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License version 2 as published
17 * by the Free Software Foundation.
20 #include <linux/gpio.h>
21 #include <linux/ar8216_platform.h>
22 #include <linux/platform_data/phy-at803x.h>
23 #include <linux/platform_device.h>
24 #include <linux/timer.h>
26 #include <asm/mach-ath79/ath79.h>
27 #include <asm/mach-ath79/ar71xx_regs.h>
30 #include "dev-ap9x-pci.h"
32 #include "dev-gpio-buttons.h"
33 #include "dev-leds-gpio.h"
34 #include "dev-m25p80.h"
37 #include "machtypes.h"
39 #define CF_EXXXN_KEYS_POLL_INTERVAL 20
40 #define CF_EXXXN_KEYS_DEBOUNCE_INTERVAL (3 * CF_EXXXN_KEYS_POLL_INTERVAL)
43 #define CF_E316N_V2_GPIO_LED_DIAG_B 0
44 #define CF_E316N_V2_GPIO_LED_DIAG_R 2
45 #define CF_E316N_V2_GPIO_LED_DIAG_G 3
46 #define CF_E316N_V2_GPIO_LED_WLAN 12
47 #define CF_E316N_V2_GPIO_LED_WAN 17
48 #define CF_E316N_V2_GPIO_LED_LAN 19
50 #define CF_E316N_V2_GPIO_EXT_WDT 16
52 #define CF_E316N_V2_GPIO_EXTERNAL_PA0 13
53 #define CF_E316N_V2_GPIO_EXTERNAL_PA1 14
55 #define CF_E316N_V2_GPIO_BTN_RESET 20
57 static struct gpio_led cf_e316n_v2_leds_gpio
[] __initdata
= {
59 .name
= "cf-e316n-v2:blue:diag",
60 .gpio
= CF_E316N_V2_GPIO_LED_DIAG_B
,
63 .name
= "cf-e316n-v2:red:diag",
64 .gpio
= CF_E316N_V2_GPIO_LED_DIAG_R
,
67 .name
= "cf-e316n-v2:green:diag",
68 .gpio
= CF_E316N_V2_GPIO_LED_DIAG_G
,
71 .name
= "cf-e316n-v2:blue:wlan",
72 .gpio
= CF_E316N_V2_GPIO_LED_WLAN
,
75 .name
= "cf-e316n-v2:blue:wan",
76 .gpio
= CF_E316N_V2_GPIO_LED_WAN
,
79 .name
= "cf-e316n-v2:blue:lan",
80 .gpio
= CF_E316N_V2_GPIO_LED_LAN
,
85 static struct gpio_keys_button cf_e316n_v2_gpio_keys
[] __initdata
= {
90 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
91 .gpio
= CF_E316N_V2_GPIO_BTN_RESET
,
97 #define CF_E320N_V2_GPIO_LED_WLAN 0
98 #define CF_E320N_V2_GPIO_LED_WAN 2
99 #define CF_E320N_V2_GPIO_LED_LAN 3
101 #define CF_E320N_V2_GPIO_HEADER_J9_1 14
102 #define CF_E320N_V2_GPIO_HEADER_J9_2 12
103 #define CF_E320N_V2_GPIO_HEADER_J9_3 11
104 #define CF_E320N_V2_GPIO_HEADER_J9_4 16
106 #define CF_E320N_V2_GPIO_EXT_WDT 13
108 #define CF_E320N_V2_GPIO_BTN_RESET 17
110 static struct gpio_led cf_e320n_v2_leds_gpio
[] __initdata
= {
112 .name
= "cf-e320n-v2:green:lan",
113 .gpio
= CF_E320N_V2_GPIO_LED_LAN
,
116 .name
= "cf-e320n-v2:red:wan",
117 .gpio
= CF_E320N_V2_GPIO_LED_WAN
,
120 .name
= "cf-e320n-v2:blue:wlan",
121 .gpio
= CF_E320N_V2_GPIO_LED_WLAN
,
126 static struct gpio_keys_button cf_e320n_v2_gpio_keys
[] __initdata
= {
128 .desc
= "Reset button",
131 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
132 .gpio
= CF_E320N_V2_GPIO_BTN_RESET
,
137 /* CF-E355AC v1/v2 */
138 #define CF_E355AC_GPIO_LED_LAN 3
139 #define CF_E355AC_GPIO_LED_WLAN2G 0
140 #define CF_E355AC_GPIO_LED_WLAN5G 2
142 #define CF_E355AC_GPIO_EXT_WDT 13
144 #define CF_E355AC_GPIO_BTN_RESET 17
146 static struct gpio_led cf_e355ac_v1_leds_gpio
[] __initdata
= {
148 .name
= "cf-e355ac-v1:green:lan",
149 .gpio
= CF_E355AC_GPIO_LED_LAN
,
152 .name
= "cf-e355ac-v1:blue:wlan2g",
153 .gpio
= CF_E355AC_GPIO_LED_WLAN2G
,
156 .name
= "cf-e355ac-v1:red:wlan5g",
157 .gpio
= CF_E355AC_GPIO_LED_WLAN5G
,
162 static struct gpio_led cf_e355ac_v2_leds_gpio
[] __initdata
= {
164 .name
= "cf-e355ac-v2:green:lan",
165 .gpio
= CF_E355AC_GPIO_LED_LAN
,
168 .name
= "cf-e355ac-v2:blue:wlan2g",
169 .gpio
= CF_E355AC_GPIO_LED_WLAN2G
,
172 .name
= "cf-e355ac-v2:red:wlan5g",
173 .gpio
= CF_E355AC_GPIO_LED_WLAN5G
,
178 static struct gpio_keys_button cf_e355ac_gpio_keys
[] __initdata
= {
180 .desc
= "Reset button",
183 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
184 .gpio
= CF_E355AC_GPIO_BTN_RESET
,
189 #define CF_E375AC_GPIO_XWDT_TRIGGER 6
191 #define CF_E375AC_GPIO_BTN_RESET_WPS 2
193 #define CF_E375AC_GPIO_LED_WAN 15
194 #define CF_E375AC_GPIO_LED_LAN 17
195 #define CF_E375AC_GPIO_LED_WLAN 16
197 static struct gpio_led cf_e375ac_leds_gpio
[] __initdata
= {
199 .name
= "comfast:red:wan",
200 .gpio
= CF_E375AC_GPIO_LED_WAN
,
203 .name
= "comfast:green:lan",
204 .gpio
= CF_E375AC_GPIO_LED_LAN
,
207 .name
= "comfast:blue:wlan",
208 .gpio
= CF_E375AC_GPIO_LED_WLAN
,
213 static struct gpio_keys_button cf_e375ac_gpio_keys
[] __initdata
= {
215 .desc
= "Reset button/WPS button",
218 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
219 .gpio
= CF_E375AC_GPIO_BTN_RESET_WPS
,
224 static struct ar8327_pad_cfg cf_e375ac_ar8337_pad0_cfg
= {
225 .mode
= AR8327_PAD_MAC_SGMII
,
226 .sgmii_delay_en
= true,
229 static struct ar8327_platform_data cf_e375ac_ar8337_data
= {
230 .pad0_cfg
= &cf_e375ac_ar8337_pad0_cfg
,
233 .speed
= AR8327_PORT_SPEED_1000
,
240 static struct mdio_board_info cf_e375ac_mdio0_info
[] = {
242 .bus_id
= "ag71xx-mdio.0",
244 .platform_data
= &cf_e375ac_ar8337_data
,
248 /* CF-E380AC v1/v2 */
249 #define CF_E380AC_V1V2_GPIO_LED_LAN 0
250 #define CF_E380AC_V1V2_GPIO_LED_WLAN2G 2
251 #define CF_E380AC_V1V2_GPIO_LED_WLAN5G 3
253 #define CF_E380AC_V1V2_GPIO_EXT_WDT 17
255 #define CF_E380AC_V1V2_GPIO_BTN_RESET 19
257 static struct gpio_led cf_e380ac_v1_leds_gpio
[] __initdata
= {
259 .name
= "cf-e380ac-v1:green:lan",
260 .gpio
= CF_E380AC_V1V2_GPIO_LED_LAN
,
263 .name
= "cf-e380ac-v1:blue:wlan2g",
264 .gpio
= CF_E380AC_V1V2_GPIO_LED_WLAN2G
,
267 .name
= "cf-e380ac-v1:red:wlan5g",
268 .gpio
= CF_E380AC_V1V2_GPIO_LED_WLAN5G
,
273 static struct gpio_led cf_e380ac_v2_leds_gpio
[] __initdata
= {
275 .name
= "cf-e380ac-v2:green:lan",
276 .gpio
= CF_E380AC_V1V2_GPIO_LED_LAN
,
279 .name
= "cf-e380ac-v2:blue:wlan2g",
280 .gpio
= CF_E380AC_V1V2_GPIO_LED_WLAN2G
,
283 .name
= "cf-e380ac-v2:red:wlan5g",
284 .gpio
= CF_E380AC_V1V2_GPIO_LED_WLAN5G
,
289 static struct gpio_keys_button cf_e380ac_v1v2_gpio_keys
[] __initdata
= {
291 .desc
= "Reset button",
294 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
295 .gpio
= CF_E380AC_V1V2_GPIO_BTN_RESET
,
300 static struct at803x_platform_data cf_e380ac_v1v2_at803x_data
= {
301 .disable_smarteee
= 1,
304 static struct mdio_board_info cf_e380ac_v1v2_mdio0_info
[] = {
306 .bus_id
= "ag71xx-mdio.0",
308 .platform_data
= &cf_e380ac_v1v2_at803x_data
,
312 /* CF-E520N/CF-E530N */
313 #define CF_E5X0N_GPIO_LED_WAN 11
314 #define CF_E5X0N_GPIO_BTN_RESET 17
316 static struct gpio_led cf_e520n_leds_gpio
[] __initdata
= {
318 .name
= "cf-e520n:blue:wan",
319 .gpio
= CF_E5X0N_GPIO_LED_WAN
,
324 static struct gpio_led cf_e530n_leds_gpio
[] __initdata
= {
326 .name
= "cf-e530n:blue:wan",
327 .gpio
= CF_E5X0N_GPIO_LED_WAN
,
333 * Some COMFAST devices include external hardware watchdog chip,
334 * Pericon Technology PT7A7514, connected to a selected GPIO
335 * and WiSoC RESET_L input. Watchdog time-out is ~1.6 s.
337 #define CF_EXXXN_EXT_WDT_TIMEOUT_MS 500
339 static struct timer_list gpio_wdt_timer
;
341 static void gpio_wdt_toggle(unsigned long gpio
)
346 gpio_set_value(gpio
, state
);
348 mod_timer(&gpio_wdt_timer
,
349 jiffies
+ msecs_to_jiffies(CF_EXXXN_EXT_WDT_TIMEOUT_MS
));
352 static void __init
cf_exxxn_common_setup(unsigned long art_ofs
, int gpio_wdt
)
354 u8
*art
= (u8
*) KSEG1ADDR(0x1f001000 + art_ofs
);
357 gpio_request_one(gpio_wdt
, GPIOF_OUT_INIT_HIGH
,
358 "PT7A7514 watchdog");
360 setup_timer(&gpio_wdt_timer
, gpio_wdt_toggle
, gpio_wdt
);
361 gpio_wdt_toggle(gpio_wdt
);
364 ath79_register_m25p80(NULL
);
366 ath79_register_wmac(art
, NULL
);
368 ath79_register_usb();
371 static void __init
cf_e316n_v2_setup(void)
373 u8
*mac
= (u8
*) KSEG1ADDR(0x1f010000);
375 cf_exxxn_common_setup(0x10000, CF_E316N_V2_GPIO_EXT_WDT
);
377 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP
);
379 ath79_register_mdio(1, 0x0);
381 /* GMAC0 is connected to the PHY0 of the internal switch */
382 ath79_switch_data
.phy4_mii_en
= 1;
383 ath79_switch_data
.phy_poll_mask
= BIT(0);
384 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
385 ath79_eth0_data
.phy_mask
= BIT(0);
386 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
387 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
388 ath79_register_eth(0);
390 /* GMAC1 is connected to the internal switch */
391 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
392 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 2);
393 ath79_register_eth(1);
395 /* Enable 2x Skyworks SE2576L WLAN power amplifiers */
396 gpio_request_one(CF_E316N_V2_GPIO_EXTERNAL_PA0
, GPIOF_OUT_INIT_HIGH
,
398 gpio_request_one(CF_E316N_V2_GPIO_EXTERNAL_PA1
, GPIOF_OUT_INIT_HIGH
,
401 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e316n_v2_leds_gpio
),
402 cf_e316n_v2_leds_gpio
);
404 ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL
,
405 ARRAY_SIZE(cf_e316n_v2_gpio_keys
),
406 cf_e316n_v2_gpio_keys
);
409 MIPS_MACHINE(ATH79_MACH_CF_E316N_V2
, "CF-E316N-V2", "COMFAST CF-E316N v2",
412 static void __init
cf_exxxn_qca953x_eth_setup(void)
414 u8
*mac
= (u8
*) KSEG1ADDR(0x1f010000);
416 ath79_setup_ar933x_phy4_switch(false, false);
418 ath79_register_mdio(0, 0x0);
420 ath79_switch_data
.phy4_mii_en
= 1;
421 ath79_switch_data
.phy_poll_mask
|= BIT(4);
424 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
425 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
426 ath79_eth1_data
.speed
= SPEED_1000
;
427 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 2);
428 ath79_register_eth(1);
431 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
432 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
433 ath79_eth0_data
.speed
= SPEED_100
;
434 ath79_eth0_data
.phy_mask
= BIT(4);
435 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
436 ath79_register_eth(0);
439 static void __init
cf_e320n_v2_setup(void)
441 cf_exxxn_common_setup(0x10000, CF_E320N_V2_GPIO_EXT_WDT
);
443 cf_exxxn_qca953x_eth_setup();
445 /* Disable JTAG (enables GPIO0-3) */
446 ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE
);
448 ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_LAN
, true);
449 ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WAN
, true);
450 ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WLAN
, true);
452 ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_LAN
, 0);
453 ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WAN
, 0);
454 ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WLAN
, 0);
456 /* Enable GPIO function for GPIOs in J9 header */
457 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_1
, 0);
458 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_2
, 0);
459 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_3
, 0);
460 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_4
, 0);
462 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e320n_v2_leds_gpio
),
463 cf_e320n_v2_leds_gpio
);
465 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
466 ARRAY_SIZE(cf_e320n_v2_gpio_keys
),
467 cf_e320n_v2_gpio_keys
);
470 MIPS_MACHINE(ATH79_MACH_CF_E320N_V2
, "CF-E320N-V2", "COMFAST CF-E320N v2",
473 static void __init
cf_e355ac_setup(void)
475 u8
*art
= (u8
*) KSEG1ADDR(0x1f010000);
477 /* Disable JTAG, enabling GPIOs 0-3 */
478 ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE
, 0);
480 cf_exxxn_common_setup(0x10000, CF_E355AC_GPIO_EXT_WDT
);
482 cf_exxxn_qca953x_eth_setup();
484 ath79_gpio_output_select(CF_E355AC_GPIO_LED_LAN
, 0);
485 ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN2G
, 0);
486 ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN5G
, 0);
488 ap91_pci_init(art
+ 0x5000, NULL
);
490 ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL
,
491 ARRAY_SIZE(cf_e355ac_gpio_keys
),
492 cf_e355ac_gpio_keys
);
495 static void __init
cf_e355ac_v1_setup(void)
499 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_v1_leds_gpio
),
500 cf_e355ac_v1_leds_gpio
);
503 static void __init
cf_e355ac_v2_setup(void)
507 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_v2_leds_gpio
),
508 cf_e355ac_v2_leds_gpio
);
511 MIPS_MACHINE(ATH79_MACH_CF_E355AC
, "CF-E355AC-V1", "COMFAST CF-E355AC v1",
514 MIPS_MACHINE(ATH79_MACH_CF_E355AC_V2
, "CF-E355AC-V2", "COMFAST CF-E355AC v2",
517 static void __init
cf_e375ac_setup(void)
519 u8
*mac
= (u8
*) KSEG1ADDR(0x1f040000);
520 u8
*art
= (u8
*) KSEG1ADDR(0x1f040000);
521 u8 wlan1_mac
[ETH_ALEN
];
523 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
524 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 1);
525 ath79_init_mac(wlan1_mac
, art
, 3);
527 /* Disable JTAG, enabling GPIOs 0-3 */
528 /* Configure OBS4 line, for GPIO 4*/
529 ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE
, 0);
531 cf_exxxn_common_setup(0x40000, CF_E375AC_GPIO_XWDT_TRIGGER
);
533 ath79_gpio_output_select(CF_E375AC_GPIO_LED_WAN
, 0);
534 ath79_gpio_output_select(CF_E375AC_GPIO_LED_LAN
, 0);
535 ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN
, 0);
537 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e375ac_leds_gpio
),
538 cf_e375ac_leds_gpio
);
539 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
540 ARRAY_SIZE(cf_e375ac_gpio_keys
),
541 cf_e375ac_gpio_keys
);
543 platform_device_register(&ath79_mdio0_device
);
545 mdiobus_register_board_info(cf_e375ac_mdio0_info
,
546 ARRAY_SIZE(cf_e375ac_mdio0_info
));
548 /* GMAC0 is connected to an AR8337 switch */
549 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_SGMII
;
550 ath79_eth0_data
.speed
= SPEED_1000
;
551 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
552 ath79_eth0_data
.phy_mask
= BIT(0);
553 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
554 ath79_register_eth(0);
556 ap91_pci_init(art
+ 0x5000, wlan1_mac
);
558 MIPS_MACHINE(ATH79_MACH_CF_E375AC
, "CF-E375AC", "COMFAST CF-E375AC", cf_e375ac_setup
);
560 static void __init
cf_e380ac_v1v2_common_setup(unsigned long art_ofs
)
562 u8
*mac
= (u8
*) KSEG1ADDR(0x1f000000 + art_ofs
);
564 cf_exxxn_common_setup(art_ofs
, CF_E380AC_V1V2_GPIO_EXT_WDT
);
566 ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN
);
568 ath79_register_mdio(0, 0x0);
569 mdiobus_register_board_info(cf_e380ac_v1v2_mdio0_info
,
570 ARRAY_SIZE(cf_e380ac_v1v2_mdio0_info
));
573 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
574 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
575 ath79_eth0_data
.phy_mask
= BIT(0);
576 ath79_eth0_pll_data
.pll_1000
= 0xbe000000;
577 ath79_eth0_pll_data
.pll_100
= 0xb0000101;
578 ath79_eth0_pll_data
.pll_10
= 0xb0001313;
579 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
580 ath79_register_eth(0);
582 ap91_pci_init(mac
+ 0x5000, NULL
);
584 /* Disable JTAG (enables GPIO0-3) */
585 ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE
);
587 ath79_gpio_direction_select(CF_E380AC_V1V2_GPIO_LED_LAN
, true);
588 ath79_gpio_direction_select(CF_E380AC_V1V2_GPIO_LED_WLAN2G
, true);
589 ath79_gpio_direction_select(CF_E380AC_V1V2_GPIO_LED_WLAN5G
, true);
591 ath79_gpio_output_select(CF_E380AC_V1V2_GPIO_LED_LAN
, 0);
592 ath79_gpio_output_select(CF_E380AC_V1V2_GPIO_LED_WLAN2G
, 0);
593 ath79_gpio_output_select(CF_E380AC_V1V2_GPIO_LED_WLAN5G
, 0);
596 ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN
);
598 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
599 ARRAY_SIZE(cf_e380ac_v1v2_gpio_keys
),
600 cf_e380ac_v1v2_gpio_keys
);
603 static void __init
cf_e380ac_v1_setup(void)
605 cf_e380ac_v1v2_common_setup(0x20000);
607 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e380ac_v1_leds_gpio
),
608 cf_e380ac_v1_leds_gpio
);
611 MIPS_MACHINE(ATH79_MACH_CF_E380AC_V1
, "CF-E380AC-V1", "COMFAST CF-E380AC v1",
614 static void __init
cf_e380ac_v2_setup(void)
616 cf_e380ac_v1v2_common_setup(0x40000);
618 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e380ac_v2_leds_gpio
),
619 cf_e380ac_v2_leds_gpio
);
622 MIPS_MACHINE(ATH79_MACH_CF_E380AC_V2
, "CF-E380AC-V2", "COMFAST CF-E380AC v2",
625 static void __init
cf_e5x0n_gpio_setup(void)
627 ath79_gpio_direction_select(CF_E5X0N_GPIO_LED_WAN
, true);
629 ath79_gpio_output_select(CF_E5X0N_GPIO_LED_WAN
, 0);
631 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
632 ARRAY_SIZE(cf_e320n_v2_gpio_keys
),
633 cf_e320n_v2_gpio_keys
);
636 static void __init
cf_e520n_setup(void)
638 cf_exxxn_common_setup(0x10000, -1);
640 cf_exxxn_qca953x_eth_setup();
642 cf_e5x0n_gpio_setup();
644 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e520n_leds_gpio
),
648 MIPS_MACHINE(ATH79_MACH_CF_E520N
, "CF-E520N", "COMFAST CF-E520N",
651 static void __init
cf_e530n_setup(void)
653 cf_exxxn_common_setup(0x10000, -1);
655 cf_exxxn_qca953x_eth_setup();
657 cf_e5x0n_gpio_setup();
659 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e530n_leds_gpio
),
663 MIPS_MACHINE(ATH79_MACH_CF_E530N
, "CF-E530N", "COMFAST CF-E530N",