mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-10-31 05:10:41 +01:00 
			
		
		
		
	stlinkv3_spi: add support for more product variants
ST released further STLINK-V3 variants with different PIDs: - STLINK-V3E - STLINK-V3S - STLINK-V3 With dual VCP - STLINK-V3 Without MSD Tested with STLINK-V3S and STLINK-V3 With dual VCP Credits goes to the stlink project for collecting the the PID list: https://github.com/stlink-org/stlink/blob/develop/src/stlink-lib/ usb.h#L22 Change-Id: Ic9ad03316b7005aa35e6f2f710c86f48befd38f2 Signed-off-by: Miklós Márton <martonmiklosqdev@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/65302 Reviewed-by: Thomas Heijligen <src@posteo.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
		 Miklós Márton
					Miklós Márton
				
			
				
					committed by
					
						 Thomas Heijligen
						Thomas Heijligen
					
				
			
			
				
	
			
			
			 Thomas Heijligen
						Thomas Heijligen
					
				
			
						parent
						
							3543bfed84
						
					
				
				
					commit
					600d37154d
				
			| @@ -115,7 +115,10 @@ enum spi_nss_level { | |||||||
| #define USB_TIMEOUT_IN_MS					5000 | #define USB_TIMEOUT_IN_MS					5000 | ||||||
|  |  | ||||||
| static const struct dev_entry devs_stlinkv3_spi[] = { | static const struct dev_entry devs_stlinkv3_spi[] = { | ||||||
| 	{0x0483, 0x374F, OK, "STMicroelectronics", "STLINK-V3"}, | 	{0x0483, 0x374E, NT, "STMicroelectronics", "STLINK-V3E"}, | ||||||
|  | 	{0x0483, 0x374F, OK, "STMicroelectronics", "STLINK-V3S"}, | ||||||
|  | 	{0x0483, 0x3753, OK, "STMicroelectronics", "STLINK-V3 dual VCP"}, | ||||||
|  | 	{0x0483, 0x3754, NT, "STMicroelectronics", "STLINK-V3 no MSD"}, | ||||||
| 	{0} | 	{0} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -478,6 +481,7 @@ static int stlinkv3_spi_init(void) | |||||||
| 	char *serialno = NULL; | 	char *serialno = NULL; | ||||||
| 	char *endptr = NULL; | 	char *endptr = NULL; | ||||||
| 	int ret = 1; | 	int ret = 1; | ||||||
|  | 	int devIndex = 0; | ||||||
| 	struct libusb_context *usb_ctx; | 	struct libusb_context *usb_ctx; | ||||||
| 	libusb_device_handle *stlinkv3_handle; | 	libusb_device_handle *stlinkv3_handle; | ||||||
| 	struct stlinkv3_spi_data *stlinkv3_data; | 	struct stlinkv3_spi_data *stlinkv3_data; | ||||||
| @@ -491,10 +495,17 @@ static int stlinkv3_spi_init(void) | |||||||
| 	serialno = extract_programmer_param_str("serial"); | 	serialno = extract_programmer_param_str("serial"); | ||||||
| 	if (serialno) | 	if (serialno) | ||||||
| 		msg_pdbg("Opening STLINK-V3 with serial: %s\n", serialno); | 		msg_pdbg("Opening STLINK-V3 with serial: %s\n", serialno); | ||||||
| 	stlinkv3_handle = usb_dev_get_by_vid_pid_serial(usb_ctx, |  | ||||||
| 							devs_stlinkv3_spi[0].vendor_id, |  | ||||||
| 							devs_stlinkv3_spi[0].device_id, | 	while (devs_stlinkv3_spi[devIndex].vendor_id != 0) { | ||||||
| 							serialno); | 		stlinkv3_handle = usb_dev_get_by_vid_pid_serial(usb_ctx, | ||||||
|  | 								devs_stlinkv3_spi[devIndex].vendor_id, | ||||||
|  | 								devs_stlinkv3_spi[devIndex].device_id, | ||||||
|  | 								serialno); | ||||||
|  | 		if (stlinkv3_handle) | ||||||
|  | 			break; | ||||||
|  | 		devIndex++; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if (!stlinkv3_handle) { | 	if (!stlinkv3_handle) { | ||||||
| 		if (serialno) | 		if (serialno) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user