summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/glados_pd/board.h1
-rw-r--r--board/oak_pd/board.h1
-rw-r--r--common/build.mk2
-rw-r--r--common/host_command.c2
-rw-r--r--common/system.c2
-rw-r--r--include/config.h3
-rw-r--r--test/stress.c4
7 files changed, 11 insertions, 4 deletions
diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h
index 508594839c..0713997921 100644
--- a/board/glados_pd/board.h
+++ b/board/glados_pd/board.h
@@ -40,6 +40,7 @@
#undef CONFIG_HOSTCMD_EVENTS
#define CONFIG_HW_CRC
#define CONFIG_I2C
+#define CONFIG_I2C_SLAVE_ONLY
#undef CONFIG_LID_SWITCH
#define CONFIG_LOW_POWER_IDLE
#define CONFIG_STM_HWTIMER32
diff --git a/board/oak_pd/board.h b/board/oak_pd/board.h
index e793c3d434..d0f88b5ae2 100644
--- a/board/oak_pd/board.h
+++ b/board/oak_pd/board.h
@@ -49,6 +49,7 @@
#undef CONFIG_HOSTCMD_EVENTS
#define CONFIG_HW_CRC
#define CONFIG_I2C
+#define CONFIG_I2C_SLAVE_ONLY
#undef CONFIG_LID_SWITCH
#define CONFIG_LOW_POWER_IDLE
#define CONFIG_STM_HWTIMER32
diff --git a/common/build.mk b/common/build.mk
index 2a44c5124b..c61c118c4d 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -45,7 +45,9 @@ common-$(CONFIG_FMAP)+=fmap.o
common-$(CONFIG_GESTURE_SW_DETECTION)+=gesture.o
common-$(CONFIG_HOSTCMD_EVENTS)+=host_event_commands.o
common-$(CONFIG_HOSTCMD_PD)+=host_command_master.o
+ifndef CONFIG_I2C_SLAVE_ONLY
common-$(CONFIG_I2C)+=i2c.o
+endif
common-$(CONFIG_INDUCTIVE_CHARGING)+=inductive_charging.o
common-$(CONFIG_KEYBOARD_PROTOCOL_8042)+=keyboard_8042.o \
keyboard_8042_sharedlib.o
diff --git a/common/host_command.c b/common/host_command.c
index 387f0d03a2..b57d41c17b 100644
--- a/common/host_command.c
+++ b/common/host_command.c
@@ -720,7 +720,7 @@ static int host_command_get_features(struct host_cmd_handler_args *args)
#ifdef CONFIG_COMMON_GPIO
| EC_FEATURE_MASK_0(EC_FEATURE_GPIO)
#endif
-#ifdef CONFIG_I2C
+#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY)
| EC_FEATURE_MASK_0(EC_FEATURE_I2C)
#endif
#ifdef CONFIG_CHARGER
diff --git a/common/system.c b/common/system.c
index 7f5a5ee5b4..851836effb 100644
--- a/common/system.c
+++ b/common/system.c
@@ -444,7 +444,7 @@ static void jump_to_image(uintptr_t init_addr)
pd_prepare_reset();
#endif
-#ifdef CONFIG_I2C
+#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY)
/* Prepare I2C module for sysjump */
i2c_prepare_sysjump();
#endif
diff --git a/include/config.h b/include/config.h
index 1e017fe028..74d7ebf264 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1043,6 +1043,9 @@
#undef CONFIG_I2C_PASSTHROUGH
#undef CONFIG_I2C_PASSTHRU_RESTRICTED
+/* For EC that is only an I2C slave */
+#undef CONFIG_I2C_SLAVE_ONLY
+
/* Defines I2C operation retry count when slave nack'd(EC_ERROR_BUSY) */
#define CONFIG_I2C_NACK_RETRY_COUNT 0
/*
diff --git a/test/stress.c b/test/stress.c
index 5e31d4e466..72c5b75ced 100644
--- a/test/stress.c
+++ b/test/stress.c
@@ -78,7 +78,7 @@ static int stress(const char *name,
/*****************************************************************************/
/* Tests */
-#ifdef CONFIG_I2C
+#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY)
static int test_i2c(void)
{
int res = EC_ERROR_UNKNOWN;
@@ -135,7 +135,7 @@ void run_test(void)
{
test_reset();
-#ifdef CONFIG_I2C
+#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY)
RUN_STRESS_TEST("I2C Stress Test", test_i2c, I2C_TEST_ITERATION);
#endif
#ifdef CONFIG_ADC