feat(stm32mp1): usb descriptor update for STM32MP13

Update USB and DFU descriptor used for STM32MP13x

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Change-Id: I6e8111d279f49400a72baa12ff39f140d97e1c70
diff --git a/plat/st/stm32mp1/stm32mp1_usb_dfu.c b/plat/st/stm32mp1/stm32mp1_usb_dfu.c
index 33b12d0..0fe2d24 100644
--- a/plat/st/stm32mp1/stm32mp1_usb_dfu.c
+++ b/plat/st/stm32mp1/stm32mp1_usb_dfu.c
@@ -28,7 +28,12 @@
 #define USBD_CONFIGURATION_STRING	"DFU Config"
 #define USBD_INTERFACE_STRING		"DFU Interface"
 
+#if STM32MP13
+#define USB_DFU_ITF_NUM			2
+#endif
+#if STM32MP15
 #define USB_DFU_ITF_NUM			6
+#endif
 
 #define USB_DFU_CONFIG_DESC_SIZ		USB_DFU_DESC_SIZ(USB_DFU_ITF_NUM)
 
@@ -98,11 +103,18 @@
 	/* Descriptor of DFU interface 0 Alternate setting 0..N */
 	USBD_DFU_IF_DESC(0),
 	USBD_DFU_IF_DESC(1),
+#if USB_DFU_ITF_NUM > 2
 	USBD_DFU_IF_DESC(2),
+#endif
+#if USB_DFU_ITF_NUM > 3
 	USBD_DFU_IF_DESC(3),
+#endif
+#if USB_DFU_ITF_NUM > 4
 	USBD_DFU_IF_DESC(4),
+#endif
+#if USB_DFU_ITF_NUM > 5
 	USBD_DFU_IF_DESC(5),
-
+#endif
 	/* DFU Functional Descriptor */
 	0x09, /* blength = 9 Bytes */
 	DFU_DESCRIPTOR_TYPE, /* DFU Functional Descriptor */
@@ -115,6 +127,13 @@
 };
 
 /* The user strings: one by alternate as defined in USBD_DFU_IF_DESC */
+#if STM32MP13
+const char *const if_desc_string[USB_DFU_ITF_NUM] = {
+	"@SSBL /0x03/1*16Me",
+	"@virtual /0xF1/1*512Ba"
+};
+#endif
+#if STM32MP15
 const char *const if_desc_string[USB_DFU_ITF_NUM] = {
 	"@Partition0 /0x00/1*256Ke",
 	"@FSBL /0x01/1*1Me",
@@ -123,6 +142,7 @@
 	"@Partition4 /0x04/1*16Me",
 	"@virtual /0xF1/1*512Ba"
 };
+#endif
 
 /* Buffer to build the unicode string provided to USB device stack */
 static uint8_t usb_str_dec[USBD_MAX_STR_DESC_SIZ];
@@ -354,9 +374,11 @@
 	stm32mp1_usb_init_driver(&usb_core_handle, &pcd_handle,
 				 (uint32_t *)USB_OTG_BASE);
 
+#if STM32MP15
 	/* STM32MP15 = keep the configuration from ROM code */
 	usb_core_handle.ep0_state = USBD_EP0_DATA_IN;
 	usb_core_handle.dev_state = USBD_STATE_CONFIGURED;
+#endif
 
 	/* Update the serial number string descriptor from the unique ID */
 	update_serial_num_string();
@@ -376,12 +398,22 @@
 	uint8_t ret;
 
 	switch (alt) {
+#if STM32MP13
+	case 0:
+		ret = PHASE_SSBL;
+		break;
+	case 1:
+		ret = PHASE_CMD;
+		break;
+#endif
+#if STM32MP15
 	case 3:
 		ret = PHASE_SSBL;
 		break;
 	case 5:
 		ret = PHASE_CMD;
 		break;
+#endif
 	default:
 		ret = PHASE_RESET;
 		break;