1/*
2 * Copyright (c) 2021, Teslabs Engineering S.L.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6/dts-v1/;
7
8#include <gigadevice/gd32vf103Xb.dtsi>
9#include "gd32vf103v_eval-pinctrl.dtsi"
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "GigaDevice GD32VF103V-EVAL";
14	compatible = "gd,gd32vf103v-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 = <&gpioc 0 GPIO_ACTIVE_HIGH>;
28			label = "LED1";
29		};
30		led2: led2 {
31			gpios = <&gpioc 2 GPIO_ACTIVE_HIGH>;
32			label = "LED2";
33		};
34		led3: led3 {
35			gpios = <&gpioe 0 GPIO_ACTIVE_HIGH>;
36			label = "LED3";
37		};
38		led4: led4 {
39			gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
40			label = "LED4";
41		};
42	};
43
44	gpio_keys {
45		compatible = "gpio-keys";
46		key_cet: key_cet {
47			label = "KEY_CET";
48			gpios = <&gpioc 4 GPIO_ACTIVE_LOW>;
49			zephyr,code = <INPUT_KEY_0>;
50		};
51		key_a: key_a {
52			label = "KEY_A";
53			gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
54			zephyr,code = <INPUT_KEY_A>;
55		};
56		key_b: key_b {
57			label = "KEY_B";
58			gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
59			zephyr,code = <INPUT_KEY_B>;
60		};
61		key_c: key_c {
62			label = "KEY_C";
63			gpios = <&gpiob 14 GPIO_ACTIVE_LOW>;
64			zephyr,code = <INPUT_KEY_C>;
65		};
66		key_d: key_d {
67			label = "KEY_D";
68			gpios = <&gpioc 5 GPIO_ACTIVE_LOW>;
69			zephyr,code = <INPUT_KEY_D>;
70		};
71	};
72
73	pwmleds {
74		compatible = "pwm-leds";
75
76		/* NOTE: bridge TIMER0_CH0 (PA8) and LED1 (PC0) */
77		pwm_led: pwm_led {
78			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
79		};
80	};
81
82	aliases {
83		led0 = &led1;
84		led1 = &led2;
85		sw0 = &key_cet;
86		pwm-led0 = &pwm_led;
87		spi-flash0 = &nor_flash;
88		watchdog0 = &fwdgt;
89	};
90};
91
92&gpioa {
93	status = "okay";
94};
95
96&gpiob {
97	status = "okay";
98};
99
100&gpioc {
101	status = "okay";
102};
103
104&gpioe {
105	status = "okay";
106};
107
108&usart0 {
109	status = "okay";
110	current-speed = <115200>;
111	pinctrl-0 = <&usart0_default>;
112	pinctrl-names = "default";
113};
114
115&usart1 {
116	status = "okay";
117	current-speed = <115200>;
118	pinctrl-0 = <&usart1_default>;
119	pinctrl-names = "default";
120};
121
122&timer0 {
123	status = "okay";
124	prescaler = <128>;
125
126	pwm0: pwm {
127		status = "okay";
128		pinctrl-0 = <&pwm0_default>;
129		pinctrl-names = "default";
130	};
131};
132
133&spi0 {
134	status = "okay";
135	pinctrl-0 = <&spi0_default>;
136	pinctrl-names = "default";
137	cs-gpios = <&gpioe 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
138
139	nor_flash: gd25q16@0 {
140		compatible ="jedec,spi-nor";
141		size = <0x1000000>;
142		reg = <0>;
143		spi-max-frequency = <4000000>;
144		status = "okay";
145		jedec-id = [c8 40 15];
146	};
147};
148
149&adc0 {
150	status = "okay";
151	pinctrl-0 = <&adc0_default>;
152	pinctrl-names = "default";
153};
154
155&fwdgt {
156	status = "okay";
157};
158