The I2C shell allows a user to input "i2c scan i2c0" for instance, to
scan addresses on the i2c0 bus enabled in DT. This currently causes
an infinite loop when CONFIG_I2C_MAX32_INTERRUPT is enabled.
The infinite loops happens because 0-length transactions
(tx_len == rx_len == 0) not being handled both by the Async
i2c_max32_transfer and by the controller ISR.
This commit makes two changes:
1) [ISR] When an address ACK is received, if there is simply no data to
send or receive, then just give up the semaphore, preventing the
i2c_max32_transfer function from waiting infinitely.
2) [i2c_max32_transfer] After getting the semaphore back, if there is no
data to send or receive, then avoid waiting for the BUSY flag to clear
since clock stretching should not occur by definition for transactions
which merely contain an address ACK.
Signed-off-by: Brandon Hurst <brandon.hurst@analog.com>
Send STOP or RESTART after a message only if they are enabled in message
flags. For reads, however, controller sends a NACK after last byte so a
restart is required even if I2C_MSG_RESTART flag is not set.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
Use the RTIO work queue to fake the i2c submit calls for drivers which
haven't yet implemented the API. Applications can change the size of
the work queue pool depending on how much traffic they have on the buses.
Signed-off-by: Yuval Peress <peress@google.com>
MAX32 I2C peripheral can benefit from DMA transfers. This patch adds
DMA support for transactions made in controller mode.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>