diff mbox series

[3/4] rockchip: board: Use a common USB Product ID for UMS

Message ID 20240226230822.2430391-4-jonas@kwiboo.se
State Superseded
Delegated to: Kever Yang
Headers show
Series rockchip: Migrate to use DM_USB_GADGET on RK3328 | expand

Commit Message

Jonas Karlman Feb. 26, 2024, 11:08 p.m. UTC
Change to use the common Product ID 0x0010 when the ums command is used.

This matches downstream vendor U-Boot and is a Product ID that tools
such as rkdeveloptool and RKDevTool will identify as MSC mode.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
 arch/arm/mach-rockchip/board.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Kever Yang March 8, 2024, 9:25 a.m. UTC | #1
On 2024/2/27 07:08, Jonas Karlman wrote:
> Change to use the common Product ID 0x0010 when the ums command is used.
>
> This matches downstream vendor U-Boot and is a Product ID that tools
> such as rkdeveloptool and RKDevTool will identify as MSC mode.
>
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   arch/arm/mach-rockchip/board.c | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
> index f84ff542aea9..e9cfba756639 100644
> --- a/arch/arm/mach-rockchip/board.c
> +++ b/arch/arm/mach-rockchip/board.c
> @@ -221,8 +221,23 @@ void enable_caches(void)
>   #endif
>   
>   #if IS_ENABLED(CONFIG_USB_GADGET)
> -#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET)
>   #include <usb.h>
> +
> +#if IS_ENABLED(CONFIG_USB_GADGET_DOWNLOAD)
> +#define ROCKCHIP_G_DNL_UMS_PRODUCT_NUM	0x0010
> +
> +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> +{
> +	if (!strcmp(name, "usb_dnl_ums"))
> +		put_unaligned(ROCKCHIP_G_DNL_UMS_PRODUCT_NUM, &dev->idProduct);
> +	else
> +		put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_USB_GADGET_DOWNLOAD */
> +
> +#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET)
>   #include <linux/usb/otg.h>
>   #include <usb/dwc2_udc.h>
>
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index f84ff542aea9..e9cfba756639 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -221,8 +221,23 @@  void enable_caches(void)
 #endif
 
 #if IS_ENABLED(CONFIG_USB_GADGET)
-#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET)
 #include <usb.h>
+
+#if IS_ENABLED(CONFIG_USB_GADGET_DOWNLOAD)
+#define ROCKCHIP_G_DNL_UMS_PRODUCT_NUM	0x0010
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+	if (!strcmp(name, "usb_dnl_ums"))
+		put_unaligned(ROCKCHIP_G_DNL_UMS_PRODUCT_NUM, &dev->idProduct);
+	else
+		put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct);
+
+	return 0;
+}
+#endif /* CONFIG_USB_GADGET_DOWNLOAD */
+
+#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET)
 #include <linux/usb/otg.h>
 #include <usb/dwc2_udc.h>