drivers: ieee802154: cc13x2_cc26x2: make driver DT-based
Use Devicetree to describe the radio and IEEE 802.15.4. This allows to remove usage of IEEE802154_CC13XX_CC26XX_DRV_NAME in preparation for the removal of NET_CONFIG_IEEE802154_DEV_NAME. All boards used in testing have been updated to enable the peripheral in DT as well. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
1ff6577e30
commit
fa16891625
6 changed files with 51 additions and 24 deletions
|
@ -8,12 +8,6 @@ menuconfig IEEE802154_CC13XX_CC26XX
|
|||
|
||||
if IEEE802154_CC13XX_CC26XX
|
||||
|
||||
config IEEE802154_CC13XX_CC26XX_DRV_NAME
|
||||
string "TI CC13xx / CC26xx IEEE 802.15.4 driver's name"
|
||||
default "IEEE802154_0"
|
||||
help
|
||||
This option sets the driver name.
|
||||
|
||||
config IEEE802154_CC13XX_CC26XX_INIT_PRIO
|
||||
int "TI CC13xx / CC26xx IEEE 802.15.4 initialization priority"
|
||||
default 80
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT ti_cc13xx_cc26xx_ieee802154
|
||||
|
||||
#define LOG_LEVEL CONFIG_IEEE802154_DRIVER_LOG_LEVEL
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(ieee802154_cc13xx_cc26xx);
|
||||
|
@ -29,8 +31,6 @@ LOG_MODULE_REGISTER(ieee802154_cc13xx_cc26xx);
|
|||
|
||||
#include "ieee802154_cc13xx_cc26xx.h"
|
||||
|
||||
DEVICE_DECLARE(ieee802154_cc13xx_cc26xx);
|
||||
|
||||
/* Overrides from SmartRF Studio 7 2.13.0 */
|
||||
static uint32_t overrides[] = {
|
||||
/* DC/DC regulator: In Tx, use DCDCCTL5[3:0]=0x3 (DITHER_EN=0 and IPEAK=3). */
|
||||
|
@ -70,7 +70,7 @@ static void cmd_ieee_csma_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
|
|||
{
|
||||
ARG_UNUSED(h);
|
||||
|
||||
const struct device *dev = &DEVICE_NAME_GET(ieee802154_cc13xx_cc26xx);
|
||||
const struct device *dev = DEVICE_DT_INST_GET(0);
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data = dev->data;
|
||||
|
||||
update_saved_cmdhandle(ch, (RF_CmdHandle *) &drv_data->saved_cmdhandle);
|
||||
|
@ -86,7 +86,7 @@ static void cmd_ieee_rx_callback(RF_Handle h, RF_CmdHandle ch, RF_EventMask e)
|
|||
{
|
||||
ARG_UNUSED(h);
|
||||
|
||||
const struct device *dev = &DEVICE_NAME_GET(ieee802154_cc13xx_cc26xx);
|
||||
const struct device *dev = DEVICE_DT_INST_GET(0);
|
||||
struct ieee802154_cc13xx_cc26xx_data *drv_data = dev->data;
|
||||
|
||||
update_saved_cmdhandle(ch, (RF_CmdHandle *) &drv_data->saved_cmdhandle);
|
||||
|
@ -753,18 +753,14 @@ static struct ieee802154_cc13xx_cc26xx_data ieee802154_cc13xx_cc26xx_data = {
|
|||
};
|
||||
|
||||
#if defined(CONFIG_NET_L2_IEEE802154)
|
||||
NET_DEVICE_INIT(ieee802154_cc13xx_cc26xx,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_DRV_NAME,
|
||||
ieee802154_cc13xx_cc26xx_init, NULL,
|
||||
&ieee802154_cc13xx_cc26xx_data, NULL,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO,
|
||||
&ieee802154_cc13xx_cc26xx_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), IEEE802154_MTU);
|
||||
NET_DEVICE_DT_INST_DEFINE(0, ieee802154_cc13xx_cc26xx_init, NULL,
|
||||
&ieee802154_cc13xx_cc26xx_data, NULL,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO,
|
||||
&ieee802154_cc13xx_cc26xx_radio_api, IEEE802154_L2,
|
||||
NET_L2_GET_CTX_TYPE(IEEE802154_L2), IEEE802154_MTU);
|
||||
#else
|
||||
DEVICE_DEFINE(ieee802154_cc13xx_cc26xx,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_DRV_NAME,
|
||||
ieee802154_cc13xx_cc26xx_init, NULL,
|
||||
&ieee802154_cc13xx_cc26xx_data,
|
||||
NULL, POST_KERNEL, CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO,
|
||||
&ieee802154_cc13xx_cc26xx_radio_api);
|
||||
DEVICE_DT_INST_DEFINE(0, ieee802154_cc13xx_cc26xx_init, NULL,
|
||||
&ieee802154_cc13xx_cc26xx_data, NULL, POST_KERNEL,
|
||||
CONFIG_IEEE802154_CC13XX_CC26XX_INIT_PRIO,
|
||||
&ieee802154_cc13xx_cc26xx_radio_api);
|
||||
#endif
|
||||
|
|
|
@ -128,6 +128,23 @@
|
|||
interrupts = <4 0>; /* interrupt #20 = 4 + 16 */
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
radio: radio@40040000 {
|
||||
compatible = "ti,cc13xx-cc26xx-radio";
|
||||
status = "disabled";
|
||||
|
||||
reg = <0x40040000 0x1000
|
||||
0x40041000 0x2000
|
||||
0x40043000 0x1000
|
||||
0x40044000 0x1000>;
|
||||
reg-names = "RFC_PWR", "RFC_DBELL", "RFC_RAT", "RFC_FSCA";
|
||||
|
||||
ieee802154: ieee802154 {
|
||||
compatible = "ti,cc13xx-cc26xx-ieee802154";
|
||||
label = "IEEE802154_0";
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
8
dts/bindings/ieee802154/ti,cc13xx-cc26xx-ieee802154.yaml
Normal file
8
dts/bindings/ieee802154/ti,cc13xx-cc26xx-ieee802154.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Copyright (c) 2022 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: TI SimpleLink CC13xx / CC26xx IEEE 802.15.4 node
|
||||
|
||||
compatible: "ti,cc13xx-cc26xx-ieee802154"
|
||||
|
||||
include: base.yaml
|
12
dts/bindings/net/wireless/ti,cc13xx-cc26xx-radio.yaml
Normal file
12
dts/bindings/net/wireless/ti,cc13xx-cc26xx-radio.yaml
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (c) 2022 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
description: TI SimpleLink CC13xx / CC26xx radio node
|
||||
|
||||
compatible: "ti,cc13xx-cc26xx-radio"
|
||||
|
||||
include: base.yaml
|
||||
|
||||
properties:
|
||||
reg:
|
||||
required: true
|
|
@ -44,7 +44,7 @@ config IEEE802154_CC13XX_CC26XX_SUB_GHZ
|
|||
select PM
|
||||
|
||||
config NET_CONFIG_IEEE802154_DEV_NAME
|
||||
default IEEE802154_CC13XX_CC26XX_DRV_NAME
|
||||
default "IEEE802154_0"
|
||||
|
||||
endif # IEEE802154
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue