diff options
39 files changed, 55 insertions, 15 deletions
diff --git a/board/auron/board.h b/board/auron/board.h index 647de67ff2..fbe1c4d1e8 100644 --- a/board/auron/board.h +++ b/board/auron/board.h @@ -22,6 +22,8 @@ #define CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_CHIPSET_HASWELL +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_POWER_COMMON #define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 #define CONFIG_CMD_GSV diff --git a/board/bds/board.h b/board/bds/board.h index e4b48c55de..1d9b454769 100644 --- a/board/bds/board.h +++ b/board/bds/board.h @@ -10,6 +10,8 @@ /* Optional features */ #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */ +#define CONFIG_I2C +#define CONFIG_I2C_MASTER /* LM4 modules we don't use on link but still want to keep compiling */ #define CONFIG_EEPROM diff --git a/board/big/board.h b/board/big/board.h index 9f0f398e8b..aac61e1196 100644 --- a/board/big/board.h +++ b/board/big/board.h @@ -20,6 +20,7 @@ #define CONFIG_EXTPOWER_GPIO #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_SPI #define CONFIG_SPI_PROTOCOL_V2 diff --git a/board/chell/board.h b/board/chell/board.h index 752ac7278a..26edf1b1b6 100644 --- a/board/chell/board.h +++ b/board/chell/board.h @@ -33,6 +33,7 @@ #define CONFIG_EXTPOWER_GPIO #define CONFIG_HOSTCMD_PD #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_LED_COMMON diff --git a/board/glados/board.h b/board/glados/board.h index d783741c0d..e44d0dd96a 100644 --- a/board/glados/board.h +++ b/board/glados/board.h @@ -40,6 +40,7 @@ #define CONFIG_HOSTCMD_PD #define CONFIG_HOSTCMD_PD_PANIC #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_LED_COMMON #define CONFIG_LID_ANGLE diff --git a/board/glados_pd/board.h b/board/glados_pd/board.h index e24aeef4ed..e87ef45e82 100644 --- a/board/glados_pd/board.h +++ b/board/glados_pd/board.h @@ -49,7 +49,7 @@ #undef CONFIG_HOSTCMD_EVENTS #define CONFIG_HW_CRC #define CONFIG_I2C -#define CONFIG_I2C_SLAVE_ONLY +#define CONFIG_I2C_SLAVE #undef CONFIG_LID_SWITCH #define CONFIG_LOW_POWER_IDLE #define CONFIG_LTO diff --git a/board/hadoken/board.h b/board/hadoken/board.h index ac61bc67b8..cd9784d98a 100644 --- a/board/hadoken/board.h +++ b/board/hadoken/board.h @@ -16,6 +16,7 @@ #undef CONFIG_LID_SWITCH #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_I2C_DEBUG /* diff --git a/board/honeybuns/board.h b/board/honeybuns/board.h index 2e23e93b4b..cb84dbfeb3 100644 --- a/board/honeybuns/board.h +++ b/board/honeybuns/board.h @@ -19,6 +19,7 @@ #define CONFIG_BOARD_PRE_INIT #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_I2C_MASTER #undef CONFIG_LID_SWITCH #define CONFIG_SHA256 #define CONFIG_STM_HWTIMER32 diff --git a/board/it8380dev/board.h b/board/it8380dev/board.h index 3a34ad2792..0a1cc35caf 100644 --- a/board/it8380dev/board.h +++ b/board/it8380dev/board.h @@ -13,6 +13,8 @@ #define CONFIG_BATTERY_SMART #define CONFIG_FANS 1 +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_IT83XX_KEYBOARD_KSI_WUC_INT #define CONFIG_IT83XX_LPC_ACCESS_INT #define CONFIG_IT83XX_PECI_WITH_INTERRUPT diff --git a/board/jerry/board.h b/board/jerry/board.h index ffea9cc738..24c77b5fca 100644 --- a/board/jerry/board.h +++ b/board/jerry/board.h @@ -22,6 +22,7 @@ #define CONFIG_FORCE_CONSOLE_RESUME #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_I2C_VIRTUAL_BATTERY #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_MKBP diff --git a/board/kunimitsu/board.h b/board/kunimitsu/board.h index 0aa7edfcc0..a58fed90b1 100644 --- a/board/kunimitsu/board.h +++ b/board/kunimitsu/board.h @@ -61,6 +61,7 @@ #endif #define CONFIG_HOSTCMD_PD #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_COL2_INVERTED #undef CONFIG_KEYBOARD_KSO_BASE #define CONFIG_KEYBOARD_KSO_BASE 0 /* KSO starts from KSO04 */ diff --git a/board/lars/board.h b/board/lars/board.h index 95f72d5901..7fb5d1fa80 100644 --- a/board/lars/board.h +++ b/board/lars/board.h @@ -47,6 +47,7 @@ #define CONFIG_HOSTCMD_PD #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_COL2_INVERTED #undef CONFIG_KEYBOARD_KSO_BASE #define CONFIG_KEYBOARD_KSO_BASE 0 /* KSO starts from KSO04 */ diff --git a/board/llama/board.h b/board/llama/board.h index ecc845d4b8..4a6503b851 100644 --- a/board/llama/board.h +++ b/board/llama/board.h @@ -21,6 +21,7 @@ #define CONFIG_FORCE_CONSOLE_RESUME #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_LED_COMMON diff --git a/board/lucid/board.h b/board/lucid/board.h index 887cfe43ee..8062b57e7f 100644 --- a/board/lucid/board.h +++ b/board/lucid/board.h @@ -39,6 +39,8 @@ #define CONFIG_HIBERNATE_WAKEUP_PINS (STM32_PWR_CSR_EWUP2) #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_I2C_MASTER +#define CONFIG_I2C_SLAVE #undef CONFIG_LID_SWITCH #define CONFIG_LOW_POWER_IDLE #define CONFIG_STM_HWTIMER32 diff --git a/board/mec1322_evb/board.h b/board/mec1322_evb/board.h index 58858de785..639c41a180 100644 --- a/board/mec1322_evb/board.h +++ b/board/mec1322_evb/board.h @@ -14,6 +14,8 @@ #define CONFIG_FANS 1 #define CONFIG_ADC #define CONFIG_FLASH_SIZE 0x00800000 +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_SPI_FLASH_W25Q64 #define CONFIG_SPI_FLASH_PORT 0 diff --git a/board/npcx_evb/board.h b/board/npcx_evb/board.h index 316ca3ede7..f6386c82c5 100644 --- a/board/npcx_evb/board.h +++ b/board/npcx_evb/board.h @@ -20,6 +20,8 @@ #define CONFIG_SPI_FLASH #define CONFIG_FLASH_SIZE 0x00800000 /* 8MB spi flash */ #define CONFIG_SPI_FLASH_W25Q64 +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_POWER_BUTTON diff --git a/board/npcx_evb_arm/board.h b/board/npcx_evb_arm/board.h index b455f40473..4678d86224 100644 --- a/board/npcx_evb_arm/board.h +++ b/board/npcx_evb_arm/board.h @@ -17,6 +17,8 @@ #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */ #define CONFIG_FLASH_SIZE 0x00800000 /* 8MB spi flash */ #define CONFIG_SPI_FLASH_W25Q64 +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_MKBP /* Instead of 8042 protocol of keyboard */ #define CONFIG_POWER_BUTTON diff --git a/board/oak/board.h b/board/oak/board.h index 3d5711494c..73a979a94c 100644 --- a/board/oak/board.h +++ b/board/oak/board.h @@ -51,6 +51,7 @@ #define CONFIG_HOSTCMD_PD #define CONFIG_HOSTCMD_PD_PANIC #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_LED_COMMON diff --git a/board/oak_pd/board.h b/board/oak_pd/board.h index f1ad61ea46..bc5894ac14 100644 --- a/board/oak_pd/board.h +++ b/board/oak_pd/board.h @@ -51,7 +51,7 @@ #undef CONFIG_HOSTCMD_EVENTS #define CONFIG_HW_CRC #define CONFIG_I2C -#define CONFIG_I2C_SLAVE_ONLY +#define CONFIG_I2C_SLAVE #undef CONFIG_LID_SWITCH #define CONFIG_LOW_POWER_IDLE #define CONFIG_LTO diff --git a/board/pdeval-stm32f072/board.h b/board/pdeval-stm32f072/board.h index 99f1e93ee0..8358420b93 100644 --- a/board/pdeval-stm32f072/board.h +++ b/board/pdeval-stm32f072/board.h @@ -18,6 +18,7 @@ /* Optional features */ #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_STM_HWTIMER32 /* USB Power Delivery configuration */ #define CONFIG_USB_POWER_DELIVERY diff --git a/board/pit/board.h b/board/pit/board.h index 10d99147e0..0dc766a506 100644 --- a/board/pit/board.h +++ b/board/pit/board.h @@ -17,6 +17,7 @@ #define CONFIG_EXTPOWER_GPIO #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_MKBP #define CONFIG_PMU_HARD_RESET diff --git a/board/plankton/board.h b/board/plankton/board.h index 33f9165583..425216360a 100644 --- a/board/plankton/board.h +++ b/board/plankton/board.h @@ -33,6 +33,7 @@ #define CONFIG_ADC #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_INA219 #define CONFIG_IO_EXPANDER_PCA9534 #undef CONFIG_WATCHDOG_HELP diff --git a/board/rambi/board.h b/board/rambi/board.h index 7568aae85f..76ba1691f2 100644 --- a/board/rambi/board.h +++ b/board/rambi/board.h @@ -27,6 +27,8 @@ #define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 #define CONFIG_CMD_GSV #define CONFIG_EXTPOWER_GPIO +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_I2C_PASSTHRU_RESTRICTED #define CONFIG_KEYBOARD_COL2_INVERTED #define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L diff --git a/board/ryu/board.h b/board/ryu/board.h index 6a438e6bcc..e4dc8401c8 100644 --- a/board/ryu/board.h +++ b/board/ryu/board.h @@ -56,6 +56,8 @@ #define CONFIG_ADC_SAMPLE_TIME 3 #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_I2C_MASTER +#define CONFIG_I2C_SLAVE #define CONFIG_LID_SWITCH #define CONFIG_LID_SWITCH_GPIO_LIST LID_GPIO(GPIO_LID_OPEN)\ LID_GPIO(GPIO_BASE_PRES_L) diff --git a/board/samus/board.h b/board/samus/board.h index ba1e0c896d..a9221f2de9 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -29,6 +29,8 @@ #define CONFIG_POWER_COMMON #define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 #define CONFIG_CHIPSET_CAN_THROTTLE +#define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_KEYBOARD_COL2_INVERTED diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h index a2cba6d77c..f647f14fac 100644 --- a/board/samus_pd/board.h +++ b/board/samus_pd/board.h @@ -38,6 +38,8 @@ #undef CONFIG_HOSTCMD_EVENTS #define CONFIG_HW_CRC #define CONFIG_I2C +#define CONFIG_I2C_MASTER +#define CONFIG_I2C_SLAVE #undef CONFIG_LID_SWITCH #define CONFIG_LOW_POWER_IDLE #undef CONFIG_PWM diff --git a/board/strago/board.h b/board/strago/board.h index 916b25d333..bb64cc5d6e 100644 --- a/board/strago/board.h +++ b/board/strago/board.h @@ -78,6 +78,7 @@ #define CONFIG_LED_COMMON #define CONFIG_I2C +#define CONFIG_I2C_MASTER /* Accelerometer */ #define CONFIG_ACCEL_KXCJ9 diff --git a/board/twinkie/board.h b/board/twinkie/board.h index 6ae82bac7e..e3c150fa34 100644 --- a/board/twinkie/board.h +++ b/board/twinkie/board.h @@ -44,6 +44,7 @@ #define CONFIG_ADC #define CONFIG_BOARD_PRE_INIT #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_INA231 #undef CONFIG_WATCHDOG_HELP #undef CONFIG_LID_SWITCH diff --git a/board/wheatley/board.h b/board/wheatley/board.h index 11d9a8e57f..cfbbb128d8 100644 --- a/board/wheatley/board.h +++ b/board/wheatley/board.h @@ -37,6 +37,7 @@ #define CONFIG_EXTPOWER_GPIO #define CONFIG_HOSTCMD_PD #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_LPC #define CONFIG_UART_HOST 0 #define CONFIG_KEYBOARD_PROTOCOL_8042 diff --git a/chip/it83xx/config_chip.h b/chip/it83xx/config_chip.h index 023365500c..c71fc5f925 100644 --- a/chip/it83xx/config_chip.h +++ b/chip/it83xx/config_chip.h @@ -94,7 +94,6 @@ #define CHIP_FAMILY_IT83XX #define CONFIG_ADC #define CONFIG_EC2I -#define CONFIG_I2C #define CONFIG_LPC #define CONFIG_PECI #define CONFIG_PWM diff --git a/chip/lm4/config_chip.h b/chip/lm4/config_chip.h index bae83e23f7..6157aa5ac6 100644 --- a/chip/lm4/config_chip.h +++ b/chip/lm4/config_chip.h @@ -95,7 +95,6 @@ /* Optional features present on this chip */ #define CONFIG_ADC -#define CONFIG_I2C #define CONFIG_LPC #define CONFIG_PECI #define CONFIG_SWITCH diff --git a/chip/mec1322/config_chip.h b/chip/mec1322/config_chip.h index 3b8f0c6ef7..f81069f753 100644 --- a/chip/mec1322/config_chip.h +++ b/chip/mec1322/config_chip.h @@ -101,7 +101,6 @@ #define CONFIG_MPU #endif #define CONFIG_DMA -#define CONFIG_I2C #define CONFIG_LPC #define CONFIG_SPI #define CONFIG_SWITCH diff --git a/chip/npcx/config_chip.h b/chip/npcx/config_chip.h index d3adb1915c..138fd47043 100644 --- a/chip/npcx/config_chip.h +++ b/chip/npcx/config_chip.h @@ -79,7 +79,6 @@ /* Optional features present on this chip */ #define CONFIG_ADC -#define CONFIG_I2C #define CONFIG_PECI #define CONFIG_SWITCH #define CONFIG_MPU diff --git a/common/build.mk b/common/build.mk index c61c118c4d..f88e534fbb 100644 --- a/common/build.mk +++ b/common/build.mk @@ -45,9 +45,7 @@ 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_I2C_MASTER)+=i2c.o 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 b57d41c17b..40b4efd4af 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 -#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY) +#ifdef CONFIG_I2C_MASTER | EC_FEATURE_MASK_0(EC_FEATURE_I2C) #endif #ifdef CONFIG_CHARGER diff --git a/common/system.c b/common/system.c index fa3a557d8b..0cecb18dc3 100644 --- a/common/system.c +++ b/common/system.c @@ -439,7 +439,7 @@ static void jump_to_image(uintptr_t init_addr) usleep(MSEC); gpio_set_level(GPIO_ENTERING_RW, 0); -#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY) +#ifdef CONFIG_I2C_MASTER /* Prepare I2C module for sysjump */ i2c_prepare_sysjump(); #endif diff --git a/include/config.h b/include/config.h index c104d681f9..db6f02cf62 100644 --- a/include/config.h +++ b/include/config.h @@ -1058,8 +1058,11 @@ #undef CONFIG_I2C_PASSTHRU_RESTRICTED #undef CONFIG_I2C_VIRTUAL_BATTERY -/* For EC that is only an I2C slave */ -#undef CONFIG_I2C_SLAVE_ONLY +/* EC uses an I2C master interface */ +#undef CONFIG_I2C_MASTER + +/* EC uses an I2C slave interface */ +#undef CONFIG_I2C_SLAVE /* 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 72c5b75ced..18e15eafb9 100644 --- a/test/stress.c +++ b/test/stress.c @@ -78,7 +78,7 @@ static int stress(const char *name, /*****************************************************************************/ /* Tests */ -#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY) +#ifdef CONFIG_I2C_MASTER static int test_i2c(void) { int res = EC_ERROR_UNKNOWN; @@ -135,7 +135,7 @@ void run_test(void) { test_reset(); -#if defined(CONFIG_I2C) && !defined(CONFIG_I2C_SLAVE_ONLY) +#ifdef CONFIG_I2C_MASTER RUN_STRESS_TEST("I2C Stress Test", test_i2c, I2C_TEST_ITERATION); #endif #ifdef CONFIG_ADC diff --git a/test/test_config.h b/test/test_config.h index ba645dff69..c2887ae1cc 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -57,6 +57,7 @@ #define CONFIG_CHARGER_DISCHARGE_ON_AC #define CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM #define CONFIG_I2C +#define CONFIG_I2C_MASTER int board_discharge_on_ac(int enabled); #define I2C_PORT_MASTER 0 #define I2C_PORT_BATTERY 0 @@ -73,6 +74,7 @@ int board_discharge_on_ac(int enabled); #define CONFIG_CHARGER_DISCHARGE_ON_AC #define CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM #define CONFIG_I2C +#define CONFIG_I2C_MASTER int board_discharge_on_ac(int enabled); #define I2C_PORT_MASTER 0 #define I2C_PORT_BATTERY 0 @@ -83,6 +85,7 @@ int board_discharge_on_ac(int enabled); #define CONFIG_CHIPSET_CAN_THROTTLE #define CONFIG_FANS 1 #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define CONFIG_TEMP_SENSOR #define CONFIG_THERMISTOR_NCP15WB #define I2C_PORT_THERMAL 0 @@ -103,6 +106,7 @@ int ncp15wb_calculate_temp(uint16_t adc); #define CONFIG_BATTERY_SMART #define CONFIG_CHARGER_INPUT_CURRENT 4032 #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define I2C_PORT_MASTER 0 #define I2C_PORT_BATTERY 0 #define I2C_PORT_CHARGER 0 @@ -110,6 +114,7 @@ int ncp15wb_calculate_temp(uint16_t adc); #ifdef TEST_LIGHTBAR #define CONFIG_I2C +#define CONFIG_I2C_MASTER #define I2C_PORT_LIGHTBAR 0 #define CONFIG_ALS_LIGHTBAR_DIMMING 0 #endif |