diff --git a/drivers/i2c/CMakeLists.txt b/drivers/i2c/CMakeLists.txt index 82b716ac13c..c67805e224b 100644 --- a/drivers/i2c/CMakeLists.txt +++ b/drivers/i2c/CMakeLists.txt @@ -26,8 +26,8 @@ zephyr_library_sources_ifdef(CONFIG_I2C_MCUX i2c_mcux.c) zephyr_library_sources_ifdef(CONFIG_I2C_MCUX_FLEXCOMM i2c_mcux_flexcomm.c) zephyr_library_sources_ifdef(CONFIG_I2C_MCUX_LPI2C i2c_mcux_lpi2c.c) zephyr_library_sources_ifdef(CONFIG_I2C_EMUL i2c_emul.c) -zephyr_library_sources_ifdef(CONFIG_NRFX_TWI i2c_nrfx_twi.c) -zephyr_library_sources_ifdef(CONFIG_NRFX_TWIM i2c_nrfx_twim.c) +zephyr_library_sources_ifdef(CONFIG_I2C_NRFX_TWI i2c_nrfx_twi.c) +zephyr_library_sources_ifdef(CONFIG_I2C_NRFX_TWIM i2c_nrfx_twim.c) zephyr_library_sources_ifdef(CONFIG_I2C_SAM_TWI i2c_sam_twi.c) zephyr_library_sources_ifdef(CONFIG_I2C_SAM_TWIHS i2c_sam_twihs.c) zephyr_library_sources_ifdef(CONFIG_I2C_SAM_TWIM i2c_sam4l_twim.c) diff --git a/drivers/i2c/Kconfig.nrfx b/drivers/i2c/Kconfig.nrfx index b5888149626..1be1ba5aa1a 100644 --- a/drivers/i2c/Kconfig.nrfx +++ b/drivers/i2c/Kconfig.nrfx @@ -13,6 +13,20 @@ menuconfig I2C_NRFX if I2C_NRFX +config I2C_NRFX_TWI + def_bool y + depends on DT_HAS_NORDIC_NRF_TWI_ENABLED + select NRFX_TWI0 if HAS_HW_NRF_TWI0 + select NRFX_TWI1 if HAS_HW_NRF_TWI1 + +config I2C_NRFX_TWIM + def_bool y + depends on DT_HAS_NORDIC_NRF_TWIM_ENABLED + select NRFX_TWIM0 if HAS_HW_NRF_TWIM0 + select NRFX_TWIM1 if HAS_HW_NRF_TWIM1 + select NRFX_TWIM2 if HAS_HW_NRF_TWIM2 + select NRFX_TWIM3 if HAS_HW_NRF_TWIM3 + config I2C_NRFX_TRANSFER_TIMEOUT int "Transfer timeout [ms]" default 500 @@ -21,48 +35,4 @@ config I2C_NRFX_TRANSFER_TIMEOUT 0 means that the driver should use the K_FOREVER value, i.e. it should wait as long as necessary. -config I2C_0_NRF_TWI - def_bool HAS_HW_NRF_TWI0 - select NRFX_TWI0 - help - Enable nRF TWI Master without EasyDMA on port 0. - -config I2C_0_NRF_TWIM - def_bool HAS_HW_NRF_TWIM0 - select NRFX_TWIM0 - help - Enable nRF TWI Master with EasyDMA on port 0. - This peripheral accepts transfers from RAM only, - if provided buffer is placed in flash, transfer will fail. - -config I2C_1_NRF_TWI - def_bool HAS_HW_NRF_TWI1 - select NRFX_TWI1 - help - Enable nRF TWI Master without EasyDMA on port 1. - -config I2C_1_NRF_TWIM - def_bool HAS_HW_NRF_TWIM1 - select NRFX_TWIM1 - help - Enable nRF TWI Master with EasyDMA on port 1. - This peripheral accepts transfers from RAM only, - if provided buffer is placed in flash, transfer will fail. - -config I2C_2_NRF_TWIM - def_bool HAS_HW_NRF_TWIM2 - select NRFX_TWIM2 - help - Enable nRF TWI Master with EasyDMA on port 2. - This peripheral accepts transfers from RAM only, - if provided buffer is placed in flash, transfer will fail. - -config I2C_3_NRF_TWIM - def_bool HAS_HW_NRF_TWIM3 - select NRFX_TWIM3 - help - Enable nRF TWI Master with EasyDMA on port 3. - This peripheral accepts transfers from RAM only, - if provided buffer is placed in flash, transfer will fail. - endif # I2C_NRFX diff --git a/drivers/i2c/i2c_nrfx_twi.c b/drivers/i2c/i2c_nrfx_twi.c index e61ec5b977d..bbb070e7e0c 100644 --- a/drivers/i2c/i2c_nrfx_twi.c +++ b/drivers/i2c/i2c_nrfx_twi.c @@ -321,10 +321,10 @@ static int twi_nrfx_pm_action(const struct device *dev, CONFIG_I2C_INIT_PRIORITY, \ &i2c_nrfx_twi_driver_api) -#ifdef CONFIG_I2C_0_NRF_TWI +#ifdef CONFIG_HAS_HW_NRF_TWI0 I2C_NRFX_TWI_DEVICE(0); #endif -#ifdef CONFIG_I2C_1_NRF_TWI +#ifdef CONFIG_HAS_HW_NRF_TWI1 I2C_NRFX_TWI_DEVICE(1); #endif diff --git a/drivers/i2c/i2c_nrfx_twim.c b/drivers/i2c/i2c_nrfx_twim.c index 5d8c329c92f..a24873fc6f8 100644 --- a/drivers/i2c/i2c_nrfx_twim.c +++ b/drivers/i2c/i2c_nrfx_twim.c @@ -436,18 +436,18 @@ static int i2c_nrfx_twim_init(const struct device *dev) CONFIG_I2C_INIT_PRIORITY, \ &i2c_nrfx_twim_driver_api) -#ifdef CONFIG_I2C_0_NRF_TWIM +#ifdef CONFIG_HAS_HW_NRF_TWIM0 I2C_NRFX_TWIM_DEVICE(0); #endif -#ifdef CONFIG_I2C_1_NRF_TWIM +#ifdef CONFIG_HAS_HW_NRF_TWIM1 I2C_NRFX_TWIM_DEVICE(1); #endif -#ifdef CONFIG_I2C_2_NRF_TWIM +#ifdef CONFIG_HAS_HW_NRF_TWIM2 I2C_NRFX_TWIM_DEVICE(2); #endif -#ifdef CONFIG_I2C_3_NRF_TWIM +#ifdef CONFIG_HAS_HW_NRF_TWIM3 I2C_NRFX_TWIM_DEVICE(3); #endif