2 * Qxwlan E750A v4 board support
4 * Copyright (C) 2017 Peng Zhang <sd20@qxwlan.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/phy.h>
12 #include <linux/gpio.h>
13 #include <linux/platform_device.h>
14 #include <linux/ath9k_platform.h>
15 #include <linux/ar8216_platform.h>
17 #include <asm/mach-ath79/ar71xx_regs.h>
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23 #include "dev-m25p80.h"
26 #include "machtypes.h"
29 #define E750A_V4_GPIO_LED_SYS 14
30 #define E750A_V4_GPIO_LED_LAN 19
31 #define E750A_V4_GPIO_LED_WAN 18
32 #define E750A_V4_GPIO_LED_DS10 15
33 #define E750A_V4_GPIO_LED_DS20 20
34 #define E750A_V4_GPIO_LED_WLAN 21
36 #define E750A_V4_GPIO_BTN_RESET 12
38 #define E750A_V4_KEYS_POLL_INTERVAL 20 /* msecs */
39 #define E750A_V4_KEYS_DEBOUNCE_INTERVAL (3 * E750A_V4_KEYS_POLL_INTERVAL)
41 static struct gpio_led e750a_v4_leds_gpio
[] __initdata
= {
43 .name
= "e750a-v4:green:system",
44 .gpio
= E750A_V4_GPIO_LED_SYS
,
48 .name
= "e750a-v4:green:lan",
49 .gpio
= E750A_V4_GPIO_LED_LAN
,
53 .name
= "e750a-v4:green:wan",
54 .gpio
= E750A_V4_GPIO_LED_WAN
,
58 .name
= "e750a-v4:green:wlan",
59 .gpio
= E750A_V4_GPIO_LED_WLAN
,
63 .name
= "e750a-v4:green:ds10",
64 .gpio
= E750A_V4_GPIO_LED_DS10
,
68 .name
= "e750a-v4:green:ds20",
69 .gpio
= E750A_V4_GPIO_LED_DS20
,
74 static struct gpio_keys_button e750a_v4_gpio_keys
[] __initdata
= {
79 .debounce_interval
= E750A_V4_KEYS_DEBOUNCE_INTERVAL
,
80 .gpio
= E750A_V4_GPIO_BTN_RESET
,
86 static void __init
e750a_v4_setup(void)
88 u8
*mac
= (u8
*) KSEG1ADDR(0x1f050400);
89 u8
*art
= (u8
*) KSEG1ADDR(0x1f061000);
91 ath79_register_m25p80(NULL
);
93 ath79_register_leds_gpio(-1, ARRAY_SIZE(e750a_v4_leds_gpio
),
95 ath79_register_gpio_keys_polled(-1, E750A_V4_KEYS_POLL_INTERVAL
,
96 ARRAY_SIZE(e750a_v4_gpio_keys
),
99 ath79_register_mdio(1, 0x0);
100 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE
);
102 /* GMAC1 is connected to the internal switch */
103 ath79_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
104 ath79_init_mac(ath79_eth1_data
.mac_addr
, mac
, 0);
105 ath79_register_eth(1);
107 /* GMAC0 is connected to the PHY4 of the internal switch */
108 ath79_switch_data
.phy4_mii_en
= 1;
109 ath79_switch_data
.phy_poll_mask
= BIT(4);
110 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_MII
;
111 ath79_eth0_data
.phy_mask
= BIT(4);
112 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio1_device
.dev
;
113 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 1);
114 ath79_register_eth(0);
116 ath79_register_pci();
117 ath79_register_usb();
118 ath79_register_wmac(art
, NULL
);
121 MIPS_MACHINE(ATH79_MACH_E750A_V4
, "E750A-V4", "Qxlan E750A v4",