Skip to contentSkip to conversation

board: stm32mp1: fixup the usb product id for USB download gadget

PATCH New Patrick Delaunay 2 participants 3 messages Sep 13, 2019 – Oct 23, 2019 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: stm32mp1: fixup the usb product id for USB download gadget

Select the correct USB product id used by the download gadget for ST stm32mp1 boards.

The board stm32mp1 select the correct product id, as defined in
http://www.linux-usb.org/usb.ids for the STMicroelectronics vendor id = 0x0483 (CONFIG_USB_GADGET_VENDOR_NUM):
- dfu = 0xdf11 : STM Device in DFU mode
it is the value used by ROM code and reused for stm32prog command
- fasboot = 0x0afb : Android Fastboot device
- others = 0x5720 (CONFIG_USB_GADGET_PRODUCT_NUM) Mass Storage Device
it is used for UMS command / usb_dnl_ums

This patch avoid conflict when the same USB VID/PID is used for ums, fastboot or dfu command (two different protocols associated to the same PID).

---

 board/st/stm32mp1/stm32mp1.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
board/st/stm32mp1/stm32mp1.c +17 -0
index 18f9b84876..126af30173 100644
@@ -233,6 +233,23 @@ int g_dnl_board_usb_cable_connected(void)
 
 	return dwc2_udc_B_session_valid(dwc2_udc_otg);
 }
+
+#define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
+#define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+	if (!strcmp(name, "usb_dnl_dfu"))
+		put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, &dev->idProduct);
+	else if (!strcmp(name, "usb_dnl_fastboot"))
+		put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,
+			      &dev->idProduct);
+	else
+		put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
+
+	return 0;
+}
+
 #endif /* CONFIG_USB_GADGET */
 
 #ifdef CONFIG_LED
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 board: stm32mp1: fixup the usb product id for USB download gadget

Hi Patrick

Quoted 42 lines · Patrick Delaunay

Select the correct USB product id used by the download gadget for ST stm32mp1 boards.

The board stm32mp1 select the correct product id, as defined in
http://www.linux-usb.org/usb.ids for the STMicroelectronics vendor id = 0x0483 (CONFIG_USB_GADGET_VENDOR_NUM):
- dfu = 0xdf11 : STM Device in DFU mode
it is the value used by ROM code and reused for stm32prog command
- fasboot = 0x0afb : Android Fastboot device
- others = 0x5720 (CONFIG_USB_GADGET_PRODUCT_NUM) Mass Storage Device
it is used for UMS command / usb_dnl_ums

This patch avoid conflict when the same USB VID/PID is used for ums, fastboot or dfu command (two different protocols associated to the same PID).

---

 board/st/stm32mp1/stm32mp1.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
board/st/stm32mp1/stm32mp1.c +10 -0
index 18f9b84876..126af30173 100644
@@ -233,6 +233,23 @@ int g_dnl_board_usb_cable_connected(void)
 
 	return dwc2_udc_B_session_valid(dwc2_udc_otg);
 }
+
+#define STM32MP1_G_DNL_DFU_PRODUCT_NUM 0xdf11
+#define STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM 0x0afb
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+	if (!strcmp(name, "usb_dnl_dfu"))
+		put_unaligned(STM32MP1_G_DNL_DFU_PRODUCT_NUM, &dev->idProduct);
+	else if (!strcmp(name, "usb_dnl_fastboot"))
+		put_unaligned(STM32MP1_G_DNL_FASTBOOT_PRODUCT_NUM,

board/st/stm32mp1/stm32mp1.c int g_dnl_board_usb_cable_connected(void) · line 255

Quoted 10 lines
board/st/stm32mp1/stm32mp1.c +7 -0
+			      &dev->idProduct);
+	else
+		put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
+
+	return 0;
+}
+
 #endif /* CONFIG_USB_GADGET */
 
 #ifdef CONFIG_LED

Thanks

#2 lore raw

PATCH 1/1 board: stm32mp1: fixup the usb product id for USB download gadget

In reply to Patrick Delaunay
Quoted 15 lines

Select the correct USB product id used by the download gadget for ST stm32mp1 boards.

The board stm32mp1 select the correct product id, as defined in http://www.linux-
usb.org/usb.ids for the STMicroelectronics vendor id = 0x0483 (CONFIG_USB_GADGET_VENDOR_NUM):
- dfu = 0xdf11 : STM Device in DFU mode
it is the value used by ROM code and reused for stm32prog
command
- fasboot = 0x0afb : Android Fastboot device
- others = 0x5720 (CONFIG_USB_GADGET_PRODUCT_NUM)
Mass Storage Device
it is used for UMS command / usb_dnl_ums

Quoted 5 lines

This patch avoid conflict when the same USB VID/PID is used for ums, fastboot or dfu command (two different protocols associated to the same PID).

---

Applied to u-boot-stm32/master, thanks!