From 200e8d481fda32f58a2b9006e12c603bcc2f12a4 Mon Sep 17 00:00:00 2001 From: Alexandre Bailon Date: Fri, 31 May 2024 12:02:33 +0200 Subject: [PATCH] boards: ti: Create a common folder to share code between boards This creates a common folder in order to share code between similar boards. This is mostly for the CC1352P1 and CC1352P7 launchpad which are very similar but it could be probably useful for some other boards. Signed-off-by: Alexandre Bailon --- boards/ti/cc1352p1_launchxl/CMakeLists.txt | 3 +- boards/ti/cc1352p1_launchxl/Kconfig | 14 +- .../cc1352p1_launchxl-pinctrl.dtsi | 87 ---------- .../cc1352p1_launchxl/cc1352p1_launchxl.dts | 158 +----------------- .../cc1352r1_launchxl/cc1352r1_launchxl.dts | 133 +-------------- .../cc1352r_sensortag/cc1352r_sensortag.dts | 2 +- .../boosterpack_connector.dtsi | 47 ------ .../cc26x2r1_launchxl-pinctrl.dtsi | 41 ----- .../cc26x2r1_launchxl/cc26x2r1_launchxl.dts | 118 +------------ boards/ti/common/CMakeLists.txt | 4 + boards/ti/common/Kconfig | 24 +++ .../board_antenna.c | 0 .../boosterpack_connector.dtsi | 0 boards/ti/common/launchxl-flash-p7.dtsi | 36 ++++ boards/ti/common/launchxl-flash.dtsi | 36 ++++ .../launchxl-pinctrl.dtsi} | 0 boards/ti/common/launchxl.dtsi | 108 ++++++++++++ boards/ti/common/launchxl_sky13317.dtsi | 61 +++++++ boards/ti/common/support/openocd.cfg | 1 + 19 files changed, 288 insertions(+), 585 deletions(-) delete mode 100644 boards/ti/cc1352p1_launchxl/cc1352p1_launchxl-pinctrl.dtsi delete mode 100644 boards/ti/cc26x2r1_launchxl/boosterpack_connector.dtsi create mode 100644 boards/ti/common/CMakeLists.txt create mode 100644 boards/ti/common/Kconfig rename boards/ti/{cc1352p1_launchxl => common}/board_antenna.c (100%) rename boards/ti/{cc1352r1_launchxl => common}/boosterpack_connector.dtsi (100%) create mode 100644 boards/ti/common/launchxl-flash-p7.dtsi create mode 100644 boards/ti/common/launchxl-flash.dtsi rename boards/ti/{cc1352r1_launchxl/cc1352r1_launchxl-pinctrl.dtsi => common/launchxl-pinctrl.dtsi} (100%) create mode 100644 boards/ti/common/launchxl.dtsi create mode 100644 boards/ti/common/launchxl_sky13317.dtsi create mode 100644 boards/ti/common/support/openocd.cfg diff --git a/boards/ti/cc1352p1_launchxl/CMakeLists.txt b/boards/ti/cc1352p1_launchxl/CMakeLists.txt index cdf4f19c873..1b2a7b60199 100644 --- a/boards/ti/cc1352p1_launchxl/CMakeLists.txt +++ b/boards/ti/cc1352p1_launchxl/CMakeLists.txt @@ -1,4 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 -zephyr_library() -zephyr_library_sources(board_antenna.c) +add_subdirectory(${ZEPHYR_BASE}/boards/ti/common/ ${CMAKE_CURRENT_BINARY_DIR}/common) diff --git a/boards/ti/cc1352p1_launchxl/Kconfig b/boards/ti/cc1352p1_launchxl/Kconfig index 6981f6fdf8b..b75441b630f 100644 --- a/boards/ti/cc1352p1_launchxl/Kconfig +++ b/boards/ti/cc1352p1_launchxl/Kconfig @@ -1,16 +1,6 @@ # TI CC1352R LaunchXL board -# Copyright (c) 2021 Florin Stancu +# Copyright (c) 2024 Alexandre Bailon # SPDX-License-Identifier: Apache-2.0 -if BOARD_CC1352P1_LAUNCHXL - -config BOARD_ANTENNA_INIT_PRIO - int "Board antenna switch initialization priority" - default 70 - help - Set the priority for board init, must be greater than - KERNEL_INIT_PRIORITY_DEVICE but smaller than - IEEE802154_CC13XX_CC26XX_SUB_GHZ_INIT_PRIO. - -endif # BOARD_CC1352P1_LAUNCHXL +source "boards/ti/common/Kconfig" diff --git a/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl-pinctrl.dtsi b/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl-pinctrl.dtsi deleted file mode 100644 index 4ecc0396d26..00000000000 --- a/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl-pinctrl.dtsi +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2022 Vaishnav Achath - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -&pinctrl { - /* UART0 */ - uart0_tx_default: uart0_tx_default { - pinmux = <13 IOC_PORT_MCU_UART0_TX>; - bias-disable; - }; - uart0_rx_default: uart0_rx_default { - pinmux = <12 IOC_PORT_MCU_UART0_RX>; - bias-disable; - input-enable; - }; - - /* I2C0 */ - i2c0_scl_default: i2c0_scl_default { - pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>; - bias-pull-up; - drive-open-drain; - input-enable; - }; - i2c0_sda_default: i2c0_sda_default { - pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>; - bias-pull-up; - drive-open-drain; - input-enable; - }; - i2c0_scl_sleep: i2c0_scl_sleep { - pinmux = <4 IOC_PORT_GPIO>; - bias-disable; - }; - i2c0_sda_sleep: i2c0_sda_sleep { - pinmux = <5 IOC_PORT_GPIO>; - bias-disable; - }; - - /* SPI0 */ - spi0_sck_default: spi0_sck_default { - pinmux = <10 IOC_PORT_MCU_SSI0_CLK>; - bias-disable; - }; - spi0_mosi_default: spi0_mosi_default { - pinmux = <9 IOC_PORT_MCU_SSI0_TX>; - bias-disable; - }; - spi0_miso_default: spi0_miso_default { - pinmux = <8 IOC_PORT_MCU_SSI0_RX>; - bias-disable; - input-enable; - }; - spi0_cs_default: spi0_cs_default { - pinmux = <11 IOC_PORT_MCU_SSI0_FSS>; - bias-disable; - }; - - /* On-board antenna pinmux states */ - board_ant_24g_off: board_ant_24g_off { - pinmux = <28 IOC_PORT_GPIO>; - bias-disable; - }; - board_ant_24g_on: board_ant_24g_on { - pinmux = <28 IOC_PORT_RFC_GPO0>; - bias-disable; - }; - board_ant_tx_pa_off: board_ant_tx_pa_off { - pinmux = <29 IOC_PORT_GPIO>; - bias-disable; - }; - board_ant_tx_pa_on: board_ant_tx_pa_on { - pinmux = <29 IOC_PORT_RFC_GPO3>; - bias-disable; - }; - board_ant_subg_off: board_ant_subg_off { - pinmux = <30 IOC_PORT_GPIO>; - bias-disable; - }; - board_ant_subg_on: board_ant_subg_on { - pinmux = <30 IOC_PORT_RFC_GPO0>; - bias-disable; - }; -}; diff --git a/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl.dts b/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl.dts index 9fcc6da57da..7f84f672ea2 100644 --- a/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl.dts +++ b/boards/ti/cc1352p1_launchxl/cc1352p1_launchxl.dts @@ -7,163 +7,11 @@ /dts-v1/; #include -#include "../cc1352r1_launchxl/boosterpack_connector.dtsi" -#include "cc1352p1_launchxl-pinctrl.dtsi" -#include +#include "../common/launchxl.dtsi" +#include "../common/launchxl-flash.dtsi" +#include "../common/launchxl_sky13317.dtsi" / { model = "TI CC1352P1 LaunchXL"; compatible = "ti,launchxl-cc1352p1"; - - aliases { - led0 = &led0; - led1 = &led1; - sw0 = &btn0; - sw1 = &btn1; - watchdog0 = &wdt0; - mcuboot-led0 = &led1; - mcuboot-button0 = &btn1; - }; - - chosen { - zephyr,sram = &sram0; - zephyr,flash = &flash0; - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,ieee802154 = &ieee802154; - zephyr,code-partition = &slot0_partition; - }; - - /** - * The CC1352P LAUNCHXL has an on-board antenna switch (SKY13317-373LF) used to select the - * appropriate RF signal port based on the currently-used PHY. - * - * Truth table: - * - * Path DIO28 DIO29 DIO30 - * =========== ===== ===== ===== - * Off 0 0 0 - * Sub-1 GHz 0 0 1 // DIO30 mux to IOC_PORT_RFC_GPO0 for auto - * 2.4 GHz 1 0 0 // DIO28 mux to IOC_PORT_RFC_GPO0 for auto - * 20 dBm TX 0 1 0 // DIO29 mux to IOC_PORT_RFC_GPO3 for auto - */ - antenna_mux0: antenna_mux0 { - compatible = "skyworks,sky13317"; - status = "okay"; - gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>, <&gpio0 29 GPIO_ACTIVE_HIGH>, \ - <&gpio0 30 GPIO_ACTIVE_HIGH>; - pinctrl-0 = <&board_ant_24g_off &board_ant_tx_pa_off &board_ant_subg_off>; - pinctrl-1 = <&board_ant_24g_on &board_ant_tx_pa_off &board_ant_subg_off>; - pinctrl-2 = <&board_ant_24g_on &board_ant_tx_pa_on &board_ant_subg_off>; - pinctrl-3 = <&board_ant_24g_off &board_ant_tx_pa_off &board_ant_subg_on>; - pinctrl-4 = <&board_ant_24g_off &board_ant_tx_pa_on &board_ant_subg_on>; - pinctrl-names = "default", "ant_24g", "ant_24g_pa", "ant_subg", "ant_subg_pa"; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; - label = "Green LED"; - }; - led1: led_1 { - gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; - label = "Red LED"; - }; - }; - - keys { - compatible = "gpio-keys"; - btn0: btn_0 { - gpios = <&gpio0 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - label = "Push button 1"; - zephyr,code = ; - }; - btn1: btn_1 { - gpios = <&gpio0 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; - label = "Push button 2"; - zephyr,code = ; - }; - }; -}; - -&flash0 { - partitions { - /* 40 KiB (0xa000) for MCUboot */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000a000>; - }; - - /* 136 KiB (0x22000) per slot for application */ - slot0_partition: partition@a000 { - label = "image-0"; - reg = <0x0000a000 0x00022000>; - }; - - slot1_partition: partition@2c000 { - label = "image-1"; - reg = <0x0002c000 0x00022000>; - }; - - /* 32 KiB (0x8000) for storage */ - storage_partition: partition@4e000 { - label = "storage"; - reg = <0x0004e000 0x00008000>; - }; - - /* CCFG (customer configuration area) is located in uppermost - * flash sector (0x2000/8 KiB @ 0x56000), keep it unused. - */ - }; -}; - -&cpu0 { - clock-frequency = <48000000>; -}; - -&trng { - status = "okay"; -}; - -&gpio0 { - status = "okay"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_rx_default &uart0_tx_default>; - pinctrl-names = "default"; -}; - -&i2c0 { - status = "okay"; - pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>; - pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&spi0 { - status = "okay"; - pinctrl-0 = <&spi0_sck_default &spi0_mosi_default - &spi0_miso_default &spi0_cs_default>; - pinctrl-names = "default"; - cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; -}; - -&radio { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; - -&ieee802154g { - status = "disabled"; -}; - -&wdt0 { - status = "okay"; }; diff --git a/boards/ti/cc1352r1_launchxl/cc1352r1_launchxl.dts b/boards/ti/cc1352r1_launchxl/cc1352r1_launchxl.dts index 53e5a08a365..cf7674b4eb2 100644 --- a/boards/ti/cc1352r1_launchxl/cc1352r1_launchxl.dts +++ b/boards/ti/cc1352r1_launchxl/cc1352r1_launchxl.dts @@ -7,143 +7,14 @@ /dts-v1/; #include -#include "boosterpack_connector.dtsi" -#include "cc1352r1_launchxl-pinctrl.dtsi" -#include - -#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP) +#include "../common/launchxl.dtsi" +#include "../common/launchxl-flash.dtsi" / { model = "TI CC1352R1 LaunchXL"; compatible = "ti,launchxl-cc1352r1"; - - aliases { - led0 = &led0; - led1 = &led1; - sw0 = &btn0; - sw1 = &btn1; - watchdog0 = &wdt0; - mcuboot-led0 = &led1; - mcuboot-button0 = &btn1; - }; - - chosen { - zephyr,sram = &sram0; - zephyr,flash = &flash0; - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,ieee802154 = &ieee802154; - zephyr,code-partition = &slot0_partition; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; - label = "Green LED"; - }; - led1: led_1 { - gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; - label = "Red LED"; - }; - }; - - keys { - compatible = "gpio-keys"; - btn0: btn_0 { - gpios = <&gpio0 15 BTN_GPIO_FLAGS>; - label = "Push button 1"; - zephyr,code = ; - }; - btn1: btn_1 { - gpios = <&gpio0 14 BTN_GPIO_FLAGS>; - label = "Push button 2"; - zephyr,code = ; - }; - }; -}; - -&flash0 { - partitions { - /* 40 KiB (0xa000) for MCUboot */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000a000>; - }; - - /* 136 KiB (0x22000) per slot for application */ - slot0_partition: partition@a000 { - label = "image-0"; - reg = <0x0000a000 0x00022000>; - }; - - slot1_partition: partition@2c000 { - label = "image-1"; - reg = <0x0002c000 0x00022000>; - }; - - /* 32 KiB (0x8000) for storage */ - storage_partition: partition@4e000 { - label = "storage"; - reg = <0x0004e000 0x00008000>; - }; - - /* CCFG (customer configuration area) is located in uppermost - * flash sector (0x2000/8 KiB @ 0x56000), keep it unused. - */ - }; -}; - -&cpu0 { - clock-frequency = <48000000>; -}; - -&trng { - status = "okay"; -}; - -&gpio0 { - status = "okay"; }; &adc0 { status = "okay"; }; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_rx_default &uart0_tx_default>; - pinctrl-names = "default"; -}; - -&i2c0 { - status = "okay"; - pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>; - pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&spi0 { - status = "okay"; - pinctrl-0 = <&spi0_sck_default &spi0_mosi_default - &spi0_miso_default &spi0_cs_default>; - pinctrl-names = "default"; - cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; -}; - -&radio { - status = "okay"; -}; - -&ieee802154 { - status = "okay"; -}; - -&ieee802154g { - status = "disabled"; -}; - -&wdt0 { - status = "okay"; -}; diff --git a/boards/ti/cc1352r_sensortag/cc1352r_sensortag.dts b/boards/ti/cc1352r_sensortag/cc1352r_sensortag.dts index b79e4854f73..1e51ef27f1b 100644 --- a/boards/ti/cc1352r_sensortag/cc1352r_sensortag.dts +++ b/boards/ti/cc1352r_sensortag/cc1352r_sensortag.dts @@ -8,7 +8,7 @@ /dts-v1/; #include -#include "../cc1352r1_launchxl/boosterpack_connector.dtsi" +#include "../common/boosterpack_connector.dtsi" #include "cc1352r_sensortag-pinctrl.dtsi" #include diff --git a/boards/ti/cc26x2r1_launchxl/boosterpack_connector.dtsi b/boards/ti/cc26x2r1_launchxl/boosterpack_connector.dtsi deleted file mode 100644 index cf126a52146..00000000000 --- a/boards/ti/cc26x2r1_launchxl/boosterpack_connector.dtsi +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2019 Brett Witherspoon - * - * SPDX-License-Identifier: Apache-2.0 - */ - -/ { - boosterpack_header: connector { - compatible = "ti,boosterpack-header"; - #gpio-cells = <2>; - gpio-map = <2 0 &gpio0 23 0>, - <3 0 &gpio0 2 0>, - <4 0 &gpio0 3 0>, - <5 0 &gpio0 22 0>, - <6 0 &gpio0 24 0>, - <7 0 &gpio0 10 0>, - <8 0 &gpio0 21 0>, - <9 0 &gpio0 4 0>, - <10 0 &gpio0 5 0>, - <11 0 &gpio0 15 0>, - <12 0 &gpio0 14 0>, - <13 0 &gpio0 13 0>, - <14 0 &gpio0 8 0>, - <15 0 &gpio0 9 0>, - <18 0 &gpio0 11 0>, - <19 0 &gpio0 12 0>, - <23 0 &gpio0 25 0>, - <24 0 &gpio0 26 0>, - <25 0 &gpio0 27 0>, - <26 0 &gpio0 28 0>, - <27 0 &gpio0 29 0>, - <28 0 &gpio0 30 0>, - <29 0 &gpio0 0 0>, - <30 0 &gpio0 1 0>, - <31 0 &gpio0 17 0>, - <32 0 &gpio0 16 0>, - <36 0 &gpio0 18 0>, - <37 0 &gpio0 19 0>, - <38 0 &gpio0 20 0>, - <39 0 &gpio0 6 0>, - <40 0 &gpio0 7 0>; - }; -}; - -boosterpack_i2c: &i2c0 {}; -boosterpack_spi: &spi0 {}; -boosterpack_serial: &uart0 {}; diff --git a/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl-pinctrl.dtsi b/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl-pinctrl.dtsi index 2376d1e98a8..02df3fee52c 100644 --- a/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl-pinctrl.dtsi +++ b/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl-pinctrl.dtsi @@ -17,45 +17,4 @@ bias-disable; input-enable; }; - - /* I2C0 */ - i2c0_scl_default: i2c0_scl_default { - pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>; - bias-pull-up; - drive-open-drain; - input-enable; - }; - i2c0_sda_default: i2c0_sda_default { - pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>; - bias-pull-up; - drive-open-drain; - input-enable; - }; - i2c0_scl_sleep: i2c0_scl_sleep { - pinmux = <4 IOC_PORT_GPIO>; - bias-disable; - }; - i2c0_sda_sleep: i2c0_sda_sleep { - pinmux = <5 IOC_PORT_GPIO>; - bias-disable; - }; - - /* SPI0 */ - spi0_sck_default: spi0_sck_default { - pinmux = <10 IOC_PORT_MCU_SSI0_CLK>; - bias-disable; - }; - spi0_mosi_default: spi0_mosi_default { - pinmux = <9 IOC_PORT_MCU_SSI0_TX>; - bias-disable; - }; - spi0_miso_default: spi0_miso_default { - pinmux = <8 IOC_PORT_MCU_SSI0_RX>; - bias-disable; - input-enable; - }; - spi0_cs_default: spi0_cs_default { - pinmux = <11 IOC_PORT_MCU_SSI0_FSS>; - bias-disable; - }; }; diff --git a/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl.dts b/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl.dts index 00b5c7d0507..7aa20e01b77 100644 --- a/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl.dts +++ b/boards/ti/cc26x2r1_launchxl/cc26x2r1_launchxl.dts @@ -7,131 +7,31 @@ /dts-v1/; #include -#include "boosterpack_connector.dtsi" +#include "../common/launchxl.dtsi" +#include "../common/launchxl-flash.dtsi" #include "cc26x2r1_launchxl-pinctrl.dtsi" -#include - -#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP) / { model = "TI CC26x2R1 LaunchXL"; compatible = "ti,launchxl-cc26x2r1"; - aliases { - led0 = &led0; - led1 = &led1; - sw0 = &btn0; - sw1 = &btn1; - watchdog0 = &wdt0; - mcuboot-led0 = &led1; - mcuboot-button0 = &btn1; - }; - chosen { - zephyr,sram = &sram0; - zephyr,flash = &flash0; - zephyr,console = &uart0; - zephyr,shell-uart = &uart0; - zephyr,code-partition = &slot0_partition; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; - label = "Green LED"; - }; - led1: led_1 { - gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; - label = "Red LED"; - }; - }; - - keys { - compatible = "gpio-keys"; - btn0: btn_0 { - gpios = <&gpio0 13 BTN_GPIO_FLAGS>; - label = "Push button 1"; - zephyr,code = ; - }; - btn1: btn_1 { - gpios = <&gpio0 14 BTN_GPIO_FLAGS>; - label = "Push button 2"; - zephyr,code = ; - }; + /delete-property/ zephyr,ieee802154; }; }; -&flash0 { - partitions { - /* 40 KiB (0xa000) for MCUboot */ - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000a000>; - }; - - /* 136 KiB (0x22000) per slot for application */ - slot0_partition: partition@a000 { - label = "image-0"; - reg = <0x0000a000 0x00022000>; - }; - - slot1_partition: partition@2c000 { - label = "image-1"; - reg = <0x0002c000 0x00022000>; - }; - - /* 32 KiB (0x8000) for storage */ - storage_partition: partition@4e000 { - label = "storage"; - reg = <0x0004e000 0x00008000>; - }; - - /* CCFG (customer configuration area) is located in uppermost - * flash sector (0x2000/8 KiB @ 0x56000), keep it unused. - */ - }; +&radio { + status = "disabled"; }; -&cpu0 { - clock-frequency = <48000000>; +&ieee802154 { + status = "disabled"; }; -&trng { - status = "okay"; -}; - -&gpio0 { - status = "okay"; +&ieee802154g { + status = "disabled"; }; &adc0 { status = "okay"; }; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_rx_default &uart0_tx_default>; - pinctrl-names = "default"; -}; - -&i2c0 { - status = "okay"; - pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>; - pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>; - pinctrl-names = "default", "sleep"; -}; - -&spi0 { - status = "okay"; - pinctrl-0 = <&spi0_sck_default &spi0_mosi_default - &spi0_miso_default &spi0_cs_default>; - pinctrl-names = "default"; - - cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; -}; - -&wdt0 { - status = "okay"; -}; diff --git a/boards/ti/common/CMakeLists.txt b/boards/ti/common/CMakeLists.txt new file mode 100644 index 00000000000..1cdd655768d --- /dev/null +++ b/boards/ti/common/CMakeLists.txt @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_library() +zephyr_library_sources_ifdef(CONFIG_BOARD_CC1352_LP_SKY13317 board_antenna.c) diff --git a/boards/ti/common/Kconfig b/boards/ti/common/Kconfig new file mode 100644 index 00000000000..854f88bad0c --- /dev/null +++ b/boards/ti/common/Kconfig @@ -0,0 +1,24 @@ +# TI CC1352R LaunchXL board + +# Copyright (c) 2021 Florin Stancu +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_CC1352_LP_SKY13317 + bool "CC1352 LP common board antenna init" + default y if DT_HAS_SKYWORKS_SKY13317_ENABLED + help + Some CC1352 boards have a SKY13317 component + to select the antenna. This enables support + for this component for the CC1352 boards using it. + +if BOARD_CC1352_LP_SKY13317 + +config BOARD_ANTENNA_INIT_PRIO + int "Board antenna switch initialization priority" + default 70 + help + Set the priority for board init, must be greater than + KERNEL_INIT_PRIORITY_DEVICE but smaller than + IEEE802154_CC13XX_CC26XX_SUB_GHZ_INIT_PRIO. + +endif # BOARD_CC1352_LP_SKY13317 diff --git a/boards/ti/cc1352p1_launchxl/board_antenna.c b/boards/ti/common/board_antenna.c similarity index 100% rename from boards/ti/cc1352p1_launchxl/board_antenna.c rename to boards/ti/common/board_antenna.c diff --git a/boards/ti/cc1352r1_launchxl/boosterpack_connector.dtsi b/boards/ti/common/boosterpack_connector.dtsi similarity index 100% rename from boards/ti/cc1352r1_launchxl/boosterpack_connector.dtsi rename to boards/ti/common/boosterpack_connector.dtsi diff --git a/boards/ti/common/launchxl-flash-p7.dtsi b/boards/ti/common/launchxl-flash-p7.dtsi new file mode 100644 index 00000000000..e60b9db5a80 --- /dev/null +++ b/boards/ti/common/launchxl-flash-p7.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2024 Alexandre Bailon + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + /* 40 KiB (0xa000) for MCUboot */ + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000a000>; + }; + + /* 136 KiB (0x22000) per slot for application */ + slot0_partition: partition@a000 { + label = "image-0"; + reg = <0x0000a000 0x0004e000>; + }; + + slot1_partition: partition@58000 { + label = "image-1"; + reg = <0x00058000 0x0004e000>; + }; + + /* 32 KiB (0x8000) for storage */ + storage_partition: partition@a6000 { + label = "storage"; + reg = <0x000a6000 0x00008000>; + }; + + /* CCFG (customer configuration area) is located in uppermost + * flash sector (0x2000/8 KiB @ 0xae000), keep it unused. + */ + }; +}; diff --git a/boards/ti/common/launchxl-flash.dtsi b/boards/ti/common/launchxl-flash.dtsi new file mode 100644 index 00000000000..cdd2a0fc82e --- /dev/null +++ b/boards/ti/common/launchxl-flash.dtsi @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 Florin Stancu + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&flash0 { + partitions { + /* 40 KiB (0xa000) for MCUboot */ + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000a000>; + }; + + /* 136 KiB (0x22000) per slot for application */ + slot0_partition: partition@a000 { + label = "image-0"; + reg = <0x0000a000 0x00022000>; + }; + + slot1_partition: partition@2c000 { + label = "image-1"; + reg = <0x0002c000 0x00022000>; + }; + + /* 32 KiB (0x8000) for storage */ + storage_partition: partition@4e000 { + label = "storage"; + reg = <0x0004e000 0x00008000>; + }; + + /* CCFG (customer configuration area) is located in uppermost + * flash sector (0x2000/8 KiB @ 0x56000), keep it unused. + */ + }; +}; diff --git a/boards/ti/cc1352r1_launchxl/cc1352r1_launchxl-pinctrl.dtsi b/boards/ti/common/launchxl-pinctrl.dtsi similarity index 100% rename from boards/ti/cc1352r1_launchxl/cc1352r1_launchxl-pinctrl.dtsi rename to boards/ti/common/launchxl-pinctrl.dtsi diff --git a/boards/ti/common/launchxl.dtsi b/boards/ti/common/launchxl.dtsi new file mode 100644 index 00000000000..9b2b58a9d88 --- /dev/null +++ b/boards/ti/common/launchxl.dtsi @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2021 Florin Stancu + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "boosterpack_connector.dtsi" +#include "launchxl-pinctrl.dtsi" +#include + +#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP) + +/ { + aliases { + led0 = &led0; + led1 = &led1; + sw0 = &btn0; + sw1 = &btn1; + watchdog0 = &wdt0; + mcuboot-led0 = &led1; + mcuboot-button0 = &btn1; + }; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,ieee802154 = &ieee802154; + zephyr,code-partition = &slot0_partition; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>; + label = "Green LED"; + }; + led1: led_1 { + gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; + label = "Red LED"; + }; + }; + + keys { + compatible = "gpio-keys"; + btn0: btn_0 { + gpios = <&gpio0 15 BTN_GPIO_FLAGS>; + label = "Push button 1"; + zephyr,code = ; + }; + btn1: btn_1 { + gpios = <&gpio0 14 BTN_GPIO_FLAGS>; + label = "Push button 2"; + zephyr,code = ; + }; + }; +}; + +&cpu0 { + clock-frequency = <48000000>; +}; + +&trng { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_rx_default &uart0_tx_default>; + pinctrl-names = "default"; +}; + +&i2c0 { + status = "okay"; + pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>; + pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>; + pinctrl-names = "default", "sleep"; +}; + +&spi0 { + status = "okay"; + pinctrl-0 = <&spi0_sck_default &spi0_mosi_default + &spi0_miso_default &spi0_cs_default>; + pinctrl-names = "default"; + cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; +}; + +&radio { + status = "okay"; +}; + +&ieee802154 { + status = "okay"; +}; + +&ieee802154g { + status = "disabled"; +}; + +&wdt0 { + status = "okay"; +}; diff --git a/boards/ti/common/launchxl_sky13317.dtsi b/boards/ti/common/launchxl_sky13317.dtsi new file mode 100644 index 00000000000..132dd1ed6f7 --- /dev/null +++ b/boards/ti/common/launchxl_sky13317.dtsi @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2021 Florin Stancu + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/ { + /** + * The CC1352P LAUNCHXL has an on-board antenna switch (SKY13317-373LF) used to select the + * appropriate RF signal port based on the currently-used PHY. + * + * Truth table: + * + * Path DIO28 DIO29 DIO30 + * =========== ===== ===== ===== + * Off 0 0 0 + * Sub-1 GHz 0 0 1 // DIO30 mux to IOC_PORT_RFC_GPO0 for auto + * 2.4 GHz 1 0 0 // DIO28 mux to IOC_PORT_RFC_GPO0 for auto + * 20 dBm TX 0 1 0 // DIO29 mux to IOC_PORT_RFC_GPO3 for auto + */ + antenna_mux0: antenna_mux0 { + compatible = "skyworks,sky13317"; + status = "okay"; + gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>, <&gpio0 29 GPIO_ACTIVE_HIGH>, \ + <&gpio0 30 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&board_ant_24g_off &board_ant_tx_pa_off &board_ant_subg_off>; + pinctrl-1 = <&board_ant_24g_on &board_ant_tx_pa_off &board_ant_subg_off>; + pinctrl-2 = <&board_ant_24g_on &board_ant_tx_pa_on &board_ant_subg_off>; + pinctrl-3 = <&board_ant_24g_off &board_ant_tx_pa_off &board_ant_subg_on>; + pinctrl-4 = <&board_ant_24g_off &board_ant_tx_pa_on &board_ant_subg_on>; + pinctrl-names = "default", "ant_24g", "ant_24g_pa", "ant_subg", "ant_subg_pa"; + }; +}; + +&pinctrl { + /* On-board antenna pinmux states */ + board_ant_24g_off: board_ant_24g_off { + pinmux = <28 IOC_PORT_GPIO>; + bias-disable; + }; + board_ant_24g_on: board_ant_24g_on { + pinmux = <28 IOC_PORT_RFC_GPO0>; + bias-disable; + }; + board_ant_tx_pa_off: board_ant_tx_pa_off { + pinmux = <29 IOC_PORT_GPIO>; + bias-disable; + }; + board_ant_tx_pa_on: board_ant_tx_pa_on { + pinmux = <29 IOC_PORT_RFC_GPO3>; + bias-disable; + }; + board_ant_subg_off: board_ant_subg_off { + pinmux = <30 IOC_PORT_GPIO>; + bias-disable; + }; + board_ant_subg_on: board_ant_subg_on { + pinmux = <30 IOC_PORT_RFC_GPO0>; + bias-disable; + }; +}; diff --git a/boards/ti/common/support/openocd.cfg b/boards/ti/common/support/openocd.cfg new file mode 100644 index 00000000000..017bb64263b --- /dev/null +++ b/boards/ti/common/support/openocd.cfg @@ -0,0 +1 @@ +source [find board/ti_cc13x2_launchpad.cfg]