diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-09-23 23:58:04 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-28 16:01:25 +0000 |
commit | 16c1d44caebe58dbd4af36b603a0c929764873a9 (patch) | |
tree | adaaa6e7fc04eebbd12a82d6e0bfba76239b6db1 /zephyr | |
parent | b7a4de94f6c425b9c642b71da4cdc569c3351bc2 (diff) | |
download | chrome-ec-16c1d44caebe58dbd4af36b603a0c929764873a9.tar.gz |
common/i2c: Implement i2cspeed console command
This adds the "i2cspeed port [speed]" console command. If only the port
number is given, then the current port bus speed is reported. With 2
arguments, the port bus speed is changed. Valid speeds are 100, 400,
1000 and the unit is kHz.
BRANCH=none
BUG=b:201039003
TEST=with follow-on patches, switched I2C bus speed between 400 kHz
and 1 MHz.
Change-Id: I7ca6b2c7a8fd9abe8e8ec77e4d1702529b297fe8
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3181504
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/Kconfig | 10 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 2f4a653fea..07f09ae46e 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -484,6 +484,16 @@ config PLATFORM_EC_CONSOLE_CMD_I2C_PORTMAP display the mapping of the I2C ports defined by the named-i2c-ports node to the physical port and remote port indexes. +config PLATFORM_EC_CONSOLE_CMD_I2C_SPEED + bool "Console command: i2cspeed" + default n + depends on PLATFORM_EC_I2C + help + Enable the 'i2cspeed' console command. This comamnd is used to + display an I2C port's bus speed. Additionally, for ports with + the DYNAMIC_SPEED port flag set, the speed can be set. In all + cases, the bus speed is in units of kHz. + config PLATFORM_EC_SMBUS_PEC bool "Packet error checking support for SMBus" help diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index a19a2e1775..04d2ca1d5d 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -169,6 +169,11 @@ #define CONFIG_I2C_PASSTHRU_RESTRICTED #endif +#undef CONFIG_CMD_I2C_SPEED +#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_I2C_SPEED +#define CONFIG_CMD_I2C_SPEED +#endif + #undef CONFIG_BATTERY_PRESENT_CUSTOM #ifdef CONFIG_PLATFORM_EC_BATTERY_PRESENT_CUSTOM #define CONFIG_BATTERY_PRESENT_CUSTOM |