OpenWrt – Blame information for rev 2

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /*
2 * TP-LINK TL-WA901ND v4, v5 board
3 *
4 * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
5 * Copyright (C) 2016 Tiziano Bacocco <tizbac2@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11  
12 #include <linux/gpio.h>
13 #include <linux/platform_device.h>
14  
15 #include <asm/mach-ath79/ath79.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
17  
18 #include "common.h"
19 #include "dev-eth.h"
20 #include "dev-gpio-buttons.h"
21 #include "dev-leds-gpio.h"
22 #include "dev-m25p80.h"
23 #include "dev-wmac.h"
24 #include "machtypes.h"
25  
26  
27 #define TL_WA901ND_V4_GPIO_LED_QSS 3
28 #define TL_WA901ND_V4_GPIO_LED_LAN 7
29 #define TL_WA901ND_V4_GPIO_LED_WLAN 8
30 #define TL_WA901ND_V4_GPIO_LED_SYSTEM 18
31  
32 #define TL_WA901ND_V4_GPIO_BTN_RESET 1
33  
34 #define TL_WA901ND_V4_KEYS_POLL_INTERVAL 20
35 #define TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL (3 * TL_WA901ND_V4_KEYS_POLL_INTERVAL)
36  
37  
38 static struct gpio_led TL_WA901ND_V4_leds_gpio[] __initdata = {
39 {
40 .name = "tp-link:green:qss",
41 .gpio = TL_WA901ND_V4_GPIO_LED_QSS,
42 .active_low = 1,
43 },
44 {
45 .name = "tp-link:green:lan",
46 .gpio = TL_WA901ND_V4_GPIO_LED_LAN,
47 .active_low = 1,
48 },
49 {
50 .name = "tp-link:green:wlan",
51 .gpio = TL_WA901ND_V4_GPIO_LED_WLAN,
52 .active_low = 1,
53 },
54 {
55 .name = "tp-link:green:system",
56 .gpio = TL_WA901ND_V4_GPIO_LED_SYSTEM,
57 .active_low = 1,
58 },
59 };
60  
61 static struct gpio_keys_button TL_WA901ND_V4_gpio_keys[] __initdata = {
62 {
63 .desc = "Reset button",
64 .type = EV_KEY,
65 .code = KEY_RESTART,
66 .debounce_interval = TL_WA901ND_V4_KEYS_DEBOUNCE_INTERVAL,
67 .gpio = TL_WA901ND_V4_GPIO_BTN_RESET,
68 .active_low = 1,
69 }
70 };
71  
72  
73 static const char *tl_wa901nd_v4_part_probes[] = {
74 "tp-link",
75 NULL,
76 };
77  
78 static struct flash_platform_data tl_wa901nd_v4_flash_data = {
79 .part_probes = tl_wa901nd_v4_part_probes,
80 };
81  
82  
83 static void __init TL_WA901ND_V4_setup(void)
84 {
85 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
86 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
87  
88 ath79_register_m25p80(&tl_wa901nd_v4_flash_data);
89  
90 ath79_register_leds_gpio(-1, ARRAY_SIZE(TL_WA901ND_V4_leds_gpio),
91 TL_WA901ND_V4_leds_gpio);
92  
93 ath79_register_gpio_keys_polled(-1, TL_WA901ND_V4_KEYS_POLL_INTERVAL,
94 ARRAY_SIZE(TL_WA901ND_V4_gpio_keys),
95 TL_WA901ND_V4_gpio_keys);
96  
97 ath79_register_mdio(0, 0x0);
98  
99 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
100 ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
101  
102 ath79_switch_data.phy4_mii_en = 1;
103  
104 ath79_register_eth(0);
105 ath79_register_eth(1);
106  
107 ath79_register_wmac(ee, mac);
108  
109 }
110  
111 MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V4, "TL-WA901ND-v4", "TP-LINK TL-WA901ND v4",
112 TL_WA901ND_V4_setup);
113  
114 MIPS_MACHINE(ATH79_MACH_TL_WA901ND_V5, "TL-WA901ND-v5", "TP-LINK TL-WA901ND v5",
115 TL_WA901ND_V4_setup);