Skip to content

Commit b423941

Browse files
cvinayaknashif
authored andcommitted
Bluetooth: Controller: Remove unused nRF21 FEM SPI CSN control
Remove unused nRF21 FEM SPI CSN control as the Zephyr Controller does not implementation SPI control for Tx/Rx nor for Tx gain settings. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 7443daf commit b423941

File tree

6 files changed

+4
-95
lines changed

6 files changed

+4
-95
lines changed

samples/bluetooth/hci_ipc/boards/nrf5340_audio_dk_nrf5340_cpunet_nrf21540_ek.overlay

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,10 @@
66
pdn-gpios = <&arduino_header 15 GPIO_ACTIVE_HIGH>; /* D9 */
77
ant-sel-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
88
mode-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; /* D2 */
9-
spi-if = <&nrf_radio_fem_spi>;
109
supply-voltage-mv = <3000>;
1110
};
1211
};
1312

14-
&spi0 {
15-
/* status = "okay"; */
16-
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>; /* D10 */
17-
18-
nrf_radio_fem_spi: nrf21540_fem_spi@0 {
19-
compatible = "nordic,nrf21540-fem-spi";
20-
/* status = "okay"; */
21-
reg = <0>;
22-
spi-max-frequency = <8000000>;
23-
};
24-
};
25-
2613
&radio {
2714
fem = <&nrf_radio_fem>;
2815
};

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ BUILD_ASSERT(NRF_DT_GPIOTE_INST(FEM_NODE, HAL_RADIO_GPIO_PA_PROP) ==
7979
static const nrfx_gpiote_t gpiote_pdn = NRFX_GPIOTE_INSTANCE(
8080
NRF_DT_GPIOTE_INST(FEM_NODE, pdn_gpios));
8181
static uint8_t gpiote_ch_pdn;
82-
static const nrfx_gpiote_t gpiote_csn = NRFX_GPIOTE_INSTANCE(
83-
NRF_DT_GPIOTE_INST(DT_BUS(FEM_SPI_DEV_NODE), cs_gpios));
84-
static uint8_t gpiote_ch_csn;
8582
#endif
8683

8784
/* These headers require the above gpiote-related variables to be declared. */
@@ -134,20 +131,6 @@ BUILD_ASSERT(!BAD_FLAGS(NRF_GPIO_LNA_FLAGS),
134131
NRF_DT_CHECK_GPIO_CTLR_IS_SOC(FEM_NODE, pdn_gpios, "pdn-gpios");
135132
#endif /* DT_NODE_HAS_PROP(FEM_NODE, pdn_gpios) */
136133

137-
/* CSN is special because it comes from the spi-if property. */
138-
#if defined(HAL_RADIO_FEM_NRF21540_HAS_CSN)
139-
#define NRF_GPIO_CSN_CTLR DT_SPI_DEV_CS_GPIOS_CTLR(FEM_SPI_DEV_NODE)
140-
#define NRF_GPIO_CSN ((NRF_GPIO_Type *)DT_REG_ADDR(NRF_GPIO_CSN_CTLR))
141-
#define NRF_GPIO_CSN_PIN DT_SPI_DEV_CS_GPIOS_PIN(FEM_SPI_DEV_NODE)
142-
#define NRF_GPIO_CSN_FLAGS DT_SPI_DEV_CS_GPIOS_FLAGS(FEM_SPI_DEV_NODE)
143-
#define NRF_GPIO_CSN_PSEL (NRF_GPIO_CSN_PIN + \
144-
(DT_PROP(NRF_GPIO_CSN_CTLR, port) << 5))
145-
BUILD_ASSERT(DT_NODE_HAS_COMPAT(NRF_GPIO_CSN_CTLR, nordic_nrf_gpio),
146-
"fem node " DT_NODE_PATH(FEM_NODE) " has a spi-if property, "
147-
" but the chip select pin is not on the SoC. Check cs-gpios in "
148-
DT_NODE_PATH(DT_BUS(FEM_SPI_DEV_NODE)));
149-
#endif /* HAL_RADIO_FEM_NRF21540_HAS_CSN */
150-
151134
#endif /* HAL_RADIO_FEM_IS_NRF21540 */
152135

153136
/* CTEINLINE S0_MASK for periodic advertising PUDs. It allows to accept all types of extended
@@ -208,15 +191,6 @@ void radio_setup(void)
208191
}
209192
#endif /* NRF_GPIO_PDN_PIN */
210193

211-
#if defined(NRF_GPIO_CSN_PIN)
212-
NRF_GPIO_CSN->DIRSET = BIT(NRF_GPIO_CSN_PIN);
213-
if (ACTIVE_LOW(NRF_GPIO_CSN_FLAGS)) {
214-
NRF_GPIO_CSN->OUTSET = BIT(NRF_GPIO_CSN_PIN);
215-
} else {
216-
NRF_GPIO_CSN->OUTCLR = BIT(NRF_GPIO_CSN_PIN);
217-
}
218-
#endif /* NRF_GPIO_CSN_PIN */
219-
220194
hal_radio_ram_prio_setup();
221195
}
222196

