1/*
2 * Copyright (c) 2019 SEAL AG
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <mem.h>
10#include <nxp/nxp_k82fn256vxx15.dtsi>
11#include <zephyr/dt-bindings/pwm/pwm.h>
12#include "frdm_k82f-pinctrl.dtsi"
13#include <zephyr/dt-bindings/input/input-event-codes.h>
14
15/ {
16	model = "NXP Kinetis K82 Freedom Board";
17	compatible = "nxp,mk82f25615", "nxp,k82f", "nxp,k8x";
18
19	aliases {
20		led0 = &red_led;
21		led1 = &green_led;
22		led2 = &blue_led;
23		pwm-led0 = &red_pwm_led;
24		pwm-led1 = &green_pwm_led;
25		pwm-led2 = &blue_pwm_led;
26		sw0 = &user_button_0;
27		sw1 = &user_button_1;
28		magn0 = &fxos8700;
29		accel0 = &fxos8700;
30		mcuboot-button0 = &user_button_0;
31	};
32
33	chosen {
34		/*
35		 * Note: when using DMA, the SRAM region must be set to
36		 * a memory region that is not cached by the chip. If the chosen
37		 * sram region is changed and DMA is in use, you will
38		 * encounter issues!
39		 */
40		zephyr,sram = &sram0;
41		zephyr,flash = &flash0;
42		zephyr,code-partition = &slot0_partition;
43		zephyr,uart-mcumgr = &lpuart4;
44		zephyr,console = &lpuart4;
45		zephyr,shell-uart = &lpuart4;
46		zephyr,uart-pipe = &lpuart4;
47	};
48
49	leds {
50		compatible = "gpio-leds";
51		red_led: led_0 {
52			gpios = <&gpioc 8 0>;
53			label = "User LED D3 Red";
54		};
55		green_led: led_1 {
56			gpios = <&gpioc 9 0>;
57			label = "User LED D3 Green";
58		};
59		blue_led: led_2 {
60			gpios = <&gpioc 10 0>;
61			label = "User LED D3 Blue";
62		};
63	};
64
65	pwmleds {
66		compatible = "pwm-leds";
67
68		red_pwm_led: red_pwm_led {
69			pwms = <&ftm3 4 15625000 PWM_POLARITY_INVERTED>;
70		};
71		green_pwm_led: green_pwm_led {
72			pwms = <&ftm3 5 15625000 PWM_POLARITY_INVERTED>;
73		};
74		blue_pwm_led: blue_pwm_led {
75			pwms = <&ftm3 6 15625000 PWM_POLARITY_INVERTED>;
76		};
77	};
78
79	gpio_keys {
80		compatible = "gpio-keys";
81		user_button_0: button_0 {
82			label = "User SW2";
83			gpios = <&gpioa 4 GPIO_ACTIVE_LOW>;
84			zephyr,code = <INPUT_KEY_0>;
85		};
86		user_button_1: button_1 {
87			label = "User SW3";
88			gpios = <&gpioc 6 GPIO_ACTIVE_LOW>;
89			zephyr,code = <INPUT_KEY_1>;
90		};
91	};
92
93	arduino_header: connector {
94		compatible = "arduino-header-r3";
95		#gpio-cells = <2>;
96		gpio-map-mask = <0xffffffff 0xffffffc0>;
97		gpio-map-pass-thru = <0 0x3f>;
98		gpio-map = <0 0 &gpiob 0 0>,	/* A0 */
99			   <1 0 &gpiob 1 0>,	/* A1 */
100			   <2 0 &gpioc 1 0>,	/* A2 */
101			   <3 0 &gpioc 2 0>,	/* A3 */
102			   <4 0 &gpiob 3 0>,	/* A4 */
103			   <5 0 &gpiob 2 0>,	/* A5 */
104			   <6 0 &gpiob 16 0>,	/* D0 */
105			   <7 0 &gpiob 17 0>,	/* D1 */
106			   <8 0 &gpioc 12 0>,	/* D2 */
107			   <9 0 &gpiod 0 0>,	/* D3 */
108			   <10 0 &gpioc 11 0>,	/* D4 */
109			   <11 0 &gpioc 10 0>,	/* D5 */
110			   <12 0 &gpioc 8 0>,	/* D6 */
111			   <13 0 &gpioc 9 0>,	/* D7 */
112			   <14 0 &gpioc 3 0>,	/* D8 */
113			   <15 0 &gpioc 5 0>,	/* D9 */
114			   <16 0 &gpiod 4 0>,	/* D10 */
115			   <17 0 &gpiod 2 0>,	/* D11 */
116			   <18 0 &gpiod 3 0>,	/* D12 */
117			   <19 0 &gpiod 1 0>,	/* D13 */
118			   <20 0 &gpioa 1 0>,	/* D14 */
119			   <21 0 &gpioa 2 0>;	/* D15 */
120	};
121};
122
123&sim {
124	pllfll-select = <KINETIS_SIM_PLLFLLSEL_MCGPLLCLK>;
125	er32k-select = <KINETIS_SIM_ER32KSEL_OSC32KCLK>;
126};
127
128&adc0 {
129	status = "okay";
130	pinctrl-0 = <&adc0_default>;
131	pinctrl-names = "default";
132};
133
134&gpioa {
135	status = "okay";
136};
137
138&gpiob {
139	status = "okay";
140};
141
142&gpioc {
143	status = "okay";
144};
145
146&gpiod {
147	status = "okay";
148};
149
150&gpioe {
151	status = "okay";
152};
153
154&flash0 {
155
156	partitions {
157		compatible = "fixed-partitions";
158		#address-cells = <1>;
159		#size-cells = <1>;
160
161		boot_partition: partition@0 {
162			label = "mcuboot";
163			reg = <0x0 DT_SIZE_K(44)>;
164		};
165		/* The MCUBoot swap-move algorithm uses the last 2 sectors
166		 * of the primary slot0 for swap status and move.
167		 */
168		slot0_partition: partition@b000 {
169			label = "image-0";
170			reg = <0xb000 (DT_SIZE_K(96) + DT_SIZE_K(8))>;
171		};
172		slot1_partition: partition@25000 {
173			label = "image-1";
174			reg = <0x25000 DT_SIZE_K(96)>;
175		};
176		storage_partition: partition@3d000 {
177			label = "storage";
178			reg = <0x3d000 DT_SIZE_K(12)>;
179		};
180	};
181};
182
183&i2c3 {
184	status = "okay";
185	pinctrl-0 = <&i2c3_default>;
186	pinctrl-names = "default";
187
188	fxos8700: fxos8700@1c {
189		compatible = "nxp,fxos8700";
190		reg = <0x1c>;
191		int1-gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
192	};
193};
194
195&lpuart4 {
196	status = "okay";
197	pinctrl-0 = <&lpuart4_default>;
198	pinctrl-names = "default";
199	current-speed = <115200>;
200};
201
202&lpuart0 {
203	pinctrl-0 = <&lpuart0_default>;
204	pinctrl-names = "default";
205};
206
207&ftm3 {
208	status = "okay";
209	compatible = "nxp,ftm-pwm";
210	#pwm-cells = <3>;
211	pinctrl-0 = <&ftm3_default>;
212	pinctrl-names = "default";
213	clock-source = "fixed";
214};
215
216&spi1 {
217	status = "okay";
218
219	pinctrl-0 = <&spi1_default>;
220	pinctrl-names = "default";
221
222	mx25u32: mx25u3235f@0 {
223		compatible = "jedec,spi-nor";
224		reg = <0>;
225		spi-max-frequency = <104000000>;
226		wp-gpios = <&gpioe 3 0>;
227		reset-gpios = <&gpioe 0 0>;
228		size = <0x2000000>;
229		jedec-id = [c2 25 36];
230	};
231};
232
233zephyr_udc0: &usbotg {
234	status = "okay";
235};
236
237&edma0 {
238	status = "okay";
239};
240
241&adc0 {
242	status = "okay";
243};
244
245&pit0 {
246	status = "okay";
247};
248
249arduino_i2c: &i2c0 {
250	status = "okay";
251	pinctrl-0 = <&i2c0_default>;
252	pinctrl-names = "default";
253};
254
255arduino_spi: &spi0 {
256	status = "okay";
257	pinctrl-0 = <&spi0_default>;
258	pinctrl-names = "default";
259};
260