1/*
2 * Copyright (c)  2020/2021 Dean Weiten <dmw@weiten.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/*
8 * Note: SPI2 and several GPIOs are not available in the S76S - these are connected
9 * to the in-package Semtech SX1276 LoRa transceiver.  See the documentation for details.
10 */
11
12/dts-v1/;
13#include <acsip/s76s.dtsi>
14#include <zephyr/dt-bindings/input/input-event-codes.h>
15
16/ {
17	model = "Ronoth LoDev";
18	compatible = "ronoth,lodev";
19
20	chosen {
21		zephyr,console = &usart1;
22		zephyr,shell-uart = &usart1;
23		zephyr,sram = &sram0;
24		zephyr,flash = &flash0;
25	};
26
27	/*
28	 * On Ronoth LoDev and perhaps other boards,
29	 * Red LED on PA5.
30	 */
31	leds {
32		compatible = "gpio-leds";
33		red_led_0: led_0 {
34			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
35			label = "User LD2";
36		};
37	};
38
39	/* Arbitrarily use PC9 as a button input. */
40	gpio_keys {
41		compatible = "gpio-keys";
42		user_button: button {
43			label = "User";
44			gpios = <&gpioc 9 GPIO_ACTIVE_LOW>;
45			zephyr,code = <INPUT_KEY_0>;
46		};
47	};
48
49	cn6_header: lodev_connector_1 {
50		compatible = "lodev_cn6";
51		#gpio-cells = <2>;
52		gpio-map-mask = <0xffffffff 0xffffffc0>;
53		gpio-map-pass-thru = <0 0x3f>;
54		gpio-map =	/*	<0 0 -      - 0>,		 3.3V */
55		/*	<1 0 -      - 0>,		 GND */
56			<2 0 &gpioc 1 0>,		/* PC1 */
57			<3 0 &gpioc 0 0>,		/* PC0 */
58			<4 0 &gpiob 8 0>,		/* PB8 */
59		/*	<5 0 -      - 0>,		 BOOT0 */
60			<6 0 &gpiob 7 0>,		/* PB7 */
61			<7 0 &gpiob 6 0>,		/* PB6 */
62			<8 0 &gpiob 5 0>,		/* PB5 */
63			<9 0 &gpiod 2 0>,		/* PD2 */
64			<10 0 &gpioc 12 0>,		/* PC12 */
65			<11 0 &gpioc 11 0>,		/* PC11 */
66			<12 0 &gpioc 10 0>,		/* PC10 */
67			<13 0 &gpioa 14 0>,		/* PA14 / SWCLK */
68			<14 0 &gpioa 13 0>,		/* PA13 / SWDIO */
69			<15 0 &gpioa 12 0>,		/* PA12 */
70			<16 0 &gpioa 11 0>,		/* PA11 */
71			<17 0 &gpioa 9 0>,		/* PA9 (UART1 Rx connected to USB) */
72			<18 0 &gpioa 10 0>,		/* PA10 (UART1 Tx connected to USB) */
73			<19 0 &gpioa 8 0>;		/* PA8 */
74	};
75
76	cn7_header: lodev_connector_2 {
77		compatible = "lodev_cn7";
78		#gpio-cells = <2>;
79		gpio-map-mask = <0xffffffff 0xffffffc0>;
80		gpio-map-pass-thru = <0 0x3f>;
81		gpio-map =		<0 0 &gpioc 2 0>,		/* PC2 */
82			<1 0 &gpioc 3 0>,		/* PC3 */
83		/*	<2 0 -      - 0>,		 nRESET */
84			<3 0 &gpioa 0 0>,		/* PA0 */
85			<4 0 &gpioa 2 0>,		/* PA2 */
86			<4 0 &gpioa 3 0>,		/* PA3 */
87			<6 0 &gpioa 4 0>,		/* PA4 */
88			<7 0 &gpioa 5 0>,		/* PA5 - connected to red LED1 */
89			<8 0 &gpioa 6 0>,		/* PA6 */
90			<9 0 &gpioa 7 0>,		/* PA7 */
91			<10 0 &gpioc 4 0>,		/* PC4 */
92			<11 0 &gpioc 5 0>,		/* PC5 */
93			<12 0 &gpiob 0 0>,		/* PB0 */
94			<13 0 &gpiob 1 0>,		/* PB1 */
95			<14 0 &gpioc 6 0>,		/* PC6 */
96			<15 0 &gpioc 7 0>,		/* PC7 */
97			<16 0 &gpioc 8 0>,		/* PC8 */
98			<17 0 &gpioc 9 0>,		/* PC9 */
99		/*	<18 0 -      - 0>,		 GND */
100			<19 0 &gpioa 1 0>;		/* PA1 (also used in S76S as "RF FEM CPS" */
101	};
102
103	aliases {
104		led0 = &red_led_0;
105		sw0 = &user_button;
106		eeprom-0 = &eeprom;
107		lora0 = &lora;
108		watchdog0 = &iwdg;
109	};
110};
111
112&clk_lsi {
113	status = "okay";
114};
115
116&clk_hsi48 {
117	status = "okay";
118};
119
120&clk_hsi {
121	status = "okay";
122};
123
124&rcc {
125	clocks = <&clk_hsi>;
126	clock-frequency = <DT_FREQ_M(16)>;
127	ahb-prescaler = <1>;
128	apb1-prescaler = <1>;
129	apb2-prescaler = <1>;
130};
131
132&usart1 {
133	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
134	pinctrl-names = "default";
135	current-speed = <115200>;
136	status = "okay";
137};
138
139&usart2 {
140	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
141	pinctrl-names = "default";
142	current-speed = <115200>;
143	status = "okay";
144};
145
146&i2c1 {
147	pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>;
148	pinctrl-names = "default";
149	clock-frequency = <I2C_BITRATE_FAST>;
150	status = "okay";
151};
152
153&spi1 {
154	pinctrl-0 = <&spi1_nss_pa4 &spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>;
155	pinctrl-names = "default";
156	status = "okay";
157};
158
159&iwdg {
160	status = "okay";
161};
162
163&adc1 {
164	pinctrl-0 = <&adc_in0_pa0>;
165	pinctrl-names = "default";
166	st,adc-clock-source = <SYNC>;
167	st,adc-prescaler = <4>;
168	status = "okay";
169};
170
171&dac1 {
172	status = "okay";
173	pinctrl-0 = <&dac_out1_pa4>;
174	pinctrl-names = "default";
175};
176
177&rtc {
178	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
179		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
180	status = "okay";
181};
182
183&rng {
184	clocks = <&rcc STM32_CLOCK_BUS_AHB1 0x00100000>,
185		 <&rcc STM32_SRC_HSI48 HSI48_SEL(1)>;
186	status = "okay";
187};
188
189&eeprom {
190	status = "okay";
191};
192