1/*
2 * Copyright (c) 2021 Telink Semiconductor
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <freq.h>
10#include <telink/telink_b91.dtsi>
11#include "tlsr9518adk80d-pinctrl.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "telink,b91";
16	compatible = "telink,tlsr9518adk80d";
17
18	aliases {
19		led0 = &led_blue;
20		led1 = &led_green;
21		led2 = &led_white;
22		led3 = &led_red;
23		sw0 = &key_1;
24		pwm-led0 = &pwm_led_blue;
25		pwm-0 = &pwm0;
26	};
27
28	leds {
29		compatible = "gpio-leds";
30
31		led_blue: led_0 {
32			gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>;
33			label = "LED Blue";
34		};
35
36		led_green: led_1 {
37			gpios = <&gpiob 5 GPIO_ACTIVE_HIGH>;
38			label = "LED Green";
39		};
40
41		led_white: led_2 {
42			gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
43			label = "LED White";
44		};
45
46		led_red: led_3 {
47			gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
48			label = "LED Red";
49		};
50	};
51
52	pwm_leds {
53		compatible = "pwm-leds";
54
55		pwm_led_blue: pwm_led_0 {
56			pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
57			label = "PWM LED Blue";
58		};
59	};
60
61	keys {
62		compatible = "gpio-keys";
63		key_1: button_1 {
64			label = "User KEY1";
65			gpios = <&gpioc 2 GPIO_PULL_DOWN>;
66			zephyr,code = <INPUT_KEY_0>;
67		};
68	};
69
70	chosen {
71		zephyr,console = &uart0;
72		zephyr,shell-uart = &uart0;
73		zephyr,sram = &ram_dlm;
74		zephyr,flash = &flash;
75		zephyr,flash-controller = &flash_mspi;
76		zephyr,entropy = &trng0;
77		zephyr,code-partition = &slot0_partition;
78		zephyr,ieee802154 = &ieee802154;
79	};
80};
81
82&cpu0 {
83	clock-frequency = <48000000>;
84};
85
86&ram_ilm {
87	reg = <0x00000000 0x00020000>;
88};
89
90&ram_dlm {
91	reg = <0x00080000 0x00020000>;
92};
93
94&flash {
95	reg = <0x20000000 0x100000>;
96
97	partitions {
98		compatible = "fixed-partitions";
99		#address-cells = <1>;
100		#size-cells = <1>;
101
102		boot_partition: partition@0 {
103			label = "mcuboot";
104			reg = <0x00000000 0x10000>;
105		};
106		slot0_partition: partition@10000 {
107			label = "image-0";
108			reg = <0x10000 0x70000>;
109		};
110		slot1_partition: partition@80000 {
111			label = "image-1";
112			reg = <0x80000 0x70000>;
113		};
114		scratch_partition: partition@f0000 {
115			label = "image-scratch";
116			reg = <0xf0000 0x4000>;
117		};
118		storage_partition: partition@f4000 {
119			label = "storage";
120			reg = <0xf4000 0x0000b000>;
121		/* region <0xff000 0x1000> is reserved for Telink B91 SDK's data */
122		};
123	};
124};
125
126&gpiob {
127	status = "okay";
128};
129
130&gpioc {
131	interrupts = <25 1>;
132	status = "okay";
133};
134
135&uart0 {
136	status = "okay";
137	current-speed = <115200>;
138	pinctrl-0 = <&uart0_tx_pb2_default &uart0_rx_pb3_default>;
139	pinctrl-names = "default";
140};
141
142&trng0 {
143	status = "okay";
144};
145
146&ieee802154 {
147	status = "okay";
148};
149
150&pwm0 {
151	status = "okay";
152	clock-frequency = <93750>;
153	pinctrl-0 = <&pwm_ch0_pb4_default>;
154	pinctrl-names = "default";
155};
156
157&pspi {
158	status = "okay";
159	cs0-pin = "PSPI_CSN_PC4";
160	pinctrl-0 = <&pspi_clk_pc5_default &pspi_miso_pc6_default &pspi_mosi_pc7_default>;
161	pinctrl-names = "default";
162};
163
164&hspi {
165	status = "okay";
166	cs0-pin = "HSPI_CSN_PA1";
167	pinctrl-0 = <&hspi_clk_pa2_default &hspi_miso_pa3_default &hspi_mosi_pa4_default>;
168	pinctrl-names = "default";
169};
170
171&i2c {
172	status = "okay";
173	clock-frequency = <I2C_BITRATE_FAST>;
174	pinctrl-0 = <&i2c_scl_pe1_default &i2c_sda_pe3_default>;
175	pinctrl-names = "default";
176};
177
178&adc {
179	status = "okay";
180	vref-internal-mv = <1200>;
181	sample-freq = <DT_FREQ_K(96)>;
182};
183