1/*
2 * Copyright (c) 2018 Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <st/l0/stm32l072Xz.dtsi>
9#include <st/l0/stm32l072c(b-z)tx-pinctrl.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11
12/ {
13	model = "STMicroelectronics B-L072Z-LRWAN1 Discovery kit";
14	compatible = "st,stm32l072z-lrwan1";
15
16	chosen {
17		zephyr,console = &usart2;
18		zephyr,shell-uart = &usart2;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21	};
22
23	leds {
24		compatible = "gpio-leds";
25		green_led_0: led_0 {
26			gpios = <&gpioa 5 GPIO_ACTIVE_HIGH>;
27			label = "Green LED 1";
28		};
29		green_led_1: led_1 {
30			gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>;
31			label = "Green LED 2";
32		};
33		blue_led: led_2 {
34			gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
35			label = "Blue LED";
36		};
37		red_led: led_3 {
38			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
39			label = "Red LED";
40		};
41	};
42
43	gpio_keys {
44		compatible = "gpio-keys";
45		user_button: button_0 {
46			label = "Push button switch";
47			gpios = <&gpiob 2 GPIO_ACTIVE_LOW>;
48			zephyr,code = <INPUT_KEY_0>;
49		};
50	};
51
52	/* These aliases are provided for compatibility with samples */
53	aliases {
54		led0 = &green_led_0;
55		led1 = &green_led_1;
56		led2 = &blue_led;
57		led3 = &red_led;
58		sw0 = &user_button;
59		eeprom-0 = &eeprom;
60		lora0 = &lora;
61	};
62
63};
64
65&clk_lse {
66	status = "okay";
67};
68
69&clk_hsi48 {
70	status = "okay";
71};
72
73&clk_hsi {
74	status = "okay";
75};
76
77&pll {
78	div = <2>;
79	mul = <4>;
80	clocks = <&clk_hsi>;
81	status = "okay";
82};
83
84&rcc {
85	clocks = <&pll>;
86	clock-frequency = <DT_FREQ_M(32)>;
87	ahb-prescaler = <1>;
88	apb1-prescaler = <1>;
89	apb2-prescaler = <1>;
90};
91
92arduino_usart: &usart1 {};
93arduino_spi: &spi2 {};
94arduino_i2c: &i2c1 {};
95
96&usart1 {
97	pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
98	pinctrl-names = "default";
99	current-speed = <115200>;
100	status = "okay";
101};
102
103&usart2 {
104	pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>;
105	pinctrl-names = "default";
106	current-speed = <115200>;
107	status = "okay";
108};
109
110&spi1 {
111	pinctrl-0 = <&spi1_nss_pa15 &spi1_sck_pb3
112		     &spi1_miso_pa6 &spi1_mosi_pa7>;
113	pinctrl-names = "default";
114	status = "okay";
115	cs-gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
116
117	lora: lora@0 {
118		compatible = "semtech,sx1276";
119		reg = <0>;
120		reset-gpios = <&gpioc 0 GPIO_ACTIVE_LOW>;
121		dio-gpios = <&gpiob 4 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
122			<&gpiob 1 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
123			<&gpiob 0 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
124			<&gpioc 13 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
125			<&gpioa 5 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
126			<&gpioa 4 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
127		rfi-enable-gpios = <&gpioa 1 GPIO_ACTIVE_HIGH>;
128		rfo-enable-gpios = <&gpioc 2 GPIO_ACTIVE_HIGH>;
129		pa-boost-enable-gpios = <&gpioc 1 GPIO_ACTIVE_HIGH>;
130		tcxo-power-gpios = <&gpioa 12 GPIO_ACTIVE_HIGH>;
131		tcxo-power-startup-delay-ms = <5>;
132		spi-max-frequency = <1000000>;
133	};
134};
135
136&spi2 {
137	pinctrl-0 = <&spi2_nss_pb12 &spi2_sck_pb13
138		     &spi2_miso_pb14 &spi2_mosi_pb15>;
139	pinctrl-names = "default";
140	status = "okay";
141};
142
143&i2c1 {
144	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
145	pinctrl-names = "default";
146	status = "okay";
147	clock-frequency = <I2C_BITRATE_FAST>;
148};
149
150&rtc {
151	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
152		 <&rcc STM32_SRC_LSE RTC_SEL(1)>;
153	status = "okay";
154};
155
156&rng {
157	status = "okay";
158};
159
160&eeprom {
161	status = "okay";
162};
163
164zephyr_udc0: &usb {
165	pinctrl-0 = <&usb_dm_pa11 &usb_dp_pa12>;
166	pinctrl-names = "default";
167	status = "okay";
168};
169
170&flash0 {
171	partitions {
172		compatible = "fixed-partitions";
173		#address-cells = <1>;
174		#size-cells = <1>;
175
176		/* Set aside 32KiB for data at the end of the 192KiB flash */
177		storage_partition: partition@28000 {
178			label = "storage";
179			reg = <0x00028000 DT_SIZE_K(32)>;
180		};
181	};
182};
183