Skip to content

Commit a55ebe1

Browse files
RafaelLayanashif
authored andcommitted
drivers: Fixes Controller Mode for I2C DW Driver
4996a9b adds Target Support for the Designware I2C Driver But the change missed guarding some places with CONFIG_I2C_TARGET This commit fixes regressions caused by such change Signed-off-by: Rafael Laya <[email protected]>
1 parent 35fc91c commit a55ebe1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/i2c/i2c_dw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ static inline void i2c_dw_data_ask(const struct device *dev)
252252
data |= IC_DATA_CMD_STOP;
253253
}
254254

255+
#ifdef CONFIG_I2C_TARGET
255256
clear_bit_intr_mask_tx_empty(reg_base);
257+
#endif /* CONFIG_I2C_TARGET */
256258

257259
write_cmd_data(data, reg_base);
258260

@@ -413,6 +415,7 @@ static void i2c_dw_isr(const struct device *port)
413415
i2c_dw_data_read(port);
414416
}
415417

418+
#ifdef CONFIG_I2C_TARGET
416419
/* Check if the TX FIFO is ready for commands.
417420
* TX FIFO also serves as command queue where read requests
418421
* are written to TX FIFO.
@@ -421,6 +424,7 @@ static void i2c_dw_isr(const struct device *port)
421424
== I2C_MSG_READ) {
422425
set_bit_intr_mask_tx_empty(reg_base);
423426
}
427+
#endif /* CONFIG_I2C_TARGET */
424428

425429
if (intr_stat.bits.tx_empty) {
426430
if ((dw->xfr_flags & I2C_MSG_RW_MASK)

0 commit comments

Comments
 (0)