ITE: drivers/i2c: Channel C/i2c2 cannot use FIFO mode

Sometimes, channel C may write wrong register to the target device.
This issue occurs when FIFO2 is enabled on channel C. The problem
arises because FIFO2 is shared between channel B and channel C.
FIFO2 will be disabled when data access is completed, at which point
FIFO2 is set to the default configuration for channel B.
The byte counter of FIFO2 may be affected by channel B. There is a
chance that channel C may encounter wrong register being written due
to the FIFO2 byte counter wrong write after channel B's write operation.

The current workaround is that channel C cannot use FIFO mode.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
This commit is contained in:
Tim Lin 2023-07-24 17:54:01 +08:00 committed by Carles Cufí
parent 9023a8e14f
commit 159fa4888b
4 changed files with 17 additions and 8 deletions

View file

@ -19,8 +19,8 @@ config I2C_IT8XXX2_FIFO_MODE
This is an option to enable FIFO mode which can reduce This is an option to enable FIFO mode which can reduce
the time between each byte to improve the I2C bus clock the time between each byte to improve the I2C bus clock
stretching during I2C transaction. stretching during I2C transaction.
The I2C controller supports two 32-bytes FIFOs, FIFO2 The I2C controller supports two 32-bytes FIFOs,
only supports one channel of B or C. FIFO1 supports channel A. FIFO2 supports channel B.
I2C FIFO mode of it8xxx2 can support I2C APIs including: I2C FIFO mode of it8xxx2 can support I2C APIs including:
i2c_write(), i2c_read(), i2c_burst_read. i2c_write(), i2c_read(), i2c_burst_read.

View file

@ -1232,9 +1232,18 @@ static const struct i2c_driver_api i2c_it8xxx2_driver_api = {
}; };
#ifdef CONFIG_I2C_IT8XXX2_FIFO_MODE #ifdef CONFIG_I2C_IT8XXX2_FIFO_MODE
BUILD_ASSERT(!((DT_INST_PROP(SMB_CHANNEL_B, fifo_enable) == true) && /*
(DT_INST_PROP(SMB_CHANNEL_C, fifo_enable) == true)), * Sometimes, channel C may write wrong register to the target device.
"Channel B and C cannot support FIFO mode at the same time."); * This issue occurs when FIFO2 is enabled on channel C. The problem
* arises because FIFO2 is shared between channel B and channel C.
* FIFO2 will be disabled when data access is completed, at which point
* FIFO2 is set to the default configuration for channel B.
* The byte counter of FIFO2 may be affected by channel B. There is a chance
* that channel C may encounter wrong register being written due to FIFO2
* byte counter wrong write after channel B's write operation.
*/
BUILD_ASSERT((DT_INST_PROP(SMB_CHANNEL_C, fifo_enable) == false),
"Channel C cannot use FIFO mode.");
#endif #endif
#define I2C_ITE_IT8XXX2_INIT(inst) \ #define I2C_ITE_IT8XXX2_INIT(inst) \

View file

@ -12,4 +12,4 @@ properties:
type: boolean type: boolean
description: | description: |
FIFO1 supports channel A. FIFO1 supports channel A.
FIFO2 only supports one channel of B or C. FIFO2 supports channel B.

View file

@ -362,7 +362,7 @@
scl-gpios = <&gpioc 1 0>; scl-gpios = <&gpioc 1 0>;
sda-gpios = <&gpioc 2 0>; sda-gpios = <&gpioc 2 0>;
clock-gate-offset = <CGC_OFFSET_SMBB>; clock-gate-offset = <CGC_OFFSET_SMBB>;
/delete-property/ fifo-enable; /* FIFO2 */ fifo-enable; /* FIFO2 */
}; };
i2c2: i2c@f01cc0 { i2c2: i2c@f01cc0 {
@ -378,7 +378,7 @@
scl-gpios = <&gpiof 6 0>; scl-gpios = <&gpiof 6 0>;
sda-gpios = <&gpiof 7 0>; sda-gpios = <&gpiof 7 0>;
clock-gate-offset = <CGC_OFFSET_SMBC>; clock-gate-offset = <CGC_OFFSET_SMBC>;
fifo-enable; /* FIFO2 */ /delete-property/ fifo-enable; /* FIFO2 */
}; };
i2c3: i2c@f03680 { i2c3: i2c@f03680 {