dts: Use separate compatibles for Nordic TWI/TWIM/TWIS peripherals
This commit introduces separate "compatible" strings for dts nodes representing different types of Nordic TWI peripherals. Previously "nordic,nrf-i2c" was used for both TWI and TWIM, and TWIS was not supported. Quite a few files need to be touched by this commit but the changes can be divided into groups of related or very similar ones, distinguishable by the initial part of the path to the modified file: * dts/bindings/i2c/ new bindings for "nordic,nrf-twim" and "nordic,nrf-twis" are added and the one for "nordic,nrf-i2s" is renamed to "nordic,nrf-twi", common fields for all these bindings are extracted to a shared file * dts/arm/nordic/ "compatible" properties in i2cX nodes are updated (when there is no choice as only one type of TWI peripheral is available) or replaced with a comment pointing out that the proper type of peripheral needs to be picked at some upper layer * drivers/i2c/ both flavors of i2c_nrfx drivers are updated with the new names of macros generated from dts * boards/ all i2cX nodes in dts files for boards equipped with an nRF chip are updated with the proper "compatible" property, according to the type of TWI peripheral that is currently selected for the board by the corresponding Kconfig choice option (I2C_x_NRF_TWI*) Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
90a2e1f0aa
commit
dd4c57d564
38 changed files with 147 additions and 60 deletions
|
@ -244,13 +244,13 @@ static int twi_nrfx_pm_control(struct device *dev, u32_t ctrl_command,
|
|||
#define I2C_NRFX_TWI_DEVICE(idx) \
|
||||
BUILD_ASSERT_MSG( \
|
||||
I2C_NRFX_TWI_FREQUENCY( \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_CLOCK_FREQUENCY) \
|
||||
DT_NORDIC_NRF_TWI_I2C_##idx##_CLOCK_FREQUENCY) \
|
||||
!= I2C_NRFX_TWI_INVALID_FREQUENCY, \
|
||||
"Wrong I2C " #idx " frequency setting in dts"); \
|
||||
static int twi_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_NORDIC_NRF_I2C_I2C_##idx##_IRQ_0, \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_IRQ_0_PRIORITY, \
|
||||
IRQ_CONNECT(DT_NORDIC_NRF_TWI_I2C_##idx##_IRQ_0, \
|
||||
DT_NORDIC_NRF_TWI_I2C_##idx##_IRQ_0_PRIORITY, \
|
||||
nrfx_isr, nrfx_twi_##idx##_irq_handler, 0); \
|
||||
return init_twi(dev); \
|
||||
} \
|
||||
|
@ -263,14 +263,14 @@ static int twi_nrfx_pm_control(struct device *dev, u32_t ctrl_command,
|
|||
static const struct i2c_nrfx_twi_config twi_##idx##z_config = { \
|
||||
.twi = NRFX_TWI_INSTANCE(idx), \
|
||||
.config = { \
|
||||
.scl = DT_NORDIC_NRF_I2C_I2C_##idx##_SCL_PIN, \
|
||||
.sda = DT_NORDIC_NRF_I2C_I2C_##idx##_SDA_PIN, \
|
||||
.scl = DT_NORDIC_NRF_TWI_I2C_##idx##_SCL_PIN, \
|
||||
.sda = DT_NORDIC_NRF_TWI_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = I2C_NRFX_TWI_FREQUENCY( \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_CLOCK_FREQUENCY) \
|
||||
DT_NORDIC_NRF_TWI_I2C_##idx##_CLOCK_FREQUENCY) \
|
||||
} \
|
||||
}; \
|
||||
DEVICE_DEFINE(twi_##idx, \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_LABEL, \
|
||||
DT_NORDIC_NRF_TWI_I2C_##idx##_LABEL, \
|
||||
twi_##idx##_init, \
|
||||
twi_nrfx_pm_control, \
|
||||
&twi_##idx##_data, \
|
||||
|
@ -286,4 +286,3 @@ I2C_NRFX_TWI_DEVICE(0);
|
|||
#ifdef CONFIG_I2C_1_NRF_TWI
|
||||
I2C_NRFX_TWI_DEVICE(1);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue