Skip to content

Commit 797772f

Browse files
ubiedakartben
authored andcommitted
drivers: i2c_rtio: Use flexcomm interface to manage interrupts
Some NXP SoC's have a FlexComm interface that manages the interrupts. Applying 482e39ea9556f53adbb7f67d0d0da3d17bbbae90 on RTIO-version. Authored-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com> Signed-off-by: Luis Ubieda <luisf@croxel.com>
1 parent 0f0bb7e commit 797772f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/i2c/i2c_mcux_lpi2c_rtio.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,19 @@ static DEVICE_API(i2c, mcux_lpi2c_driver_api) = {
350350
#define I2C_MCUX_LPI2C_SDA_INIT(n)
351351
#endif /* CONFIG_I2C_MCUX_LPI2C_BUS_RECOVERY */
352352

353+
#define I2C_MCUX_LPI2C_MODULE_IRQ_CONNECT(n) \
354+
do { \
355+
IRQ_CONNECT(DT_INST_IRQN(n), \
356+
DT_INST_IRQ(n, priority), \
357+
mcux_lpi2c_isr, \
358+
DEVICE_DT_INST_GET(n), 0); \
359+
irq_enable(DT_INST_IRQN(n)); \
360+
} while (false)
361+
362+
#define I2C_MCUX_LPI2C_MODULE_IRQ(n) \
363+
IF_ENABLED(DT_INST_IRQ_HAS_IDX(n, 0), \
364+
(I2C_MCUX_LPI2C_MODULE_IRQ_CONNECT(n)))
365+
353366
#define I2C_MCUX_LPI2C_INIT(n) \
354367
PINCTRL_DT_INST_DEFINE(n); \
355368
\
@@ -386,12 +399,7 @@ static DEVICE_API(i2c, mcux_lpi2c_driver_api) = {
386399
\
387400
static void mcux_lpi2c_config_func_##n(const struct device *dev)\
388401
{ \
389-
IRQ_CONNECT(DT_INST_IRQN(n), \
390-
DT_INST_IRQ(n, priority), \
391-
mcux_lpi2c_isr, \
392-
DEVICE_DT_INST_GET(n), 0); \
393-
\
394-
irq_enable(DT_INST_IRQN(n)); \
402+
I2C_MCUX_LPI2C_MODULE_IRQ(n); \
395403
}
396404

397405
DT_INST_FOREACH_STATUS_OKAY(I2C_MCUX_LPI2C_INIT)

0 commit comments

Comments
 (0)