mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-10-31 05:10:41 +01:00 
			
		
		
		
	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>
This commit is contained in:
		 Peter Marheine
					Peter Marheine
				
			
				
					committed by
					
						 Edward O'Callaghan
						Edward O'Callaghan
					
				
			
			
				
	
			
			
			 Edward O'Callaghan
						Edward O'Callaghan
					
				
			
						parent
						
							508fb169ed
						
					
				
				
					commit
					db2a639aec
				
			| @@ -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; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user