summaryrefslogtreecommitdiffstats
path: root/master/kkmoon
blob: e0ee88552fc72506eba5879fdec673ea26073bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 75cccae..e87014f 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -48,6 +48,7 @@ ramips_setup_interfaces()
 	ht-tm02|\
 	microwrt|\
 	ncs601w|\
+	tp-c516w|\
 	w150m|\
 	wnce2001|\
 	zte-q7)
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 7fc6f29..3b2d04c 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -173,6 +173,9 @@ get_status_led() {
 	wsr-600)
 		status_led="$board:orange:diag"
 		;;
+	tp-c516w)
+		status_led="$board:green:camera"
+		;;
 	esac
 }
 
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/01_leds b/target/linux/ramips/base-files/etc/uci-defaults/01_leds
new file mode 100644
index 0000000..9a43eba
--- /dev/null
+++ b/target/linux/ramips/base-files/etc/uci-defaults/01_leds
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+. /lib/ramips.sh
+
+board=$(ramips_board_name)
+
+case "$board" in
+tp-c516w)
+	ucidef_set_led_netdev "lan" "LAN" "$board:orange:ethernet" "eth0"
+	;;
+esac
+
+ucidef_commit_leds
+
+exit 0
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index d242235..3261cef 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -259,6 +259,9 @@ ramips_board_detect() {
 	*"NCS601W")
 		name="ncs601w"
 		;;
+	*"TP-C516W")
+		name="tp-c516w"
+		;;
 	*"NW718")
 		name="nw718"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 2f6c624..059aae2 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -15,6 +15,8 @@ platform_check_image() {
 
 	case "$board" in
 	3g150b|\
+	ncs601w|\
+	tp-c516w|\
 	3g300m|\
 	3g-6200n|\
 	3g-6200nl|\
diff --git a/target/linux/ramips/dts/TP-C516W-16M.dts b/target/linux/ramips/dts/TP-C516W-16M.dts
new file mode 100644
index 0000000..61c1b23
--- /dev/null
+++ b/target/linux/ramips/dts/TP-C516W-16M.dts
@@ -0,0 +1,49 @@
+/dts-v1/;
+
+/include/ "rt5350.dtsi"
+
+/ {
+	compatible = "TP-C516W", "ralink,rt5350-soc";
+	model = "KKMoon TP-C516W";
+
+	palmbus@10000000 {
+		spi@b00 {
+			status = "okay";
+
+			m25p80@0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "s25sl12801";
+				reg = <0 0>;
+				linux,modalias = "m25p80", "s25sl12801";
+				spi-max-frequency = <10000000>;
+
+				partition@0 {
+					label = "u-boot";
+					reg = <0x0 0x30000>;
+					read-only;
+				};
+
+				partition@30000 {
+					label = "u-boot-env";
+					reg = <0x30000 0x10000>;
+					read-only;
+				};
+
+				factory: partition@40000 {
+					label = "factory";
+					reg = <0x40000 0x10000>;
+					read-only;
+				};
+
+				partition@50000 {
+					label = "firmware";
+					reg = <0x50000 0xfb0000>;
+				};
+			};
+		};
+	};
+
+/include/ "TP-C516W-common.dtsi"
+
+};
diff --git a/target/linux/ramips/dts/TP-C516W-8M.dts b/target/linux/ramips/dts/TP-C516W-8M.dts
new file mode 100644
index 0000000..d80b4d4
--- /dev/null
+++ b/target/linux/ramips/dts/TP-C516W-8M.dts
@@ -0,0 +1,49 @@
+/dts-v1/;
+
+/include/ "rt5350.dtsi"
+
+/ {
+	compatible = "TP-C516W", "ralink,rt5350-soc";
+	model = "KKMoon TP-C516W";
+
+	palmbus@10000000 {
+		spi@b00 {
+			status = "okay";
+
+			m25p80@0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "s25fl064k";
+				reg = <0 0>;
+				linux,modalias = "m25p80", "s25fl064k";
+				spi-max-frequency = <10000000>;
+
+				partition@0 {
+					label = "u-boot";
+					reg = <0x0 0x30000>;
+					read-only;
+				};
+
+				partition@30000 {
+					label = "u-boot-env";
+					reg = <0x30000 0x10000>;
+					read-only;
+				};
+
+				factory: partition@40000 {
+					label = "factory";
+					reg = <0x40000 0x10000>;
+					read-only;
+				};
+
+				partition@50000 {
+					label = "firmware";
+					reg = <0x50000 0x7b0000>;
+				};
+			};
+		};
+	};
+
+
+/include/ "TP-C516W-common.dtsi"
+};
diff --git a/target/linux/ramips/dts/TP-C516W-common.dtsi b/target/linux/ramips/dts/TP-C516W-common.dtsi
new file mode 100644
index 0000000..675f83a
--- /dev/null
+++ b/target/linux/ramips/dts/TP-C516W-common.dtsi
@@ -0,0 +1,81 @@
+/*Common definitions for TP-C516W */
+
+	palmbus@10000000 {
+		gpio1: gpio@660 {
+			status = "ok";
+		};
+
+		spi@b00 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&spi_pins>;
+		};
+
+	};
+
+	pinctrl {
+		state_default: pinctrl0 {
+			gpio {
+				ralink,group = "jtag", "rgmii", "mdio", "led", "spi_cs1", "uartf";
+				ralink,function = "gpio";
+			};
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		camera {
+			label = "tp-c516w:green:camera";
+			gpios = <&gpio0 12 0>;
+		};
+
+		wifi {
+			label = "tp-c516w:orange:ethernet";
+			gpios = <&gpio0 13 1>;
+		};
+
+		alarm_out  {
+			label = "tp-c516w::alarm_out";
+			gpios = <&gpio1 5 0>;
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 0 1>;
+			linux,code = <0x198>;
+		};
+
+		alarm_in {
+			label = "alarm_in";
+			gpios = <&gpio0 21 0>;
+		};
+	};
+
+
+	ethernet@10100000 {
+		mtd-mac-address = <&factory 0x4>;
+	};
+
+	esw@10110000 {
+		ralink,portmap = <0x2f>;
+	};
+
+	wmac@10180000 {
+		ralink,mtd-eeprom = <&factory 0>;
+	};
+
+	ehci@101c0000 {
+		status = "okay";
+	};
+
+	ohci@101c1000 {
+		status = "okay";
+	};
diff --git a/target/linux/ramips/dts/rt5350.dtsi b/target/linux/ramips/dts/rt5350.dtsi
index 5282e5b..22d0e36 100644
--- a/target/linux/ramips/dts/rt5350.dtsi
+++ b/target/linux/ramips/dts/rt5350.dtsi
@@ -119,6 +119,9 @@
 			compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio";
 			reg = <0x660 0x24>;
 
+			resets = <&rstctrl 13>;
+			reset-names = "pio";
+
 			interrupt-parent = <&intc>;
 			interrupts = <6>;
 
@@ -135,7 +138,7 @@
 		};
 
 		i2c@900 {
-			compatible = "link,rt5350-i2c", "ralink,rt2880-i2c";
+			compatible = "ralink,rt5350-i2c", "ralink,rt2880-i2c";
 			reg = <0x900 0x100>;
 
 			resets = <&rstctrl 16>;
@@ -150,6 +153,16 @@
 			status = "disabled";
 		};
 
