1/*
2 * Copyright (c) 2021 Florin Stancu
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <ti/cc1352r.dtsi>
10#include "../cc1352r1_launchxl/boosterpack_connector.dtsi"
11#include "cc1352p1_launchxl-pinctrl.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "TI CC1352P1 LaunchXL";
16	compatible = "ti,launchxl-cc1352p1";
17
18	aliases {
19		led0 = &led0;
20		led1 = &led1;
21		sw0 = &btn0;
22		sw1 = &btn1;
23		watchdog0 = &wdt0;
24		mcuboot-led0 = &led1;
25		mcuboot-button0 = &btn1;
26	};
27
28	chosen {
29		zephyr,sram = &sram0;
30		zephyr,flash = &flash0;
31		zephyr,console = &uart0;
32		zephyr,shell-uart = &uart0;
33		zephyr,ieee802154 = &ieee802154;
34		zephyr,code-partition = &slot0_partition;
35	};
36
37	/**
38	 * The CC1352P LAUNCHXL has an on-board antenna switch (SKY13317-373LF) used to select the
39	 * appropriate RF signal port based on the currently-used PHY.
40	 *
41	 * Truth table:
42	 *
43	 * Path        DIO28 DIO29 DIO30
44	 * =========== ===== ===== =====
45	 * Off         0     0     0
46	 * Sub-1 GHz   0     0     1     // DIO30 mux to IOC_PORT_RFC_GPO0 for auto
47	 * 2.4 GHz     1     0     0     // DIO28 mux to IOC_PORT_RFC_GPO0 for auto
48	 * 20 dBm TX   0     1     0     // DIO29 mux to IOC_PORT_RFC_GPO3 for auto
49	 */
50	antenna_mux0: antenna_mux0 {
51		compatible = "skyworks,sky13317";
52		status = "okay";
53		gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>, <&gpio0 29 GPIO_ACTIVE_HIGH>, \
54				<&gpio0 30 GPIO_ACTIVE_HIGH>;
55		pinctrl-0 = <&board_ant_24g_off &board_ant_tx_pa_off &board_ant_subg_off>;
56		pinctrl-1 = <&board_ant_24g_on &board_ant_tx_pa_off &board_ant_subg_off>;
57		pinctrl-2 = <&board_ant_24g_on &board_ant_tx_pa_on &board_ant_subg_off>;
58		pinctrl-3 = <&board_ant_24g_off &board_ant_tx_pa_off &board_ant_subg_on>;
59		pinctrl-4 = <&board_ant_24g_off &board_ant_tx_pa_on &board_ant_subg_on>;
60		pinctrl-names = "default", "ant_24g", "ant_24g_pa", "ant_subg", "ant_subg_pa";
61	};
62
63	leds {
64		compatible = "gpio-leds";
65		led0: led_0 {
66			gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
67			label = "Green LED";
68		};
69		led1: led_1 {
70			gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
71			label = "Red LED";
72		};
73	};
74
75	keys {
76		compatible = "gpio-keys";
77		btn0: btn_0 {
78			gpios = <&gpio0 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
79			label = "Push button 1";
80			zephyr,code = <INPUT_KEY_0>;
81		};
82		btn1: btn_1 {
83			gpios = <&gpio0 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
84			label = "Push button 2";
85			zephyr,code = <INPUT_KEY_1>;
86		};
87	};
88};
89
90&flash0 {
91	partitions {
92		/* 40 KiB (0xa000) for MCUboot */
93		boot_partition: partition@0 {
94			label = "mcuboot";
95			reg = <0x00000000 0x0000a000>;
96		};
97
98		/* 136 KiB (0x22000) per slot for application */
99		slot0_partition: partition@a000 {
100			label = "image-0";
101			reg = <0x0000a000 0x00022000>;
102		};
103
104		slot1_partition: partition@2c000 {
105			label = "image-1";
106			reg = <0x0002c000 0x00022000>;
107		};
108
109		/* 32 KiB (0x8000) for storage */
110		storage_partition: partition@4e000 {
111			label = "storage";
112			reg = <0x0004e000 0x00008000>;
113		};
114
115		/* CCFG (customer configuration area) is located in uppermost
116		 * flash sector (0x2000/8 KiB @ 0x56000), keep it unused.
117		 */
118	};
119};
120
121&cpu0 {
122	clock-frequency = <48000000>;
123};
124
125&trng {
126	status = "okay";
127};
128
129&gpio0 {
130	status = "okay";
131};
132
133&uart0 {
134	status = "okay";
135	current-speed = <115200>;
136	pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
137	pinctrl-names = "default";
138};
139
140&i2c0 {
141	status = "okay";
142	pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
143	pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
144	pinctrl-names = "default", "sleep";
145};
146
147&spi0 {
148	status = "okay";
149	pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
150				 &spi0_miso_default &spi0_cs_default>;
151	pinctrl-names = "default";
152	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
153};
154
155&radio {
156	status = "okay";
157};
158
159&ieee802154 {
160	status = "okay";
161};
162
163&ieee802154g {
164	status = "disabled";
165};
166
167&wdt0 {
168	status = "okay";
169};
170