2 * TP-Link Archer C60 v1 board support
4 * Copyright (C) 2016 Henryk Heisig <hyniu@o2.pl>
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.
10 #include <linux/platform_device.h>
11 #include <linux/ath9k_platform.h>
12 #include <linux/ar8216_platform.h>
13 #include <asm/mach-ath79/ar71xx_regs.h>
14 #include <linux/gpio.h>
17 #include "dev-m25p80.h"
18 #include "machtypes.h"
20 #include "dev-ap9x-pci.h"
22 #include "dev-gpio-buttons.h"
23 #include "dev-leds-gpio.h"
28 #define ARCHER_C60_V1_GPIO_LED_LAN 2
29 #define ARCHER_C60_V1_GPIO_LED_POWER 16
30 #define ARCHER_C60_V1_GPIO_LED_WLAN2 17
31 #define ARCHER_C60_V1_GPIO_LED_WLAN5 18
32 #define ARCHER_C60_V1_GPIO_LED_WPS 19
33 #define ARCHER_C60_V1_GPIO_LED_WAN_GREEN 20
34 #define ARCHER_C60_V1_GPIO_LED_WAN_AMBER 22
37 #define ARCHER_C60_V1_KEYS_POLL_INTERVAL 20
38 #define ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL (3 * ARCHER_C60_V1_KEYS_POLL_INTERVAL)
40 #define ARCHER_C60_V1_GPIO_BTN_RESET 21
41 #define ARCHER_C60_V1_GPIO_BTN_RFKILL 1
45 #define ARCHER_C60_V1_WMAC_CALDATA_OFFSET 0x1000
46 #define ARCHER_C60_V1_PCI_CALDATA_OFFSET 0x5000
48 static struct gpio_led archer_c60_v1_leds_gpio[] __initdata = {
50 .name = "archer-c60-v1:green:power",
51 .gpio = ARCHER_C60_V1_GPIO_LED_POWER,
55 .name = "archer-c60-v1:green:wlan2g",
56 .gpio = ARCHER_C60_V1_GPIO_LED_WLAN2,
60 .name = "archer-c60-v1:green:wlan5g",
61 .gpio = ARCHER_C60_V1_GPIO_LED_WLAN5,
65 .name = "archer-c60-v1:green:lan",
66 .gpio = ARCHER_C60_V1_GPIO_LED_LAN,
70 .name = "archer-c60-v1:green:wan",
71 .gpio = ARCHER_C60_V1_GPIO_LED_WAN_GREEN,
75 .name = "archer-c60-v1:amber:wan",
76 .gpio = ARCHER_C60_V1_GPIO_LED_WAN_AMBER,
80 .name = "archer-c60-v1:green:wps",
81 .gpio = ARCHER_C60_V1_GPIO_LED_WPS,
86 static struct gpio_keys_button archer_c60_v1_gpio_keys[] __initdata = {
88 .desc = "Reset button",
91 .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL,
92 .gpio = ARCHER_C60_V1_GPIO_BTN_RESET,
96 .desc = "RFKILL button",
99 .debounce_interval = ARCHER_C60_V1_KEYS_DEBOUNCE_INTERVAL,
100 .gpio = ARCHER_C60_V1_GPIO_BTN_RFKILL,
105 static void __init archer_c60_v1_setup(void)
107 u8 *mac = (u8 *) KSEG1ADDR(0x1f010008);
108 u8 *art = (u8 *) KSEG1ADDR(0x1f7f0000);
110 ath79_register_m25p80(NULL);
112 ath79_register_leds_gpio(-1, ARRAY_SIZE(archer_c60_v1_leds_gpio),
113 archer_c60_v1_leds_gpio);
115 ath79_register_gpio_keys_polled(-1, ARCHER_C60_V1_KEYS_POLL_INTERVAL,
116 ARRAY_SIZE(archer_c60_v1_gpio_keys),
117 archer_c60_v1_gpio_keys);
119 ath79_setup_qca956x_eth_cfg(QCA956X_ETH_CFG_SW_PHY_SWAP |
120 QCA956X_ETH_CFG_SW_PHY_ADDR_SWAP);
121 ath79_register_mdio(1, 0x0);
123 ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
125 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
126 ath79_eth1_data.speed = SPEED_1000;
127 ath79_eth1_data.duplex = DUPLEX_FULL;
128 ath79_register_eth(1);
130 ath79_register_wmac(art + ARCHER_C60_V1_WMAC_CALDATA_OFFSET, mac);
131 ap91_pci_init(art + ARCHER_C60_V1_PCI_CALDATA_OFFSET, NULL);
134 MIPS_MACHINE(ATH79_MACH_ARCHER_C60_V1, "ARCHER-C60-V1",
135 "TP-LINK Archer C60 v1", archer_c60_v1_setup);