1/*
2 * Copyright (c) 2017 Powersoft
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/f4/stm32f412Xg.dtsi>
9#include <st/f4/stm32f412z(e-g)tx-pinctrl.dtsi>
10#include "arduino_r3_connector.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "STMicroelectronics STM32F412G-DISCO board";
15	compatible = "st,stm32f412g-disco";
16
17	chosen {
18		zephyr,console = &usart2;
19		zephyr,shell-uart = &usart2;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22	};
23
24	leds {
25		compatible = "gpio-leds";
26		green_led_1: led_1 {
27			gpios = <&gpioe 0 GPIO_ACTIVE_HIGH>;
28			label = "User LD1";
29		};
30		orange_led_2: led_2 {
31			gpios = <&gpioe 1 GPIO_ACTIVE_HIGH>;
32			label = "User LD2";
33		};
34		red_led_3: led_3 {
35			gpios = <&gpioe 2 GPIO_ACTIVE_HIGH>;
36			label = "User LD3";
37		};
38		blue_led_4: led_4 {
39			gpios = <&gpioe 3 GPIO_ACTIVE_HIGH>;
40			label = "User LD4";
41		};
42	};
43
44	gpio_keys {
45		compatible = "gpio-keys";
46		joy_sel: joystick_selection {
47			label = "joystick selection";
48			gpios = <&gpioa 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
49			zephyr,code = <INPUT_KEY_ENTER>;
50		};
51		joy_down: joystick_down {
52			label = "joystick down";
53			gpios = <&gpiog 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
54			zephyr,code = <INPUT_KEY_DOWN>;
55		};
56		joy_up: joystick_up {
57			label = "joystick up";
58			gpios = <&gpiog 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
59			zephyr,code = <INPUT_KEY_UP>;
60		};
61		joy_left: joystick_left {
62			label = "joystick left";
63			gpios = <&gpiof 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
64			zephyr,code = <INPUT_KEY_LEFT>;
65		};
66		joy_right: joystick_right {
67			label = "joystick right";
68			gpios = <&gpiof 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
69			zephyr,code = <INPUT_KEY_RIGHT>;
70		};
71	};
72
73	aliases {
74		led0 = &green_led_1;
75		led1 = &orange_led_2;
76		led2 = &red_led_3;
77		led3 = &blue_led_4;
78		sw0 = &joy_sel;
79	};
80};
81
82&clk_lsi {
83	status = "okay";
84};
85
86&clk_hse {
87	hse-bypass;
88	clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */
89	status = "okay";
90};
91
92&pll {
93	div-m = <4>;
94	mul-n = <100>;
95	div-p = <2>;
96	div-q = <8>;
97	clocks = <&clk_hse>;
98	status = "okay";
99};
100
101&rcc {
102	clocks = <&pll>;
103	clock-frequency = <DT_FREQ_M(100)>;
104	ahb-prescaler = <1>;
105	apb1-prescaler = <2>;
106	apb2-prescaler = <1>;
107};
108
109&usart2 {
110	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
111	pinctrl-names = "default";
112	current-speed = <115200>;
113	status = "okay";
114};
115
116&usart6 {
117	pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>;
118	pinctrl-names = "default";
119	current-speed = <115200>;
120	status = "okay";
121};
122
123&i2c2 {
124	pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb9>;
125	pinctrl-names = "default";
126	clock-frequency = <I2C_BITRATE_FAST>;
127	status = "okay";
128};
129
130&spi1 {
131	pinctrl-0 = <&spi1_nss_pa15 &spi1_sck_pa5
132		     &spi1_miso_pa6 &spi1_mosi_pa7>;
133	pinctrl-names = "default";
134	status = "okay";
135};
136
137&rtc {
138	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
139		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
140	status = "okay";
141};
142
143&quadspi {
144	pinctrl-0 = <&quadspi_clk_pb2 &quadspi_bk1_ncs_pg6
145		     &quadspi_bk1_io0_pf8 &quadspi_bk1_io1_pf9
146		     &quadspi_bk1_io2_pf7 &quadspi_bk1_io3_pf6>;
147	pinctrl-names = "default";
148	status = "okay";
149
150	n25q128a1: qspi-nor-flash@90000000 {
151		compatible = "st,stm32-qspi-nor";
152		reg = <0x90000000 DT_SIZE_M(16)>; /* 128 Mbits */
153		qspi-max-frequency = <72000000>;
154		status = "okay";
155	};
156};
157