1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * This is the common sandbox device-tree nodes. This is shared between sandbox
4 * and sandbox64 builds.
5 */
6
7#include <dt-bindings/input/input.h>
8
9#define USB_CLASS_HUB			9
10
11/ {
12	binman {
13	};
14
15	chosen {
16		stdout-path = "/serial";
17	};
18
19	alarm_wdt: alarm-wdt {
20		compatible = "sandbox,alarm-wdt";
21		timeout-sec = <5>;
22		u-boot,autostart;
23	};
24
25	audio: audio-codec {
26		compatible = "sandbox,audio-codec";
27		#sound-dai-cells = <1>;
28	};
29
30	bootstd {
31		compatible = "u-boot,boot-std";
32		filename-prefixes = "./";
33	};
34
35	buttons {
36		compatible = "gpio-keys";
37
38		btn1 {
39			gpios = <&gpio_a 3 0>;
40			label = "button1";
41		    linux,code = <BTN_1>;
42		};
43
44		btn2 {
45			gpios = <&gpio_a 4 0>;
46			label = "button2";
47		    linux,code = <BTN_2>;
48		};
49	};
50
51	clk_fixed: clk-fixed {
52		bootph-all;
53		compatible = "sandbox,fixed-clock";
54		#clock-cells = <0>;
55		clock-frequency = <1234>;
56	};
57
58	clk_sandbox: clk-sbox {
59		bootph-all;
60		compatible = "sandbox,clk";
61		#clock-cells = <1>;
62		assigned-clocks = <&clk_sandbox 3>;
63		assigned-clock-rates = <321>;
64	};
65
66	clk-test {
67		bootph-all;
68		compatible = "sandbox,clk-test";
69		clocks = <&clk_fixed>,
70			 <&clk_sandbox 1>,
71			 <&clk_sandbox 0>,
72			 <&clk_sandbox 3>,
73			 <&clk_sandbox 2>;
74		clock-names = "fixed", "i2c", "spi", "uart2", "uart1";
75	};
76
77	gpio_a: gpios@0 {
78		bootph-some-ram;
79		gpio-controller;
80		compatible = "sandbox,gpio";
81		#gpio-cells = <1>;
82		gpio-bank-name = "a";
83		sandbox,gpio-count = <20>;
84	};
85
86	gpio_b: gpios@1 {
87		bootph-pre-ram;
88		gpio-controller;
89		compatible = "sandbox,gpio";
90		#gpio-cells = <2>;
91		gpio-bank-name = "b";
92		sandbox,gpio-count = <10>;
93	};
94
95	gpio-test {
96		bootph-pre-ram;
97		compatible = "sandbox,gpio-test";
98		test-gpios = <&gpio_b 3 0>;
99	};
100
101	hexagon {
102		compatible = "demo-simple";
103		colour = "white";
104		sides = <6>;
105	};
106
107	i2c_0: i2c@0 {
108		eeprom@2c {
109			reg = <0x2c>;
110			compatible = "i2c-eeprom";
111			sandbox,emul = <&emul_eeprom>;
112		};
113
114		rtc_0: rtc@43 {
115			reg = <0x43>;
116			compatible = "sandbox-rtc";
117			sandbox,emul = <&emul0>;
118			bootph-pre-ram;
119		};
120		sandbox_pmic: sandbox_pmic {
121			reg = <0x40>;
122		};
123
124		mc34708: pmic@41 {
125			reg = <0x41>;
126		};
127
128		i2c_emul: emul {
129			bootph-pre-ram;
130			reg = <0xff>;
131			compatible = "sandbox,i2c-emul-parent";
132			emul_eeprom: emul-eeprom {
133				compatible = "sandbox,i2c-eeprom";
134				sandbox,filename = "i2c.bin";
135				sandbox,size = <256>;
136				#emul-cells = <0>;
137			};
138			emul0: emul0 {
139				bootph-pre-ram;
140				compatible = "sandbox,i2c-rtc-emul";
141				#emul-cells = <0>;
142			};
143		};
144	};
145
146	i2s: i2s {
147		compatible = "sandbox,i2s";
148		#sound-dai-cells = <1>;
149	};
150
151	irq_sandbox: irq-sbox {
152		bootph-pre-ram;
153		compatible = "sandbox,irq";
154		interrupt-controller;
155		#interrupt-cells = <2>;
156	};
157
158	irq-test {
159		bootph-pre-ram;
160		compatible = "sandbox,irq-test";
161		interrupts-extended = <&irq_sandbox 3 0>;
162	};
163
164	lcd {
165		bootph-some-ram;
166		compatible = "sandbox,lcd-sdl";
167		xres = <1366>;
168		yres = <768>;
169		log2-depth = <5>;
170	};
171
172	leds {
173		compatible = "gpio-leds";
174
175		iracibble {
176			gpios = <&gpio_a 1 0>;
177			label = "sandbox:red";
178		};
179
180		martinet {
181			gpios = <&gpio_a 2 0>;
182			label = "sandbox:green";
183		};
184	};
185
186	pci@0 {
187		pci@1e,0 {
188			compatible = "sandbox,pmc";
189			reg = <0xf000 0 0 0 0>;
190			sandbox,emul = <&pmc_emul>;
191			gpe0-dwx-mask = <0xf>;
192			gpe0-dwx-shift-base = <4>;
193			gpe0-dw = <6 7 9>;
194			gpe0-sts = <0x20>;
195			gpe0-en = <0x30>;
196		};
197
198		pci@1f,0 {
199			compatible = "pci-generic";
200			reg = <0xf800 0 0 0 0>;
201			sandbox,emul = <&swap_case_emul>;
202		};
203	};
204
205	emul {
206		compatible = "sandbox,pci-emul-parent";
207		pmc_emul: emul@1e,0 {
208			compatible = "sandbox,pmc-emul";
209		};
210		swap_case_emul: emul@1f,0 {
211			compatible = "sandbox,swap-case";
212		};
213	};
214
215	pinctrl {
216		compatible = "sandbox,pinctrl";
217		status = "okay";
218
219		pinctrl_i2c0: i2c0 {
220			groups = "i2c";
221			function = "i2c";
222			bias-pull-up;
223		};
224
225		pinctrl_serial0: uart0 {
226			groups = "serial_a";
227			function = "serial";
228		};
229
230		pinctrl_onewire0: onewire0 {
231			groups = "w1";
232			function = "w1";
233			bias-pull-up;
234		};
235	};
236
237	reset@1 {
238		compatible = "sandbox,reset";
239		bootph-some-ram;
240	};
241
242	rng {
243		compatible = "sandbox,sandbox-rng";
244	};
245
246	scsi {
247		compatible = "sandbox,scsi";
248	};
249
250	sound {
251		compatible = "sandbox,sound";
252		cpu {
253			sound-dai = <&i2s 0>;
254		};
255
256		codec {
257			sound-dai = <&audio 0>;
258		};
259	};
260
261	spi@0 {
262		firmware_storage_spi: flash@0 {
263			bootph-some-ram;
264			reg = <0>;
265			compatible = "spansion,m25p16", "jedec,spi-nor";
266			spi-max-frequency = <40000000>;
267			sandbox,filename = "spi.bin";
268		};
269	};
270
271	spl-test {
272		bootph-pre-ram;
273		compatible = "sandbox,spl-test";
274		boolval;
275		intval = <1>;
276		intarray = <2 3 4>;
277		maybe-empty-int = <>;
278		byteval = [05];
279		bytearray = [06];
280		longbytearray = [09 0a 0b 0c 0d 0e 0f 10 11];
281		stringval = "message";
282		stringarray = "multi-word", "message";
283	};
284
285	spl-test2 {
286		bootph-pre-ram;
287		compatible = "sandbox,spl-test";
288		intval = <3>;
289		intarray = <5>;
290		byteval = [08];
291		bytearray = [01 23 34];
292		longbytearray = [09 0a 0b 0c];
293		stringval = "message2";
294		stringarray = "another", "multi-word", "message";
295	};
296
297	spl-test3 {
298		bootph-pre-ram;
299		compatible = "sandbox,spl-test";
300		stringarray = "one";
301		maybe-empty-int = <1>;
302	};
303
304	spl-test5 {
305		bootph-verify;
306		compatible = "sandbox,spl-test";
307		stringarray = "tpl";
308	};
309
310	spl-test6 {
311		bootph-some-ram;
312		compatible = "sandbox,spl-test";
313		stringarray = "pre-proper";
314	};
315
316	spl-test7 {
317		bootph-pre-ram;
318		compatible = "sandbox,spl-test";
319		stringarray = "spl";
320	};
321
322	square {
323		compatible = "demo-shape";
324		colour = "blue";
325		sides = <4>;
326	};
327
328	timer {
329		compatible = "sandbox,timer";
330		clock-frequency = <1000000>;
331	};
332
333	tpm {
334		compatible = "google,sandbox-tpm";
335	};
336
337	tpm2 {
338		compatible = "sandbox,tpm2";
339	};
340
341	triangle {
342		compatible = "demo-shape";
343		colour = "cyan";
344		sides = <3>;
345		character = <83>;
346		light-gpios = <&gpio_a 2>, <&gpio_b 6 0>;
347	};
348
349	/* Needs to be available prior to relocation */
350	uart0: serial {
351		bootph-pre-ram;
352		bootph-pre-sram;
353		bootph-verify;
354		compatible = "sandbox,serial";
355		sandbox,text-colour = "cyan";
356		pinctrl-names = "default";
357		pinctrl-0 = <&pinctrl_serial0>;
358	};
359
360	usb@0 {
361		compatible = "sandbox,usb";
362		status = "disabled";
363		hub {
364			compatible = "sandbox,usb-hub";
365			#address-cells = <1>;
366			#size-cells = <0>;
367			flash-stick {
368				reg = <0>;
369				compatible = "sandbox,usb-flash";
370			};
371		};
372	};
373
374	usb@1 {
375		compatible = "sandbox,usb";
376		hub {
377			compatible = "usb-hub";
378			usb,device-class = <USB_CLASS_HUB>;
379			hub-emul {
380				compatible = "sandbox,usb-hub";
381				#address-cells = <1>;
382				#size-cells = <0>;
383				flash-stick {
384					reg = <0>;
385					compatible = "sandbox,usb-flash";
386					sandbox,filepath = "flash.bin";
387				};
388			};
389		};
390	};
391
392	usb@2 {
393		compatible = "sandbox,usb";
394		status = "disabled";
395	};
396
397	spmi: spmi@0 {
398		compatible = "sandbox,spmi";
399		#address-cells = <0x1>;
400		#size-cells = <0x1>;
401		pm8916@0 {
402			compatible = "qcom,spmi-pmic";
403			reg = <0x0 0x1>;
404			#address-cells = <0x1>;
405			#size-cells = <0x1>;
406
407			spmi_gpios: gpios@c000 {
408				compatible = "qcom,pm8916-gpio";
409				reg = <0xc000 0x400>;
410				gpio-controller;
411				gpio-count = <4>;
412				#gpio-cells = <2>;
413				gpio-bank-name="spmi";
414			};
415		};
416	};
417
418	axi: axi@0 {
419		compatible = "sandbox,axi";
420		#address-cells = <0x1>;
421		#size-cells = <0x1>;
422		store@0 {
423			compatible = "sandbox,sandbox_store";
424			reg = <0x0 0x400>;
425		};
426	};
427
428	onewire0: onewire {
429		compatible = "w1-gpio";
430		gpios = <&gpio_a 8>;
431		pinctrl-names = "default";
432		pinctrl-0 = <&pinctrl_onewire0>;
433		status = "okay";
434
435		sandbox_eeprom0: sandbox_eeprom@0 {
436			compatible = "sandbox,w1-eeprom";
437			status = "okay";
438		};
439	};
440
441	sandbox_tee {
442		compatible = "sandbox,tee";
443	};
444
445	thermal {
446		compatible = "sandbox,thermal";
447	};
448};
449
450&cros_ec {
451	/*
452	 * This describes the flash memory within the EC. Note
453	 * that the STM32L flash erases to 0, not 0xff.
454	 */
455	flash {
456		image-pos = <0x08000000>;
457		size = <0x20000>;
458		erase-value = <0>;
459
460		/* Information for sandbox */
461		ro {
462			image-pos = <0>;
463			size = <0xf000>;
464		};
465		wp-ro {
466			image-pos = <0xf000>;
467			size = <0x1000>;
468		};
469		rw {
470			image-pos = <0x10000>;
471			size = <0x10000>;
472		};
473	};
474
475	keyboard-controller {
476		bootph-some-ram;
477	};
478};
479