2 * Qxwlan E750G v8 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/platform_device.h>
13 #include <linux/ath9k_platform.h>
14 #include <linux/ar8216_platform.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
20 #include "dev-ap9x-pci.h"
21 #include "dev-gpio-buttons.h"
24 #include "dev-leds-gpio.h"
25 #include "dev-m25p80.h"
28 #include "machtypes.h"
30 #define E750G_V8_GPIO_LED_SYS 14
31 #define E750G_V8_GPIO_LED_DS20 15
32 #define E750G_V8_GPIO_LED_DS10 20
33 #define E750G_V8_GPIO_LED_WLAN 21
35 #define E750G_V8_GPIO_BTN_RESET 12
37 #define E750G_V8_KEYS_POLL_INTERVAL 20 /* msecs */
38 #define E750G_V8_KEYS_DEBOUNCE_INTERVAL (3 * E750G_V8_KEYS_POLL_INTERVAL)
40 static struct gpio_led e750g_v8_leds_gpio
[] __initdata
= {
42 .name
= "e750g-v8:green:system",
43 .gpio
= E750G_V8_GPIO_LED_SYS
,
47 .name
= "e750g-v8:green:ds10",
48 .gpio
= E750G_V8_GPIO_LED_DS10
,
52 .name
= "e750g-v8:green:ds20",
53 .gpio
= E750G_V8_GPIO_LED_DS20
,
57 .name
= "e750g-v8:green:wlan",
58 .gpio
= E750G_V8_GPIO_LED_WLAN
,
63 static struct gpio_keys_button e750g_v8_gpio_keys
[] __initdata
= {
68 .debounce_interval
= E750G_V8_KEYS_DEBOUNCE_INTERVAL
,
69 .gpio
= E750G_V8_GPIO_BTN_RESET
,
74 static const struct ar8327_led_info e750g_v8_leds_qca8334
[] = {
75 AR8327_LED_INFO(PHY1_0
, HW
, "e750g-v8:green:lan"),
76 AR8327_LED_INFO(PHY2_0
, HW
, "e750g-v8:green:wan"),
79 static struct ar8327_pad_cfg e750g_v8_ar8327_pad0_cfg
= {
80 .mode
= AR8327_PAD_MAC_RGMII
,
81 .txclk_delay_en
= true,
82 .rxclk_delay_en
= true,
83 .txclk_delay_sel
= AR8327_CLK_DELAY_SEL1
,
84 .rxclk_delay_sel
= AR8327_CLK_DELAY_SEL2
,
85 .mac06_exchange_dis
= true,
88 static struct ar8327_led_cfg e750g_v8_ar8327_led_cfg
= {
89 .led_ctrl0
= 0x00000000,
90 .led_ctrl1
= 0xc737c737,
91 .led_ctrl2
= 0x00000000,
92 .led_ctrl3
= 0x00c30c00,
96 static struct ar8327_platform_data e750g_v8_ar8327_data
= {
97 .pad0_cfg
= &e750g_v8_ar8327_pad0_cfg
,
100 .speed
= AR8327_PORT_SPEED_1000
,
105 .led_cfg
= &e750g_v8_ar8327_led_cfg
,
106 .leds
= e750g_v8_leds_qca8334
,
107 .num_leds
= ARRAY_SIZE(e750g_v8_leds_qca8334
),
110 static struct mdio_board_info e750g_v8_mdio0_info
[] = {
112 .bus_id
= "ag71xx-mdio.0",
114 .platform_data
= &e750g_v8_ar8327_data
,
118 static void __init
e750g_v8_setup(void)
120 u8
*mac
= (u8
*) KSEG1ADDR(0x1f050400);
121 u8
*art
= (u8
*) KSEG1ADDR(0x1f061000);
123 ath79_register_m25p80(NULL
);
124 ath79_register_leds_gpio(-1, ARRAY_SIZE(e750g_v8_leds_gpio
),
126 ath79_register_gpio_keys_polled(-1, E750G_V8_KEYS_POLL_INTERVAL
,
127 ARRAY_SIZE(e750g_v8_gpio_keys
),
130 mdiobus_register_board_info(e750g_v8_mdio0_info
,
131 ARRAY_SIZE(e750g_v8_mdio0_info
));
133 ath79_register_mdio(0, 0x0);
134 ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0
|
135 AR934X_ETH_CFG_SW_ONLY_MODE
);
137 /* GMAC0 is connected to an AR8327 switch */
138 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
139 ath79_eth0_data
.phy_mask
= BIT(0);
140 ath79_eth0_data
.mii_bus_dev
= &ath79_mdio0_device
.dev
;
141 ath79_eth0_pll_data
.pll_1000
= 0x06000000;
142 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
143 ath79_register_eth(0);
145 ath79_register_pci();
146 ath79_register_usb();
147 ath79_register_wmac(art
, NULL
);
150 MIPS_MACHINE(ATH79_MACH_E750G_V8
, "E750G-V8", "Qxwlan E750G v8",