samsung:common:thor: Define common Samsung code to handle THOR usb descriptor setup
authorLukasz Majewski <l.majewski@samsung.com>
Tue, 8 Oct 2013 12:30:45 +0000 (14:30 +0200)
committerMarek Vasut <marex@denx.de>
Sun, 20 Oct 2013 21:42:41 +0000 (23:42 +0200)
Special, common to Samsung, function for altering usb descriptor's
idVendor and idProduct has been added.
For compatibility reasons (Win vs Linux) the THOR idProduct must be
different than the one for DFU/UMS.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
board/samsung/common/Makefile
board/samsung/common/thor.c [new file with mode: 0644]

index 9e48a7b6e57dda5944adfa354802e4d85d369a72..ad7564cddf585485b264c782e2708ae6d87df463 100644 (file)
@@ -10,6 +10,7 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)libsamsung.o
 
 COBJS-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o
+COBJS-$(CONFIG_THOR_FUNCTION) += thor.o
 
 SRCS    := $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS-y))
diff --git a/board/samsung/common/thor.c b/board/samsung/common/thor.c
new file mode 100644 (file)
index 0000000..1c7630d
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ *  Copyright (C) 2013 Samsung Electronics
+ *  Lukasz Majewski <l.majewski@samsung.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <linux/usb/ch9.h>
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+       if (!strcmp(name, "usb_dnl_thor")) {
+               put_unaligned(CONFIG_G_DNL_THOR_VENDOR_NUM, &dev->idVendor);
+               put_unaligned(CONFIG_G_DNL_THOR_PRODUCT_NUM, &dev->idProduct);
+       } else {
+               put_unaligned(CONFIG_G_DNL_VENDOR_NUM, &dev->idVendor);
+               put_unaligned(CONFIG_G_DNL_PRODUCT_NUM, &dev->idProduct);
+       }
+       return 0;
+}