OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * TP-LINK TL-WR1043N/ND board support |
||
3 | * |
||
4 | * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org> |
||
5 | * |
||
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. |
||
9 | */ |
||
10 | |||
11 | #include <linux/platform_device.h> |
||
12 | #include <linux/rtl8366.h> |
||
13 | |||
14 | #include <asm/mach-ath79/ath79.h> |
||
15 | #include <asm/mach-ath79/ar71xx_regs.h> |
||
16 | |||
17 | #include "dev-eth.h" |
||
18 | #include "dev-m25p80.h" |
||
19 | #include "dev-gpio-buttons.h" |
||
20 | #include "dev-leds-gpio.h" |
||
21 | #include "dev-usb.h" |
||
22 | #include "dev-wmac.h" |
||
23 | #include "machtypes.h" |
||
24 | |||
25 | #define TL_WR1043ND_GPIO_LED_USB 1 |
||
26 | #define TL_WR1043ND_GPIO_LED_SYSTEM 2 |
||
27 | #define TL_WR1043ND_GPIO_LED_QSS 5 |
||
28 | #define TL_WR1043ND_GPIO_LED_WLAN 9 |
||
29 | |||
30 | #define TL_WR1043ND_GPIO_BTN_RESET 3 |
||
31 | #define TL_WR1043ND_GPIO_BTN_QSS 7 |
||
32 | |||
33 | #define TL_WR1043ND_GPIO_RTL8366_SDA 18 |
||
34 | #define TL_WR1043ND_GPIO_RTL8366_SCK 19 |
||
35 | |||
36 | #define TL_WR1043ND_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
37 | #define TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043ND_KEYS_POLL_INTERVAL) |
||
38 | |||
39 | static const char *tl_wr1043nd_part_probes[] = { |
||
40 | "tp-link", |
||
41 | NULL, |
||
42 | }; |
||
43 | |||
44 | static struct flash_platform_data tl_wr1043nd_flash_data = { |
||
45 | .part_probes = tl_wr1043nd_part_probes, |
||
46 | }; |
||
47 | |||
48 | static struct gpio_led tl_wr1043nd_leds_gpio[] __initdata = { |
||
49 | { |
||
50 | .name = "tp-link:green:usb", |
||
51 | .gpio = TL_WR1043ND_GPIO_LED_USB, |
||
52 | .active_low = 1, |
||
53 | }, { |
||
54 | .name = "tp-link:green:system", |
||
55 | .gpio = TL_WR1043ND_GPIO_LED_SYSTEM, |
||
56 | .active_low = 1, |
||
57 | }, { |
||
58 | .name = "tp-link:green:qss", |
||
59 | .gpio = TL_WR1043ND_GPIO_LED_QSS, |
||
60 | .active_low = 0, |
||
61 | }, { |
||
62 | .name = "tp-link:green:wlan", |
||
63 | .gpio = TL_WR1043ND_GPIO_LED_WLAN, |
||
64 | .active_low = 1, |
||
65 | } |
||
66 | }; |
||
67 | |||
68 | static struct gpio_keys_button tl_wr1043nd_gpio_keys[] __initdata = { |
||
69 | { |
||
70 | .desc = "reset", |
||
71 | .type = EV_KEY, |
||
72 | .code = KEY_RESTART, |
||
73 | .debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL, |
||
74 | .gpio = TL_WR1043ND_GPIO_BTN_RESET, |
||
75 | .active_low = 1, |
||
76 | }, { |
||
77 | .desc = "qss", |
||
78 | .type = EV_KEY, |
||
79 | .code = KEY_WPS_BUTTON, |
||
80 | .debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL, |
||
81 | .gpio = TL_WR1043ND_GPIO_BTN_QSS, |
||
82 | .active_low = 1, |
||
83 | } |
||
84 | }; |
||
85 | |||
86 | static void tl_wr1043nd_rtl8366rb_hw_reset(bool active) |
||
87 | { |
||
88 | if (active) |
||
89 | ath79_device_reset_set(AR71XX_RESET_GE0_PHY); |
||
90 | else |
||
91 | ath79_device_reset_clear(AR71XX_RESET_GE0_PHY); |
||
92 | } |
||
93 | |||
94 | static struct rtl8366_platform_data tl_wr1043nd_rtl8366rb_data = { |
||
95 | .gpio_sda = TL_WR1043ND_GPIO_RTL8366_SDA, |
||
96 | .gpio_sck = TL_WR1043ND_GPIO_RTL8366_SCK, |
||
97 | .hw_reset = tl_wr1043nd_rtl8366rb_hw_reset, |
||
98 | }; |
||
99 | |||
100 | static struct platform_device tl_wr1043nd_rtl8366rb_device = { |
||
101 | .name = RTL8366RB_DRIVER_NAME, |
||
102 | .id = -1, |
||
103 | .dev = { |
||
104 | .platform_data = &tl_wr1043nd_rtl8366rb_data, |
||
105 | } |
||
106 | }; |
||
107 | |||
108 | static void __init tl_wr1043nd_setup(void) |
||
109 | { |
||
110 | u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); |
||
111 | u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000); |
||
112 | |||
113 | tl_wr1043nd_rtl8366rb_hw_reset(true); |
||
114 | |||
115 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
||
116 | ath79_eth0_data.mii_bus_dev = &tl_wr1043nd_rtl8366rb_device.dev; |
||
117 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
118 | ath79_eth0_data.speed = SPEED_1000; |
||
119 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
120 | ath79_eth0_pll_data.pll_1000 = 0x1a000000; |
||
121 | |||
122 | ath79_register_eth(0); |
||
123 | |||
124 | ath79_register_usb(); |
||
125 | |||
126 | ath79_register_m25p80(&tl_wr1043nd_flash_data); |
||
127 | |||
128 | ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_leds_gpio), |
||
129 | tl_wr1043nd_leds_gpio); |
||
130 | |||
131 | platform_device_register(&tl_wr1043nd_rtl8366rb_device); |
||
132 | |||
133 | ath79_register_gpio_keys_polled(-1, TL_WR1043ND_KEYS_POLL_INTERVAL, |
||
134 | ARRAY_SIZE(tl_wr1043nd_gpio_keys), |
||
135 | tl_wr1043nd_gpio_keys); |
||
136 | |||
137 | ath79_register_wmac(eeprom, mac); |
||
138 | } |
||
139 | |||
140 | MIPS_MACHINE(ATH79_MACH_TL_WR1043ND, "TL-WR1043ND", "TP-LINK TL-WR1043ND", |
||
141 | tl_wr1043nd_setup); |