Skip to content

Commit 9de258c

Browse files
Burakbabaofabiobaltieri
authored andcommitted
drivers: i2c: Update driver to enable I2C for MAX32650 SoC
This commit adds new wrapper functions into driver to handle differences of MAX32650 SoC. Signed-off-by: Burak Babaoglu <burak.babaoglu@analog.com>
1 parent ccc26a5 commit 9de258c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

drivers/i2c/i2c_max32.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
#define ADI_MAX32_I2C_INT_FL0_MASK 0x00FFFFFF
2222
#define ADI_MAX32_I2C_INT_FL1_MASK 0x7
2323

24-
#define ADI_MAX32_I2C_STATUS_MASTER_BUSY BIT(5)
25-
2624
#define I2C_RECOVER_MAX_RETRIES 3
2725

2826
#ifdef CONFIG_I2C_MAX32_DMA
@@ -540,8 +538,7 @@ static int i2c_max32_transfer(const struct device *dev, struct i2c_msg *msgs, ui
540538
/* Wait for busy flag to be cleared for clock stetching
541539
* use-cases
542540
*/
543-
while (i2c->status & ADI_MAX32_I2C_STATUS_MASTER_BUSY) {
544-
}
541+
Wrap_MXC_I2C_WaitForBusyClear(i2c);
545542
MXC_I2C_ClearFlags(i2c, ADI_MAX32_I2C_INT_FL0_MASK,
546543
ADI_MAX32_I2C_INT_FL1_MASK);
547544
}
@@ -650,7 +647,7 @@ static void i2c_max32_isr_target(const struct device *dev, mxc_i2c_regs_t *i2c)
650647
uint32_t int_en0;
651648
uint32_t int_en1;
652649

653-
ctrl = i2c->ctrl;
650+
Wrap_MXC_I2C_GetCtrl(i2c, &ctrl);
654651
Wrap_MXC_I2C_GetIntEn(i2c, &int_en0, &int_en1);
655652
MXC_I2C_GetFlags(i2c, &int_fl0, &int_fl1);
656653
MXC_I2C_ClearFlags(i2c, ADI_MAX32_I2C_INT_FL0_MASK, ADI_MAX32_I2C_INT_FL1_MASK);
@@ -710,7 +707,7 @@ static void i2c_max32_isr_target(const struct device *dev, mxc_i2c_regs_t *i2c)
710707
if (int_en0 & ADI_MAX32_I2C_INT_EN0_ADDR_MATCH) {
711708
if (int_fl0 & ADI_MAX32_I2C_INT_FL0_ADDR_MATCH) {
712709
/* Address match occurred, prepare for transaction */
713-
if (i2c->ctrl & MXC_F_I2C_CTRL_READ) {
710+
if (Wrap_MXC_I2C_GetReadWriteBitStatus(i2c)) {
714711
/* Read request received from the master */
715712
i2c_max32_target_callback(dev, i2c, MXC_I2C_EVT_MASTER_RD);
716713
int_en0 = ADI_MAX32_I2C_INT_EN0_TX_THD |

0 commit comments

Comments
 (0)