drivers: i2c: i2c_rv32m1_lpi2c: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per instance Kconfig symbol usage. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
977cd7b588
commit
376c5a4e4f
|
@ -53,16 +53,6 @@ config UART_RV32M1_LPUART
|
|||
default y
|
||||
depends on SERIAL
|
||||
|
||||
if I2C
|
||||
|
||||
config I2C_0
|
||||
default y
|
||||
|
||||
config I2C_3
|
||||
default y if RV32M1_INTMUX
|
||||
|
||||
endif # I2C
|
||||
|
||||
if SPI
|
||||
|
||||
config SPI_0
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define DT_DRV_COMPAT openisa_rv32m1_lpi2c
|
||||
|
||||
#include <drivers/i2c.h>
|
||||
#include <drivers/clock_control.h>
|
||||
#include <fsl_lpi2c.h>
|
||||
|
@ -263,15 +265,13 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = {
|
|||
static void rv32m1_lpi2c_irq_config_func_##id(struct device *dev); \
|
||||
static const struct rv32m1_lpi2c_config rv32m1_lpi2c_##id##_config = { \
|
||||
.base = \
|
||||
(LPI2C_Type *)DT_OPENISA_RV32M1_LPI2C_I2C_##id##_BASE_ADDRESS, \
|
||||
.clock_controller = \
|
||||
DT_OPENISA_RV32M1_LPI2C_I2C_##id##_CLOCK_CONTROLLER, \
|
||||
(LPI2C_Type *)DT_INST_REG_ADDR(id), \
|
||||
.clock_controller = DT_INST_CLOCKS_LABEL(id), \
|
||||
.clock_subsys = \
|
||||
(clock_control_subsys_t) \
|
||||
DT_OPENISA_RV32M1_LPI2C_I2C_##id##_CLOCK_NAME, \
|
||||
.clock_ip_name = kCLOCK_Lpi2c##id, \
|
||||
(clock_control_subsys_t) DT_INST_CLOCKS_CELL(id, name),\
|
||||
.clock_ip_name = INST_DT_CLOCK_IP_NAME(id), \
|
||||
.clock_ip_src = kCLOCK_IpSrcFircAsync, \
|
||||
.bitrate = DT_OPENISA_RV32M1_LPI2C_I2C_##id##_CLOCK_FREQUENCY, \
|
||||
.bitrate = DT_INST_PROP(id, clock_frequency), \
|
||||
.irq_config_func = rv32m1_lpi2c_irq_config_func_##id, \
|
||||
}; \
|
||||
static struct rv32m1_lpi2c_data rv32m1_lpi2c_##id##_data = { \
|
||||
|
@ -281,7 +281,7 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = {
|
|||
rv32m1_lpi2c_##id##_data.completion_sync, 0, 1), \
|
||||
}; \
|
||||
DEVICE_AND_API_INIT(rv32m1_lpi2c_##id, \
|
||||
DT_OPENISA_RV32M1_LPI2C_I2C_##id##_LABEL, \
|
||||
DT_INST_LABEL(id), \
|
||||
&rv32m1_lpi2c_init, \
|
||||
&rv32m1_lpi2c_##id##_data, \
|
||||
&rv32m1_lpi2c_##id##_config, \
|
||||
|
@ -289,25 +289,11 @@ static const struct i2c_driver_api rv32m1_lpi2c_driver_api = {
|
|||
&rv32m1_lpi2c_driver_api); \
|
||||
static void rv32m1_lpi2c_irq_config_func_##id(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_OPENISA_RV32M1_LPI2C_I2C_##id##_IRQ_0, \
|
||||
IRQ_CONNECT(DT_INST_IRQN(id), \
|
||||
0, \
|
||||
rv32m1_lpi2c_isr, DEVICE_GET(rv32m1_lpi2c_##id), \
|
||||
0); \
|
||||
irq_enable(DT_OPENISA_RV32M1_LPI2C_I2C_##id##_IRQ_0); \
|
||||
irq_enable(DT_INST_IRQN(id)); \
|
||||
} \
|
||||
|
||||
#ifdef CONFIG_I2C_0
|
||||
RV32M1_LPI2C_DEVICE(0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_1
|
||||
RV32M1_LPI2C_DEVICE(1)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_2
|
||||
RV32M1_LPI2C_DEVICE(2)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_I2C_3
|
||||
RV32M1_LPI2C_DEVICE(3)
|
||||
#endif
|
||||
DT_INST_FOREACH(RV32M1_LPI2C_DEVICE)
|
||||
|
|
Loading…
Reference in a new issue