summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/i2c.c9
-rw-r--r--common/system.c5
-rw-r--r--include/i2c.h5
3 files changed, 19 insertions, 0 deletions
diff --git a/common/i2c.c b/common/i2c.c
index 3975bf1927..4a851da39d 100644
--- a/common/i2c.c
+++ b/common/i2c.c
@@ -68,6 +68,15 @@ void i2c_lock(int port, int lock)
}
}
+void i2c_prepare_sysjump(void)
+{
+ int i;
+
+ /* Lock all I2C port to prepare for sysjump */
+ for (i = 0; i < i2c_ports_used; i++)
+ i2c_lock(i2c_ports[i].port, 1);
+}
+
int i2c_read16(int port, int slave_addr, int offset, int *data)
{
int rv;
diff --git a/common/system.c b/common/system.c
index 803784d6cd..484fc81c1c 100644
--- a/common/system.c
+++ b/common/system.c
@@ -12,6 +12,7 @@
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
+#include "i2c.h"
#include "lpc.h"
#ifdef CONFIG_MPU
#include "mpu.h"
@@ -419,6 +420,10 @@ static void jump_to_image(uintptr_t init_addr)
usleep(5*MSEC);
#endif
+#ifdef CONFIG_I2C
+ /* Prepare I2C module for sysjump */
+ i2c_prepare_sysjump();
+#endif
/* Flush UART output unless the UART hasn't been initialized yet */
if (uart_init_done())
uart_flush_output();
diff --git a/include/i2c.h b/include/i2c.h
index 798c831318..dbc51eebbd 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -149,6 +149,11 @@ void i2c_lock(int port, int lock);
#define I2C_TIMEOUT_DEFAULT_US (100 * MSEC)
/**
+ * Prepare I2C module for sysjump.
+ */
+void i2c_prepare_sysjump(void);
+
+/**
* Set the timeout for an I2C transaction.
*
* @param port Port to set timeout for