drivers: Narrow Band Unit interruption driver creation
Creation of the new zephyr\soc\nxp\common\nxp_nbu.c driver which manage the interruption of the NBU. This modification is mandatory to support a coex application which includes Bluetooth and 802.15.4 on the same narrow band path. Signed-off-by: Xavier Razavet <xavier.razavet@nxp.com>
This commit is contained in:
parent
5a93b27aa9
commit
1ac3470efb
19 changed files with 136 additions and 59 deletions
9
soc/nxp/common/Kconfig.nbu
Normal file
9
soc/nxp/common/Kconfig.nbu
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Copyright 2024 NXP
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config NXP_NBU
|
||||
bool
|
||||
default y if BT || IEEE802154
|
||||
depends on DT_HAS_NXP_NBU_ENABLED
|
||||
help
|
||||
NXP Narrow Band Unit interrupt initialization.
|
56
soc/nxp/common/nxp_nbu.c
Normal file
56
soc/nxp/common/nxp_nbu.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2024 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Interrupt Narrow Band Unit. This is meant for a RCP radio device.
|
||||
*/
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Includes */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#include <zephyr/irq.h>
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Definitions */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#define DT_DRV_COMPAT nxp_nbu
|
||||
|
||||
#define NBU_RX_IRQ_N DT_IRQ_BY_NAME(DT_DRV_INST(0), nbu_rx_int, irq)
|
||||
#define NBU_RX_IRQ_P DT_IRQ_BY_NAME(DT_DRV_INST(0), nbu_rx_int, priority)
|
||||
#if DT_INST_IRQ_HAS_NAME(0, wakeup_int)
|
||||
#define NBU_WAKE_UP_IRQ_N DT_IRQ_BY_NAME(DT_DRV_INST(0), wakeup_int, irq)
|
||||
#define NBU_WAKE_UP_IRQ_P DT_IRQ_BY_NAME(DT_DRV_INST(0), wakeup_int, priority)
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Private prototypes */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
extern int32_t nbu_handler(void);
|
||||
extern int32_t nbu_wakeup_done_handler(void);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Public function */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void nxp_nbu_init(void)
|
||||
{
|
||||
#if defined(CONFIG_BT) || defined(CONFIG_IEEE802154)
|
||||
/* NBU interface Interrupt */
|
||||
IRQ_CONNECT(NBU_RX_IRQ_N, NBU_RX_IRQ_P, nbu_handler, 0, 0);
|
||||
irq_enable(NBU_RX_IRQ_N);
|
||||
|
||||
#if DT_INST_IRQ_HAS_NAME(0, wakeup_int)
|
||||
/* Wake up done interrupt */
|
||||
IRQ_CONNECT(NBU_WAKE_UP_IRQ_N, NBU_WAKE_UP_IRQ_P, nbu_wakeup_done_handler, 0, 0);
|
||||
irq_enable(NBU_WAKE_UP_IRQ_N);
|
||||
#endif
|
||||
#if (DT_INST_PROP(0, wakeup_source)) && CONFIG_PM
|
||||
EnableDeepSleepIRQ(NBU_RX_IRQ_N);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
zephyr_sources(soc.c mcxw71_platform_init.S)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_NXP_NBU
|
||||
../../common/nxp_nbu.c
|
||||
)
|
||||
|
||||
zephyr_include_directories(.)
|
||||
|
||||
set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "")
|
||||
|
|
|
@ -15,3 +15,5 @@ config SOC_SERIES_MCXW
|
|||
select SOC_RESET_HOOK
|
||||
select SOC_EARLY_INIT_HOOK
|
||||
select CLOCK_CONTROL
|
||||
|
||||
rsource "../../common/Kconfig.nbu"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <fsl_clock.h>
|
||||
|
||||
extern uint32_t SystemCoreClock;
|
||||
extern void nxp_nbu_init(void);
|
||||
|
||||
static ALWAYS_INLINE void clock_init(void)
|
||||
{
|
||||
|
@ -214,4 +215,8 @@ void soc_early_init_hook(void)
|
|||
|
||||
/* restore interrupt state */
|
||||
irq_unlock(oldLevel);
|
||||
|
||||
#if defined(CONFIG_BT) || defined(CONFIG_IEEE802154)
|
||||
nxp_nbu_init();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
#define PORT_MUX_GPIO kPORT_MuxAsGpio
|
||||
|
||||
#define ble_hci_handler RF_IMU0_IRQHandler
|
||||
#define nbu_handler RF_IMU0_IRQHandler
|
||||
|
||||
#endif /* _SOC__H_ */
|
||||
|
|
|
@ -7,6 +7,10 @@ zephyr_sources(
|
|||
flexspi_clock_setup.c
|
||||
)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_NXP_NBU
|
||||
../common/nxp_nbu.c
|
||||
)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_PM
|
||||
power.c
|
||||
)
|
||||
|
|
|
@ -52,5 +52,6 @@ config IMAGE_VECTOR_TABLE_OFFSET
|
|||
endif # NXP_RW6XX_BOOT_HEADER
|
||||
|
||||
rsource "../common/Kconfig.flexspi_xip"
|
||||
rsource "../common/Kconfig.nbu"
|
||||
|
||||
endif # SOC_SERIES_RW6XX
|
||||
|
|
|
@ -36,6 +36,7 @@ extern void z_arm_debug_monitor(void);
|
|||
extern void z_arm_pendsv(void);
|
||||
extern void sys_clock_isr(void);
|
||||
extern void z_arm_exc_spurious(void);
|
||||
extern void nxp_nbu_init(void);
|
||||
|
||||
__imx_boot_ivt_section void (*const image_vector_table[])(void) = {
|
||||
(void (*)())(z_main_stack + CONFIG_MAIN_STACK_SIZE), /* 0x00 */
|
||||
|
@ -301,12 +302,16 @@ void soc_early_init_hook(void)
|
|||
/* Initialize clock */
|
||||
clock_init();
|
||||
|
||||
#if defined(CONFIG_ADC_MCUX_GAU) || defined(CONFIG_DAC_MCUX_GAU)
|
||||
#if defined(CONFIG_ADC_MCUX_GAU) || defined(CONFIG_DAC_MCUX_GAU)
|
||||
POWER_PowerOnGau();
|
||||
#endif
|
||||
#if CONFIG_PM
|
||||
nxp_rw6xx_power_init();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT) || defined(CONFIG_IEEE802154)
|
||||
nxp_nbu_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void soc_reset_hook(void)
|
||||
|
|
|
@ -16,11 +16,8 @@
|
|||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
#define ble_hci_handler BLE_MCI_WAKEUP0_DriverIRQHandler
|
||||
#define ble_wakeup_done_handler BLE_MCI_WAKEUP_DONE0_DriverIRQHandler
|
||||
|
||||
#define hdlc_rcp_if_handler BLE_MCI_WAKEUP0_DriverIRQHandler
|
||||
#define hdlc_rcp_if_wakeup_done_handler BLE_MCI_WAKEUP_DONE0_DriverIRQHandler
|
||||
#define nbu_handler BLE_MCI_WAKEUP0_DriverIRQHandler
|
||||
#define nbu_wakeup_done_handler BLE_MCI_WAKEUP_DONE0_DriverIRQHandler
|
||||
|
||||
/* Wrapper Function to deal with SDK differences in power API */
|
||||
static inline void EnableDeepSleepIRQ(IRQn_Type irq)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue