diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2015-08-03 23:37:54 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-23 15:10:08 -0700 |
commit | f9272713da615e51ea14f70872fec46fbd88e938 (patch) | |
tree | 7b12c57a3435a615718c9d3325dfc0671fc297b6 /board | |
parent | 806aae81f6bed5ab1a26e860eaa2b5b1349a1444 (diff) | |
download | chrome-ec-f9272713da615e51ea14f70872fec46fbd88e938.tar.gz |
i2c: Add i2ctest console command
Added i2ctest console command to test the reliability of the I2C.
By reading/writing to the known registers this tests provides the
number of successful read and writes.
BUG=chrome-os-partner:57487
TEST=Enabled the i2ctest config on Reef and tested the
i2c read/writes.
BRANCH=none
Change-Id: I9e27ff96f2b85422933bc590d112a083990e2dfb
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/290427
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/reef/board.c | 63 | ||||
-rw-r--r-- | board/reef/board.h | 8 |
2 files changed, 71 insertions, 0 deletions
diff --git a/board/reef/board.c b/board/reef/board.c index 5b7a1f3936..bde169f3df 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -143,6 +143,69 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); +#ifdef CONFIG_CMD_I2C_STRESS_TEST +struct i2c_stress_test i2c_stress_tests[] = { +/* NPCX_I2C_PORT0_0 */ +#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC + { + .port = NPCX_I2C_PORT0_0, + .addr = 0x50, + .i2c_test = &anx74xx_i2c_stress_test_dev, + }, +#endif + +/* NPCX_I2C_PORT0_1 */ +#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC + { + .port = NPCX_I2C_PORT0_1, + .addr = 0x16, + .i2c_test = &ps8751_i2c_stress_test_dev, + }, +#endif + +/* NPCX_I2C_PORT1 */ +#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL + { + .port = I2C_PORT_GYRO, + .addr = BMI160_ADDR0, + .i2c_test = &bmi160_i2c_stress_test_dev, + }, +#endif + +/* NPCX_I2C_PORT2 */ +#ifdef CONFIG_CMD_I2C_STRESS_TEST_ACCEL + { + .port = I2C_PORT_BARO, + .addr = BMP280_I2C_ADDRESS1, + .i2c_test = &bmp280_i2c_stress_test_dev, + }, + { + .port = I2C_PORT_LID_ACCEL, + .addr = KX022_ADDR1, + .i2c_test = &kionix_i2c_stress_test_dev, + }, +#endif +#ifdef CONFIG_CMD_I2C_STRESS_TEST_ALS + { + .i2c_test = &opt3001_i2c_stress_test_dev, + }, +#endif + +/* NPCX_I2C_PORT3 */ +#ifdef CONFIG_CMD_I2C_STRESS_TEST_BATTERY + { + .i2c_test = &battery_i2c_stress_test_dev, + }, +#endif +#ifdef CONFIG_CMD_I2C_STRESS_TEST_CHARGER + { + .i2c_test = &bd9995x_i2c_stress_test_dev, + }, +#endif +}; +const int i2c_test_dev_used = ARRAY_SIZE(i2c_stress_tests); +#endif /* CONFIG_CMD_I2C_STRESS_TEST */ + const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { #if IS_PROTO == 1 {NPCX_I2C_PORT0_0, 0x50, &anx74xx_tcpm_drv, TCPC_ALERT_ACTIVE_HIGH}, diff --git a/board/reef/board.h b/board/reef/board.h index 8ed35be00b..c4013270ef 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -38,7 +38,15 @@ #define BD9995X_PSYS_GAIN_SELECT \ BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW +#define CONFIG_CMD_I2C_STRESS_TEST +#define CONFIG_CMD_I2C_STRESS_TEST_ACCEL +#define CONFIG_CMD_I2C_STRESS_TEST_ALS +#define CONFIG_CMD_I2C_STRESS_TEST_BATTERY +#define CONFIG_CMD_I2C_STRESS_TEST_CHARGER +#define CONFIG_CMD_I2C_STRESS_TEST_TCPC + /* Battery */ +#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION" #define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_PRESENT_CUSTOM #define CONFIG_BATTERY_REVIVE_DISCONNECT |