ramips: add NMBM support for ipTIME AX2004M
[openwrt/staging/981213.git] / target / linux / ramips / dts / mt7621_iptime_ax2004m.dts
1 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2
3 #include "mt7621.dtsi"
4
5 #include <dt-bindings/gpio/gpio.h>
6 #include <dt-bindings/input/input.h>
7 #include <dt-bindings/leds/common.h>
8
9 / {
10 compatible = "iptime,ax2004m", "mediatek,mt7621-soc";
11 model = "ipTIME AX2004M";
12
13 aliases {
14 led-boot = &led_cpu;
15 led-failsafe = &led_cpu;
16 led-running = &led_cpu;
17 led-upgrade = &led_cpu;
18 };
19
20 chosen {
21 bootargs = "console=ttyS0,115200";
22 };
23
24 leds {
25 compatible = "gpio-leds";
26
27 led_cpu: cpu {
28 function = LED_FUNCTION_CPU;
29 color = <LED_COLOR_ID_AMBER>;
30 gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
31 };
32
33 wlan2g {
34 label = "amber:wlan2g";
35 gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
36 linux,default-trigger = "phy0radio";
37 };
38
39 wlan5g {
40 label = "amber:wlan5g";
41 gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
42 linux,default-trigger = "phy1radio";
43 };
44 };
45
46 keys {
47 compatible = "gpio-keys";
48
49 reset {
50 label = "reset";
51 gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
52 linux,code = <KEY_RESTART>;
53 };
54 };
55 };
56
57 &nand {
58 status = "okay";
59
60 mediatek,nmbm;
61 mediatek,bmt-max-ratio = <1>;
62 mediatek,bmt-max-reserved-blocks = <64>;
63 mediatek,bmt-remap-range = <0x000000 0x580000>;
64
65 partitions {
66 compatible = "fixed-partitions";
67 #address-cells = <1>;
68 #size-cells = <1>;
69
70 partition@0 {
71 label = "u-boot";
72 reg = <0x0 0x80000>;
73 read-only;
74 };
75
76 partition@80000 {
77 label = "config";
78 reg = <0x80000 0x80000>;
79 read-only;
80 };
81
82 partition@100000 {
83 label = "factory";
84 reg = <0x100000 0x80000>;
85 read-only;
86
87 nvmem-layout {
88 compatible = "fixed-layout";
89 #address-cells = <1>;
90 #size-cells = <1>;
91
92 eeprom_factory_0: eeprom@0 {
93 reg = <0x0 0xe00>;
94 };
95
96 macaddr_factory_4: macaddr@4 {
97 compatible = "mac-base";
98 reg = <0x4 0x6>;
99 #nvmem-cell-cells = <1>;
100 };
101
102 precal_factory_e10: precal@e10 {
103 reg = <0xe10 0x19c10>;
104 };
105 };
106 };
107
108 partition@180000 {
109 label = "firmware";
110 reg = <0x180000 0x7680000>;
111
112 compatible = "fixed-partitions";
113 #address-cells = <1>;
114 #size-cells = <1>;
115
116 partition@0 {
117 label = "kernel";
118 reg = <0x0 0x400000>;
119 };
120
121 partition@400000 {
122 label = "ubi";
123 reg = <0x400000 0x7280000>;
124 };
125 };
126
127 /* last 8 MiB is reserved for NMBM bad block table */
128 };
129 };
130
131 &state_default {
132 gpio {
133 groups = "i2c", "jtag", "wdt";
134 function = "gpio";
135 };
136 };
137
138 &gmac0 {
139 nvmem-cells = <&macaddr_factory_4 3>;
140 nvmem-cell-names = "mac-address";
141 };
142
143 &gmac1 {
144 status = "okay";
145 label = "wan";
146 phy-handle = <&ethphy0>;
147
148 nvmem-cells = <&macaddr_factory_4 1>;
149 nvmem-cell-names = "mac-address";
150 };
151
152 &mdio {
153 ethphy0: ethernet-phy@0 {
154 reg = <0>;
155 };
156 };
157
158 &switch0 {
159 ports {
160 port@1 {
161 status = "okay";
162 label = "lan4";
163 };
164
165 port@2 {
166 status = "okay";
167 label = "lan3";
168 };
169
170 port@3 {
171 status = "okay";
172 label = "lan2";
173 };
174
175 port@4 {
176 status = "okay";
177 label = "lan1";
178 };
179 };
180 };
181
182 &pcie {
183 status = "okay";
184 };
185
186 &pcie1 {
187 wifi@0,0 {
188 compatible = "mediatek,mt76";
189 reg = <0x0000 0 0 0 0>;
190 nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
191 nvmem-cell-names = "eeprom", "precal";
192 };
193 };