dts: nrf: Remove TWI dts.fixup defines and use aliases instead.
Changed driver to use alias defines instead of fixup. Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
This commit is contained in:
parent
5f09eae7a1
commit
5a10087a25
8 changed files with 75 additions and 76 deletions
|
@ -136,29 +136,32 @@ static int init_twi(struct device *dev, const nrfx_twi_config_t *config)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define I2C_NRFX_TWI_DEVICE(idx) \
|
||||
static int twi_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_I2C_##idx##_IRQ, \
|
||||
DT_I2C_##idx##_IRQ_PRI, \
|
||||
nrfx_isr, nrfx_twi_##idx##_irq_handler, 0); \
|
||||
const nrfx_twi_config_t config = { \
|
||||
.scl = DT_I2C_##idx##_SCL_PIN, \
|
||||
.sda = DT_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = NRF_TWI_FREQ_100K, \
|
||||
}; \
|
||||
return init_twi(dev, &config); \
|
||||
} \
|
||||
static struct i2c_nrfx_twi_data twi_##idx##_data = { \
|
||||
.sync = _K_SEM_INITIALIZER(twi_##idx##_data.sync, 0, 1) \
|
||||
}; \
|
||||
static const struct i2c_nrfx_twi_config twi_##idx##_config = { \
|
||||
.twi = NRFX_TWI_INSTANCE(idx) \
|
||||
}; \
|
||||
DEVICE_AND_API_INIT(twi_##idx, CONFIG_I2C_##idx##_NAME, \
|
||||
twi_##idx##_init, &twi_##idx##_data, \
|
||||
&twi_##idx##_config, POST_KERNEL, \
|
||||
CONFIG_I2C_INIT_PRIORITY, \
|
||||
#define I2C_NRFX_TWI_DEVICE(idx) \
|
||||
static int twi_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_NORDIC_NRF_I2C_I2C_##idx##_IRQ, \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_IRQ_PRIORITY, \
|
||||
nrfx_isr, nrfx_twi_##idx##_irq_handler, 0); \
|
||||
const nrfx_twi_config_t config = { \
|
||||
.scl = DT_NORDIC_NRF_I2C_I2C_##idx##_SCL_PIN, \
|
||||
.sda = DT_NORDIC_NRF_I2C_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = NRF_TWI_FREQ_100K, \
|
||||
}; \
|
||||
return init_twi(dev, &config); \
|
||||
} \
|
||||
static struct i2c_nrfx_twi_data twi_##idx##_data = { \
|
||||
.sync = _K_SEM_INITIALIZER(twi_##idx##_data.sync, 0, 1) \
|
||||
}; \
|
||||
static const struct i2c_nrfx_twi_config twi_##idx##_config = { \
|
||||
.twi = NRFX_TWI_INSTANCE(idx) \
|
||||
}; \
|
||||
DEVICE_AND_API_INIT(twi_##idx, \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_LABEL, \
|
||||
twi_##idx##_init, \
|
||||
&twi_##idx##_data, \
|
||||
&twi_##idx##_config, \
|
||||
POST_KERNEL, \
|
||||
CONFIG_I2C_INIT_PRIORITY, \
|
||||
&i2c_nrfx_twi_driver_api)
|
||||
|
||||
#ifdef CONFIG_I2C_0_NRF_TWI
|
||||
|
|
|
@ -137,29 +137,32 @@ static int init_twim(struct device *dev, const nrfx_twim_config_t *config)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define I2C_NRFX_TWIM_DEVICE(idx) \
|
||||
static int twim_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_I2C_##idx##_IRQ, \
|
||||
DT_I2C_##idx##_IRQ_PRI, \
|
||||
nrfx_isr, nrfx_twim_##idx##_irq_handler, 0);\
|
||||
const nrfx_twim_config_t config = { \
|
||||
.scl = DT_I2C_##idx##_SCL_PIN, \
|
||||
.sda = DT_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = NRF_TWIM_FREQ_100K, \
|
||||
}; \
|
||||
return init_twim(dev, &config); \
|
||||
} \
|
||||
static struct i2c_nrfx_twim_data twim_##idx##_data = { \
|
||||
.sync = _K_SEM_INITIALIZER(twim_##idx##_data.sync, 0, 1)\
|
||||
}; \
|
||||
static const struct i2c_nrfx_twim_config twim_##idx##_config = {\
|
||||
.twim = NRFX_TWIM_INSTANCE(idx) \
|
||||
}; \
|
||||
DEVICE_AND_API_INIT(twim_##idx, CONFIG_I2C_##idx##_NAME, \
|
||||
twim_##idx##_init, &twim_##idx##_data, \
|
||||
&twim_##idx##_config, POST_KERNEL, \
|
||||
CONFIG_I2C_INIT_PRIORITY, \
|
||||
#define I2C_NRFX_TWIM_DEVICE(idx) \
|
||||
static int twim_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_NORDIC_NRF_I2C_I2C_##idx##_IRQ, \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_IRQ_PRIORITY, \
|
||||
nrfx_isr, nrfx_twim_##idx##_irq_handler, 0); \
|
||||
const nrfx_twim_config_t config = { \
|
||||
.scl = DT_NORDIC_NRF_I2C_I2C_##idx##_SCL_PIN, \
|
||||
.sda = DT_NORDIC_NRF_I2C_I2C_##idx##_SDA_PIN, \
|
||||
.frequency = NRF_TWIM_FREQ_100K, \
|
||||
}; \
|
||||
return init_twim(dev, &config); \
|
||||
} \
|
||||
static struct i2c_nrfx_twim_data twim_##idx##_data = { \
|
||||
.sync = _K_SEM_INITIALIZER(twim_##idx##_data.sync, 0, 1) \
|
||||
}; \
|
||||
static const struct i2c_nrfx_twim_config twim_##idx##_config = { \
|
||||
.twim = NRFX_TWIM_INSTANCE(idx) \
|
||||
}; \
|
||||
DEVICE_AND_API_INIT(twim_##idx, \
|
||||
DT_NORDIC_NRF_I2C_I2C_##idx##_LABEL, \
|
||||
twim_##idx##_init, \
|
||||
&twim_##idx##_data, \
|
||||
&twim_##idx##_config, \
|
||||
POST_KERNEL, \
|
||||
CONFIG_I2C_INIT_PRIORITY, \
|
||||
&i2c_nrfx_twim_driver_api)
|
||||
|
||||
#ifdef CONFIG_I2C_0_NRF_TWIM
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
compatible = "mmio-sram";
|
||||
};
|
||||
|
||||
aliases {
|
||||
i2c-0 = &i2c0;
|
||||
i2c-1 = &i2c1;
|
||||
};
|
||||
|
||||
soc {
|
||||
adc: adc@40007000 {
|
||||
compatible = "nordic,nrf-adc";
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
compatible = "mmio-sram";
|
||||
};
|
||||
|
||||
aliases {
|
||||
i2c-0 = &i2c0;
|
||||
};
|
||||
|
||||
soc {
|
||||
adc: adc@40007000 {
|
||||
compatible = "nordic,nrf-saadc";
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
compatible = "mmio-sram";
|
||||
};
|
||||
|
||||
aliases {
|
||||
i2c-0 = &i2c0;
|
||||
i2c-1 = &i2c1;
|
||||
};
|
||||
|
||||
soc {
|
||||
adc: adc@40007000 {
|
||||
compatible = "nordic,nrf-saadc";
|
||||
|
|
|
@ -36,6 +36,11 @@
|
|||
compatible = "mmio-sram";
|
||||
};
|
||||
|
||||
aliases {
|
||||
i2c-0 = &i2c0;
|
||||
i2c-1 = &i2c1;
|
||||
};
|
||||
|
||||
soc {
|
||||
adc: adc@40007000 {
|
||||
compatible = "nordic,nrf-saadc";
|
||||
|
|
|
@ -26,21 +26,8 @@
|
|||
#define DT_GPIOTE_IRQ_PRI DT_NORDIC_NRF_GPIOTE_40006000_IRQ_0_PRIORITY
|
||||
#define DT_GPIOTE_IRQ DT_NORDIC_NRF_GPIOTE_40006000_IRQ_0
|
||||
|
||||
#define DT_I2C_0_BASE_ADDR DT_NORDIC_NRF_I2C_40003000_BASE_ADDRESS
|
||||
#define CONFIG_I2C_0_NAME DT_NORDIC_NRF_I2C_40003000_LABEL
|
||||
#define DT_I2C_0_BITRATE DT_NORDIC_NRF_I2C_40003000_CLOCK_FREQUENCY
|
||||
#define DT_I2C_0_IRQ_PRI DT_NORDIC_NRF_I2C_40003000_IRQ_0_PRIORITY
|
||||
#define DT_I2C_0_IRQ DT_NORDIC_NRF_I2C_40003000_IRQ_0
|
||||
#define DT_I2C_0_SDA_PIN DT_NORDIC_NRF_I2C_40003000_SDA_PIN
|
||||
#define DT_I2C_0_SCL_PIN DT_NORDIC_NRF_I2C_40003000_SCL_PIN
|
||||
|
||||
#define DT_I2C_1_BASE_ADDR DT_NORDIC_NRF_I2C_40004000_BASE_ADDRESS
|
||||
#define CONFIG_I2C_1_NAME DT_NORDIC_NRF_I2C_40004000_LABEL
|
||||
#define DT_I2C_1_BITRATE DT_NORDIC_NRF_I2C_40004000_CLOCK_FREQUENCY
|
||||
#define DT_I2C_1_IRQ_PRI DT_NORDIC_NRF_I2C_40004000_IRQ_0_PRIORITY
|
||||
#define DT_I2C_1_IRQ DT_NORDIC_NRF_I2C_40004000_IRQ_0
|
||||
#define DT_I2C_1_SDA_PIN DT_NORDIC_NRF_I2C_40004000_SDA_PIN
|
||||
#define DT_I2C_1_SCL_PIN DT_NORDIC_NRF_I2C_40004000_SCL_PIN
|
||||
#define DT_I2C_0_NAME DT_NORDIC_NRF_I2C_I2C_0_LABEL
|
||||
#define DT_I2C_1_NAME DT_NORDIC_NRF_I2C_I2C_1_LABEL
|
||||
|
||||
#define DT_QDEC_BASE_ADDR DT_NORDIC_NRF_QDEC_40012000_BASE_ADDRESS
|
||||
#define DT_QDEC_NAME DT_NORDIC_NRF_QDEC_40012000_LABEL
|
||||
|
|
|
@ -59,21 +59,8 @@
|
|||
#define DT_GPIOTE_IRQ_PRI DT_NORDIC_NRF_GPIOTE_40006000_IRQ_0_PRIORITY
|
||||
#define DT_GPIOTE_IRQ DT_NORDIC_NRF_GPIOTE_40006000_IRQ_0
|
||||
|
||||
#define DT_I2C_0_BASE_ADDR DT_NORDIC_NRF_I2C_40003000_BASE_ADDRESS
|
||||
#define CONFIG_I2C_0_NAME DT_NORDIC_NRF_I2C_40003000_LABEL
|
||||
#define DT_I2C_0_BITRATE DT_NORDIC_NRF_I2C_40003000_CLOCK_FREQUENCY
|
||||
#define DT_I2C_0_IRQ_PRI DT_NORDIC_NRF_I2C_40003000_IRQ_0_PRIORITY
|
||||
#define DT_I2C_0_IRQ DT_NORDIC_NRF_I2C_40003000_IRQ_0
|
||||
#define DT_I2C_0_SDA_PIN DT_NORDIC_NRF_I2C_40003000_SDA_PIN
|
||||
#define DT_I2C_0_SCL_PIN DT_NORDIC_NRF_I2C_40003000_SCL_PIN
|
||||
|
||||
#define DT_I2C_1_BASE_ADDR DT_NORDIC_NRF_I2C_40004000_BASE_ADDRESS
|
||||
#define CONFIG_I2C_1_NAME DT_NORDIC_NRF_I2C_40004000_LABEL
|
||||
#define DT_I2C_1_BITRATE DT_NORDIC_NRF_I2C_40004000_CLOCK_FREQUENCY
|
||||
#define DT_I2C_1_IRQ_PRI DT_NORDIC_NRF_I2C_40004000_IRQ_0_PRIORITY
|
||||
#define DT_I2C_1_IRQ DT_NORDIC_NRF_I2C_40004000_IRQ_0
|
||||
#define DT_I2C_1_SDA_PIN DT_NORDIC_NRF_I2C_40004000_SDA_PIN
|
||||
#define DT_I2C_1_SCL_PIN DT_NORDIC_NRF_I2C_40004000_SCL_PIN
|
||||
#define DT_I2C_0_NAME DT_NORDIC_NRF_I2C_I2C_0_LABEL
|
||||
#define DT_I2C_1_NAME DT_NORDIC_NRF_I2C_I2C_1_LABEL
|
||||
|
||||
#define DT_QDEC_BASE_ADDR DT_NORDIC_NRF_QDEC_40012000_BASE_ADDRESS
|
||||
#define DT_QDEC_NAME DT_NORDIC_NRF_QDEC_40012000_LABEL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue