1/*
2 * Copyright (c) 2024 RAKwireless Technology Co., Ltd. <www.rakwireless.com>
3 * Sercan Erat <sercanerat@gmail.com>
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <ambiq/ambiq_apollo3_blue.dtsi>
9#include <zephyr/dt-bindings/lora/sx126x.h>
10#include "rak11720_apollo3-pinctrl.dtsi"
11#include <zephyr/dt-bindings/input/input-event-codes.h>
12
13/ {
14	model = "RAKwireless RAK11720 WisBlock LPWAN Module";
15	compatible = "ambiq,rak11720";
16
17	chosen {
18		zephyr,itcm = &tcm;
19		zephyr,sram = &sram0;
20		zephyr,flash = &flash0;
21		zephyr,console = &uart0;
22		zephyr,shell-uart = &uart0;
23		zephyr,uart-mcumgr = &uart0;
24		zephyr,uart-pipe = &uart0;
25		zephyr,flash-controller = &flash;
26		zephyr,bt_hci = &bt_hci_apollo;
27		zephyr,code-partition = &slot0_partition;
28	};
29
30	aliases {
31		watchdog0 = &wdt0;
32		led0 = &blue_led;
33		led1 = &green_led;
34		lora0 = &lora;
35		bootloader-led0 = &blue_led;
36		mcuboot-led0 = &blue_led;
37	};
38
39	leds {
40		compatible = "gpio-leds";
41		blue_led: led_2 {
42			gpios = <&gpio32_63 13 GPIO_ACTIVE_HIGH>;
43			label = "Blue LED";
44		};
45		green_led: led_1 {
46			gpios = <&gpio32_63 12 GPIO_ACTIVE_HIGH>;
47			label = "Green LED";
48		};
49	};
50};
51
52&flash0 {
53	erase-block-size = <8192>;
54	write-block-size = <4>;
55
56	partitions {
57		compatible = "fixed-partitions";
58		#address-cells = <1>;
59		#size-cells = <1>;
60
61		internal_boot_partition: partition@0 {
62			label = "internal_bootloader";
63			reg = <0x00000000 0xc000>;
64		};
65
66		boot_partition: partition@c000 {
67			label = "mcuboot";
68			reg = <0x0000c000 0xc000>;
69		};
70		slot0_partition: partition@18000 {
71			label = "image-0";
72			reg = <0x00018000 0x72000>;
73		};
74		slot1_partition: partition@8a000 {
75			label = "image-1";
76			reg = <0x0008a000 0x72000>;
77		};
78
79		/* Set 16KB of storage at the end of the 1024KB of flash */
80		storage_partition: partition@fc000 {
81			label = "storage";
82			reg = <0x000fc000 0x4000>;
83		};
84	};
85};
86
87&stimer0 {
88	clk-source = <3>;
89};
90
91&bleif {
92	pinctrl-0 = <&bleif_default>;
93	pinctrl-names = "default";
94	status = "okay";
95};
96
97&uart0 {
98	current-speed = <115200>;
99	pinctrl-0 = <&uart0_default>;
100	pinctrl-names = "default";
101	status = "okay";
102};
103
104&wdt0 {
105	status = "okay";
106};
107
108&i2c2 {
109	compatible = "ambiq,i2c";
110	pinctrl-0 = <&i2c2_default>;
111	pinctrl-names = "default";
112	clock-frequency = <I2C_BITRATE_STANDARD>;
113	status = "okay";
114};
115
116&spi0 {
117	compatible = "ambiq,spi";
118	pinctrl-0 = <&spi0_default>;
119	pinctrl-names = "default";
120	cs-gpios = <&gpio0_31 1 GPIO_ACTIVE_LOW>;
121	clock-frequency = <DT_FREQ_M(1)>;
122	status = "okay";
123};
124
125&spi1 {
126	compatible = "ambiq,spi";
127	status = "okay";
128	pinctrl-0 = <&spi1_default>;
129	pinctrl-names = "default";
130	clock-frequency = <DT_FREQ_M(1)>;
131	cs-gpios = <&gpio0_31 11 GPIO_ACTIVE_LOW>;
132
133	lora: lora@0 {
134		compatible = "semtech,sx1262";
135		reg = <0>;
136		reset-gpios = <&gpio0_31 17 GPIO_ACTIVE_LOW>;
137		busy-gpios = <&gpio0_31 16 GPIO_ACTIVE_HIGH>;
138		dio1-gpios = <&gpio0_31 15 GPIO_ACTIVE_HIGH>;
139		antenna-enable-gpios = <&gpio0_31 18 GPIO_ACTIVE_LOW>;
140		dio2-tx-enable;
141		dio3-tcxo-voltage = <SX126X_DIO3_TCXO_3V3>;
142		tcxo-power-startup-delay-ms = <5>;
143		spi-max-frequency = <DT_FREQ_M(1)>;
144	};
145};
146
147&counter0 {
148	status = "okay";
149};
150
151&counter1 {
152	status = "okay";
153};
154
155&counter2 {
156	status = "okay";
157};
158
159&counter3 {
160	status = "okay";
161};
162
163&counter4 {
164	status = "okay";
165};
166
167&counter5 {
168	status = "okay";
169};
170
171&counter6 {
172	status = "okay";
173};
174
175&counter7 {
176	status = "okay";
177};
178
179&gpio0_31 {
180	status = "okay";
181};
182
183&gpio32_63 {
184	status = "okay";
185};
186