drivers: i2c: nrfx: Clean up driver instantiation
- use CONFIG_HAS_HW_NRF_* symbols consistently in nRF multi-instance drivers when creating particular driver instances - remove unnecessary hidden Kconfig options that indicated the type of peripheral to be used by a given instance (e.g. SPI, SPIM, or SPIS) and enabled proper nrfx driver instance; instead, use one option per peripheral type and include the corresponding shim driver flavor into compilation basing on that option (not the one that enables the nrfx driver as it was incorrectly done so far in some cases) Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
e1e4fcc701
commit
fb7d40c757
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue