aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/dts/mt7621_comfast_cf-ew72-v2.dts
blob: 8b7b4a035ea2d301625b9680cbd39bac13603698 (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
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

#include "mt7621.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "comfast,cf-ew72-v2", "mediatek,mt7621-soc";
	model = "COMFAST CF-EW72 V2";
	
	// There are at least two HW variants of cf-ew72-v2: 
	// With external RAM chip and with integrated RAM (RAM chip not soldered).
	// Both act same.

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
			debounce-interval = <60>;
		};
	};

	leds {
		compatible = "gpio-leds";

		// The only both visible and controllable indicator is wifi LED.
		// CF-EW72 have 8 LEDs: 
		//  "wlan" is the only LED is controllable with GPIO and have proper hole in shell.
		//  "power", "wan" and "lan" LEDs have proper holes in shell, but can not be controlled with GPIO
		//  "hidden_led_2" and "hidden_led_4" can be controlled with GPIO, but have no proper holes in shell
		//     "hidden_led_2" is between POWER and WAN LEDs
		//     "hidden_led_4" is between WAN and LAN LEDs
		//  "noconn_led_6" and "noconn_led_8" exist, but have no proper holes in shell and not controlled:
		//     "noconn_led_6" is between LAN and WLAN LEDs
		//     "noconn_led_8" is after WLAN LED
		
		// LED "hidden_led_2" between POWER and WAN LEDs is controllable with GPIO, but it has no proper hole in shell;
		// LED "hidden_led_4" between WAN and LAN LEDs is controllable with GPIO, but it has no proper hole in shell;

		// TABLE of LEDs. All leds are blue.
		//
		// Place (WAN->ANT) | Num | GPIO | LED name (LuCI)   | Note
		// -----------------|-----|-----------------------------------------------------------------------------------------         
		//            power | 1   |      |                   | POWER LED. Not controlled with GPIO.
		//     hidden_led_2 | 2   | 13   | blue:hidden_led_2 | This LED does not have proper hole in shell.
		//              wan | 3   |      |                   | WAN LED. Not controlled with GPIO.
		//     hidden_led_4 | 4   | 16   | blue:hidden_led_4 | This LED does not have proper hole in shell.
		//              lan | 5   |      |                   | LAN LED. Not controlled with GPIO.
		//     noconn_led_6 | 6   |      |                   | Not controlled with GPIO, possibly not connected
		//             wlan | 7   | 15   | blue:wlan         | WLAN LED. Wireless indicator.
		//     noconn_led_8 | 8   |      |                   | Not controlled with GPIO, possibly not connected

		hidden_led_2_blue {
			label = "blue:hidden_led_2";
			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
		};

		hidden_led_4_blue {
			label = "blue:hidden_led_4";
			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
		};

		wlan_blue {
			label = "blue:wlan";
			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
		};
	};

	aliases {
		label-mac-device = &wan;
	};
};

&spi0 {
	status = "okay";

	flash@0 {
		compatible = "w25q128";
		reg = <0>;
		spi-max-frequency = <10000000>;
		m25p,fast-read;
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "Bootloader";
				reg = <0x0 0x30000>;
				read-only;
			};
			
			partition@30000 {
				label = "Config";
				reg = <0x30000 0x10000>;
				read-only;
			};
			
			factory: partition@40000  {
				label = "factory";
				compatible = "nvmem-cells";
				reg = <0x40000 0x10000>;
				read-only;
				nvmem-layout {
					compatible = "fixed-layout";
					#address-cells = <1>;
					#size-cells = <1>;
					macaddr_factory_e000: macaddr@e000 {
						compatible = "mac-base";
						reg = <0xe000 0x6>;
						#nvmem-cell-cells = <1>;
					};

					// Serial number can be found in "factory" at 0xE100. 
					//   it starts and ends with double quotes `"` and is ASCII string
				};
			};
			
			partition@50000  {
				label = "firmware";
				compatible = "denx,uimage";
				reg = <0x50000 0xfb0000>;
			};
		};
	};
};

&gpio {
	groups = "i2c", "uart2", "uart3", "sdhci", "jtag";
	function = "gpio";
};

&gmac0 {
	nvmem-cells = <&macaddr_factory_e000 0>;
	nvmem-cell-names = "mac-address";
};

&pcie {
	status = "okay";
};

&pcie0 {
	wifi_2_4_ghz: wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x0000>;
		// Wi-Fi device reads it's MAC address from EEPROM (&factory + 4)
		// adding anything related to mac-address here will cause use random MAC
	};
};

&pcie1 {
	wifi_5_0_ghz: wifi@0,0 {
		compatible = "mediatek,mt76";
		reg = <0x0000 0 0 0 0>;
		mediatek,mtd-eeprom = <&factory 0x8000>;
		// Wi-Fi device reads it's MAC address from EEPROM, (&factory + 0x8000 + 4)
		// adding anything related to mac-address here will cause use random MAC.
	};
};

&pcie2 {
	status = "disabled";
};

&switch0 {
	mediatek,mcm;
	ports {
		wan: port@0 {
			status = "okay";
			label = "wan";
			nvmem-cells = <&macaddr_factory_e000 1>;
			nvmem-cell-names = "mac-address";
		};
		
		lan: port@1 {
			status = "okay";
			label = "lan";
			nvmem-cells = <&macaddr_factory_e000 0>;
			nvmem-cell-names = "mac-address";
		};
	};
};