1/* SPDX-License-Identifier: Apache-2.0 */
2
3#include <mem.h>
4#include <arm/armv7-m.dtsi>
5#include <zephyr/dt-bindings/adc/adc.h>
6#include <zephyr/dt-bindings/clock/kinetis_sim.h>
7#include <zephyr/dt-bindings/clock/kinetis_mcg.h>
8#include <zephyr/dt-bindings/gpio/gpio.h>
9#include <zephyr/dt-bindings/i2c/i2c.h>
10
11/* Include package pinmux file for the spi modem settings */
12#include <nxp/kinetis/MKW24D512VHA5-pinctrl.h>
13
14/ {
15	aliases {
16		watchdog0 = &wdog;
17	};
18
19	chosen {
20		zephyr,entropy = &rnga;
21		zephyr,flash-controller = &ftfl;
22	};
23
24	cpus {
25		#address-cells = <1>;
26		#size-cells = <0>;
27
28		cpu0: cpu@0 {
29			device_type = "cpu";
30			compatible = "arm,cortex-m4";
31			reg = <0>;
32		};
33	};
34
35	/* Dummy pinctrl node, filled with pin mux options at board level */
36	pinctrl: pinctrl {
37		compatible = "nxp,kinetis-pinctrl";
38		status = "okay";
39		/*
40		 * KW2XD is a system in package part, so the SPI1 controller is
41		 * connected internally to the modem
42		 */
43		spi1_modem: spi1_modem {
44			group0 {
45				pinmux = <KINETIS_MUX('B', 10, 2)>,
46					<KINETIS_MUX('B', 11, 2)>,
47					<KINETIS_MUX('B', 16, 2)>,
48					<KINETIS_MUX('B', 17, 2)>;
49				drive-strength = "low";
50				slew-rate = "slow";
51			};
52		};
53	};
54
55	sram0: memory@20000000 {
56		compatible = "mmio-sram";
57		reg = <0x20000000 DT_SIZE_K(32)>;
58	};
59
60	soc {
61
62		mcg: clock-controller@40064000 {
63			compatible = "nxp,kinetis-mcg";
64			reg = <0x40064000 0xd>;
65			#clock-cells = <1>;
66		};
67
68		clock-controller@40065000 {
69			compatible = "nxp,k64f-osc";
70			reg = <0x40065000 0x4>;
71
72			enable-external-reference;
73		};
74
75		rtc@4003d000 {
76			compatible = "nxp,k64f-rtc";
77			reg = <0x4003d000 0x808>;
78			clock-frequency = <32768>;
79		};
80
81		sim: sim@40047000 {
82			compatible = "nxp,kinetis-sim";
83			reg = <0x40047000 0x1060>;
84			#clock-cells = <3>;
85
86			core_clk {
87				compatible = "fixed-factor-clock";
88				clocks = <&mcg KINETIS_MCG_OUT_CLK>;
89				clock-div = <1>;
90				#clock-cells = <0>;
91			};
92
93			bus_clk {
94				compatible = "fixed-factor-clock";
95				clocks = <&mcg KINETIS_MCG_OUT_CLK>;
96				clock-div = <1>;
97				#clock-cells = <0>;
98			};
99
100			flash_clk {
101				compatible = "fixed-factor-clock";
102				clocks = <&mcg KINETIS_MCG_OUT_CLK>;
103				clock-div = <2>;
104				#clock-cells = <0>;
105			};
106		};
107
108		ftfl: flash-controller@40020000 {
109			compatible = "nxp,kinetis-ftfl";
110			reg = <0x40020000 0x18>;
111			interrupts = <18 0>, <19 0>;
112			interrupt-names = "command-complete", "read-collision";
113			status = "okay";
114
115			#address-cells = <1>;
116			#size-cells = <1>;
117
118			flash0: flash@0 {
119				compatible = "soc-nv-flash";
120				reg = <0 DT_SIZE_K(512)>;
121				erase-block-size = <2048>;
122				write-block-size = <4>;
123			};
124		};
125
126		i2c0: i2c@40066000 {
127			compatible = "nxp,kinetis-i2c";
128			clock-frequency = <I2C_BITRATE_STANDARD>;
129			#address-cells = <1>;
130			#size-cells = <0>;
131			reg = <0x40066000 0x1000>;
132			interrupts = <24 0>;
133			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1034 6>;
134			status = "disabled";
135		};
136
137		i2c1: i2c@40067000 {
138			compatible = "nxp,kinetis-i2c";
139			clock-frequency = <I2C_BITRATE_STANDARD>;
140			#address-cells = <1>;
141			#size-cells = <0>;
142			reg = <0x40067000 0x1000>;
143			interrupts = <25 0>;
144			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1034 7>;
145			status = "disabled";
146		};
147
148		uart0: uart@4006a000 {
149			compatible = "nxp,kinetis-uart";
150			reg = <0x4006a000 0x1000>;
151			interrupts = <31 0>, <32 0>;
152			interrupt-names = "status", "error";
153			clocks = <&sim KINETIS_SIM_CORESYS_CLK 0x1034 10>;
154
155			status = "disabled";
156		};
157
158		uart1: uart@4006b000 {
159			compatible = "nxp,kinetis-uart";
160			reg = <0x4006b000 0x1000>;
161			interrupts = <33 0>, <34 0>;
162			interrupt-names = "status", "error";
163			clocks = <&sim KINETIS_SIM_CORESYS_CLK 0x1034 11>;
164
165			status = "disabled";
166		};
167
168		uart2: uart@4006c000 {
169			compatible = "nxp,kinetis-uart";
170			reg = <0x4006c000 0x1000>;
171			interrupts = <35 0>, <36 0>;
172			interrupt-names = "status", "error";
173			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1034 12>;
174
175			status = "disabled";
176		};
177
178		porta: pinmux@40049000 {
179			compatible = "nxp,kinetis-pinmux";
180			reg = <0x40049000 0xd0>;
181			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1038 9>;
182		};
183
184		portb: pinmux@4004a000 {
185			compatible = "nxp,kinetis-pinmux";
186			reg = <0x4004a000 0xd0>;
187			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1038 10>;
188		};
189
190		portc: pinmux@4004b000 {
191			compatible = "nxp,kinetis-pinmux";
192			reg = <0x4004b000 0xd0>;
193			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1038 11>;
194		};
195
196		portd: pinmux@4004c000 {
197			compatible = "nxp,kinetis-pinmux";
198			reg = <0x4004c000 0xd0>;
199			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1038 12>;
200		};
201
202		porte: pinmux@4004d000 {
203			compatible = "nxp,kinetis-pinmux";
204			reg = <0x4004d000 0xd0>;
205			clocks = <&sim KINETIS_SIM_BUS_CLK 0x1038 13>;
206		};
207
208		gpioa: gpio@400ff000 {
209			compatible = "nxp,kinetis-gpio";
210			status = "disabled";
211			reg = <0x400ff000 0x40>;
212			interrupts = <59 2>;
213			gpio-controller;
214			#gpio-cells = <2>;
215			nxp,kinetis-port = <&porta>;
216		};
217
218		gpiob: gpio@400ff040 {
219			compatible = "nxp,kinetis-gpio";
220			status = "disabled";
221			reg = <0x400ff040 0x40>;
222			interrupts = <60 2>;
223			gpio-controller;
224			#gpio-cells = <2>;
225			nxp,kinetis-port = <&portb>;
226		};
227
228		gpioc: gpio@400ff080 {
229			compatible = "nxp,kinetis-gpio";
230			status = "disabled";
231			reg = <0x400ff080 0x40>;
232			interrupts = <61 2>;
233			gpio-controller;
234			#gpio-cells = <2>;
235			nxp,kinetis-port = <&portc>;
236		};
237
238		gpiod: gpio@400ff0c0 {
239			compatible = "nxp,kinetis-gpio";
240			status = "disabled";
241			reg = <0x400ff0c0 0x40>;
242			interrupts = <62 2>;
243			gpio-controller;
244			#gpio-cells = <2>;
245			nxp,kinetis-port = <&portd>;
246		};
247
248		gpioe: gpio@400ff100 {
249			compatible = "nxp,kinetis-gpio";
250			status = "disabled";
251			reg = <0x400ff100 0x40>;
252			interrupts = <63 2>;
253			gpio-controller;
254			#gpio-cells = <2>;
255			nxp,kinetis-port = <&porte>;
256		};
257
258		spi0: spi@4002c000 {
259			compatible = "nxp,kinetis-dspi";
260			reg = <0x4002c000 0x88>;
261			interrupts = <26 3>;
262			clocks = <&sim KINETIS_SIM_BUS_CLK 0x103C 12>;
263			status = "disabled";
264			#address-cells = <1>;
265			#size-cells = <0>;
266		};
267
268		spi1: spi@4002d000 {
269			compatible = "nxp,kinetis-dspi";
270			reg = <0x4002d000 0x88>;
271			interrupts = <27 3>;
272			clocks = <&sim KINETIS_SIM_BUS_CLK 0x103C 13>;
273
274			#address-cells = <1>;
275			#size-cells = <0>;
276
277			pinctrl-0 = <&spi1_modem>;
278			pinctrl-names = "default";
279
280			ieee802154: mcr20a@0 {
281				compatible = "nxp,mcr20a";
282				reg = <0x0>;
283				spi-max-frequency = <8000000>;
284				irqb-gpios = <&gpiob 3 0>;
285				reset-gpios = <&gpiob 19 0>;
286				status = "okay";
287			};
288		};
289
290		wdog: watchdog@40052000 {
291			compatible = "nxp,kinetis-wdog";
292			reg = <0x40052000 16>;
293			interrupts = <22 0>;
294			clocks = <&sim KINETIS_SIM_LPO_CLK 0 0>;
295		};
296
297		ftm0: ftm@40038000{
298			compatible = "nxp,kinetis-ftm";
299			reg = <0x40038000 0x98>;
300			interrupts = <42 0>;
301			clocks = <&mcg KINETIS_MCG_FIXED_FREQ_CLK>;
302			prescaler = <16>;
303			status = "disabled";
304		};
305
306		ftm1: ftm@40039000{
307			compatible = "nxp,kinetis-ftm";
308			reg = <0x40039000 0x98>;
309			interrupts = <43 0>;
310			clocks = <&mcg KINETIS_MCG_FIXED_FREQ_CLK>;
311			prescaler = <16>;
312			status = "disabled";
313		};
314
315		ftm2: ftm@4003a000{
316			compatible = "nxp,kinetis-ftm";
317			reg = <0x4003a000 0x98>;
318			interrupts = <44 0>;
319			clocks = <&mcg KINETIS_MCG_FIXED_FREQ_CLK>;
320			prescaler = <16>;
321			status = "disabled";
322		};
323
324		adc0: adc@4003b000{
325			compatible = "nxp,kinetis-adc16";
326			reg = <0x4003b000 0x70>;
327			interrupts = <39 0>;
328			status = "disabled";
329			#io-channel-cells = <1>;
330		};
331
332		usbd: usbd@40072000 {
333			compatible = "nxp,kinetis-usbd";
334			reg = <0x40072000 0x1000>;
335			interrupts = <53 1>;
336			interrupt-names = "usb_otg";
337			num-bidir-endpoints = <16>;
338			status = "disabled";
339		};
340
341		rnga: random@40029000 {
342			compatible = "nxp,kinetis-rnga";
343			reg = <0x40029000 0x1000>;
344			status = "okay";
345			interrupts = <23 0>;
346		};
347	};
348};
349
350&nvic {
351	arm,num-irq-priority-bits = <4>;
352};
353