1/*
2 * Copyright (c) 2018 Prevas A/S
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <nxp/nxp_k2x.dtsi>
10#include <zephyr/dt-bindings/pwm/pwm.h>
11#include "frdm_k22f-pinctrl.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "NXP Freedom MK22F board";
16	compatible = "nxp,mk22f12", "nxp,k22f", "nxp,k2x";
17
18	aliases {
19		led0 = &green_led;
20		led1 = &blue_led;
21		led2 = &red_led;
22		sw0 = &user_button_3;
23		sw1 = &user_button_2;
24		pwm-led0 = &green_pwm_led;
25		green-pwm-led = &green_pwm_led;
26		blue-pwm-led = &blue_pwm_led;
27		red-pwm-led = &red_pwm_led;
28		magn0 = &fxos8700;
29		accel0 = &fxos8700;
30	};
31
32	chosen {
33		zephyr,sram = &sram0;
34		zephyr,flash = &flash0;
35		zephyr,code-partition = &slot0_partition;
36		zephyr,console = &uart1;
37		zephyr,shell-uart = &uart1;
38		zephyr,uart-pipe = &uart1;
39	};
40
41	leds {
42		compatible = "gpio-leds";
43		red_led: led_0 {
44			gpios = <&gpioa 1 0>;
45			label = "User LD1";
46		};
47		green_led: led_1 {
48			gpios = <&gpioa 2 0>;
49			label = "User LD2";
50		};
51		blue_led: led_2 {
52			gpios = <&gpiod 5 0>;
53			label = "User LD3";
54		};
55	};
56
57	pwmleds {
58		compatible = "pwm-leds";
59
60		red_pwm_led: red_pwm_led {
61			label = "red_led";
62			pwms = <&ftm0 6 15625000 PWM_POLARITY_INVERTED>;
63		};
64		green_pwm_led: green_pwm_led {
65			label = "green_led";
66			pwms = <&ftm0 7 15625000 PWM_POLARITY_INVERTED>;
67		};
68		blue_pwm_led: blue_pwm_led {
69			label = "blue_led";
70			pwms = <&ftm0 5 15625000 PWM_POLARITY_INVERTED>;
71		};
72	};
73
74	gpio_keys {
75		compatible = "gpio-keys";
76		user_button_2: button_0 {
77			label = "User SW2";
78			gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
79			zephyr,code = <INPUT_KEY_0>;
80		};
81		user_button_3: button_1 {
82			label = "User SW3";
83			gpios = <&gpiob 17 GPIO_ACTIVE_LOW>;
84			zephyr,code = <INPUT_KEY_1>;
85		};
86	};
87
88	arduino_header: connector {
89		compatible = "arduino-header-r3";
90		#gpio-cells = <2>;
91		gpio-map-mask = <0xffffffff 0xffffffc0>;
92		gpio-map-pass-thru = <0 0x3f>;
93		gpio-map = <0 0 &gpiob 0 0>,	/* A0 */
94			   <1 0 &gpiob 1 0>,	/* A1 */
95			   <2 0 &gpioc 1 0>,	/* A2 */
96			   <3 0 &gpioc 2 0>,	/* A3 */
97			   <4 0 &gpiob 3 0>,	/* A4 */
98			   <5 0 &gpiob 2 0>,	/* A5 */
99			   <6 0 &gpiod 2 0>,	/* D0 */
100			   <7 0 &gpiod 3 0>,	/* D1 */
101			   <8 0 &gpiob 16 0>,	/* D2 */
102			   <9 0 &gpioa 2 0>,	/* D3 */
103			   <10 0 &gpioa 4 0>,	/* D4 */
104			   <11 0 &gpiob 18 0>,	/* D5 */
105			   <12 0 &gpioc 3 0>,	/* D6 */
106			   <13 0 &gpioc 6 0>,	/* D7 */
107			   <14 0 &gpiob 19 0>,	/* D8 */
108			   <15 0 &gpioa 1 0>,	/* D9 */
109			   <16 0 &gpiod 4 0>,	/* D10 */
110			   <17 0 &gpiod 6 0>,	/* D11 */
111			   <18 0 &gpiod 7 0>,	/* D12 */
112			   <19 0 &gpiod 5 0>,	/* D13 */
113			   <20 0 &gpioe 0 0>,	/* D14 */
114			   <21 0 &gpioe 1 0>;	/* D15 */
115	};
116};
117
118&sim {
119	pllfll-select = <KINETIS_SIM_PLLFLLSEL_MCGPLLCLK>;
120	er32k-select = <KINETIS_SIM_ER32KSEL_RTC>;
121};
122
123&adc0 {
124	status = "okay";
125};
126
127&dac0 {
128	status = "okay";
129	voltage-reference = <2>;
130};
131arduino_i2c: &i2c0 {
132	status = "okay";
133	pinctrl-0 = <&i2c0_default>;
134	pinctrl-names = "default";
135
136	fxos8700: fxos8700@1c {
137		compatible = "nxp,fxos8700";
138		reg = <0x1c>;
139		int1-gpios = <&gpiod 0 GPIO_ACTIVE_LOW>;
140		int2-gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;
141	};
142};
143
144
145arduino_spi: &spi0 {
146	status = "okay";
147	pinctrl-0 = <&spi0_default>;
148	pinctrl-names = "default";
149};
150
151&ftm0 {
152	status = "okay";
153	compatible = "nxp,kinetis-ftm-pwm";
154	#pwm-cells = <3>;
155	pinctrl-0 = <&ftm0_default>;
156	pinctrl-names = "default";
157};
158
159&uart1 {
160	status = "okay";
161	current-speed = <115200>;
162	pinctrl-0 = <&uart1_default>;
163	pinctrl-names = "default";
164};
165
166&uart2 {
167	pinctrl-0 = <&uart2_default>;
168	pinctrl-names = "default";
169};
170
171zephyr_udc0: &usbotg {
172	compatible = "nxp,kinetis-usbd";
173	status = "okay";
174	num-bidir-endpoints = <8>;
175};
176
177&gpioa {
178	status = "okay";
179};
180
181&gpiob {
182	status = "okay";
183};
184
185&gpioc {
186	status = "okay";
187};
188
189&gpiod {
190	status = "okay";
191};
192
193&gpioe {
194	status = "okay";
195};
196
197&flash0 {
198	partitions {
199		compatible = "fixed-partitions";
200		#address-cells = <1>;
201		#size-cells = <1>;
202
203		boot_partition: partition@0 {
204			label = "mcuboot";
205			reg = <0x00000000 0x00010000>;
206			read-only;
207		};
208		slot0_partition: partition@10000 {
209			label = "image-0";
210			reg = <0x00010000 0x00020000>;
211		};
212		slot1_partition: partition@30000 {
213			label = "image-1";
214			reg = <0x00030000 0x00020000>;
215		};
216		scratch_partition: partition@50000 {
217			label = "image-scratch";
218			reg = <0x00050000 0x00010000>;
219		};
220
221		/*
222		 * The flash starting at 0x00060000 and ending at
223		 * 0x0007ffff (sectors 16-31) is reserved for use
224		 * by the application.
225		 */
226		storage_partition: partition@60000 {
227			label = "storage";
228			reg = <0x00060000 0x00020000>;
229		};
230
231	};
232};
233