@@ -1841,12 +1815,6 @@ int radio_gpio_pa_lna_init(void)
18411815
}
18421816
#endif
18431817

1844-
#if defined(NRF_GPIO_CSN_PIN)
1845-
if (nrfx_gpiote_channel_alloc(&gpiote_csn, &gpiote_ch_csn) != NRFX_SUCCESS) {
1846-
return -ENOMEM;
1847-
}
1848-
#endif
1849-
18501818
return 0;
18511819
}
18521820

@@ -1859,10 +1827,6 @@ void radio_gpio_pa_lna_deinit(void)
18591827
#if defined(NRF_GPIO_PDN_PIN)
18601828
(void)nrfx_gpiote_channel_free(&gpiote_pdn, gpiote_ch_pdn);
18611829
#endif
1862-
1863-
#if defined(NRF_GPIO_CSN_PIN)
1864-
(void)nrfx_gpiote_channel_free(&gpiote_csn, gpiote_ch_csn);
1865-
#endif
18661830
}
18671831

18681832
#if defined(HAL_RADIO_GPIO_HAVE_PA_PIN)
@@ -1881,7 +1845,6 @@ void radio_gpio_pa_setup(void)
18811845
#if defined(HAL_RADIO_FEM_IS_NRF21540)
18821846
hal_pa_ppi_setup();
18831847
radio_gpio_pdn_setup();
1884-
radio_gpio_csn_setup();
18851848
#endif
18861849
}
18871850
#endif /* HAL_RADIO_GPIO_HAVE_PA_PIN */
@@ -1902,7 +1865,6 @@ void radio_gpio_lna_setup(void)
19021865
#if defined(HAL_RADIO_FEM_IS_NRF21540)
19031866
hal_lna_ppi_setup();
19041867
radio_gpio_pdn_setup();
1905-
radio_gpio_csn_setup();
19061868
#endif
19071869
}
19081870

@@ -1922,22 +1884,6 @@ void radio_gpio_pdn_setup(void)
19221884
#endif /* NRF_GPIO_PDN_PIN */
19231885
}
19241886

1925-
void radio_gpio_csn_setup(void)
1926-
{
1927-
/* Note: the spi-if property is optional. */
1928-
#if defined(NRF_GPIO_CSN_PIN)
1929-
gpiote_csn.p_reg->CONFIG[gpiote_ch_csn] =
1930-
(GPIOTE_CONFIG_MODE_Task <<
1931-
GPIOTE_CONFIG_MODE_Pos) |
1932-
(NRF_GPIO_CSN_PSEL <<
1933-
GPIOTE_CONFIG_PSEL_Pos) |
1934-
(GPIOTE_CONFIG_POLARITY_Toggle <<
1935-
GPIOTE_CONFIG_POLARITY_Pos) |
1936-
(OUTINIT_INACTIVE(NRF_GPIO_CSN_FLAGS) <<
1937-
GPIOTE_CONFIG_OUTINIT_Pos);
1938-
#endif /* NRF_GPIO_CSN_PIN */
1939-
}
1940-
19411887
void radio_gpio_lna_on(void)
19421888
{
19431889
if (ACTIVE_LOW(NRF_GPIO_LNA_FLAGS)) {
@@ -1981,7 +1927,6 @@ void radio_gpio_pa_lna_disable(void)
19811927
BIT(HAL_DISABLE_FEM_PPI));
19821928
gpiote_palna.p_reg->CONFIG[gpiote_ch_palna] = 0;
19831929
gpiote_pdn.p_reg->CONFIG[gpiote_ch_pdn] = 0;
1984-
gpiote_csn.p_reg->CONFIG[gpiote_ch_csn] = 0;
19851930
#else
19861931
hal_radio_nrf_ppi_channels_disable(BIT(HAL_ENABLE_PALNA_PPI) |
19871932
BIT(HAL_DISABLE_PALNA_PPI));

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ void radio_gpio_pa_lna_deinit(void);
163163
void radio_gpio_pa_setup(void);
164164
void radio_gpio_lna_setup(void);
165165
void radio_gpio_pdn_setup(void);
166-
void radio_gpio_csn_setup(void);
167166
void radio_gpio_lna_on(void);
168167
void radio_gpio_lna_off(void);
169168
void radio_gpio_pa_lna_enable(uint32_t trx_us);

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi_gpiote.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ static inline void hal_fem_ppi_setup(void)
6666
hal_gpiote_tasks_setup(gpiote_pdn.p_reg, gpiote_ch_pdn,
6767
IS_ENABLED(HAL_RADIO_GPIO_NRF21540_PDN_POL_INV),
6868
HAL_ENABLE_FEM_PPI, HAL_DISABLE_FEM_PPI);
69-
70-
hal_gpiote_tasks_setup(gpiote_csn.p_reg, gpiote_ch_csn,
71-
IS_ENABLED(HAL_RADIO_GPIO_NRF21540_CSN_POL_INV),
72-
HAL_ENABLE_FEM_PPI, HAL_DISABLE_FEM_PPI);
7369
}
7470

