1/*
2 * Copyright (c) 2019-2021 Vestas Wind Systems A/S
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <arm/armv7-m.dtsi>
8#include <zephyr/dt-bindings/adc/adc.h>
9#include <zephyr/dt-bindings/clock/kinetis_pcc.h>
10#include <zephyr/dt-bindings/clock/kinetis_scg.h>
11#include <zephyr/dt-bindings/gpio/gpio.h>
12#include <zephyr/dt-bindings/i2c/i2c.h>
13
14/ {
15	aliases {
16		watchdog0 = &wdog;
17	};
18
19	chosen {
20		zephyr,flash-controller = &ftfe;
21	};
22
23	cpus {
24		#address-cells = <1>;
25		#size-cells = <0>;
26
27		cpu0: cpu@0 {
28			device_type = "cpu";
29			compatible = "arm,cortex-m4f";
30			reg = <0>;
31			cpu-power-states = <&idle &stop &pstop1 &pstop2>;
32		};
33
34		power-states {
35			idle: idle {
36				compatible = "zephyr,power-state";
37				power-state-name = "runtime-idle";
38			};
39
40			stop: stop {
41				compatible = "zephyr,power-state";
42				power-state-name = "suspend-to-idle";
43				substate-id = <0>;
44			};
45
46			pstop1: pstop1 {
47				compatible = "zephyr,power-state";
48				power-state-name = "suspend-to-idle";
49				substate-id = <1>;
50			};
51
52			pstop2: pstop2 {
53				compatible = "zephyr,power-state";
54				power-state-name = "suspend-to-idle";
55				substate-id = <2>;
56			};
57		};
58	};
59
60	temp0: temp0 {
61		compatible = "nxp,kinetis-temperature";
62		io-channels = <&adc0 26>, <&adc0 27>;
63		io-channel-names = "SENSOR", "BANDGAP";
64		bandgap-voltage = <1000000>;
65		vtemp25 = <740500>;
66		sensor-slope-cold = <1564>;
67		sensor-slope-hot = <1564>;
68		status = "disabled";
69	};
70
71	temp1: temp1 {
72		compatible = "nxp,kinetis-temperature";
73		io-channels = <&adc1 26>, <&adc1 27>;
74		io-channel-names = "SENSOR", "BANDGAP";
75		bandgap-voltage = <1000000>;
76		vtemp25 = <740500>;
77		sensor-slope-cold = <1564>;
78		sensor-slope-hot = <1564>;
79		status = "disabled";
80	};
81
82	temp2: temp2 {
83		compatible = "nxp,kinetis-temperature";
84		io-channels = <&adc2 26>, <&adc2 27>;
85		io-channel-names = "SENSOR", "BANDGAP";
86		bandgap-voltage = <1000000>;
87		vtemp25 = <740500>;
88		sensor-slope-cold = <1564>;
89		sensor-slope-hot = <1564>;
90		status = "disabled";
91	};
92
93	/* Dummy pinctrl node, filled with pin mux options at board level */
94	pinctrl: pinctrl {
95		compatible = "nxp,port-pinctrl";
96		status = "okay";
97	};
98
99	soc {
100		edma: dma-controller@40008000 {
101			compatible = "nxp,mcux-edma";
102			nxp,version = <2>;
103			dma-channels = <16>;
104			dma-requests = <64>;
105			nxp,mem2mem;
106			reg = <0x40008000 0x1000>, <0x40021000 0x1000>;
107			interrupts = <0 0>, <1 0>, <2 0>, <3 0>,
108				     <4 0>, <5 0>, <6 0>, <7 0>,
109				     <8 0>, <9 0>, <10 0>, <11 0>,
110				     <12 0>, <13 0>, <14 0>, <15 0>,
111				     <16 0>;
112			status = "disabled";
113			#dma-cells = <2>;
114		};
115
116		mpu: mpu@4000d000 {
117			compatible = "nxp,sysmpu";
118			reg = <0x4000d000 0x1000>;
119			status = "disabled";
120		};
121
122		sim: sim@40048000 {
123			compatible = "nxp,kinetis-ke1xf-sim";
124			reg = <0x40048000 0x1000>;
125		};
126
127		scg: scg@40064000 {
128			compatible = "nxp,kinetis-scg";
129			reg = <0x40064000 0x1000>;
130			#clock-cells = <1>;
131
132			sosc_clk: sosc_clk {
133				compatible = "fixed-clock";
134				status = "disabled";
135				#clock-cells = <0>;
136			};
137
138			sirc_clk: sirc_clk {
139				compatible = "fixed-clock";
140				clock-frequency = <8000000>;
141				#clock-cells = <0>;
142			};
143
144			firc_clk: firc_clk {
145				compatible = "fixed-clock";
146				clock-frequency = <48000000>;
147				#clock-cells = <0>;
148			};
149
150			pll: pll {
151				compatible = "fixed-factor-clock";
152				clocks = <&sosc_clk>;
153				clock-div = <1>;
154				clock-mult = <16>;
155				#clock-cells = <0>;
156			};
157
158			spll_clk: spll_clk {
159				compatible = "fixed-factor-clock";
160				clocks = <&pll>;
161				clock-div = <2>;
162				#clock-cells = <0>;
163			};
164
165			core_clk: core_clk {
166				compatible = "fixed-factor-clock";
167				clocks = <&firc_clk>;
168				clock-div = <1>;
169				#clock-cells = <0>;
170			};
171
172			bus_clk: bus_clk {
173				compatible = "fixed-factor-clock";
174				clocks = <&core_clk>;
175				clock-div = <1>;
176				#clock-cells = <0>;
177			};
178
179			slow_clk: slow_clk {
180				compatible = "fixed-factor-clock";
181				clocks = <&core_clk>;
182				clock-div = <2>;
183				#clock-cells = <0>;
184			};
185
186			clkout_clk: clkout_clk {
187				compatible = "fixed-factor-clock";
188				status = "disabled";
189				clocks = <&firc_clk>;
190				#clock-cells = <0>;
191			};
192
193			splldiv1_clk: splldiv1_clk {
194				compatible = "fixed-factor-clock";
195				clocks = <&spll_clk>;
196				clock-div = <0>;
197				#clock-cells = <0>;
198			};
199
200			splldiv2_clk: splldiv2_clk {
201				compatible = "fixed-factor-clock";
202				clocks = <&spll_clk>;
203				clock-div = <0>;
204				#clock-cells = <0>;
205			};
206
207			sircdiv1_clk: sircdiv1_clk {
208				compatible = "fixed-factor-clock";
209				clocks = <&sirc_clk>;
210				clock-div = <0>;
211				#clock-cells = <0>;
212			};
213
214			sircdiv2_clk: sircdiv2_clk {
215				compatible = "fixed-factor-clock";
216				clocks = <&sirc_clk>;
217				clock-div = <0>;
218				#clock-cells = <0>;
219			};
220
221			fircdiv1_clk: fircdiv1_clk {
222				compatible = "fixed-factor-clock";
223				clocks = <&firc_clk>;
224				clock-div = <0>;
225				#clock-cells = <0>;
226			};
227
228			fircdiv2_clk: fircdiv2_clk {
229				compatible = "fixed-factor-clock";
230				clocks = <&firc_clk>;
231				clock-div = <0>;
232				#clock-cells = <0>;
233			};
234
235			soscdiv1_clk: soscdiv1_clk {
236				compatible = "fixed-factor-clock";
237				clocks = <&sosc_clk>;
238				clock-div = <0>;
239				#clock-cells = <0>;
240			};
241
242			soscdiv2_clk: soscdiv2_clk {
243				compatible = "fixed-factor-clock";
244				clocks = <&sosc_clk>;
245				clock-div = <0>;
246				#clock-cells = <0>;
247			};
248		};
249
250		pmc: pmc@4007d000 {
251			reg = <0x4007d000 0x1000>;
252
253			lpo: lpo128k {
254			/* LPO clock */
255				compatible = "fixed-clock";
256				clock-frequency = <128000>;
257				#clock-cells = <0>;
258			};
259		};
260
261		pcc: pcc@40065000 {
262			compatible = "nxp,kinetis-pcc";
263			reg = <0x40065000 0x1000>;
264			#clock-cells = <2>;
265		};
266
267		rtc: rtc@4003d000 {
268			compatible = "nxp,rtc";
269			reg = <0x4003d000 0x1000>;
270			interrupts = <46 0>, <47 0>;
271			interrupt-names = "alarm", "seconds";
272			clock-frequency = <32768>;
273			prescaler = <32768>;
274		};
275
276		dac0: dac@4003f000 {
277			compatible = "nxp,kinetis-dac32";
278			reg = <0x4003f000 0x1000>;
279			interrupts = <56 0>;
280			clocks = <&scg KINETIS_SCG_BUS_CLK>;
281			voltage-reference = <1>;
282			buffered;
283			status = "disabled";
284			#io-channel-cells = <1>;
285		};
286
287		lptmr0: lptmr@40040000 {
288			compatible = "nxp,lptmr";
289			reg = <0x40040000 0x1000>;
290			interrupts = <58 0>;
291			clock-frequency = <128000>;
292			prescaler = <1>;
293			clk-source = <1>;
294			resolution = <16>;
295		};
296
297		wdog: watchdog@40052000 {
298			compatible = "nxp,wdog32";
299			reg = <0x40052000 0x1000>;
300			interrupts = <22 0>;
301			clocks = <&lpo>;
302			clk-source = <1>;
303			clk-divider = <256>;
304		};
305
306		pwt: pwt@40056000 {
307			compatible = "nxp,kinetis-pwt";
308			reg = <0x40056000 0x1000>;
309			interrupts = <29 0>;
310			clocks = <&scg KINETIS_SCG_BUS_CLK>;
311			prescaler = <1>;
312			status = "disabled";
313
314			#pwm-cells = <3>;
315		};
316
317		ftfe: flash-controller@40020000 {
318			compatible = "nxp,kinetis-ftfe";
319			reg = <0x40020000 0x1000>;
320			interrupts = <18 0>, <19 0>;
321			interrupt-names = "command-complete", "read-collision";
322
323			#address-cells = <1>;
324			#size-cells = <1>;
325		};
326
327		lpuart0: uart@4006a000 {
328			compatible = "nxp,lpuart";
329			reg = <0x4006a000 0x1000>;
330			interrupts = <31 0>, <32 0>;
331			interrupt-names = "transmit", "receive";
332			clocks = <&pcc 0x1a8 KINETIS_PCC_SRC_FIRC_ASYNC>;
333			dmas = <&edma 1 2>, <&edma 2 3>;
334			dma-names = "rx", "tx";
335			status = "disabled";
336		};
337
338		lpuart1: uart@4006b000 {
339			compatible = "nxp,lpuart";
340			reg = <0x4006b000 0x1000>;
341			interrupts = <33 0>, <34 0>;
342			interrupt-names = "transmit", "receive";
343			clocks = <&pcc 0x1ac KINETIS_PCC_SRC_FIRC_ASYNC>;
344			dmas = <&edma 3 4>, <&edma 4 5>;
345			dma-names = "rx", "tx";
346			status = "disabled";
347		};
348
349		lpuart2: uart@4006c000 {
350			compatible = "nxp,lpuart";
351			reg = <0x4006c000 0x1000>;
352			interrupts = <35 0>, <36 0>;
353			interrupt-names = "transmit", "receive";
354			clocks = <&pcc 0x1b0 KINETIS_PCC_SRC_FIRC_ASYNC>;
355			dmas = <&edma 5 6>, <&edma 5 7>;
356			dma-names = "rx", "tx";
357			status = "disabled";
358		};
359
360		lpi2c0: i2c@40066000 {
361			compatible = "nxp,lpi2c";
362			clock-frequency = <I2C_BITRATE_STANDARD>;
363			#address-cells = <1>;
364			#size-cells = <0>;
365			reg = <0x40066000 0x1000>;
366			interrupts = <24 0>;
367			clocks = <&pcc 0x198 KINETIS_PCC_SRC_FIRC_ASYNC>;
368			status = "disabled";
369		};
370
371		lpi2c1: i2c@40067000 {
372			compatible = "nxp,lpi2c";
373			clock-frequency = <I2C_BITRATE_STANDARD>;
374			#address-cells = <1>;
375			#size-cells = <0>;
376			reg = <0x40067000 0x1000>;
377			interrupts = <25 0>;
378			clocks = <&pcc 0x19c KINETIS_PCC_SRC_FIRC_ASYNC>;
379			status = "disabled";
380		};
381
382		lpspi0: spi@4002c000 {
383			compatible = "nxp,lpspi";
384			reg = <0x4002c000 0x1000>;
385			interrupts = <26 0>;
386			clocks = <&pcc 0xb0 KINETIS_PCC_SRC_FIRC_ASYNC>;
387			status = "disabled";
388			#address-cells = <1>;
389			#size-cells = <0>;
390			tx-fifo-size = <4>;
391			rx-fifo-size = <4>;
392		};
393
394		lpspi1: spi@4002d000 {
395			compatible = "nxp,lpspi";
396			reg = <0x4002d000 0x1000>;
397			interrupts = <27 0>;
398			clocks = <&pcc 0xb4 KINETIS_PCC_SRC_FIRC_ASYNC>;
399			status = "disabled";
400			#address-cells = <1>;
401			#size-cells = <0>;
402			tx-fifo-size = <4>;
403			rx-fifo-size = <4>;
404		};
405
406		flexcan0: can@40024000 {
407			compatible = "nxp,flexcan";
408			reg = <0x40024000 0x1000>;
409			interrupts = <78 0>, <79 0>, <80 0>, <81 0>;
410			interrupt-names = "warning", "error", "wake-up",
411					  "mb-0-15";
412			clocks = <&scg KINETIS_SCG_BUS_CLK>;
413			clk-source = <1>;
414			status = "disabled";
415		};
416
417		flexcan1: can@40025000 {
418			compatible = "nxp,flexcan";
419			reg = <0x40025000 0x1000>;
420			interrupts = <85 0>, <86 0>, <87 0>, <88 0>;
421			interrupt-names = "warning", "error", "wake-up",
422					  "mb-0-15";
423			clocks = <&scg KINETIS_SCG_BUS_CLK>;
424			clk-source = <1>;
425			status = "disabled";
426		};
427
428		porta: pinmux@40049000 {
429			compatible = "nxp,port-pinmux";
430			reg = <0x40049000 0x1000>;
431			clocks = <&pcc 0x124 KINETIS_PCC_SRC_NONE_OR_EXT>;
432		};
433
434		portb: pinmux@4004a000 {
435			compatible = "nxp,port-pinmux";
436			reg = <0x4004a000 0x1000>;
437			clocks = <&pcc 0x128 KINETIS_PCC_SRC_NONE_OR_EXT>;
438		};
439
440		portc: pinmux@4004b000 {
441			compatible = "nxp,port-pinmux";
442			reg = <0x4004b000 0x1000>;
443			clocks = <&pcc 0x12c KINETIS_PCC_SRC_NONE_OR_EXT>;
444		};
445
446		portd: pinmux@4004c000 {
447			compatible = "nxp,port-pinmux";
448			reg = <0x4004c000 0x1000>;
449			clocks = <&pcc 0x130 KINETIS_PCC_SRC_NONE_OR_EXT>;
450		};
451
452		porte: pinmux@4004d000 {
453			compatible = "nxp,port-pinmux";
454			reg = <0x4004d000 0x1000>;
455			clocks = <&pcc 0x134 KINETIS_PCC_SRC_NONE_OR_EXT>;
456		};
457
458		gpioa: gpio@400ff000 {
459			compatible = "nxp,kinetis-gpio";
460			status = "disabled";
461			reg = <0x400ff000 0x40>;
462			interrupts = <59 2>;
463			gpio-controller;
464			#gpio-cells = <2>;
465			nxp,kinetis-port = <&porta>;
466		};
467
468		gpiob: gpio@400ff040 {
469			compatible = "nxp,kinetis-gpio";
470			status = "disabled";
471			reg = <0x400ff040 0x40>;
472			interrupts = <60 2>;
473			gpio-controller;
474			#gpio-cells = <2>;
475			nxp,kinetis-port = <&portb>;
476		};
477
478		gpioc: gpio@400ff080 {
479			compatible = "nxp,kinetis-gpio";
480			status = "disabled";
481			reg = <0x400ff080 0x40>;
482			interrupts = <61 2>;
483			gpio-controller;
484			#gpio-cells = <2>;
485			nxp,kinetis-port = <&portc>;
486		};
487
488		gpiod: gpio@400ff0c0 {
489			compatible = "nxp,kinetis-gpio";
490			status = "disabled";
491			reg = <0x400ff0c0 0x40>;
492			interrupts = <62 2>;
493			gpio-controller;
494			#gpio-cells = <2>;
495			nxp,kinetis-port = <&portd>;
496		};
497
498		gpioe: gpio@400ff100 {
499			compatible = "nxp,kinetis-gpio";
500			status = "disabled";
501			reg = <0x400ff100 0x40>;
502			interrupts = <63 2>;
503			gpio-controller;
504			#gpio-cells = <2>;
505			nxp,kinetis-port = <&porte>;
506		};
507
508		adc0: adc@4003b000 {
509			compatible = "nxp,adc12";
510			reg = <0x4003b000 0x1000>;
511			interrupts = <39 0>;
512			clocks = <&pcc 0xec KINETIS_PCC_SRC_FIRC_ASYNC>;
513			clk-source = <0>;
514			clk-divider = <1>;
515			status = "disabled";
516			#io-channel-cells = <1>;
517		};
518
519		adc1: adc@40027000 {
520			compatible = "nxp,adc12";
521			reg = <0x40027000 0x1000>;
522			interrupts = <73 0>;
523			clocks = <&pcc 0x9c KINETIS_PCC_SRC_FIRC_ASYNC>;
524			clk-source = <0>;
525			clk-divider = <1>;
526			status = "disabled";
527			#io-channel-cells = <1>;
528		};
529
530		adc2: adc@4003c000 {
531			compatible = "nxp,adc12";
532			reg = <0x4003c000 0x1000>;
533			interrupts = <74 0>;
534			clocks = <&pcc 0xf0 KINETIS_PCC_SRC_FIRC_ASYNC>;
535			clk-source = <0>;
536			clk-divider = <1>;
537			status = "disabled";
538			#io-channel-cells = <1>;
539		};
540
541		ftm0: ftm@40038000 {
542			compatible = "nxp,ftm";
543			reg = <0x40038000 0x1000>;
544			interrupts = <42 0>;
545			clocks = <&pcc 0xe0 KINETIS_PCC_SRC_FIRC_ASYNC>;
546			prescaler = <16>;
547			status = "disabled";
548		};
549
550		ftm1: ftm@40039000 {
551			compatible = "nxp,ftm";
552			reg = <0x40039000 0x1000>;
553			interrupts = <43 0>;
554			clocks = <&pcc 0xe4 KINETIS_PCC_SRC_FIRC_ASYNC>;
555			prescaler = <16>;
556			status = "disabled";
557		};
558
559		ftm2: ftm@4003a000 {
560			compatible = "nxp,ftm";
561			reg = <0x4003a000 0x1000>;
562			interrupts = <44 0>;
563			clocks = <&pcc 0xe8 KINETIS_PCC_SRC_FIRC_ASYNC>;
564			prescaler = <16>;
565			status = "disabled";
566		};
567
568		ftm3: ftm@40026000 {
569			compatible = "nxp,ftm";
570			reg = <0x40026000 0x1000>;
571			interrupts = <71 0>;
572			clocks = <&pcc 0x98 KINETIS_PCC_SRC_FIRC_ASYNC>;
573			prescaler = <16>;
574			status = "disabled";
575		};
576
577		cmp0: cmp@40073000 {
578			compatible = "nxp,kinetis-acmp";
579			reg = <0x40073000 0x1000>;
580			interrupts = <40 0>;
581			clocks = <&scg KINETIS_SCG_BUS_CLK>;
582			status = "disabled";
583		};
584
585		cmp1: cmp@40074000 {
586			compatible = "nxp,kinetis-acmp";
587			reg = <0x40074000 0x1000>;
588			interrupts = <41 0>;
589			clocks = <&scg KINETIS_SCG_BUS_CLK>;
590			status = "disabled";
591		};
592
593		cmp2: cmp@40075000 {
594			compatible = "nxp,kinetis-acmp";
595			reg = <0x40075000 0x1000>;
596			interrupts = <70 0>;
597			clocks = <&scg KINETIS_SCG_BUS_CLK>;
598			status = "disabled";
599		};
600
601		flexio1: flexio@4005a000 {
602			compatible = "nxp,flexio";
603			reg = <0x4005a000 0x1000>;
604			status = "disabled";
605			interrupts = <69 0>;
606			clocks = <&pcc 0x168 KINETIS_PCC_SRC_FIRC_ASYNC>;
607		};
608	};
609};
610
611&nvic {
612	arm,num-irq-priority-bits = <4>;
613};
614