1/*
2 * Copyright (c) 2022, Rtone.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6/dts-v1/;
7
8#include <gd/gd32f4xx/gd32f470ik.dtsi>
9#include "gd32f470i_eval-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "GigaDevice GD32F470I-EVAL";
14	compatible = "gd,gd32f470i-eval";
15
16	chosen {
17		zephyr,sram = &sram0;
18		zephyr,flash = &flash0;
19		zephyr,console = &usart0;
20		zephyr,shell-uart = &usart0;
21		zephyr,flash-controller = &fmc;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		led1: led1 {
27			gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
28			label = "LED1";
29		};
30		led2: led2 {
31			gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
32			label = "LED2";
33		};
34		led3: led3 {
35			gpios = <&gpiof 10 GPIO_ACTIVE_HIGH>;
36			label = "LED3";
37		};
38	};
39
40	gpio_keys {
41		compatible = "gpio-keys";
42		wakeup_key: wakeup_key {
43			label = "WAKEUP_KEY";
44			gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
45			zephyr,code = <INPUT_KEY_WAKEUP>;
46		};
47		tamper_key: tamper_key {
48			label = "TAMPER_KEY";
49			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
50			zephyr,code = <INPUT_KEY_0>;
51		};
52		user_key: user_key {
53			label = "USER_KEY";
54			gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
55			zephyr,code = <INPUT_KEY_1>;
56		};
57	};
58
59	pwmleds {
60		compatible = "pwm-leds";
61
62		/* NOTE: bridge TIMER1_CH2 (PB10) and LED1 (PE2) */
63		pwm_led: pwm_led {
64			pwms = <&pwm1 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
65		};
66	};
67
68	aliases {
69		led0 = &led1;
70		led1 = &led2;
71		sw0 = &user_key;
72		pwm-led0 = &pwm_led;
73		eeprom-0 = &eeprom0;
74		watchdog0 = &fwdgt;
75	};
76};
77
78&gpioa {
79	status = "okay";
80};
81
82&gpiob {
83	status = "okay";
84};
85
86&gpioc {
87	status = "okay";
88};
89
90&gpioe {
91	status = "okay";
92};
93
94&gpiog {
95	status = "okay";
96};
97
98&gpiof {
99	status = "okay";
100};
101
102&gpioi {
103	status = "okay";
104};
105
106&usart0 {
107	status = "okay";
108	current-speed = <115200>;
109	pinctrl-0 = <&usart0_default>;
110	pinctrl-names = "default";
111};
112
113&dac {
114	status = "okay";
115	pinctrl-0 = <&dac_default>;
116	pinctrl-names = "default";
117};
118
119&timer1 {
120	status = "okay";
121
122	pwm1: pwm {
123		status = "okay";
124		pinctrl-0 = <&pwm1_default>;
125		pinctrl-names = "default";
126	};
127};
128
129&i2c0 {
130	status = "okay";
131	pinctrl-0 = <&i2c0_default>;
132	pinctrl-names = "default";
133
134	eeprom0: eeprom@50 {
135		compatible = "atmel,at24";
136		reg = <0x50>;
137		status = "okay";
138		size = <256>;
139		pagesize = <8>;
140		address-width = <8>;
141		timeout = <5>;
142	};
143};
144
145&spi5 {
146	status = "okay";
147	pinctrl-0 = <&spi5_default>;
148	pinctrl-names = "default";
149	cs-gpios = <&gpioi 8 GPIO_ACTIVE_LOW>;
150
151	nor_flash: gd25q16@0 {
152		compatible ="jedec,spi-nor";
153		size = <0x1000000>;
154		reg = <0>;
155		spi-max-frequency = <4000000>;
156		status = "okay";
157		jedec-id = [c8 40 15];
158	};
159};
160
161&fwdgt {
162	status = "okay";
163};
164