7571
#endif /* HAL_RADIO_FEM_IS_NRF21540 */

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_fem_nrf21540.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,3 @@
5959
#define HAL_RADIO_GPIO_NRF21540_PDN_POL_INV 1
6060
#endif /* DT_GPIO_FLAGS(FEM_NODE, pdn_gpios) & GPIO_ACTIVE_LOW */
6161
#endif /* FEM_HAS_PROP(pdn_gpios) */
62-
63-
#if FEM_HAS_PROP(spi_if)
64-
/* This is the "SPI device" node, i.e. the one with compatible
65-
* nordic,nrf21540-fem-spi.
66-
*/
67-
#define FEM_SPI_DEV_NODE DT_PHANDLE(FEM_NODE, spi_if)
68-
/* If the SPI device node has a chip select gpio... */
69-
#if DT_SPI_DEV_HAS_CS_GPIOS(FEM_SPI_DEV_NODE)
70-
/* set a macro indicating that, and... */
71-
#define HAL_RADIO_FEM_NRF21540_HAS_CSN 1
72-
/* use it to get the CSN polarity. */
73-
#if DT_SPI_DEV_CS_GPIOS_FLAGS(FEM_SPI_DEV_NODE) & GPIO_ACTIVE_LOW
74-
#define HAL_RADIO_GPIO_NRF21540_CSN_POL_INV 1
75-
#endif /* DT_SPI_DEV_CS_GPIOS_FLAGS(FEM_SPI_DEV_NODE) & GPIO_ACTIVE_LOW */
76-
#endif /* DT_SPI_DEV_HAS_CS_GPIOS(FEM_SPI_DEV_NODE) */
77-
#endif /* FEM_HAS_PROP(spi_if) */

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi_gpiote.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,16 @@ static inline void hal_lna_ppi_setup(void)
3636

3737
static inline void hal_fem_ppi_setup(void)
3838
{
39-
nrf_ppi_channel_and_fork_endpoint_setup(
39+
nrf_ppi_channel_endpoint_setup(
4040
NRF_PPI,
4141
HAL_ENABLE_FEM_PPI,
4242
(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[3]),
43-
(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]),
44-
(uint32_t)&(gpiote_csn.p_reg->TASKS_OUT[gpiote_ch_csn]));
45-
nrf_ppi_channel_and_fork_endpoint_setup(
43+
(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]));
44+
nrf_ppi_channel_endpoint_setup(
4645
NRF_PPI,
4746
HAL_DISABLE_FEM_PPI,
4847
(uint32_t)&(NRF_RADIO->EVENTS_DISABLED),
49-
(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]),
50-
(uint32_t)&(gpiote_csn.p_reg->TASKS_OUT[gpiote_ch_csn]));
48+
(uint32_t)&(gpiote_pdn.p_reg->TASKS_OUT[gpiote_ch_pdn]));
5149
}
5250

5351
#endif /* HAL_RADIO_FEM_IS_NRF21540 */

0 commit comments

Comments
 (0)