1 /* 2 * Copyright (c) 2021 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /* 8 * This file contains helper macros for dealing with the devicetree 9 * radio node's fem property, in the case that it has compatible 10 * "nordic,nrf21540-fem". 11 * 12 * Do not include it directly. 13 * 14 * For nRF21540 devices: 15 * 16 * Value Property 17 * --------- -------- 18 * PA pin tx-en-gpios 19 * PA offset tx-en-settle-time-us 20 * LNA pin rx-en-gpios 21 * LNA offset rx-en-settle-time-us 22 * PDN pin pdn-gpios 23 * PDN offset pdn-settle-time-us 24 * 25 * The spi-if property may point at a SPI device node representing the 26 * FEM's SPI control interface. See the binding for details. 27 */ 28 29 #define HAL_RADIO_FEM_IS_NRF21540 1 30 31 #define HAL_RADIO_GPIO_PA_PROP_NAME "tx-en-gpios" 32 #define HAL_RADIO_GPIO_PA_OFFSET_PROP_NAME "tx-en-settle-time-us" 33 #define HAL_RADIO_GPIO_LNA_PROP_NAME "rx-en-gpios" 34 #define HAL_RADIO_GPIO_LNA_OFFSET_PROP_NAME "rx-en-settle-time-us" 35 36 /* This FEM's PA and LNA offset properties have defaults set. */ 37 #define HAL_RADIO_GPIO_PA_OFFSET_MISSING 0 38 #define HAL_RADIO_GPIO_LNA_OFFSET_MISSING 0 39 40 #if FEM_HAS_PROP(tx_en_gpios) 41 #define HAL_RADIO_GPIO_HAVE_PA_PIN 1 42 #define HAL_RADIO_GPIO_PA_PROP tx_en_gpios 43 #define HAL_RADIO_GPIO_PA_OFFSET DT_PROP(FEM_NODE, tx_en_settle_time_us) 44 #endif /* FEM_HAS_PROP(tx_en_gpios) */ 45 46 #if FEM_HAS_PROP(rx_en_gpios) 47 #define HAL_RADIO_GPIO_HAVE_LNA_PIN 1 48 #define HAL_RADIO_GPIO_LNA_PROP rx_en_gpios 49 #define HAL_RADIO_GPIO_LNA_OFFSET DT_PROP(FEM_NODE, rx_en_settle_time_us) 50 #endif /* FEM_HAS_PROP(rx_en_gpios) */ 51 52 /* 53 * The POL_INV macros defined below are just to keep things simple in 54 * radio_nrf5_dppi.h, which uses them. 55 */ 56 57 #if FEM_HAS_PROP(pdn_gpios) 58 #if DT_GPIO_FLAGS(FEM_NODE, pdn_gpios) & GPIO_ACTIVE_LOW 59 #define HAL_RADIO_GPIO_NRF21540_PDN_POL_INV 1 60 #endif /* DT_GPIO_FLAGS(FEM_NODE, pdn_gpios) & GPIO_ACTIVE_LOW */ 61 #endif /* FEM_HAS_PROP(pdn_gpios) */ 62