1/*
2 * Copyright (c) 2020 Erik Larson
3 * Copyright (c) 2020-2022 Jason Kridner, BeagleBoard.org Foundation
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9
10#include <ti/cc1352r7.dtsi>
11#include "beagleconnect_freedom-pinctrl.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
15
16/ {
17	model = "BeagleConnect Freedom";
18	compatible = "beagle,beagleconnect-freedom";
19
20	aliases {
21		led0 = &led0;
22		sw0 = &button0;
23		mcuboot-button0 = &button0;
24		sensor0 = &light;
25		sensor1 = &humidity;
26		spi-flash0 = &spi_flash0;
27	};
28
29	chosen {
30		zephyr,sram = &sram0;
31		zephyr,console = &uart0;
32		zephyr,shell-uart = &uart0;
33		zephyr,flash = &flash0;
34		zephyr,ieee802154 = &ieee802154g;
35		zephyr,code-partition = &slot0_partition;
36	};
37
38	gpio_keys {
39		compatible = "gpio-keys";
40		button0: button_0 {
41			gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
42			zephyr,code = <INPUT_KEY_0>;
43		};
44	};
45
46	leds: leds {
47		compatible = "gpio-leds";
48		led0: led_0 {
49			gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>; // 2.4GHz TX/RX
50		};
51
52		/* U.FL connector switch */
53		rf_sw: rf_sw {
54			gpios =
55				<&gpio0 29 GPIO_ACTIVE_HIGH>, // SubG TX +20dB
56				<&gpio0 30 GPIO_ACTIVE_HIGH>; // SubG TX/RX 0dB
57		};
58	};
59
60	sens_i2c: sensor-switch {
61		status = "okay";
62		compatible = "ti,ts5a2066";
63		#address-cells = <1>;
64		#size-cells = <0>;
65		controller = <&i2c0>;
66		gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
67
68		light: opt3001-light@44 {
69			status = "okay";
70			compatible = "ti,opt3001";
71			reg = <0x44>;
72		};
73
74		humidity: hdc2010-humidity@41 {
75			status = "okay";
76			compatible = "ti,hdc2010";
77			reg = <0x41>;
78		};
79	};
80};
81
82&flash0 {
83	partitions {
84		compatible = "fixed-partitions";
85		#address-cells = <1>;
86		#size-cells = <1>;
87
88		/* Allocate 128 KiB for mcuboot */
89		boot_partition: partition@0 {
90			label = "mcuboot";
91			reg = <0x00000000 0x00020000>;
92		};
93
94		/* Allocate 568 KiB for application (avoid touching CCFG) */
95		slot0_partition: partition@20000 {
96			label = "image-0";
97			reg = <0x00020000 0x0008e000>;
98		};
99	};
100};
101
102&cpu0 {
103	clock-frequency = <48000000>;
104};
105
106&trng {
107	status = "okay";
108};
109
110&gpio0 {
111	status = "okay";
112};
113
114/* Side away from battery connector (with MSP430) */
115&uart0 {
116	status = "okay";
117	current-speed = <115200>;
118	pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
119	pinctrl-names = "default";
120};
121
122/* Side with battery connector (with CC1352 and not MSP430) */
123&uart1 {
124	status = "okay";
125	current-speed = <115200>;
126	pinctrl-0 = <&uart1_rx_default &uart1_tx_default>;
127	pinctrl-names = "default";
128};
129
130&i2c0 {
131	status = "okay";
132	clock-frequency = <I2C_BITRATE_FAST>;
133	pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
134	pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
135	pinctrl-names = "default", "sleep";
136
137	mcu: msp430-usbbridge@4 {
138		compatible = "beagle,usbbridge";
139		reg = <0x4>;
140	};
141};
142
143&spi0 {
144	status = "okay";
145	pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
146		&spi0_miso_default &spi0_cs0_default
147		&spi0_cs1_default &spi0_cs2_default>;
148	pinctrl-names = "default";
149	cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>, // SPI flash
150		<&gpio0 28 GPIO_ACTIVE_LOW>,  // mikroBUS port 1
151		<&gpio0 27 GPIO_ACTIVE_LOW>;  // mikroBUS port 2
152
153	spi_flash0: gd25q16c@0 {
154		compatible = "jedec,spi-nor";
155		reg = <0>;
156		spi-max-frequency = <2000000>;
157		size = <0x200000>;
158		//has-be32k;
159		has-dpd;
160		t-enter-dpd = <20000>;
161		t-exit-dpd = <100000>;
162		jedec-id = [c8 40 15];
163
164		partitions {
165			compatible = "fixed-partitions";
166			#address-cells = <1>;
167			#size-cells = <1>;
168
169			/* Allocate 568 KiB for application */
170			slot1_partition: partition@0 {
171				label = "image-1";
172				reg = <0x00000000 0x0008e000>;
173			};
174
175			/* Allocate 128 KiB scratch for image swap */
176			scratch_partition: partition@8e000 {
177				label = "image-scratch";
178				reg = <0x0008e000 0x00020000>;
179			};
180
181			/* Allocate 1 MiB storage partition */
182			storage_partition: partition@ae000 {
183				label = "storage";
184				reg = <0x000ae000 DT_SIZE_K(1024)>;
185			};
186		};
187	};
188};
189
190&ieee802154 {
191	status = "okay";
192};
193
194&ieee802154g {
195	status = "okay";
196};
197