1// SPDX-License-Identifier: GPL-2.0-only OR MIT
2
3/dts-v1/;
4
5#include <dt-bindings/gpio/gpio.h>
6#include <dt-bindings/regulator/richtek,rt5190a-regulator.h>
7
8#include "mt7988a.dtsi"
9
10/ {
11	compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
12	model = "Banana Pi BPI-R4";
13	chassis-type = "embedded";
14
15	chosen {
16		stdout-path = "serial0:115200n8";
17	};
18
19	reg_1p8v: regulator-1p8v {
20		compatible = "regulator-fixed";
21		regulator-name = "fixed-1.8V";
22		regulator-min-microvolt = <1800000>;
23		regulator-max-microvolt = <1800000>;
24		regulator-boot-on;
25		regulator-always-on;
26	};
27
28	reg_3p3v: regulator-3p3v {
29		compatible = "regulator-fixed";
30		regulator-name = "fixed-3.3V";
31		regulator-min-microvolt = <3300000>;
32		regulator-max-microvolt = <3300000>;
33		regulator-boot-on;
34		regulator-always-on;
35	};
36};
37
38&cpu0 {
39	proc-supply = <&rt5190_buck3>;
40};
41
42&cpu1 {
43	proc-supply = <&rt5190_buck3>;
44};
45
46&cpu2 {
47	proc-supply = <&rt5190_buck3>;
48};
49
50&cpu3 {
51	proc-supply = <&rt5190_buck3>;
52};
53
54&cpu_thermal {
55	trips {
56		cpu_trip_hot: hot {
57			temperature = <120000>;
58			hysteresis = <2000>;
59			type = "hot";
60		};
61
62		cpu_trip_active_high: active-high {
63			temperature = <115000>;
64			hysteresis = <2000>;
65			type = "active";
66		};
67
68		cpu_trip_active_med: active-med {
69			temperature = <85000>;
70			hysteresis = <2000>;
71			type = "active";
72		};
73
74		cpu_trip_active_low: active-low {
75			temperature = <40000>;
76			hysteresis = <2000>;
77			type = "active";
78		};
79	};
80};
81
82&i2c0 {
83	pinctrl-names = "default";
84	pinctrl-0 = <&i2c0_pins>;
85	status = "okay";
86
87	rt5190a_64: rt5190a@64 {
88		compatible = "richtek,rt5190a";
89		reg = <0x64>;
90		vin2-supply = <&rt5190_buck1>;
91		vin3-supply = <&rt5190_buck1>;
92		vin4-supply = <&rt5190_buck1>;
93
94		regulators {
95			rt5190_buck1: buck1 {
96				regulator-name = "rt5190a-buck1";
97				regulator-min-microvolt = <5090000>;
98				regulator-max-microvolt = <5090000>;
99				regulator-allowed-modes =
100				<RT5190A_OPMODE_AUTO>, <RT5190A_OPMODE_FPWM>;
101				regulator-boot-on;
102				regulator-always-on;
103			};
104			buck2 {
105				regulator-name = "vcore";
106				regulator-min-microvolt = <600000>;
107				regulator-max-microvolt = <1400000>;
108				regulator-boot-on;
109				regulator-always-on;
110			};
111			rt5190_buck3: buck3 {
112				regulator-name = "vproc";
113				regulator-min-microvolt = <600000>;
114				regulator-max-microvolt = <1400000>;
115				regulator-boot-on;
116			};
117			buck4 {
118				regulator-name = "rt5190a-buck4";
119				regulator-min-microvolt = <1800000>;
120				regulator-max-microvolt = <1800000>;
121				regulator-allowed-modes =
122				<RT5190A_OPMODE_AUTO>, <RT5190A_OPMODE_FPWM>;
123				regulator-boot-on;
124				regulator-always-on;
125			};
126			ldo {
127				regulator-name = "rt5190a-ldo";
128				regulator-min-microvolt = <1800000>;
129				regulator-max-microvolt = <1800000>;
130				regulator-boot-on;
131				regulator-always-on;
132			};
133		};
134	};
135};
136
137&i2c2 {
138	pinctrl-names = "default";
139	pinctrl-0 = <&i2c2_1_pins>;
140	status = "okay";
141
142	pca9545: i2c-mux@70 {
143		compatible = "nxp,pca9545";
144		reg = <0x70>;
145		reset-gpios = <&pio 5 GPIO_ACTIVE_LOW>;
146		#address-cells = <1>;
147		#size-cells = <0>;
148
149		i2c@0 {
150			#address-cells = <1>;
151			#size-cells = <0>;
152			reg = <0>;
153
154			pcf8563: rtc@51 {
155				compatible = "nxp,pcf8563";
156				reg = <0x51>;
157				#clock-cells = <0>;
158			};
159
160			eeprom@57 {
161				compatible = "atmel,24c02";
162				reg = <0x57>;
163				size = <256>;
164			};
165
166		};
167
168		i2c_sfp1: i2c@1 {
169			#address-cells = <1>;
170			#size-cells = <0>;
171			reg = <1>;
172		};
173
174		i2c_sfp2: i2c@2 {
175			#address-cells = <1>;
176			#size-cells = <0>;
177			reg = <2>;
178		};
179	};
180};
181
182/* mPCIe SIM2 */
183&pcie0 {
184	status = "okay";
185};
186
187/* mPCIe SIM3 */
188&pcie1 {
189	status = "okay";
190};
191
192/* M.2 key-B SIM1 */
193&pcie2 {
194	status = "okay";
195};
196
197/* M.2 key-M SSD */
198&pcie3 {
199	status = "okay";
200};
201
202&pio {
203	mdio0_pins: mdio0-pins {
204		mux {
205			function = "eth";
206			groups = "mdc_mdio0";
207		};
208
209		conf {
210			pins = "SMI_0_MDC", "SMI_0_MDIO";
211			drive-strength = <8>;
212		};
213	};
214
215	i2c0_pins: i2c0-g0-pins {
216		mux {
217			function = "i2c";
218			groups = "i2c0_1";
219		};
220	};
221
222	i2c1_pins: i2c1-g0-pins {
223		mux {
224			function = "i2c";
225			groups = "i2c1_0";
226		};
227	};
228
229	i2c1_sfp_pins: i2c1-sfp-g0-pins {
230		mux {
231			function = "i2c";
232			groups = "i2c1_sfp";
233		};
234	};
235
236	i2c2_0_pins: i2c2-g0-pins {
237		mux {
238			function = "i2c";
239			groups = "i2c2_0";
240		};
241	};
242
243	i2c2_1_pins: i2c2-g1-pins {
244		mux {
245			function = "i2c";
246			groups = "i2c2_1";
247		};
248	};
249
250	gbe0_led0_pins: gbe0-led0-pins {
251		mux {
252			function = "led";
253			groups = "gbe0_led0";
254		};
255	};
256
257	gbe1_led0_pins: gbe1-led0-pins {
258		mux {
259			function = "led";
260			groups = "gbe1_led0";
261		};
262	};
263
264	gbe2_led0_pins: gbe2-led0-pins {
265		mux {
266			function = "led";
267			groups = "gbe2_led0";
268		};
269	};
270
271	gbe3_led0_pins: gbe3-led0-pins {
272		mux {
273			function = "led";
274			groups = "gbe3_led0";
275		};
276	};
277
278	gbe0_led1_pins: gbe0-led1-pins {
279		mux {
280			function = "led";
281			groups = "gbe0_led1";
282		};
283	};
284
285	gbe1_led1_pins: gbe1-led1-pins {
286		mux {
287			function = "led";
288			groups = "gbe1_led1";
289		};
290	};
291
292	gbe2_led1_pins: gbe2-led1-pins {
293		mux {
294			function = "led";
295			groups = "gbe2_led1";
296		};
297	};
298
299	gbe3_led1_pins: gbe3-led1-pins {
300		mux {
301			function = "led";
302			groups = "gbe3_led1";
303		};
304	};
305
306	i2p5gbe_led0_pins: 2p5gbe-led0-pins {
307		mux {
308			function = "led";
309			groups = "2p5gbe_led0";
310		};
311	};
312
313	i2p5gbe_led1_pins: 2p5gbe-led1-pins {
314		mux {
315			function = "led";
316			groups = "2p5gbe_led1";
317		};
318	};
319
320	mmc0_pins_emmc_45: mmc0-emmc-45-pins {
321		mux {
322			function = "flash";
323			groups = "emmc_45";
324		};
325	};
326
327	mmc0_pins_emmc_51: mmc0-emmc-51-pins {
328		mux {
329			function = "flash";
330			groups = "emmc_51";
331		};
332	};
333
334	mmc0_pins_sdcard: mmc0-sdcard-pins {
335		mux {
336			function = "flash";
337			groups = "sdcard";
338		};
339	};
340
341	uart0_pins: uart0-pins {
342		mux {
343			function = "uart";
344			groups =  "uart0";
345		};
346	};
347
348	snfi_pins: snfi-pins {
349		mux {
350			function = "flash";
351			groups = "snfi";
352		};
353	};
354
355	spi0_pins: spi0-pins {
356		mux {
357			function = "spi";
358			groups = "spi0";
359		};
360	};
361
362	spi0_flash_pins: spi0-flash-pins {
363		mux {
364			function = "spi";
365			groups = "spi0", "spi0_wp_hold";
366		};
367	};
368
369	spi1_pins: spi1-pins {
370		mux {
371			function = "spi";
372			groups = "spi1";
373		};
374	};
375
376	spi2_pins: spi2-pins {
377		mux {
378			function = "spi";
379			groups = "spi2";
380		};
381	};
382
383	spi2_flash_pins: spi2-flash-pins {
384		mux {
385			function = "spi";
386			groups = "spi2", "spi2_wp_hold";
387		};
388	};
389};
390
391&pwm {
392	status = "okay";
393};
394
395&serial0 {
396	status = "okay";
397};
398
399&ssusb1 {
400	status = "okay";
401};
402
403&tphy {
404	status = "okay";
405};
406
407&watchdog {
408	status = "okay";
409};
410