diff options
author | tim <tim2.lin@ite.corp-partner.google.com> | 2021-05-17 11:09:56 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-18 15:08:31 +0000 |
commit | 9d6b2fb5d861750b5de933327fe555af29f95ea2 (patch) | |
tree | c81377818d1f4431b47459bbf24278393ff20928 | |
parent | 6aabf0406bf3e848ee171d705963e8c3d18106ba (diff) | |
download | chrome-ec-9d6b2fb5d861750b5de933327fe555af29f95ea2.tar.gz |
zephyr: it8xxx2_evb: enable I2C driver
Enable the I2C driver and connect with I2C peripheral to
test writing and reading data.
BUG=b:185202623
BRANCH=none
TEST=shell:
"i2c scan I2C_0(I2C_1, I2C_2, I2C_4)"
"i2c write_byte I2C_0 0x52(slv) 0x10 0x20"
"i2c read_byte I2C_0 0x52(slv) 0x10"
Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com>
Change-Id: I112aa379ba6162d774e6cd861fb6f579bb859823
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2878764
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
4 files changed, 52 insertions, 2 deletions
diff --git a/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml b/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml index 49d9ee53c4..d16dedc954 100644 --- a/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml +++ b/zephyr/dts/bindings/i2c/cros-ec-i2c-port-base.yaml @@ -17,6 +17,9 @@ properties: - I2C_PORT_BATTERY - I2C_PORT_CHARGER - I2C_PORT_EEPROM + - I2C_PORT_EVB_1 + - I2C_PORT_EVB_2 + - I2C_PORT_OPT_4 - I2C_PORT_POWER - I2C_PORT_SENSOR - I2C_PORT_TCPC0 diff --git a/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts b/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts index f87376adce..e4f2e24b8e 100644 --- a/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts +++ b/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb.dts @@ -154,12 +154,57 @@ channel = <5>; }; }; + + named-i2c-ports { + compatible = "named-i2c-ports"; + + battery { + i2c-port = <&i2c2>; + enum-name = "I2C_PORT_BATTERY"; + label = "BATTERY"; + }; + evb-1 { + i2c-port = <&i2c0>; + enum-name = "I2C_PORT_EVB_1"; + label = "EVB_1"; + }; + evb-2 { + i2c-port = <&i2c1>; + enum-name = "I2C_PORT_EVB_2"; + label = "EVB_2"; + }; + opt-4 { + i2c-port = <&i2c4>; + enum-name = "I2C_PORT_OPT_4"; + label = "OPT_4"; + }; + }; }; &adc0 { status = "okay"; }; +&i2c0 { + status = "okay"; + clock-frequency = <I2C_BITRATE_STANDARD>; +}; + +&i2c1 { + status = "okay"; + clock-frequency = <I2C_BITRATE_STANDARD>; +}; + +&i2c2 { + status = "okay"; + clock-frequency = <I2C_BITRATE_STANDARD>; +}; + +&i2c4 { + status = "okay"; + clock-frequency = <I2C_BITRATE_STANDARD>; +}; + &uart1 { status = "okay"; current-speed = <115200>; diff --git a/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig b/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig index 1177eab7af..cde997421a 100644 --- a/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig +++ b/zephyr/projects/it8xxx2_evb/boards/riscv/it8xxx2_evb/it8xxx2_evb_defconfig @@ -33,7 +33,7 @@ CONFIG_CLOCK_CONTROL=y CONFIG_WATCHDOG=n # I2C Controller -CONFIG_I2C_ITE_IT8XXX2=n +CONFIG_I2C_ITE_IT8XXX2=y CONFIG_ITE_IT8XXX2_TIMER=y diff --git a/zephyr/projects/it8xxx2_evb/prj.conf b/zephyr/projects/it8xxx2_evb/prj.conf index b6e48ea9c6..f9da4185b5 100644 --- a/zephyr/projects/it8xxx2_evb/prj.conf +++ b/zephyr/projects/it8xxx2_evb/prj.conf @@ -13,6 +13,9 @@ CONFIG_AP_ARM_MTK_MT8192=y # ADC CONFIG_PLATFORM_EC_ADC=y +# I2C +CONFIG_PLATFORM_EC_I2C=y + # Flash CONFIG_PLATFORM_EC_FLASH_CROS=y @@ -28,7 +31,6 @@ CONFIG_LOG=y # TODO(b:185202623): bring these features up CONFIG_PLATFORM_EC_BACKLIGHT_LID=n CONFIG_PLATFORM_EC_BOARD_VERSION=n -CONFIG_PLATFORM_EC_I2C=n CONFIG_PLATFORM_EC_KEYBOARD=n CONFIG_PLATFORM_EC_SWITCH=n CONFIG_PLATFORM_EC_VBOOT=n |