Opennet Firmware
hardware_tplink_cpe510v2_v3.patch
gehe zur Dokumentation dieser Datei
1 The patch below was slightly adjusted in order to backport it to 19.07.
2 
3 commit cad4132e003cecc386d791d552ddba42c182c216
4 Author: Andrew Cameron <apcameron@softhome.net>
5 Date: Wed Jun 26 16:40:54 2019 -0500
6 
7  ath79: add support for TP-Link CPE510-v2/v3
8 
9  TP-Link CPE510-v2/v3 is an outdoor wireless CPE for 5 GHz with
10  one Ethernet port based on Atheros AR9344
11 
12  Specifications:
13  - Based on the same underlying hardware as the TP-Link CPE510
14  - Power, LAN, and 4 green LEDs
15  - 1 10/100Mbps Shielded Ethernet Port (Passive PoE in)
16  - Built-in 13dBi 2x2 dual-polarized directional MIMO antenna
17  - Adjustable transmission power from 0 to 23dBm/200mw
18 
19  Flashing instructions:
20  Flash factory image through stock firmware WEB UI
21  or through TFTP
22  To get to TFTP recovery just hold reset button while powering on for
23  around 4-5 seconds and release.
24  Rename factory image to recovery.bin
25  Stock TFTP server IP:192.168.0.100
26  Stock device TFTP adress:192.168.0.254
27 
28  Signed-off-by: Andrew Cameron <apcameron@softhome.net>
29  [whitespace fixes]
30  Signed-off-by: Petr Štetiar <ynezz@true.cz>
31 
32 diff --git a/openwrt/target/linux/ath79/base-files/etc/board.d/01_leds b/openwrt/target/linux/ath79/base-files/etc/board.d/01_leds
33 index 238dda18f6..0cb03db4be 100755
34 --- a/openwrt/target/linux/ath79/base-files/etc/board.d/01_leds
35 +++ b/openwrt/target/linux/ath79/base-files/etc/board.d/01_leds
36 @@ -155,6 +155,15 @@ tplink,cpe210-v3)
37  ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "60" "100"
38  ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "80" "100"
39  ;;
40 +tplink,cpe510-v2|\
41 +tplink,cpe510-v3)
42 + ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
43 + ucidef_set_rssimon "wlan0" "200000" "1"
44 + ucidef_set_led_rssi "rssilow" "RSSILOW" "tp-link:green:link1" "wlan0" "1" "100" "0" "13"
45 + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "tp-link:green:link2" "wlan0" "26" "100" "-25" "13"
46 + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "51" "100" "-50" "13"
47 + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "76" "100" "-75" "13"
48 + ;;
49  tplink,re450-v2)
50  ucidef_set_led_netdev "lan_data" "LAN Data" "tp-link:green:lan_data" "eth0" "tx rx"
51  ucidef_set_led_netdev "lan_link" "LAN Link" "tp-link:green:lan_link" "eth0" "link"
52 diff --git a/openwrt/target/linux/ath79/base-files/etc/board.d/02_network b/openwrt/target/linux/ath79/base-files/etc/board.d/02_network
53 index 2413b1f4bc..1d4cec025a 100755
54 --- a/openwrt/target/linux/ath79/base-files/etc/board.d/02_network
55 +++ b/openwrt/target/linux/ath79/base-files/etc/board.d/02_network
56 @@ -26,6 +26,8 @@ ath79_setup_interfaces()
57  pqi,air-pen|\
58  tplink,cpe210-v2|\
59  tplink,cpe210-v3|\
60 + tplink,cpe510-v2|\
61 + tplink,cpe510-v3|\
62  tplink,re350k-v1|\
63  tplink,re450-v2|\
64  tplink,tl-mr10u|\
65 diff --git a/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510-v2.dts b/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510-v2.dts
66 new file mode 100644
67 index 0000000000..758d0c02f0
68 --- /dev/null
69 +++ b/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510-v2.dts
70 @@ -0,0 +1,9 @@
71 +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
72 +/dts-v1/;
73 +
74 +#include "ar9344_tplink_cpe510.dtsi"
75 +
76 +/ {
77 + compatible = "tplink,cpe510-v2", "qca,ar9344";
78 + model = "TP-Link CPE510 v2";
79 +};
80 diff --git a/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510-v3.dts b/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510-v3.dts
81 new file mode 100644
82 index 0000000000..0909fcfa73
83 --- /dev/null
84 +++ b/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510-v3.dts
85 @@ -0,0 +1,9 @@
86 +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
87 +/dts-v1/;
88 +
89 +#include "ar9344_tplink_cpe510.dtsi"
90 +
91 +/ {
92 + compatible = "tplink,cpe510-v3", "qca,ar9344";
93 + model = "TP-Link CPE510 v3";
94 +};
95 diff --git a/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510.dtsi b/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510.dtsi
96 new file mode 100644
97 index 0000000000..f19ef01d49
98 --- /dev/null
99 +++ b/openwrt/target/linux/ath79/dts/ar9344_tplink_cpe510.dtsi
100 @@ -0,0 +1,152 @@
101 +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
102 +/dts-v1/;
103 +
104 +#include <dt-bindings/gpio/gpio.h>
105 +#include <dt-bindings/input/input.h>
106 +
107 +#include "ar9344.dtsi"
108 +
109 +/ {
110 + aliases {
111 + led-boot = &system;
112 + led-failsafe = &system;
113 + led-running = &system;
114 + led-upgrade = &system;
115 + };
116 +
117 + leds {
118 + compatible = "gpio-leds";
119 +
120 + lan {
121 + label = "tp-link:green:lan";
122 + gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
123 + };
124 +
125 + link1 {
126 + label = "tp-link:green:link1";
127 + gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
128 + };
129 +
130 + link2 {
131 + label = "tp-link:green:link2";
132 + gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
133 + };
134 +
135 + link3 {
136 + label = "tp-link:green:link3";
137 + gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
138 + };
139 +
140 + system: link4 {
141 + label = "tp-link:green:link4";
142 + gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
143 + };
144 + };
145 +
146 + keys {
147 + compatible = "gpio-keys";
148 +
149 + reset {
150 + linux,code = <KEY_RESTART>;
151 + gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
152 + debounce-interval = <60>;
153 + };
154 + };
155 +
156 +};
157 +
158 +&ref {
159 + clock-frequency = <40000000>;
160 +};
161 +
162 +&uart {
163 + status = "okay";
164 +};
165 +
166 +&spi {
167 + num-cs = <1>;
168 +
169 + status = "okay";
170 +
171 + flash@0 {
172 + compatible = "jedec,spi-nor";
173 + reg = <0>;
174 + spi-max-frequency = <25000000>;
175 +
176 + partitions {
177 + compatible = "fixed-partitions";
178 + #address-cells = <1>;
179 + #size-cells = <1>;
180 +
181 + uboot: partition@0 {
182 + label = "u-boot";
183 + reg = <0x000000 0x020000>;
184 + read-only;
185 + };
186 +
187 + partition@20000 {
188 + label = "partition-table";
189 + reg = <0x020000 0x010000>;
190 + read-only;
191 + };
192 +
193 + info: partition@30000 {
194 + label = "info";
195 + reg = <0x030000 0x010000>;
196 + read-only;
197 + };
198 +
199 + partition@40000 {
200 + label = "firmware";
201 + reg = <0x040000 0x780000>;
202 +
203 + compatible = "fixed-partitions";
204 + #address-cells = <1>;
205 + #size-cells = <1>;
206 +
207 + partition@0 {
208 + label = "kernel";
209 + reg = <0x000000 0x160000>;
210 + };
211 +
212 + partition@160000 {
213 + label = "rootfs";
214 + reg = <0x160000 0x5c0000>;
215 + };
216 + };
217 +
218 + partition@7c0000 {
219 + label = "config";
220 + reg = <0x7c0000 0x030000>;
221 + read-only;
222 + };
223 +
224 + art: partition@7f0000 {
225 + label = "art";
226 + reg = <0x7f0000 0x010000>;
227 + read-only;
228 + };
229 + };
230 + };
231 +};
232 +
233 +&wmac {
234 + status = "okay";
235 +
236 + mtd-cal-data = <&art 0x1000>;
237 + mtd-mac-address = <&info 0x08>;
238 +};
239 +
240 +&eth0 {
241 + status = "okay";
242 +
243 + mtd-mac-address = <&info 0x08>;
244 +
245 + phy-mode = "mii";
246 + phy-handle = <&swphy4>;
247 +};
248 +
249 +&eth1 {
250 + status = "okay";
251 + compatible = "syscon", "simple-mfd";
252 +};
253 diff --git a/openwrt/target/linux/ath79/image/generic-tp-link.mk b/openwrt/target/linux/ath79/image/generic-tp-link.mk
254 index f1424d02ee..312ce78f22 100644
255 --- a/openwrt/target/linux/ath79/image/generic-tp-link.mk
256 +++ b/openwrt/target/linux/ath79/image/generic-tp-link.mk
257 @@ -146,6 +146,38 @@ define Device/tplink_cpe210-v3
258  endef
259  TARGET_DEVICES += tplink_cpe210-v3
260 
261 +define Device/tplink_cpe510-v2
262 + $(Device/tplink-safeloader)
263 + ATH_SOC := ar9344
264 + IMAGE_SIZE := 7680k
265 + DEVICE_TITLE := TP-Link CPE510 v2
266 + DEVICE_PACKAGES := rssileds
267 + TPLINK_BOARD_ID := CPE510V2
268 + LOADER_TYPE := elf
269 + LOADER_FLASH_OFFS := 0x43000
270 + COMPILE := loader-$(1).elf
271 + COMPILE/loader-$(1).elf := loader-okli-compile
272 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 12288
273 + SUPPORTED_DEVICES += cpe510-v2
274 +endef
275 +TARGET_DEVICES += tplink_cpe510-v2
276 +
277 +define Device/tplink_cpe510-v3
278 + $(Device/tplink-safeloader)
279 + ATH_SOC := ar9344
280 + IMAGE_SIZE := 7680k
281 + DEVICE_TITLE := TP-Link CPE510 v3
282 + DEVICE_PACKAGES := rssileds
283 + TPLINK_BOARD_ID := CPE510V3
284 + LOADER_TYPE := elf
285 + LOADER_FLASH_OFFS := 0x43000
286 + COMPILE := loader-$(1).elf
287 + COMPILE/loader-$(1).elf := loader-okli-compile
288 + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1) 12288
289 + SUPPORTED_DEVICES += cpe510-v3
290 +endef
291 +TARGET_DEVICES += tplink_cpe510-v3
292 +
293  define Device/tplink_archer-d50-v1
294  ATH_SOC := qca9531
295  DEVICE_TITLE := TP-Link Archer D50 v1
296 diff --git a/openwrt/tools/firmware-utils/src/tplink-safeloader.c b/openwrt/tools/firmware-utils/src/tplink-safeloader.c
297 index 773e7ed26c..cfd3645950 100644
298 --- a/openwrt/tools/firmware-utils/src/tplink-safeloader.c
299 +++ b/openwrt/tools/firmware-utils/src/tplink-safeloader.c
300 @@ -317,6 +317,7 @@
301  .last_sysupgrade_partition = "support-list",
302  },
303 
304 +
305  /** Firmware layout for the CPE510 V2 */
306  {
307  .id = "CPE510V2",
308 @@ -344,8 +345,53 @@
309  {"default-mac", 0x30000, 0x00020},
310  {"product-info", 0x31100, 0x00100},
311  {"signature", 0x32000, 0x00400},
312 - {"os-image", 0x40000, 0x1c0000},
313 - {"file-system", 0x200000, 0x5b0000},
314 + {"os-image", 0x40000, 0x160000},
315 + {"file-system", 0x1a0000, 0x5c0000},
316 + {"soft-version", 0x7b0000, 0x00100},
317 + {"support-list", 0x7b1000, 0x00400},
318 + {"user-config", 0x7c0000, 0x10000},
319 + {"default-config", 0x7d0000, 0x10000},
320 + {"log", 0x7e0000, 0x10000},
321 + {"radio", 0x7f0000, 0x10000},
322 + {NULL, 0, 0}
323 + },
324 +
325 + .first_sysupgrade_partition = "os-image",
326 + .last_sysupgrade_partition = "support-list",
327 + },
328 +
329 + /** Firmware layout for the CPE510 V3 */
330 + {
331 + .id = "CPE510V3",
332 + .vendor = "CPE510(TP-LINK|UN|N300-5):3.0\r\n",
333 + .support_list =
334 + "SupportList:\r\n"
335 + "CPE510(TP-LINK|EU|N300-5|00000000):3.0\r\n"
336 + "CPE510(TP-LINK|EU|N300-5|45550000):3.0\r\n"
337 + "CPE510(TP-LINK|EU|N300-5|55530000):3.0\r\n"
338 + "CPE510(TP-LINK|UN|N300-5|00000000):3.0\r\n"
339 + "CPE510(TP-LINK|UN|N300-5|45550000):3.0\r\n"
340 + "CPE510(TP-LINK|UN|N300-5|55530000):3.0\r\n"
341 + "CPE510(TP-LINK|US|N300-5|00000000):3.0\r\n"
342 + "CPE510(TP-LINK|US|N300-5|45550000):3.0\r\n"
343 + "CPE510(TP-LINK|US|N300-5|55530000):3.0\r\n"
344 + "CPE510(TP-LINK|UN|N300-5):3.0\r\n"
345 + "CPE510(TP-LINK|EU|N300-5):3.0\r\n"
346 + "CPE510(TP-LINK|US|N300-5):3.0\r\n"
347 + "CPE510(TP-LINK|UN|N300-5|00000000):3.20\r\n"
348 + "CPE510(TP-LINK|US|N300-5|55530000):3.20\r\n"
349 + "CPE510(TP-LINK|EU|N300-5|45550000):3.20\r\n",
350 + .support_trail = '\xff',
351 + .soft_ver = NULL,
352 +
353 + .partitions = {
354 + {"fs-uboot", 0x00000, 0x20000},
355 + {"partition-table", 0x20000, 0x02000},
356 + {"default-mac", 0x30000, 0x00020},
357 + {"product-info", 0x31100, 0x00100},
358 + {"signature", 0x32000, 0x00400},
359 + {"os-image", 0x40000, 0x160000},
360 + {"file-system", 0x1a0000, 0x5c0000},
361  {"soft-version", 0x7b0000, 0x00100},
362  {"support-list", 0x7b1000, 0x00400},
363  {"user-config", 0x7c0000, 0x10000},