Edward O'Callaghan submitted this change.
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>
---
M lspcon_i2c_spi.c
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lspcon_i2c_spi.c b/lspcon_i2c_spi.c
index 9f3bb9a..b590f1d 100644
--- a/lspcon_i2c_spi.c
+++ b/lspcon_i2c_spi.c
@@ -318,11 +318,13 @@
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 @@
.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 @@
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;
}
To view, visit change 55403. To unsubscribe, or for help writing mail filters, visit settings.