+		i2s@a00 {
+			compatible = "ralink,rt5350-i2s";
+			reg = <0xa00 0x28>;
+
+			resets = <&rstctrl 17>;
+			reset-names = "i2s";
+
+			status = "disabled";
+		};
+
 		spi@b00 {
 			compatible = "ralink,rt5350-spi";
 			reg = <0xb00 0x100>;
@@ -189,6 +202,9 @@
 			interrupt-parent = <&cpuintc>;
 			interrupts = <7>;
 		};
+
+
+
 	};
 
 	pinctrl {
@@ -214,8 +230,8 @@
 			};
 		};
 
-		phy_led_pins: phy_led {
-			phy_led {
+		led_pins: led {
+			led {
 				ralink,group = "led";
 				ralink,function = "led";
 			};
@@ -241,6 +257,7 @@
 				ralink,function = "spi_cs1";
 			};
 		};
+
 	};
 
 	rstctrl: rstctrl {
@@ -309,4 +326,11 @@
 		interrupt-parent = <&intc>;
 		interrupts = <18>;
 	};
+
+	ephy {
+		compatible = "ralink,ephy";
+		
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_pins>;
+	};
 };
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index c24d220..c8c2cc1 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -193,6 +193,7 @@ BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(
 # $(4) = uImage header name field
 ralink_default_fw_size_8M=8060928
 BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
+BuildFirmware/Default8M/jffs2=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
 BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
 BuildFirmware/Tplink/squashfs=$(call BuildFirmware/OF/tplink,$(1),$(2),$(3),$(4))
 BuildFirmware/Tplink/initramfs=$(call BuildFirmware/OF/tplink/initramfs,$(1),$(2),$(3),$(4))
@@ -569,6 +570,17 @@ Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2
 
 Image/Build/Profile/NCS601W=$(call BuildFirmware/Default8M/$(1),$(1),ncs601W,NCS601W)
 
+define BuildFirmware/TP-C516W/squashfs
+	$(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M)
+	$(call BuildFirmware/Default16M/$(1),$(1),$(2)-16M,$(3)-16M)
+endef
+define BuildFirmware/TP-C516W/initramfs
+	$(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
+	$(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
+endef
+
+Image/Build/Profile/TP-C516W=$(call BuildFirmware/TP-C516W/$(1),$(1),tp-c516w,TP-C516W)
+
 nw718_mtd_size=3801088
 Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory)
 
@@ -742,6 +754,7 @@ define Image/Build/Profile/Default
 	$(call Image/Build/Profile/MZKW300NH2,$(1))
 	$(call Image/Build/Profile/NBG-419N,$(1))
 	$(call Image/Build/Profile/NCS601W,$(1))
+	$(call Image/Build/Profile/TP-C516W,$(1))
 	$(call Image/Build/Profile/NW718,$(1))
 	$(call Image/Build/Profile/MINIEMBWIFI,$(1))
 	$(call Image/Build/Profile/MINIEMBPLUG,$(1))
diff --git a/target/linux/ramips/patches-3.18/9997-alarm-out.patch b/target/linux/ramips/patches-3.18/9997-alarm-out.patch
new file mode 100644
index 0000000..64fb4fc
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/9997-alarm-out.patch
@@ -0,0 +1,16 @@
+Index: linux-3.18.21/drivers/pinctrl/pinctrl-rt2880.c
+===================================================================
+--- linux-3.18.21.orig/drivers/pinctrl/pinctrl-rt2880.c
++++ linux-3.18.21/drivers/pinctrl/pinctrl-rt2880.c
+@@ -372,6 +372,11 @@ static int rt2880_pinmux_pins(struct rt2
+ 	/* pin 0 is always a gpio */
+ 	p->gpio[0] = 1;
+ 
++        /* ditto pin 27 as we don't have a driver to represent spi_cs1
++         * so we can't get pinmux to export them otherwise */
++
++	p->gpio[27] = 1;
++
+ 	/* set the pads */
+ 	for (i = 0; i < p->max_pins; i++) {
+ 		/* strlen("ioXY") + 1 = 5 */
diff --git a/target/linux/ramips/patches-3.18/9997-rt5350-pinmux.patch b/target/linux/ramips/patches-3.18/9997-rt5350-pinmux.patch
new file mode 100644
index 0000000..d02829c
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/9997-rt5350-pinmux.patch
@@ -0,0 +1,18 @@
+Index: linux-3.18.21/arch/mips/ralink/rt305x.c
+===================================================================
+--- linux-3.18.21.orig/arch/mips/ralink/rt305x.c
++++ linux-3.18.21/arch/mips/ralink/rt305x.c
+@@ -35,7 +35,12 @@ static struct rt2880_pmx_func uartf_func
+ static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 15, 2) };
+ static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) };
+ static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) };
+-static struct rt2880_pmx_func rt5350_led_func[] = { FUNC("led", 0, 22, 5) };
++static struct rt2880_pmx_func rt5350_led_func[] = { 
++	FUNC("led", 0, 22, 5) ,
++	FUNC("gpio", 1, 22, 5) ,
++	FUNC("btmode", 2, 22, 5), 
++};
++
+ static struct rt2880_pmx_func rt5350_cs1_func[] = {
+ 	FUNC("spi_cs1", 0, 27, 1),
+ 	FUNC("wdg_cs1", 1, 27, 1),
diff --git a/target/linux/ramips/rt305x/profiles/kkmoon.mk b/target/linux/ramips/rt305x/profiles/kkmoon.mk
new file mode 100644
index 0000000..65ed584
--- /dev/null
+++ b/target/linux/ramips/rt305x/profiles/kkmoon.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/TP-C516W
+	NAME:=KKMoon TP-C516W
+	PACKAGES:=kmod-video-core kmod-video-uvc \
+		kmod-usb-core kmod-usb-ohci \
+		mjg-streamer
+endef
+
+define Profile/TP-C516W/Description
+	Package set for KKMoon TP-C516W board
+endef
+$(eval $(call Profile,TP-C516W))