Skip to content

Commit bd8880c

Browse files
committed
drivers/i2c: Add I2C driver of it51xxx
Implement the functions of I2C host and target. I2CM: supports nine hosts and each one able located at I2C interface 0~12. supports two 32 bytes dedicated FIFO mode for read and write. I2CS: supports three targets and each one able located at I2C interface 0~8. supports 16 bytes dedicated FIFO mode that only supports write or read mode and the maximum buffer size is 256 bytes. support non-FIFO write to shared FIFO read mode. The maximum shared FIFO size for read is 256 bytes. The APIs test include: i2c_write(), i2c_read(), i2c_burst_read(), i2c_burst_write(), i2c_write_read() Signed-off-by: Tim Lin <[email protected]>
1 parent 4d848eb commit bd8880c

File tree

13 files changed

+2405
-8
lines changed

13 files changed

+2405
-8
lines changed

boards/ite/it515xx_evb/it515xx_evb.dts

+9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
compatible = "ite,it515xx-evb";
1616

1717
aliases {
18+
i2c-0 = &i2c0;
1819
led0 = &led0;
1920
watchdog0 = &twd0;
2021
};
@@ -38,6 +39,14 @@
3839
};
3940
};
4041

42+
&i2c0 {
43+
status = "okay";
44+
clock-frequency = <I2C_BITRATE_STANDARD>;
45+
pinctrl-0 = <&i2c0_clk_gpf2_default
46+
&i2c0_data_gpf3_default>;
47+
pinctrl-names = "default";
48+
};
49+
4150
&uart1 {
4251
status = "okay";
4352
current-speed = <115200>;

boards/ite/it515xx_evb/it515xx_evb.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ ram: 128
88
supported:
99
- flash
1010
- gpio
11+
- i2c
1112
- pinctrl
1213
- pm
1314
- uart

drivers/i2c/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ zephyr_library_sources_ifdef(CONFIG_I2C_INFINEON_CAT1 i2c_ifx_cat1.c)
3838
zephyr_library_sources_ifdef(CONFIG_I2C_INFINEON_XMC4 i2c_ifx_xmc4.c)
3939
zephyr_library_sources_ifdef(CONFIG_I2C_IPROC i2c_bcm_iproc.c)
4040
zephyr_library_sources_ifdef(CONFIG_I2C_ITE_ENHANCE i2c_ite_enhance.c)
41+
zephyr_library_sources_ifdef(CONFIG_I2C_ITE_IT51XXX i2c_ite_it51xxx.c)
4142
zephyr_library_sources_ifdef(CONFIG_I2C_ITE_IT8XXX2 i2c_ite_it8xxx2.c)
4243
zephyr_library_sources_ifdef(CONFIG_I2C_LITEX i2c_litex.c)
4344
zephyr_library_sources_ifdef(CONFIG_I2C_LITEX_LITEI2C i2c_litex_litei2c.c)

drivers/i2c/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ source "drivers/i2c/Kconfig.gpio"
132132
source "drivers/i2c/Kconfig.i2c_emul"
133133
source "drivers/i2c/Kconfig.ifx_cat1"
134134
source "drivers/i2c/Kconfig.ifx_xmc4"
135+
source "drivers/i2c/Kconfig.it51xxx"
135136
source "drivers/i2c/Kconfig.it8xxx2"
136137
source "drivers/i2c/Kconfig.litex"
137138
source "drivers/i2c/Kconfig.lpc11u6x"

drivers/i2c/Kconfig.it51xxx

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2025 ITE Corporation. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config I2C_ITE_IT51XXX
5+
bool "ITE IT51XXX I2C driver"
6+
default y
7+
depends on DT_HAS_ITE_IT51XXX_I2C_ENABLED
8+
select PINCTRL
9+
select I2C_BITBANG
10+
help
11+
Enable I2C support on IT51XXX series.
12+
Supports nine hosts and three targets and each one able to located
13+
at I2C interface0~8.
14+
Three I2C targets on design A, B and C. Support 16 bytes dedicated
15+
FIFO mode for read/write.
16+
Supported Speeds: 50kHz, 100kHz, 400kHz and 1MHz.
17+
This driver supports repeated start.
18+
19+
if I2C_ITE_IT51XXX
20+
21+
config I2C_IT51XXX_FIFO_MODE
22+
bool "IT51XXX I2C FIFO mode"
23+
default y
24+
help
25+
This is an option to enable FIFO mode which can reduce the time
26+
between each byte to improve the I2C bus clock stretching during
27+
I2C transaction.
28+
The I2C controller supports two 32-bytes FIFOs,
29+
FIFO1 supports I2C 0, and FIFO2 supports other ports.
30+
I2C FIFO mode of IT51XXX can support I2C APIs including:
31+
i2c_write(), i2c_read(), i2c_burst_read.
32+
33+
endif # I2C_ITE_IT51XXX
34+
35+
if I2C_TARGET
36+
37+
config I2C_TARGET_IT51XXX_MAX_BUF_SIZE
38+
int "It is allowed to configure the dedicated FIFO size up to 256 bytes."
39+
default 256
40+
41+
config I2C_IT51XXX_MAX_SHARE_FIFO_SIZE
42+
int "It is allowed to configure the shared FIFO size up to 256 bytes."
43+
range 16 256
44+
default 256
45+
46+
config SOC_IT51XXX_CPU_IDLE_GATING
47+
default y
48+
help
49+
This option is used when the I2C target shared FIFO property is enabled.
50+
51+
endif # I2C_TARGET

0 commit comments

Comments
 (0)