summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chip/stm32/i2c-stm32f0.c3
-rw-r--r--chip/stm32/i2c-stm32f4.c3
-rw-r--r--include/config.h8
3 files changed, 12 insertions, 2 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index 5b58cb3e45..d1d40f242b 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -196,7 +196,8 @@ defined(CONFIG_LOW_POWER_IDLE) && \
* and result/size on response). After any protocol-specific headers, the
* buffers must be 32-bit aligned.
*/
-static uint8_t host_buffer_padded[I2C_MAX_HOST_PACKET_SIZE + 4] __aligned(4);
+static uint8_t host_buffer_padded[I2C_MAX_HOST_PACKET_SIZE + 4 +
+ CONFIG_I2C_EXTRA_PACKET_SIZE] __aligned(4);
static uint8_t * const host_buffer = host_buffer_padded + 2;
static uint8_t params_copy[I2C_MAX_HOST_PACKET_SIZE] __aligned(4);
static int host_i2c_resp_port;
diff --git a/chip/stm32/i2c-stm32f4.c b/chip/stm32/i2c-stm32f4.c
index 5d8a837cf6..a542088567 100644
--- a/chip/stm32/i2c-stm32f4.c
+++ b/chip/stm32/i2c-stm32f4.c
@@ -763,7 +763,8 @@ DECLARE_HOOK(HOOK_FREQ_CHANGE, i2c_freq_change_hook, HOOK_PRIO_DEFAULT);
* and result/size on response). After any protocol-specific headers, the
* buffers must be 32-bit aligned.
*/
-static uint8_t host_buffer_padded[I2C_MAX_HOST_PACKET_SIZE + 4] __aligned(4);
+static uint8_t host_buffer_padded[I2C_MAX_HOST_PACKET_SIZE + 4 +
+ CONFIG_I2C_EXTRA_PACKET_SIZE] __aligned(4);
static uint8_t * const host_buffer = host_buffer_padded + 2;
static uint8_t params_copy[I2C_MAX_HOST_PACKET_SIZE] __aligned(4);
static int host_i2c_resp_port;
diff --git a/include/config.h b/include/config.h
index 76a6049720..7d8d3900d1 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1438,6 +1438,14 @@
#undef CONFIG_I2C_SCL_GATE_GPIO
/*
+ * Some chip supports two owned slave address. The second slave address is used
+ * for other purpose such as board specific i2c commands. This option can be
+ * set if user of the second slave address requires larger host packet buffer
+ * size.
+ */
+#define CONFIG_I2C_EXTRA_PACKET_SIZE 0
+
+/*
* I2C multi-port controller.
*
* If CONFIG_I2C_MULTI_PORT_CONTROLLER is defined, a single on-chip I2C