1/*
2 * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6/dts-v1/;
7
8#include <espressif/esp32.dtsi>
9#include "esp_wrover_kit-pinctrl.dtsi"
10
11/ {
12	model = "esp32";
13	compatible = "espressif,esp32";
14
15	aliases {
16		led0 = &blue_led;
17		led1 = &green_led;
18		led2 = &red_led;
19		pwm-led0 = &pwm_led_red;
20		pwm-led1 = &pwm_led_green;
21		pwm-led2 = &pwm_led_blue;
22		red-pwm-led = &pwm_led_red;
23		green-pwm-led = &pwm_led_green;
24		blue-pwm-led = &pwm_led_blue;
25		uart-0 = &uart0;
26		i2c-0 = &i2c0;
27		watchdog0 = &wdt0;
28	};
29
30	chosen {
31		zephyr,sram = &sram0;
32		zephyr,console = &uart0;
33		zephyr,shell-uart = &uart0;
34		zephyr,flash = &flash0;
35		zephyr,display = &ili9341;
36	};
37
38	leds {
39		compatible = "gpio-leds";
40
41		blue_led: led_0 {
42			gpios =  <&gpio0 4 GPIO_ACTIVE_HIGH>;
43			label = "Blue - LED0";
44		};
45
46		green_led: led_1 {
47			gpios =  <&gpio0 2 GPIO_ACTIVE_HIGH>;
48			label = "Green - LED1";
49		};
50
51		red_led: led_2 {
52			gpios =  <&gpio0 0 GPIO_ACTIVE_HIGH>;
53			label = "Red - LED2";
54		};
55	};
56
57	pwmleds {
58		compatible = "pwm-leds";
59		pwm_led_red: pwm_led_0 {
60			label = "Red PWM LED";
61			pwms = <&ledc0 0 PWM_HZ(100) PWM_POLARITY_NORMAL>;
62		};
63		pwm_led_green: pwm_led_1 {
64			label = "Green PWM LED";
65			pwms = <&ledc0 1 PWM_HZ(100) PWM_POLARITY_NORMAL>;
66		};
67		pwm_led_blue: pwm_led_2 {
68			label = "Blue PWM LED";
69			pwms = <&ledc0 2 PWM_HZ(100) PWM_POLARITY_NORMAL>;
70		};
71	};
72};
73
74&cpu0 {
75	clock-frequency = <ESP32_CLK_CPU_240M>;
76};
77
78&cpu1 {
79	clock-frequency = <ESP32_CLK_CPU_240M>;
80};
81
82&uart0 {
83	status = "okay";
84	current-speed = <115200>;
85	pinctrl-0 = <&uart0_default>;
86	pinctrl-names = "default";
87};
88
89&gpio0 {
90	status = "okay";
91};
92
93&gpio1 {
94	status = "okay";
95};
96
97&i2c0 {
98	status = "okay";
99	clock-frequency = <I2C_BITRATE_STANDARD>;
100	sda-gpios = <&gpio0 21 GPIO_OPEN_DRAIN>;
101	scl-gpios = <&gpio0 22 GPIO_OPEN_DRAIN>;
102	pinctrl-0 = <&i2c0_default>;
103	pinctrl-names = "default";
104};
105
106&spi2 {
107	#address-cells = <1>;
108	#size-cells = <0>;
109	status = "okay";
110	pinctrl-0 = <&spim2_default>;
111	pinctrl-names = "default";
112};
113
114&spi3 {
115	#address-cells = <1>;
116	#size-cells = <0>;
117	status = "okay";
118	pinctrl-0 = <&spim3_default>;
119	pinctrl-names = "default";
120
121	ili9341: ili9341@0 {
122		compatible = "ilitek,ili9341";
123		spi-max-frequency = <25000000>;
124		reg = <0>;
125		cmd-data-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
126		reset-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
127		pixel-format = <0>;
128		rotation = <0>;
129		width = <240>;
130		height = <320>;
131	};
132};
133
134&ledc0 {
135	pinctrl-0 = <&ledc0_default>;
136	pinctrl-names = "default";
137	status = "okay";
138	#address-cells = <1>;
139	#size-cells = <0>;
140	channel0@0 {
141		reg = <0x0>;
142		timer = <0>;
143	};
144	channel1@1 {
145		reg = <0x1>;
146		timer = <1>;
147	};
148	channel2@2 {
149		reg = <0x2>;
150		timer = <2>;
151	};
152};
153
154&timer0 {
155	status = "okay";
156};
157
158&timer1 {
159	status = "okay";
160};
161
162&timer2 {
163	status = "okay";
164};
165
166&timer3 {
167	status = "okay";
168};
169
170&trng0 {
171	status = "okay";
172};
173
174&flash0 {
175	status = "okay";
176	partitions {
177		compatible = "fixed-partitions";
178		#address-cells = <1>;
179		#size-cells = <1>;
180
181		/* Reserve 60kB for the bootloader */
182		boot_partition: partition@1000 {
183			label = "mcuboot";
184			reg = <0x00001000 0x0000F000>;
185			read-only;
186		};
187
188		/* Reserve 1024kB for the application in slot 0 */
189		slot0_partition: partition@10000 {
190			label = "image-0";
191			reg = <0x00010000 0x00100000>;
192		};
193
194		/* Reserve 1024kB for the application in slot 1 */
195		slot1_partition: partition@110000 {
196			label = "image-1";
197			reg = <0x00110000 0x00100000>;
198		};
199
200		/* Reserve 256kB for the scratch partition */
201		scratch_partition: partition@210000 {
202			   label = "image-scratch";
203			   reg = <0x00210000 0x00040000>;
204		};
205
206		storage_partition: partition@250000 {
207			label = "storage";
208			reg = <0x00250000 0x00006000>;
209		};
210	};
211};
212