summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2021-06-11 09:27:30 +1000
committerEdward O'Callaghan <quasisec@chromium.org>2021-06-17 03:37:19 +0000
commitdb2a639aec21bf05edaab90497875231f01a52a3 (patch)
treecfb17101f9a4b05223b18f95d5f23d4e5b985244
parent508fb169ed63414c63283ac99672a2f34f2a3817 (diff)
downloadflashrom-db2a639aec21bf05edaab90497875231f01a52a3.tar.gz
flashrom-db2a639aec21bf05edaab90497875231f01a52a3.tar.bz2
flashrom-db2a639aec21bf05edaab90497875231f01a52a3.zip
lspcon: restart MPU on programmer shutdown
Programmer initialization stops the on-chip MPU, and it was never restarted. Leaving it stopped seems to prevent some display detection from working, so implement restarting the MPU on programmer shutdown. BUG=b:190359231 TEST=display hotplug works reliably after device communication Change-Id: I66cd68f8f6905a2bfaf5b085bf08dcb218f42855 Reviewed-on: https://review.coreboot.org/c/flashrom/+/55403 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@google.com>
-rw-r--r--lspcon_i2c_spi.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 9f3bb9ad4..b590f1db9 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -318,11 +318,13 @@ static int lspcon_i2c_clt2_spi_reset(int fd)
return ret;
}
-static int lspcon_i2c_spi_reset_mpu_stop(int fd)
+static int lspcon_i2c_spi_set_mpu_active(int fd, int running)
{
int ret = 0;
- ret |= lspcon_i2c_spi_write_register(fd, MPU, 0xc0); // cmd mode
- ret |= lspcon_i2c_spi_write_register(fd, MPU, 0x40); // stop mcu
+ // Cmd mode
+ ret |= lspcon_i2c_spi_write_register(fd, MPU, 0xc0);
+ // Stop or release MPU
+ ret |= lspcon_i2c_spi_write_register(fd, MPU, running ? 0 : 0x40);
return ret;
}
@@ -418,15 +420,16 @@ static const struct spi_master spi_master_i2c_lspcon = {
.write_aai = lspcon_i2c_spi_write_aai,
};
-/* TODO: MPU still stopped at this point, probably need to reset it. */
static int lspcon_i2c_spi_shutdown(void *data)
{
int ret = 0;
struct lspcon_i2c_spi_data *lspcon_data =
(struct lspcon_i2c_spi_data *)data;
int fd = lspcon_data->fd;
+
ret |= lspcon_i2c_spi_enable_write_protection(fd);
ret |= lspcon_i2c_spi_toggle_register_protection(fd, 0);
+ ret |= lspcon_i2c_spi_set_mpu_active(fd, 1);
i2c_close(fd);
free(data);
@@ -439,9 +442,9 @@ static int lspcon_i2c_spi_init(void)
if (fd < 0)
return fd;
- int ret = lspcon_i2c_spi_reset_mpu_stop(fd);
+ int ret = lspcon_i2c_spi_set_mpu_active(fd, 0);
if (ret) {
- msg_perr("%s: call to reset_mpu_stop failed.\n", __func__);
+ msg_perr("%s: call to set_mpu_active failed.\n", __func__);
i2c_close(fd);
return ret;
}