1/*
2 * Copyright 2024 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <nxp/nxp_ke17z512.dtsi>
10#include "frdm_ke17z512-pinctrl.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12#include <zephyr/dt-bindings/pwm/pwm.h>
13
14/ {
15	model = "NXP Freedom KE17Z512 board";
16	compatible = "nxp,ke17z512", "nxp,mke17z9", "nxp,ke1xz";
17
18	chosen {
19		zephyr,sram = &sram_u;
20		zephyr,flash = &flash0;
21		zephyr,code-partition = &slot0_partition;
22		zephyr,uart-mcumgr = &lpuart2;
23		zephyr,console = &lpuart2;
24		zephyr,shell-uart = &lpuart2;
25	};
26
27	aliases {
28		watchdog0 = &wdog;
29		led0 = &red_led;
30		led1 = &green_led;
31		led2 = &blue_led;
32		sw0 = &user_button_2;
33		sw1 = &user_button_3;
34		pwm-led0 = &red_pwm_led;
35		pwm-led1 = &green_pwm_led;
36		pwm-led2 = &blue_pwm_led;
37		mcuboot-button0 = &user_button_2;
38	};
39
40	leds {
41		compatible = "gpio-leds";
42		red_led: led_0 {
43			gpios = <&gpiod 10 GPIO_ACTIVE_LOW>;
44			label = "Red LED";
45		};
46		green_led: led_1 {
47			gpios = <&gpiod 5 GPIO_ACTIVE_LOW>;
48			label = "Green LED";
49		};
50		blue_led: led_2 {
51			gpios = <&gpiod 12 GPIO_ACTIVE_LOW>;
52			label = "Blue LED";
53		};
54	};
55
56	pwmleds {
57		compatible = "pwm-leds";
58		red_pwm_led: led_pwm_0 {
59			pwms = <&ftm2 0 PWM_HZ(20) PWM_POLARITY_INVERTED>;
60			label = "RED RGB PWM LED";
61		};
62		green_pwm_led: led_pwm_1 {
63			pwms = <&ftm2 3 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
64			label = "GREEN RGB PWM LED";
65		};
66		blue_pwm_led: led_pwm_2 {
67			pwms = <&ftm2 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
68			label = "BLUE RGB PWM LED";
69		};
70	};
71
72	gpio_keys {
73		compatible = "gpio-keys";
74		user_button_2: button_0 {
75			label = "User SW2";
76			gpios = <&gpioe 14 GPIO_ACTIVE_LOW>;
77			zephyr,code = <INPUT_KEY_0>;
78		};
79		user_button_3: button_1 {
80			label = "User SW3";
81			gpios = <&gpiod 3 GPIO_ACTIVE_LOW>;
82			zephyr,code = <INPUT_KEY_1>;
83		};
84	};
85};
86
87&idle {
88	min-residency-us = <1>;
89};
90
91&stop {
92	min-residency-us = <20000>;
93	exit-latency-us = <13>;
94};
95
96&lpuart2 {
97	dmas = <&edma 5 6>, <&edma 6 7>;
98	dma-names = "rx", "tx";
99	status = "okay";
100	pinctrl-0 = <&lpuart2_default>;
101	pinctrl-names = "default";
102	current-speed = <115200>;
103};
104
105&adc0 {
106	status = "okay";
107	sample-time = <12>;
108	vref-mv = <3300>;
109	pinctrl-0 = <&adc0_default>;
110	pinctrl-names = "default";
111};
112
113&gpiod {
114	status = "okay";
115};
116
117&scg {
118	bus_clk {
119		clock-div = <2>;
120	};
121};
122
123&gpioe {
124	status = "okay";
125};
126
127&rtc {
128	status = "okay";
129	clock-source = "LPO";
130};
131
132&lpi2c0 {
133	status = "okay";
134	pinctrl-0 = <&lpi2c0_default>;
135	pinctrl-names = "default";
136};
137
138&lpi2c1 {
139	status = "okay";
140	pinctrl-0 = <&lpi2c1_default>;
141	pinctrl-names = "default";
142};
143
144&ftm2 {
145	status = "okay";
146	compatible = "nxp,ftm-pwm";
147	#pwm-cells = <3>;
148	clocks = <&scg KINETIS_SCG_SIRC_CLK>;
149	prescaler = <128>;
150	pinctrl-0 = <&ftm2_default>;
151	pinctrl-names = "default";
152	clock-source = "system";
153};
154
155&flash0 {
156
157	partitions {
158		compatible = "fixed-partitions";
159		#address-cells = <1>;
160		#size-cells = <1>;
161		boot_partition: partition@0 {
162			label = "mcuboot";
163			reg = <0x00000000 DT_SIZE_K(64)>;
164			read-only;
165		};
166		/* The MCUBoot swap-move algorithm uses the last 3 sectors
167		 * of the primary slot0 for swap status and move.
168		 */
169		slot0_partition: partition@10000 {
170			label = "image-0";
171			reg = <0x00010000 (DT_SIZE_K(202) + DT_SIZE_K(6))>;
172		};
173		slot1_partition: partition@44000 {
174			label = "image-1";
175			reg = <0x00044000 DT_SIZE_K(202)>;
176		};
177		storage_partition: partition@76800 {
178			label = "storage";
179			reg = <0x00076800 DT_SIZE_K(38)>;
180		};
181	};
182};
183
184&lpspi0 {
185	dmas = <&edma 0 14>, <&edma 1 15>;
186	dma-names = "rx", "tx";
187	status = "okay";
188	pinctrl-0 = <&lpspi0_default>;
189	pinctrl-names = "default";
190};
191
192&edma {
193	status = "okay";
194};
195
196&wdog {
197	status = "okay";
198};
199