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-E385AC (QCA9558 + QCA9984 + QCA8337)
10 * - CF-E520N/CF-E530N (QCA9531)
12 * Copyright (C) 2016 Piotr Dymacz <pepe2k@gmail.com>
13 * Copyright (C) 2016 Gareth Parker <gareth41@orcon.net.nz>
14 * Copyright (C) 2015 Paul Fertser <fercerpav@gmail.com>
16 * This program is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License version 2 as published
18 * by the Free Software Foundation.
21 #include <linux/gpio.h>
22 #include <linux/ar8216_platform.h>
23 #include <linux/platform_data/phy-at803x.h>
24 #include <linux/platform_device.h>
25 #include <linux/timer.h>
27 #include <asm/mach-ath79/ath79.h>
28 #include <asm/mach-ath79/ar71xx_regs.h>
31 #include "dev-ap9x-pci.h"
33 #include "dev-gpio-buttons.h"
34 #include "dev-leds-gpio.h"
35 #include "dev-m25p80.h"
38 #include "machtypes.h"
41 #define CF_EXXXN_KEYS_POLL_INTERVAL 20
42 #define CF_EXXXN_KEYS_DEBOUNCE_INTERVAL (3 * CF_EXXXN_KEYS_POLL_INTERVAL)
45 #define CF_E316N_V2_GPIO_LED_DIAG_B 0
46 #define CF_E316N_V2_GPIO_LED_DIAG_R 2
47 #define CF_E316N_V2_GPIO_LED_DIAG_G 3
48 #define CF_E316N_V2_GPIO_LED_WLAN 12
49 #define CF_E316N_V2_GPIO_LED_WAN 17
50 #define CF_E316N_V2_GPIO_LED_LAN 19
52 #define CF_E316N_V2_GPIO_EXT_WDT 16
54 #define CF_E316N_V2_GPIO_EXTERNAL_PA0 13
55 #define CF_E316N_V2_GPIO_EXTERNAL_PA1 14
57 #define CF_E316N_V2_GPIO_BTN_RESET 20
59 static struct gpio_led cf_e316n_v2_leds_gpio
[] __initdata
= {
61 .name
= "cf-e316n-v2:blue:diag",
62 .gpio
= CF_E316N_V2_GPIO_LED_DIAG_B
,
65 .name
= "cf-e316n-v2:red:diag",
66 .gpio
= CF_E316N_V2_GPIO_LED_DIAG_R
,
69 .name
= "cf-e316n-v2:green:diag",
70 .gpio
= CF_E316N_V2_GPIO_LED_DIAG_G
,
73 .name
= "cf-e316n-v2:blue:wlan",
74 .gpio
= CF_E316N_V2_GPIO_LED_WLAN
,
77 .name
= "cf-e316n-v2:blue:wan",
78 .gpio
= CF_E316N_V2_GPIO_LED_WAN
,
81 .name
= "cf-e316n-v2:blue:lan",
82 .gpio
= CF_E316N_V2_GPIO_LED_LAN
,
87 static struct gpio_keys_button cf_e316n_v2_gpio_keys
[] __initdata
= {
92 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
93 .gpio
= CF_E316N_V2_GPIO_BTN_RESET
,
99 #define CF_E320N_V2_GPIO_LED_WLAN 0
100 #define CF_E320N_V2_GPIO_LED_WAN 2
101 #define CF_E320N_V2_GPIO_LED_LAN 3
103 #define CF_E320N_V2_GPIO_HEADER_J9_1 14
104 #define CF_E320N_V2_GPIO_HEADER_J9_2 12
105 #define CF_E320N_V2_GPIO_HEADER_J9_3 11
106 #define CF_E320N_V2_GPIO_HEADER_J9_4 16
108 #define CF_E320N_V2_GPIO_EXT_WDT 13
110 #define CF_E320N_V2_GPIO_BTN_RESET 17
112 static struct gpio_led cf_e320n_v2_leds_gpio
[] __initdata
= {
114 .name
= "cf-e320n-v2:green:lan",
115 .gpio
= CF_E320N_V2_GPIO_LED_LAN
,
118 .name
= "cf-e320n-v2:red:wan",
119 .gpio
= CF_E320N_V2_GPIO_LED_WAN
,
122 .name
= "cf-e320n-v2:blue:wlan",
123 .gpio
= CF_E320N_V2_GPIO_LED_WLAN
,
128 static struct gpio_keys_button cf_e320n_v2_gpio_keys
[] __initdata
= {
130 .desc
= "Reset button",
133 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
134 .gpio
= CF_E320N_V2_GPIO_BTN_RESET
,
139 /* CF-E355AC v1/v2 */
140 #define CF_E355AC_GPIO_LED_LAN 3
141 #define CF_E355AC_GPIO_LED_WLAN2G 0
142 #define CF_E355AC_GPIO_LED_WLAN5G 2
144 #define CF_E355AC_GPIO_EXT_WDT 13
146 #define CF_E355AC_GPIO_BTN_RESET 17
148 static struct gpio_led cf_e355ac_v1_leds_gpio
[] __initdata
= {
150 .name
= "cf-e355ac-v1:green:lan",
151 .gpio
= CF_E355AC_GPIO_LED_LAN
,
154 .name
= "cf-e355ac-v1:blue:wlan2g",
155 .gpio
= CF_E355AC_GPIO_LED_WLAN2G
,
158 .name
= "cf-e355ac-v1:red:wlan5g",
159 .gpio
= CF_E355AC_GPIO_LED_WLAN5G
,
164 static struct gpio_led cf_e355ac_v2_leds_gpio
[] __initdata
= {
166 .name
= "cf-e355ac-v2:green:lan",
167 .gpio
= CF_E355AC_GPIO_LED_LAN
,
170 .name
= "cf-e355ac-v2:blue:wlan2g",
171 .gpio
= CF_E355AC_GPIO_LED_WLAN2G
,
174 .name
= "cf-e355ac-v2:red:wlan5g",
175 .gpio
= CF_E355AC_GPIO_LED_WLAN5G
,
180 static struct gpio_keys_button cf_e355ac_gpio_keys
[] __initdata
= {
182 .desc
= "Reset button",
185 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
186 .gpio
= CF_E355AC_GPIO_BTN_RESET
,
192 #define CF_E375AC_GPIO_LED_LAN 17
193 #define CF_E375AC_GPIO_LED_WLAN2G 16
194 #define CF_E375AC_GPIO_LED_WLAN5G 15
196 #define CF_E375AC_GPIO_EXT_WDT 6
198 #define CF_E375AC_GPIO_BTN_RESET 2
200 static struct gpio_led cf_e375ac_leds_gpio
[] __initdata
= {
202 .name
= "cf-e375ac:green:lan",
203 .gpio
= CF_E375AC_GPIO_LED_LAN
,
206 .name
= "cf-e375ac:red:wlan5g",
207 .gpio
= CF_E375AC_GPIO_LED_WLAN5G
,
210 .name
= "cf-e375ac:blue:wlan2g",
211 .gpio
= CF_E375AC_GPIO_LED_WLAN2G
,
216 static struct gpio_keys_button cf_e375ac_gpio_keys
[] __initdata
= {
218 .desc
= "Reset button",
221 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
222 .gpio
= CF_E375AC_GPIO_BTN_RESET
,
227 static struct ar8327_pad_cfg cf_e375ac_ar8337_pad0_cfg
= {
228 .mode
= AR8327_PAD_MAC_SGMII
,
229 .sgmii_delay_en
= true,
232 static struct ar8327_platform_data cf_e375ac_ar8337_data
= {
233 .pad0_cfg
= &cf_e375ac_ar8337_pad0_cfg
,
236 .speed
= AR8327_PORT_SPEED_1000
,
243 static struct mdio_board_info cf_e375ac_mdio0_info
[] = {
245 .bus_id
= "ag71xx-mdio.0",
247 .platform_data
= &cf_e375ac_ar8337_data
,
251 /* CF-E380AC v1/v2, CF-E385AC */
252 #define CF_E38XAC_GPIO_LED_LAN 0
253 #define CF_E38XAC_GPIO_LED_WLAN2G 2
254 #define CF_E38XAC_GPIO_LED_WLAN5G 3
256 #define CF_E38XAC_GPIO_EXT_WDT 17
258 #define CF_E38XAC_GPIO_BTN_RESET 19
260 static struct gpio_led cf_e380ac_v1_leds_gpio
[] __initdata
= {
262 .name
= "cf-e380ac-v1:green:lan",
263 .gpio
= CF_E38XAC_GPIO_LED_LAN
,
266 .name
= "cf-e380ac-v1:blue:wlan2g",
267 .gpio
= CF_E38XAC_GPIO_LED_WLAN2G
,
270 .name
= "cf-e380ac-v1:red:wlan5g",
271 .gpio
= CF_E38XAC_GPIO_LED_WLAN5G
,
276 static struct gpio_led cf_e380ac_v2_leds_gpio
[] __initdata
= {
278 .name
= "cf-e380ac-v2:green:lan",
279 .gpio
= CF_E38XAC_GPIO_LED_LAN
,
282 .name
= "cf-e380ac-v2:blue:wlan2g",
283 .gpio
= CF_E38XAC_GPIO_LED_WLAN2G
,
286 .name
= "cf-e380ac-v2:red:wlan5g",
287 .gpio
= CF_E38XAC_GPIO_LED_WLAN5G
,
292 static struct gpio_led cf_e385ac_leds_gpio
[] __initdata
= {
294 .name
= "cf-e385ac:green:lan",
295 .gpio
= CF_E38XAC_GPIO_LED_LAN
,
298 .name
= "cf-e385ac:blue:wlan2g",
299 .gpio
= CF_E38XAC_GPIO_LED_WLAN2G
,
302 .name
= "cf-e385ac:red:wlan5g",
303 .gpio
= CF_E38XAC_GPIO_LED_WLAN5G
,
308 static struct gpio_keys_button cf_e38xac_gpio_keys
[] __initdata
= {
310 .desc
= "Reset button",
313 .debounce_interval
= CF_EXXXN_KEYS_DEBOUNCE_INTERVAL
,
314 .gpio
= CF_E38XAC_GPIO_BTN_RESET
,
319 static struct at803x_platform_data cf_e380ac_v1v2_at803x_data
= {
320 .disable_smarteee
= 1,
323 static struct mdio_board_info cf_e380ac_v1v2_mdio0_info
[] = {
325 .bus_id
= "ag71xx-mdio.0",
327 .platform_data
= &cf_e380ac_v1v2_at803x_data
,
331 /* CF-E520N/CF-E530N */
332 #define CF_E5X0N_GPIO_LED_WAN 11
333 #define CF_E5X0N_GPIO_BTN_RESET 17
335 static struct gpio_led cf_e520n_leds_gpio
[] __initdata
= {
337 .name
= "cf-e520n:blue:wan",
338 .gpio
= CF_E5X0N_GPIO_LED_WAN
,
343 static struct gpio_led cf_e530n_leds_gpio
[] __initdata
= {
345 .name
= "cf-e530n:blue:wan",
346 .gpio
= CF_E5X0N_GPIO_LED_WAN
,
352 * Some COMFAST devices include external hardware watchdog chip,
353 * Pericon Technology PT7A7514, connected to a selected GPIO
354 * and WiSoC RESET_L input. Watchdog time-out is ~1.6 s.
356 #define CF_EXXXN_EXT_WDT_TIMEOUT_MS 500
358 static struct timer_list gpio_wdt_timer
;
360 static void gpio_wdt_toggle(unsigned long gpio
)
365 gpio_set_value(gpio
, state
);
367 mod_timer(&gpio_wdt_timer
,
368 jiffies
+ msecs_to_jiffies(CF_EXXXN_EXT_WDT_TIMEOUT_MS
));
371 static void __init
cf_exxxn_common_setup(unsigned long art_ofs
, int gpio_wdt
)
373 u8
*art
= (u8
*) KSEG1ADDR(0x1f001000 + art_ofs
);
376 gpio_request_one(gpio_wdt
, GPIOF_OUT_INIT_HIGH
,
377 "PT7A7514 watchdog");
379 setup_timer(&gpio_wdt_timer
, gpio_wdt_toggle
, gpio_wdt
);
380 gpio_wdt_toggle(gpio_wdt
);
383 ath79_register_m25p80(NULL
);
385 ath79_register_wmac(art
, NULL
);
387 ath79_register_usb();
390 static void __init
cf_e316n_v2_setup(void)
392 u8
*mac
= (u8
*) KSEG1ADDR(0x1f010000);
394 cf_exxxn_common_setup(0x10000, CF_E316N_V2_GPIO_EXT_WDT
);
396 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP
);
398 ath79_register_mdio(1, 0x0);
400 /* GMAC0 is connected to the PHY0 of the internal switch */
401 ath79_switch_data
.phy4_mii_en
= 1;
402 ath79_switch_data
.phy_poll_mask
= BIT(0);
403 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
404 ath79_eth0_data
.phy_mask
= BIT(0);
405 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
406 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
407 ath79_register_eth(0);
409 /* GMAC1 is connected to the internal switch */
410 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
411 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 2);
412 ath79_register_eth(1);
414 /* Enable 2x Skyworks SE2576L WLAN power amplifiers */
415 gpio_request_one(CF_E316N_V2_GPIO_EXTERNAL_PA0
, GPIOF_OUT_INIT_HIGH
,
417 gpio_request_one(CF_E316N_V2_GPIO_EXTERNAL_PA1
, GPIOF_OUT_INIT_HIGH
,
420 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e316n_v2_leds_gpio
),
421 cf_e316n_v2_leds_gpio
);
423 ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL
,
424 ARRAY_SIZE(cf_e316n_v2_gpio_keys
),
425 cf_e316n_v2_gpio_keys
);
428 MIPS_MACHINE(ATH79_MACH_CF_E316N_V2
, "CF-E316N-V2", "COMFAST CF-E316N v2",
431 static void __init
cf_exxxn_qca953x_eth_setup(void)
433 u8
*mac
= (u8
*) KSEG1ADDR(0x1f010000);
435 ath79_setup_ar933x_phy4_switch(false, false);
437 ath79_register_mdio(0, 0x0);
439 ath79_switch_data
.phy4_mii_en
= 1;
440 ath79_switch_data
.phy_poll_mask
|= BIT(4);
443 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
444 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
445 ath79_eth1_data
.speed
= SPEED_1000
;
446 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 2);
447 ath79_register_eth(1);
450 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
451 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
452 ath79_eth0_data
.speed
= SPEED_100
;
453 ath79_eth0_data
.phy_mask
= BIT(4);
454 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
455 ath79_register_eth(0);
458 static void __init
cf_e320n_v2_setup(void)
460 cf_exxxn_common_setup(0x10000, CF_E320N_V2_GPIO_EXT_WDT
);
462 cf_exxxn_qca953x_eth_setup();
464 /* Disable JTAG (enables GPIO0-3) */
465 ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE
);
467 ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_LAN
, true);
468 ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WAN
, true);
469 ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WLAN
, true);
471 ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_LAN
, 0);
472 ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WAN
, 0);
473 ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WLAN
, 0);
475 /* Enable GPIO function for GPIOs in J9 header */
476 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_1
, 0);
477 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_2
, 0);
478 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_3
, 0);
479 ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_4
, 0);
481 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e320n_v2_leds_gpio
),
482 cf_e320n_v2_leds_gpio
);
484 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
485 ARRAY_SIZE(cf_e320n_v2_gpio_keys
),
486 cf_e320n_v2_gpio_keys
);
489 MIPS_MACHINE(ATH79_MACH_CF_E320N_V2
, "CF-E320N-V2", "COMFAST CF-E320N v2",
492 static void __init
cf_e355ac_setup(void)
494 u8
*art
= (u8
*) KSEG1ADDR(0x1f010000);
496 /* Disable JTAG, enabling GPIOs 0-3 */
497 ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE
, 0);
499 cf_exxxn_common_setup(0x10000, CF_E355AC_GPIO_EXT_WDT
);
501 cf_exxxn_qca953x_eth_setup();
503 ath79_gpio_output_select(CF_E355AC_GPIO_LED_LAN
, 0);
504 ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN2G
, 0);
505 ath79_gpio_output_select(CF_E355AC_GPIO_LED_WLAN5G
, 0);
507 ap91_pci_init(art
+ 0x5000, NULL
);
509 ath79_register_gpio_keys_polled(1, CF_EXXXN_KEYS_POLL_INTERVAL
,
510 ARRAY_SIZE(cf_e355ac_gpio_keys
),
511 cf_e355ac_gpio_keys
);
514 static void __init
cf_e355ac_v1_setup(void)
518 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_v1_leds_gpio
),
519 cf_e355ac_v1_leds_gpio
);
522 static void __init
cf_e355ac_v2_setup(void)
526 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e355ac_v2_leds_gpio
),
527 cf_e355ac_v2_leds_gpio
);
530 MIPS_MACHINE(ATH79_MACH_CF_E355AC
, "CF-E355AC-V1", "COMFAST CF-E355AC v1",
533 MIPS_MACHINE(ATH79_MACH_CF_E355AC_V2
, "CF-E355AC-V2", "COMFAST CF-E355AC v2",
536 static void __init
cf_e375ac_setup(void)
538 u8
*mac
= (u8
*) KSEG1ADDR(0x1f040000);
540 /* Disable JTAG, enabling GPIOs 0-3 */
541 ath79_gpio_function_setup(AR934X_GPIO_FUNC_JTAG_DISABLE
, 0);
543 cf_exxxn_common_setup(0x40000, CF_E375AC_GPIO_EXT_WDT
);
545 ath79_gpio_output_select(CF_E375AC_GPIO_LED_LAN
, 0);
546 ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN2G
, 0);
547 ath79_gpio_output_select(CF_E375AC_GPIO_LED_WLAN5G
, 0);
549 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e375ac_leds_gpio
),
550 cf_e375ac_leds_gpio
);
552 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
553 ARRAY_SIZE(cf_e375ac_gpio_keys
),
554 cf_e375ac_gpio_keys
);
556 platform_device_register(&ath79_mdio0_device
);
558 mdiobus_register_board_info(cf_e375ac_mdio0_info
,
559 ARRAY_SIZE(cf_e375ac_mdio0_info
));
561 /* GMAC0 is connected to an AR8337 switch */
562 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_SGMII
;
563 ath79_eth0_data
.speed
= SPEED_1000
;
564 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
565 ath79_eth0_data
.phy_mask
= BIT(0);
566 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
567 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
568 ath79_register_eth(0);
570 ath79_register_pci();
573 MIPS_MACHINE(ATH79_MACH_CF_E375AC
, "CF-E375AC", "COMFAST CF-E375AC",
576 static void __init
cf_e38xac_common_setup(unsigned long art_ofs
)
578 cf_exxxn_common_setup(art_ofs
, CF_E38XAC_GPIO_EXT_WDT
);
580 ath79_register_pci();
582 /* Disable JTAG (enables GPIO0-3) */
583 ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE
);
585 ath79_gpio_direction_select(CF_E38XAC_GPIO_LED_LAN
, true);
586 ath79_gpio_direction_select(CF_E38XAC_GPIO_LED_WLAN2G
, true);
587 ath79_gpio_direction_select(CF_E38XAC_GPIO_LED_WLAN5G
, true);
589 ath79_gpio_output_select(CF_E38XAC_GPIO_LED_LAN
, 0);
590 ath79_gpio_output_select(CF_E38XAC_GPIO_LED_WLAN2G
, 0);
591 ath79_gpio_output_select(CF_E38XAC_GPIO_LED_WLAN5G
, 0);
594 ath79_gpio_function_disable(AR934X_GPIO_FUNC_CLK_OBS4_EN
);
596 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
597 ARRAY_SIZE(cf_e38xac_gpio_keys
),
598 cf_e38xac_gpio_keys
);
601 static void __init
cf_e380ac_v1v2_common_setup(unsigned long art_ofs
)
603 u8
*mac
= (u8
*) KSEG1ADDR(0x1f000000 + art_ofs
);
605 cf_e38xac_common_setup(art_ofs
);
607 ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN
);
609 ath79_register_mdio(0, 0x0);
610 mdiobus_register_board_info(cf_e380ac_v1v2_mdio0_info
,
611 ARRAY_SIZE(cf_e380ac_v1v2_mdio0_info
));
614 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
615 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
616 ath79_eth0_data
.phy_mask
= BIT(0);
617 ath79_eth0_pll_data
.pll_1000
= 0xbe000000;
618 ath79_eth0_pll_data
.pll_100
= 0xb0000101;
619 ath79_eth0_pll_data
.pll_10
= 0xb0001313;
620 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
621 ath79_register_eth(0);
624 static void __init
cf_e380ac_v1_setup(void)
626 cf_e380ac_v1v2_common_setup(0x20000);
628 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e380ac_v1_leds_gpio
),
629 cf_e380ac_v1_leds_gpio
);
632 MIPS_MACHINE(ATH79_MACH_CF_E380AC_V1
, "CF-E380AC-V1", "COMFAST CF-E380AC v1",
635 static void __init
cf_e380ac_v2_setup(void)
637 cf_e380ac_v1v2_common_setup(0x40000);
639 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e380ac_v2_leds_gpio
),
640 cf_e380ac_v2_leds_gpio
);
643 MIPS_MACHINE(ATH79_MACH_CF_E380AC_V2
, "CF-E380AC-V2", "COMFAST CF-E380AC v2",
646 /* QCA8337 GMAC0 is connected with QCA9558 over RGMII */
647 static struct ar8327_pad_cfg cf_e385ac_qca8337_pad0_cfg
= {
648 .mode
= AR8327_PAD_MAC_RGMII
,
649 .txclk_delay_en
= true,
650 .rxclk_delay_en
= true,
651 .txclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
652 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
655 /* QCA8337 GMAC6 is connected with QCA9558 over SGMII */
656 static struct ar8327_pad_cfg cf_e385ac_qca8337_pad6_cfg
= {
657 .mode
= AR8327_PAD_MAC_SGMII
,
658 .sgmii_delay_en
= true,
659 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL0
,
662 static struct ar8327_platform_data cf_e385ac_qca8337_data
= {
663 .pad0_cfg
= &cf_e385ac_qca8337_pad0_cfg
,
664 .pad6_cfg
= &cf_e385ac_qca8337_pad6_cfg
,
667 .speed
= AR8327_PORT_SPEED_1000
,
674 .speed
= AR8327_PORT_SPEED_1000
,
681 static struct mdio_board_info cf_e385ac_mdio0_info
[] = {
683 .bus_id
= "ag71xx-mdio.0",
685 .platform_data
= &cf_e385ac_qca8337_data
,
689 static void __init
cf_e385ac_setup(void)
691 u8
*mac
= (u8
*) KSEG1ADDR(0x1f040000);
693 cf_e38xac_common_setup(0x40000);
695 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e385ac_leds_gpio
),
696 cf_e385ac_leds_gpio
);
698 mdiobus_register_board_info(cf_e385ac_mdio0_info
,
699 ARRAY_SIZE(cf_e385ac_mdio0_info
));
700 ath79_register_mdio(0, 0x0);
702 ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN
);
704 /* QCA9558 GMAC0 is connected to RMGII interface */
705 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
706 ath79_eth0_data
.phy_mask
= BIT(0);
707 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
708 ath79_eth0_pll_data
.pll_1000
= 0x96000000;
710 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
711 ath79_register_eth(0);
713 /* QCA9558 GMAC1 is connected to SGMII interface */
714 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_SGMII
;
715 ath79_eth1_data
.speed
= SPEED_1000
;
716 ath79_eth1_data
.duplex
= DUPLEX_FULL
;
717 ath79_eth1_pll_data
.pll_1000
= 0x03000101;
719 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 1);
720 ath79_register_eth(1);
723 MIPS_MACHINE(ATH79_MACH_CF_E385AC
, "CF-E385AC", "COMFAST CF-E385AC",
726 static void __init
cf_e5x0n_gpio_setup(void)
728 ath79_gpio_direction_select(CF_E5X0N_GPIO_LED_WAN
, true);
730 ath79_gpio_output_select(CF_E5X0N_GPIO_LED_WAN
, 0);
732 ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL
,
733 ARRAY_SIZE(cf_e320n_v2_gpio_keys
),
734 cf_e320n_v2_gpio_keys
);
737 static void __init
cf_e520n_setup(void)
739 cf_exxxn_common_setup(0x10000, -1);
741 cf_exxxn_qca953x_eth_setup();
743 cf_e5x0n_gpio_setup();
745 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e520n_leds_gpio
),
749 MIPS_MACHINE(ATH79_MACH_CF_E520N
, "CF-E520N", "COMFAST CF-E520N",
752 static void __init
cf_e530n_setup(void)
754 cf_exxxn_common_setup(0x10000, -1);
756 cf_exxxn_qca953x_eth_setup();
758 cf_e5x0n_gpio_setup();
760 ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e530n_leds_gpio
),
764 MIPS_MACHINE(ATH79_MACH_CF_E530N
, "CF-E530N", "COMFAST CF-E530N",