board: toradex: make USB PID from config block optional
authorStefan Agner <stefan.agner@toradex.com>
Fri, 23 Jul 2021 06:39:46 +0000 (09:39 +0300)
committerStefano Babic <sbabic@denx.de>
Mon, 9 Aug 2021 11:09:29 +0000 (13:09 +0200)
If config block support is enabled, USB gadget modes unconditionally
use Toradex Product ID as USB PID. Some applications might prefer a
different and/or static USB PID. Add a Kconfig configuration option
to descide whether to use USB PID from config block or the fallback
config option CONFIG_G_DNL_PRODUCT_NUM.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
board/toradex/common/Kconfig
board/toradex/common/tdx-common.c

index 36068d2..1f6a5e4 100644 (file)
@@ -84,4 +84,14 @@ config TDX_CFG_BLOCK_EXTRA
          Enables fetching auxilary config blocks from carrier board/display
          adapter EEPROMs.
 
+config TDX_CFG_BLOCK_USB_GADGET_PID
+       bool "Use config block product ID as USB product ID"
+       depends on USB_GADGET_DOWNLOAD
+       default y
+       help
+         Use the Toradex product ID learned from the config block as USB
+         product ID. An offset of 0x4000 is added to the product ID since
+         inside the Toradex vendor ID (0x1b67) the range starting from
+         offset 0x4000 is reserved for Colibri/Apalis modules.
+
 endif
index a3d287e..061abf7 100644 (file)
@@ -147,7 +147,7 @@ int show_board_info(void)
        return 0;
 }
 
-#ifdef CONFIG_USB_GADGET_DOWNLOAD
+#ifdef CONFIG_TDX_CFG_BLOCK_USB_GADGET_PID
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
        unsigned short usb_pid;