1/*
2 * Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu)
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <posix/posix.dtsi>
9#include <zephyr/dt-bindings/adc/adc.h>
10#include <zephyr/dt-bindings/i2c/i2c.h>
11#include <zephyr/dt-bindings/gpio/gpio.h>
12
13/ {
14	model = "Native Sim Board";
15	compatible = "zephyr,posix";
16
17	chosen {
18		zephyr,console = &uart0;
19		zephyr,shell-uart = &uart0;
20		zephyr,uart-mcumgr = &uart0;
21		zephyr,flash = &flash0;
22		zephyr,entropy = &rng;
23		zephyr,flash-controller = &flashcontroller0;
24		zephyr,display = &sdl_dc;
25		zephyr,canbus = &can_loopback0;
26		zephyr,code-partition = &slot0_partition;
27		zephyr,bt-hci = &bt_hci_userchan;
28		zephyr,touch = &input_sdl_touch;
29	};
30
31	aliases {
32		eeprom-0 = &eeprom0;
33		i2c-0 = &i2c0;
34		spi-0 = &spi0;
35		led0 = &led0;
36		rtc = &rtc;
37	};
38
39	leds {
40		compatible = "gpio-leds";
41
42		led0: led_0 {
43			gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
44			label = "Green LED";
45		};
46	};
47
48	cpus {
49		#address-cells = <1>;
50		#size-cells = <0>;
51
52		cpu0: cpu@0 {
53			compatible = "zephyr,native-sim-cpu";
54			reg = <0>;
55		};
56	};
57
58	flashcontroller0: flash-controller@0 {
59		compatible = "zephyr,sim-flash";
60		reg = <0x00000000 DT_SIZE_K(2048)>;
61
62		#address-cells = <1>;
63		#size-cells = <1>;
64		erase-value = <0xff>;
65
66		flash0: flash@0 {
67			status = "okay";
68			compatible = "soc-nv-flash";
69			erase-block-size = <4096>;
70			write-block-size = <1>;
71			reg = <0x00000000 DT_SIZE_K(2048)>;
72
73			partitions {
74				compatible = "fixed-partitions";
75				#address-cells = <1>;
76				#size-cells = <1>;
77
78				boot_partition: partition@0 {
79					label = "mcuboot";
80					reg = <0x00000000 0x0000C000>;
81				};
82
83				slot0_partition: partition@c000 {
84					label = "image-0";
85					reg = <0x0000C000 0x00069000>;
86				};
87
88				slot1_partition: partition@75000 {
89					label = "image-1";
90					reg = <0x00075000 0x00069000>;
91				};
92
93				scratch_partition: partition@de000 {
94					label = "image-scratch";
95					reg = <0x000de000 0x0001e000>;
96				};
97
98				storage_partition: partition@fc000 {
99					label = "storage";
100					reg = <0x000fc000 0x00004000>;
101				};
102			};
103		};
104	};
105
106	eeprom0: eeprom {
107		status = "okay";
108		compatible = "zephyr,sim-eeprom";
109		size = <DT_SIZE_K(32)>;
110	};
111
112	i2c0: i2c@100 {
113		status = "okay";
114		compatible = "zephyr,i2c-emul-controller";
115		clock-frequency = <I2C_BITRATE_STANDARD>;
116		#address-cells = <1>;
117		#size-cells = <0>;
118		#forward-cells = <1>;
119		reg = <0x100 4>;
120	};
121
122	spi0: spi@200 {
123		status = "okay";
124		compatible = "zephyr,spi-emul-controller";
125		clock-frequency = <50000000>;
126		#address-cells = <1>;
127		#size-cells = <0>;
128		reg = <0x200 4>;
129	};
130
131	espi0: espi@300 {
132		status = "okay";
133		compatible = "zephyr,espi-emul-controller";
134		reg = <0x300 4>;
135		#address-cells = <1>;
136		#size-cells = <0>;
137	};
138
139	mspi0: mspi@400 {
140		status = "okay";
141		compatible = "zephyr,mspi-emul-controller";
142		clock-frequency = <250000000>;
143		reg = <0x400 4>;
144		#address-cells = <1>;
145		#size-cells = <0>;
146	};
147
148	uart0: uart {
149		status = "okay";
150		compatible = "zephyr,native-pty-uart";
151		/* Dummy current-speed entry to comply with serial
152		 * DTS binding
153		 */
154		current-speed = <0>;
155	};
156
157	uart1: uart_1 {
158		status = "disabled";
159		compatible = "zephyr,native-pty-uart";
160		/* Dummy current-speed entry to comply with serial
161		 * DTS binding
162		 */
163		current-speed = <0>;
164	};
165
166	rng: rng {
167		status = "okay";
168		compatible = "zephyr,native-sim-rng";
169	};
170
171	counter0: counter {
172		status = "okay";
173		compatible = "zephyr,native-sim-counter";
174	};
175
176	gpio0: gpio_emul {
177		status = "okay";
178		compatible = "zephyr,gpio-emul";
179		rising-edge;
180		falling-edge;
181		high-level;
182		low-level;
183		gpio-controller;
184		#gpio-cells = <2>;
185	};
186
187	zephyr_udc0: udc0 {
188		compatible = "zephyr,native-posix-udc";
189	};
190
191	sdl_dc: sdl_dc {
192		compatible = "zephyr,sdl-dc";
193		height = <240>;
194		width = <320>;
195	};
196
197	input_sdl_touch: input-sdl-touch {
198		compatible = "zephyr,input-sdl-touch";
199		display = <&sdl_dc>;
200	};
201
202	can_loopback0: can_loopback0 {
203		status = "okay";
204		compatible = "zephyr,can-loopback";
205	};
206
207	can0: can {
208		status = "disabled";
209		compatible = "zephyr,native-linux-can";
210		/* adjust zcan0 to desired host interface or create an alternative
211		 * name, e.g.: sudo ip link property add dev vcan0 altname zcan0
212		 */
213		host-interface = "zcan0";
214	};
215
216	rtc: rtc {
217		status = "okay";
218		compatible = "zephyr,rtc-emul";
219		alarms-count = <2>;
220	};
221
222	adc0: adc {
223		compatible = "zephyr,adc-emul";
224		nchannels = <2>;
225		#io-channel-cells = <1>;
226		status = "okay";
227	};
228
229	dma: dma {
230		compatible = "zephyr,dma-emul";
231		#dma-cells = <1>;
232		stack-size = <4096>;
233	};
234
235	bt_hci_userchan: bt_hci_userchan {
236		compatible = "zephyr,bt-hci-userchan";
237		status = "okay";
238	};
239
240	performance-states {
241		pstate_0: pstate_0 {
242			compatible = "zephyr,native-sim-pstate";
243			load-threshold = <50>;
244			pstate-id = <0>;
245		};
246
247		pstate_1: pstate_1 {
248			compatible = "zephyr,native-sim-pstate";
249			load-threshold = <20>;
250			pstate-id = <1>;
251		};
252
253		pstate_2: pstate_2 {
254			compatible = "zephyr,native-sim-pstate";
255			load-threshold = <0>;
256			pstate-id = <2>;
257		};
258	};
259};
260