1list(APPEND CMAKE_MODULE_PATH
2    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/${MCUX_DEVICE_PATH}
3    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/${MCUX_DEVICE_PATH}/drivers
4    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/common
5    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/flexcomm
6    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpflexcomm
7    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/flexio
8    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/dmamux
9    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/osa
10    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/lists
11)
12
13if(CONFIG_CPU_CORTEX_A)
14    list(APPEND CMAKE_MODULE_PATH
15        ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/CMSIS/Core_AArch64/Include
16    )
17else()
18    list(APPEND CMAKE_MODULE_PATH
19        ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/cache/armv7-m7
20        ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/CMSIS/Core/Include
21    )
22endif()
23
24function(include_ifdef feature_toggle module)
25  if(${${feature_toggle}})
26    include(${module})
27  endif()
28endfunction()
29
30function(include_driver_ifdef feature_toggle directory module)
31  if(${${feature_toggle}})
32    list(APPEND CMAKE_MODULE_PATH
33        ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/${directory}
34    )
35    zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/${directory})
36    include(${module})
37  endif()
38endfunction()
39
40message("Load components for ${MCUX_DEVICE}:")
41
42#specific operation to shared drivers
43if((DEFINED CONFIG_FLASH_MCUX_FLEXSPI_XIP) AND (DEFINED CONFIG_FLASH))
44  zephyr_code_relocate(FILES ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/flexspi/fsl_flexspi.c
45    LOCATION ${CONFIG_FLASH_MCUX_FLEXSPI_XIP_MEM}_TEXT)
46endif()
47
48if(NOT CONFIG_ASSERT OR CONFIG_FORCE_NO_ASSERT)
49  zephyr_compile_definitions(NDEBUG) # squelch fsl_flexcan.c warning
50endif()
51
52zephyr_compile_definitions_ifdef(
53  CONFIG_PTP_CLOCK_MCUX
54  ENET_ENHANCEDBUFFERDESCRIPTOR_MODE
55)
56
57zephyr_compile_definitions_ifdef(
58  CONFIG_PTP_CLOCK_NXP_ENET
59  ENET_ENHANCEDBUFFERDESCRIPTOR_MODE
60)
61
62zephyr_compile_definitions_ifdef(
63  CONFIG_SOC_MIMX9596
64  FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL=1
65)
66
67zephyr_library_compile_definitions_ifdef(
68  CONFIG_HAS_MCUX_CACHE FSL_SDK_ENABLE_DRIVER_CACHE_CONTROL
69)
70
71# note: if FSL_IRQSTEER_ENABLE_MASTER_INT is not
72# defined then it will automatically be defined
73# and set to 1 via fsl_irqsteer.h
74zephyr_library_compile_definitions_ifdef(
75  CONFIG_NXP_IRQSTEER
76  FSL_IRQSTEER_ENABLE_MASTER_INT=0
77)
78
79zephyr_library_compile_definitions_ifdef(
80  CONFIG_DAI_NXP_SAI
81  MCUX_SDK_SAI_ALLOW_NULL_FIFO_WATERMARK=1
82)
83
84zephyr_library_compile_definitions_ifdef(
85  CONFIG_DAI_NXP_SAI
86  MCUX_SDK_SAI_DISABLE_IMPLICIT_CHAN_CONFIG=1
87)
88
89# Required by all SCFW-based SoCs
90if (CONFIG_SOC_MIMX8QM6_ADSP OR CONFIG_SOC_MIMX8QX6_ADSP)
91    list(APPEND CMAKE_MODULE_PATH
92        ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/${MCUX_DEVICE_PATH}/scfw_api
93    )
94    zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/${MCUX_DEVICE_PATH}/scfw_api)
95    include(driver_scfw_api)
96endif()
97
98include(driver_common)
99
100#Include system_xxx file
101#This can be extended to other SoC series if needed
102if (DEFINED CONFIG_SOC_RESET_HOOK OR DEFINED CONFIG_SOC_SERIES_IMXRT6XX
103    OR DEFINED CONFIG_SOC_SERIES_LPC55XXX OR DEFINED CONFIG_SOC_SERIES_MCXN)
104if (CONFIG_SOC_MIMXRT1166_CM4)
105include(device_system_MIMXRT1166_cm4)
106elseif (CONFIG_SOC_MIMXRT1166_CM7)
107include(device_system_MIMXRT1166_cm7)
108elseif (CONFIG_SOC_MIMXRT1176_CM4)
109include(device_system_MIMXRT1176_cm4)
110elseif (CONFIG_SOC_MIMXRT1176_CM7)
111include(device_system_MIMXRT1176_cm7)
112elseif (CONFIG_SOC_MIMXRT1189_CM33)
113include(device_system_MIMXRT1189_cm33)
114elseif (CONFIG_SOC_MIMXRT1189_CM7)
115include(device_system_MIMXRT1189_cm7)
116elseif (CONFIG_SOC_LPC55S69_CPU0)
117include(device_system_LPC55S69_cm33_core0)
118elseif (CONFIG_SOC_LPC55S69_CPU1)
119include(device_system_LPC55S69_cm33_core1)
120elseif (CONFIG_SOC_LPC54114_M4)
121include(device_system_LPC54114_cm4)
122elseif (CONFIG_SOC_LPC54114_M0)
123include(device_system_LPC54114_cm0plus)
124elseif (CONFIG_SOC_MCXN947_CPU0)
125include(device_system_MCXN947_cm33_core0)
126elseif (CONFIG_SOC_MCXN947_CPU1)
127include(device_system_MCXN947_cm33_core1)
128elseif (CONFIG_SOC_MCXN236)
129include(device_system_MCXN236)
130else()
131include(device_system)
132endif()
133endif()
134
135zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/common)
136
137#include shared drivers
138include_driver_ifdef(CONFIG_ADC_MCUX_LPADC		lpadc		driver_lpadc)
139include_driver_ifdef(CONFIG_COUNTER_MCUX_CTIMER		ctimer		driver_ctimer)
140include_driver_ifdef(CONFIG_COUNTER_MCUX_LPC_RTC	lpc_rtc		driver_lpc_rtc)
141include_driver_ifdef(CONFIG_DMA_MCUX_LPC		lpc_dma		driver_lpc_dma)
142include_driver_ifdef(CONFIG_GPIO_MCUX_LPC		lpc_gpio        driver_lpc_gpio)
143include_driver_ifdef(CONFIG_NXP_PINT			pint    	driver_pint)
144include_driver_ifdef(CONFIG_NXP_PINT			inputmux	driver_inputmux)
145include_driver_ifdef(CONFIG_I2C_MCUX_FLEXCOMM		flexcomm	driver_flexcomm)
146include_driver_ifdef(CONFIG_I2C_MCUX_FLEXCOMM		flexcomm/i2c	driver_flexcomm_i2c)
147include_driver_ifdef(CONFIG_I2S_MCUX_FLEXCOMM		flexcomm	driver_flexcomm)
148include_driver_ifdef(CONFIG_I2S_MCUX_FLEXCOMM		flexcomm/i2s	driver_flexcomm_i2s)
149include_driver_ifdef(CONFIG_MCUX_OS_TIMER		ostimer		driver_ostimer)
150include_driver_ifdef(CONFIG_PWM_MCUX_SCTIMER		sctimer		driver_sctimer)
151include_driver_ifdef(CONFIG_SOC_FLASH_LPC		flashiap	driver_flashiap)
152include_driver_ifdef(CONFIG_SPI_MCUX_FLEXCOMM		flexcomm	driver_flexcomm)
153include_driver_ifdef(CONFIG_SPI_MCUX_FLEXCOMM		flexcomm/spi	driver_flexcomm_spi)
154include_driver_ifdef(CONFIG_UART_MCUX_FLEXCOMM		flexcomm	driver_flexcomm)
155include_driver_ifdef(CONFIG_UART_MCUX_FLEXCOMM		flexcomm/usart	driver_flexcomm_usart)
156include_driver_ifdef(CONFIG_WDT_MCUX_WWDT		wwdt		driver_wwdt)
157include_driver_ifdef(CONFIG_ADC_MCUX_ADC12		adc12		driver_adc12)
158include_driver_ifdef(CONFIG_ADC_MCUX_ADC16		adc16		driver_adc16)
159include_driver_ifdef(CONFIG_CAN_MCUX_FLEXCAN		flexcan		driver_flexcan)
160include_driver_ifdef(CONFIG_CAN_MCUX_FLEXCAN_FD		flexcan		driver_flexcan)
161include_driver_ifdef(CONFIG_COUNTER_NXP_PIT		pit		driver_pit)
162include_driver_ifdef(CONFIG_COUNTER_MCUX_RTC		rtc		driver_rtc)
163include_driver_ifdef(CONFIG_DAC_MCUX_DAC		dac		driver_dac)
164include_driver_ifdef(CONFIG_DAC_MCUX_DAC32		dac32		driver_dac32)
165include_driver_ifdef(CONFIG_DMA_MCUX_EDMA		dmamux		driver_dmamux)
166include_driver_ifdef(CONFIG_DMA_MCUX_EDMA_V3		dmamux		driver_dmamux)
167include_driver_ifdef(CONFIG_DMA_MCUX_EDMA		edma		driver_edma)
168include_driver_ifdef(CONFIG_DMA_MCUX_EDMA_V3		dma3		driver_dma3)
169include_driver_ifdef(CONFIG_DMA_MCUX_EDMA_V4		edma4		driver_edma4)
170include_driver_ifdef(CONFIG_ENTROPY_MCUX_RNGA		rnga		driver_rnga)
171include_driver_ifdef(CONFIG_ENTROPY_MCUX_TRNG		trng		driver_trng)
172include_driver_ifdef(CONFIG_ENTROPY_MCUX_CAAM		caam		driver_caam)
173include_driver_ifdef(CONFIG_ETH_NXP_ENET		enet		driver_enet)
174include_driver_ifdef(CONFIG_ETH_NXP_IMX_NETC		netc		driver_netc)
175include_driver_ifdef(CONFIG_HAS_MCUX_SMC		smc		driver_smc)
176include_driver_ifdef(CONFIG_I2C_MCUX			i2c		driver_i2c)
177if (CONFIG_NXP_LP_FLEXCOMM)
178include_driver_ifdef(CONFIG_I2C_MCUX_LPI2C		lpflexcomm	driver_lpflexcomm)
179include_driver_ifdef(CONFIG_I2C_MCUX_LPI2C		lpflexcomm/lpi2c	driver_lpi2c)
180else()
181include_driver_ifdef(CONFIG_I2C_MCUX_LPI2C		lpi2c		driver_lpi2c)
182endif()
183include_driver_ifdef(CONFIG_I3C_MCUX			i3c		driver_i3c)
184include_driver_ifdef(CONFIG_MCUX_ACMP			acmp		driver_acmp)
185include_driver_ifdef(CONFIG_PWM_MCUX_FTM		ftm     	driver_ftm)
186include_driver_ifdef(CONFIG_PWM_MCUX_TPM		tpm		driver_tpm)
187include_driver_ifdef(CONFIG_PWM_MCUX_PWT		pwt		driver_pwt)
188include_driver_ifdef(CONFIG_PWM_MCUX_QTMR		qtmr_1		driver_qtmr_1)
189include_driver_ifdef(CONFIG_RTC_MCUX			rtc		driver_rtc)
190include_driver_ifdef(CONFIG_SPI_MCUX_DSPI		dspi		driver_dspi)
191include_driver_ifdef(CONFIG_SPI_MCUX_ECSPI		ecspi		driver_ecspi)
192if (CONFIG_NXP_LP_FLEXCOMM)
193include_driver_ifdef(CONFIG_SPI_MCUX_LPSPI		lpflexcomm	driver_lpflexcomm)
194include_driver_ifdef(CONFIG_SPI_MCUX_LPSPI		lpflexcomm/lpspi	driver_lpspi)
195else()
196include_driver_ifdef(CONFIG_SPI_MCUX_LPSPI		lpspi		driver_lpspi)
197endif()
198include_driver_ifdef(CONFIG_MCUX_FLEXIO			flexio		driver_flexio)
199include_driver_ifdef(CONFIG_SPI_MCUX_FLEXIO		flexio/spi	driver_flexio_spi)
200include_driver_ifdef(CONFIG_MIPI_DBI_NXP_FLEXIO_LCDIF	flexio/mculcd	driver_flexio_mculcd)
201include_driver_ifdef(CONFIG_UART_MCUX			uart		driver_uart)
202include_driver_ifdef(CONFIG_UART_MCUX_LPSCI		lpsci		driver_lpsci)
203if (CONFIG_NXP_LP_FLEXCOMM)
204include_driver_ifdef(CONFIG_UART_MCUX_LPUART		lpflexcomm	driver_lpflexcomm)
205include_driver_ifdef(CONFIG_UART_MCUX_LPUART		lpflexcomm/lpuart	driver_lpuart)
206else()
207include_driver_ifdef(CONFIG_UART_MCUX_LPUART		lpuart		driver_lpuart)
208endif()
209include_driver_ifdef(CONFIG_WDT_MCUX_WDOG		wdog		driver_wdog)
210include_driver_ifdef(CONFIG_WDT_MCUX_WDOG32		wdog32		driver_wdog32)
211include_driver_ifdef(CONFIG_COUNTER_MCUX_GPT		gpt		driver_gpt)
212include_driver_ifdef(CONFIG_COUNTER_MCUX_TPM		tpm		driver_tpm)
213include_driver_ifdef(CONFIG_MCUX_GPT_TIMER		gpt		driver_gpt)
214include_driver_ifdef(CONFIG_COUNTER_MCUX_QTMR		qtmr_1		driver_qtmr_1)
215include_driver_ifdef(CONFIG_DISPLAY_MCUX_ELCDIF		elcdif		driver_elcdif)
216include_driver_ifdef(CONFIG_DISPLAY_MCUX_DCNANO_LCDIF	lcdif		driver_lcdif)
217include_driver_ifdef(CONFIG_MCUX_PXP			pxp		driver_pxp)
218include_driver_ifdef(CONFIG_LV_USE_GPU_NXP_PXP		pxp		driver_pxp)
219include_driver_ifdef(CONFIG_ETH_MCUX			enet		driver_enet)
220include_driver_ifdef(CONFIG_GPIO_MCUX_IGPIO		igpio		driver_igpio)
221include_driver_ifdef(CONFIG_GPIO_MCUX_RGPIO		rgpio		driver_rgpio)
222include_driver_ifdef(CONFIG_I2S_MCUX_SAI		sai		driver_sai)
223include_driver_ifdef(CONFIG_DAI_NXP_SAI			sai		driver_sai)
224include_driver_ifdef(CONFIG_MEMC_MCUX_FLEXSPI		flexspi		driver_flexspi)
225include_driver_ifdef(CONFIG_PWM_MCUX			pwm		driver_pwm)
226include_driver_ifdef(CONFIG_VIDEO_MCUX_CSI		csi		driver_csi)
227include_driver_ifdef(CONFIG_VIDEO_MCUX_MIPI_CSI2RX	mipi_csi2rx     driver_mipi_csi2rx)
228include_driver_ifdef(CONFIG_WDT_MCUX_IMX_WDOG		wdog01		driver_wdog01)
229include_driver_ifdef(CONFIG_DMA_MCUX_LPC		lpc_dma		driver_lpc_dma)
230include_driver_ifdef(CONFIG_MEMC_MCUX_FLEXSPI		flexspi		driver_flexspi)
231include_driver_ifdef(CONFIG_HAS_MCUX_RDC		rdc		driver_rdc)
232include_driver_ifdef(CONFIG_UART_MCUX_IUART		iuart		driver_iuart)
233include_driver_ifdef(CONFIG_ADC_MCUX_12B1MSPS_SAR	adc_12b1msps_sar	driver_adc_12b1msps_sar)
234include_driver_ifdef(CONFIG_HWINFO_MCUX_SRC		src		driver_src)
235include_driver_ifdef(CONFIG_HWINFO_MCUX_SIM		sim		driver_sim)
236include_driver_ifdef(CONFIG_HWINFO_MCUX_RCM		rcm		driver_rcm)
237include_driver_ifdef(CONFIG_IPM_MCUX			mailbox		driver_mailbox)
238include_driver_ifdef(CONFIG_MBOX_NXP_MAILBOX		mailbox		driver_mailbox)
239include_driver_ifdef(CONFIG_COUNTER_MCUX_SNVS		snvs_hp		driver_snvs_hp)
240include_driver_ifdef(CONFIG_COUNTER_MCUX_SNVS_SRTC	snvs_lp		driver_snvs_lp)
241include_driver_ifdef(CONFIG_COUNTER_MCUX_LPTMR		lptmr		driver_lptmr)
242include_driver_ifdef(CONFIG_MCUX_LPTMR_TIMER		lptmr		driver_lptmr)
243include_driver_ifdef(CONFIG_IMX_USDHC			usdhc		driver_usdhc)
244include_driver_ifdef(CONFIG_MIPI_DSI_MCUX		mipi_dsi_split	driver_mipi_dsi_split)
245include_driver_ifdef(CONFIG_MIPI_DSI_MCUX_2L		mipi_dsi	driver_mipi_dsi)
246include_driver_ifdef(CONFIG_ADC_LPC_ADC			lpc_adc		driver_lpc_adc)
247include_driver_ifdef(CONFIG_MCUX_SDIF			sdif		driver_sdif)
248include_driver_ifdef(CONFIG_ADC_MCUX_ETC		adc_etc		driver_adc_etc)
249include_driver_ifdef(CONFIG_MCUX_XBARA			xbara		driver_xbara)
250include_driver_ifdef(CONFIG_QDEC_MCUX			enc		driver_enc)
251include_driver_ifdef(CONFIG_CRYPTO_MCUX_DCP		dcp		driver_dcp)
252include_driver_ifdef(CONFIG_DMA_MCUX_SMARTDMA		smartdma	driver_lpc_smartdma)
253include_driver_ifdef(CONFIG_DMA_MCUX_SMARTDMA		inputmux	driver_inputmux)
254include_driver_ifdef(CONFIG_DAC_MCUX_LPDAC		dac_1		driver_dac_1)
255include_driver_ifdef(CONFIG_NXP_IRQSTEER		irqsteer	driver_irqsteer)
256include_driver_ifdef(CONFIG_AUDIO_DMIC_MCUX		dmic		driver_dmic)
257include_driver_ifdef(CONFIG_DMA_NXP_EDMA		edma_rev2	driver_edma_rev2)
258include_driver_ifdef(CONFIG_SOC_SERIES_MCXN		mcx_spc		driver_mcx_spc)
259include_driver_ifdef(CONFIG_SOC_SERIES_MCXA		mcx_spc		driver_mcx_spc)
260include_driver_ifdef(CONFIG_ADC_MCUX_GAU		cns_adc		driver_cns_adc)
261include_driver_ifdef(CONFIG_DAC_MCUX_GAU		cns_dac		driver_cns_dac)
262include_driver_ifdef(CONFIG_DAI_NXP_ESAI		esai		driver_esai)
263include_driver_ifdef(CONFIG_MCUX_LPCMP		        lpcmp		driver_lpcmp)
264include_driver_ifdef(CONFIG_NXP_RF_IMU			imu		driver_imu)
265include_driver_ifdef(CONFIG_TRDC_MCUX_TRDC              trdc            driver_trdc)
266include_driver_ifdef(CONFIG_S3MU_MCUX_S3MU              s3mu            driver_s3mu)
267include_driver_ifdef(CONFIG_PINCTRL_NXP_KINETIS         port            driver_port)
268if(CONFIG_BT_NXP)
269include_driver_ifdef(CONFIG_SOC_SERIES_MCXW		spc		driver_spc)
270endif()
271
272if (${MCUX_DEVICE} MATCHES "MIMXRT1189")
273  include_driver_ifdef(CONFIG_ETH_NXP_IMX_NETC	netc/socs/imxrt1180	driver_netc_soc_imxrt1180)
274  include_driver_ifdef(CONFIG_ETH_NXP_IMX_NETC	msgintr			driver_msgintr)
275endif()
276
277if ((${MCUX_DEVICE} MATCHES "MIMXRT1[0-9][0-9][0-9]") AND (NOT (CONFIG_SOC_MIMXRT1166_CM4 OR CONFIG_SOC_MIMXRT1176_CM4 OR CONFIG_SOC_MIMXRT1189_CM33)))
278  include_driver_ifdef(CONFIG_HAS_MCUX_CACHE		cache/armv7-m7	driver_cache_armv7_m7)
279elseif((${MCUX_DEVICE} MATCHES "MIMXRT(5|6)") OR (${MCUX_DEVICE} MATCHES "RW61") OR (${MCUX_DEVICE} MATCHES "MCXN.4."))
280  include_driver_ifdef(CONFIG_HAS_MCUX_CACHE		cache/cache64	driver_cache_cache64)
281elseif((${MCUX_DEVICE} MATCHES "MK(28|66)") OR (${MCUX_DEVICE} MATCHES "MKE(14|16|18)") OR (CONFIG_SOC_MIMXRT1166_CM4) OR (CONFIG_SOC_MIMXRT1176_CM4))
282  include_driver_ifdef(CONFIG_HAS_MCUX_CACHE		cache/lmem	driver_cache_lmem)
283elseif(CONFIG_SOC_MIMXRT1189_CM33)
284  include_driver_ifdef(CONFIG_HAS_MCUX_CACHE    cache/xcache  driver_cache_xcache)
285endif()
286
287if (${MCUX_DEVICE} MATCHES "MIMX9596")
288  include_driver_ifdef(CONFIG_IPM_IMX			mu1		driver_mu1)
289  include_driver_ifdef(CONFIG_MBOX_NXP_IMX_MU		mu1		driver_mu1)
290else()
291  include_driver_ifdef(CONFIG_IPM_IMX			mu		driver_mu)
292  include_driver_ifdef(CONFIG_MBOX_NXP_IMX_MU		mu		driver_mu)
293endif()
294
295if(CONFIG_CPU_CORTEX_A)
296  include_driver_ifdef(CONFIG_HAS_MCUX_CACHE		cache/armv8-a	driver_cache_armv8a)
297endif()
298
299if (${MCUX_DEVICE} MATCHES "MIMXRT11[0-9][0-9]")
300   include_driver_ifdef(CONFIG_PM_MCUX_GPC		gpc_3		driver_gpc_3)
301   include_ifdef(CONFIG_HWINFO_MCUX_SRC_V2		driver_soc_src)
302elseif (${MCUX_DEVICE} MATCHES "MIMXRT10[0-9][0-9]")
303   include_driver_ifdef(CONFIG_PM_MCUX_GPC		gpc_1		driver_gpc_1)
304   include_driver_ifdef(CONFIG_PM_MCUX_DCDC		dcdc_1		driver_dcdc_1)
305   include_driver_ifdef(CONFIG_PM_MCUX_PMU		pmu		driver_pmu)
306endif()
307
308if((${MCUX_DEVICE} MATCHES "RW61") AND (NOT DEFINED CONFIG_MINIMAL_LIBC))
309	# Whenever building for RW61x without minimal LIBC, use optimized memcpy.
310	# This will avoid issues with unaligned access to peripheral RAM regions
311	# caused by the memcpy implmentation in newlib
312	zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/utilities/misc_utilities/fsl_memcpy.S)
313endif()
314
315
316if("${CONFIG_SOC_FAMILY}" STREQUAL "nxp_kinetis")
317
318  include_driver_ifdef(CONFIG_SOC_FLASH_MCUX		flash		driver_flash)
319
320  include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/port/driver_port.cmake)
321  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/port)
322
323  if(${MCUX_DEVICE} MATCHES "MK(80|82|64|66|M34|M35|E14F|E16F|E18F|22F12)")
324    include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/sysmpu/driver_sysmpu.cmake)
325    zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/sysmpu)
326  endif()
327
328endif()
329
330if(CONFIG_SOC_SERIES_MCXC)
331    include_driver_ifdef(CONFIG_SOC_FLASH_MCUX		flash		driver_flash)
332elseif(CONFIG_SOC_SERIES_MCXA)
333    zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/mcxa_romapi)
334elseif(CONFIG_SOC_SERIES_MCXN)
335    include_driver_ifdef(CONFIG_SOC_FLASH_MCUX		mcx_romapi	driver_flashiap)
336    zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/mcx_romapi/flash)
337elseif(CONFIG_SOC_SERIES_MCXW)
338    include_driver_ifdef(CONFIG_SOC_FLASH_MCUX		flash_k4	driver_flash_k4)
339endif()
340
341# Temporary change to handle LPC SOC family name change between HWMv1 and HWMv2
342if(("${CONFIG_SOC_FAMILY}" STREQUAL "lpc") OR ("${CONFIG_SOC_FAMILY}" STREQUAL "nxp_lpc"))
343
344if ((${MCUX_DEVICE} MATCHES "LPC8[0-9][0-9]") OR (${MCUX_DEVICE} MATCHES "LPC5(1|4)"))
345  include_driver_ifdef(CONFIG_SOC_FLASH_MCUX		iap		driver_iap)
346  include_driver_ifdef(CONFIG_ENTROPY_MCUX_RNG		iap		driver_rng)
347elseif (${MCUX_DEVICE} MATCHES "LPC55")
348  if (${MCUX_DEVICE} MATCHES "LPC55S*3")
349   if(${CONFIG_SOC_FLASH_MCUX})
350      list(APPEND CMAKE_MODULE_PATH
351        ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/LPC55S36/drivers
352      )
353      zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/devices/LPC55S36/drivers/flash)
354      include(driver_flashiap)
355    endif()
356  else()
357    include_driver_ifdef(CONFIG_SOC_FLASH_MCUX		iap1		driver_iap1)
358  endif()
359  include_driver_ifdef(CONFIG_ENTROPY_MCUX_RNG		rng_1		driver_rng_1)
360endif()
361
362if (${MCUX_DEVICE} MATCHES "LPC5")
363  include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon/driver_lpc_iocon.cmake)
364  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon)
365  if (${MCUX_DEVICE} MATCHES "LPC55S*3" AND (DEFINED CONFIG_ADC_MCUX_LPADC OR DEFINED CONFIG_DAC_MCUX_LPDAC))
366    include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/vref_1/driver_vref_1.cmake)
367    zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/vref_1)
368  endif()
369elseif (${MCUX_DEVICE} MATCHES "LPC8")
370  include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon_lite/driver_lpc_iocon_lite.cmake)
371  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iocon_lite)
372endif()
373
374endif()
375
376if(${MCUX_DEVICE} MATCHES "MIMXRT(5|6)")
377  include(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iopctl/driver_lpc_iopctl.cmake)
378  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/lpc_iopctl)
379endif()
380
381if(CONFIG_SOC_FAMILY_NXP_IMXRT)
382  include_driver_ifdef(CONFIG_ETH_NXP_ENET ocotp driver_ocotp)
383endif()
384
385if(CONFIG_ETH_MCUX)
386  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy)
387  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phyksz8081)
388  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phyar8031)
389  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phylan8720a)
390  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/device/phyrtl8211f)
391  zephyr_library_sources(mcux-sdk/components/phy/device/phyksz8081/fsl_phyksz8081.c)
392  zephyr_library_sources(mcux-sdk/components/phy/device/phyar8031/fsl_phyar8031.c)
393  zephyr_library_sources(mcux-sdk/components/phy/device/phylan8720a/fsl_phylan8720a.c)
394  zephyr_library_sources(mcux-sdk/components/phy/device/phyrtl8211f/fsl_phyrtl8211f.c)
395
396  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/phy/mdio/enet)
397  #zephyr_library_sources(mcux-sdk/components/phy/mdio/enet/fsl_enet_mdio.c)
398endif()
399
400if (CONFIG_USB_DEVICE_DRIVER)
401  set(CONFIG_USE_component_osa_zephyr true)
402
403  list(APPEND CMAKE_MODULE_PATH
404    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/osa
405  )
406
407  list(APPEND CMAKE_MODULE_PATH
408    ${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb
409  )
410  include(middleware_usb_phy)
411  include_ifdef(CONFIG_USB_DC_NXP_EHCI         middleware_usb_device_ehci)
412  include_ifdef(CONFIG_USB_DC_NXP_LPCIP3511    middleware_usb_device_ip3511fs)
413  include(set_component_osa)
414
415  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/device)
416  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/phy)
417  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/include)
418endif()
419
420
421if (CONFIG_UDC_DRIVER)
422  set(CONFIG_USE_component_osa_zephyr true)
423
424  list(APPEND CMAKE_MODULE_PATH
425    ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/osa
426  )
427
428  list(APPEND CMAKE_MODULE_PATH
429    ${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb
430  )
431  include_ifdef(CONFIG_DT_HAS_NXP_USBPHY_ENABLED  middleware_usb_phy)
432  include_ifdef(CONFIG_UDC_NXP_EHCI               middleware_usb_device_ehci)
433  include_ifdef(CONFIG_UDC_NXP_IP3511             middleware_usb_device_ip3511fs)
434  include(set_component_osa)
435
436  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/device)
437  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/phy)
438  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/middleware/mcux-sdk-middleware-usb/include)
439endif()
440
441if(${MCUX_DEVICE} MATCHES "RW61")
442  set(CONFIG_USE_component_osa_zephyr true)
443  if(CONFIG_NXP_FW_LOADER)
444    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/components/flash/mflash)
445    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/components/flash/mflash/rdrw612bga)
446    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/drivers/cache/cache64)
447    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/drivers/flexspi)
448    include(component_mflash_rdrw610)
449  endif()
450endif()
451
452if(${CONFIG_USE_component_osa_zephyr})
453  zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/components/osa)
454endif()
455
456include_ifdef(CONFIG_USE_component_osa_zephyr set_component_osa)
457
458if(CONFIG_WIFI_NXP)
459    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/components/wifi_bt_module)
460    include(component_wifi_bt_module_tx_pwr_limits)
461endif()
462
463if(CONFIG_NXP_FW_LOADER)
464    list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mcux-sdk/components/conn_fwloader)
465    include(driver_conn_fwloader)
466endif()
467
468if(CONFIG_NXP_RF_IMU)
469  if(CONFIG_SOC_SERIES_RW6XX)
470      list(APPEND CMAKE_MODULE_PATH
471          ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/rpmsg
472          ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/imu
473          ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/gdma
474      )
475    include(component_wireless_imu_adapter)
476  elseif(CONFIG_SOC_SERIES_MCXW)
477      zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/rpmsg)
478      zephyr_library_sources(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/components/rpmsg/fsl_adapter_rpmsg.c)
479      include(component_lists)
480      zephyr_compile_definitions(HAL_RPMSG_SELECT_ROLE=0U)
481  endif()
482endif()
483
484if(${MCUX_DEVICE} MATCHES "MCXW")
485  list(APPEND CMAKE_MODULE_PATH
486      ${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/ccm32k
487  )
488
489  include(driver_ccm32k)
490  zephyr_include_directories(${CMAKE_CURRENT_LIST_DIR}/mcux-sdk/drivers/ccm32k)
491endif()
492