[U-Boot] [PATCH v2 4/5] usb, g_dnl: make bcdDevice value configurable

Heiko Schocher hs at denx.de
Mon Nov 4 08:02:38 CET 2013


add the possibility to set the bcdDevice number board specific.
Therefore the weak function g_dnl_get_board_bcd_device_number()
is introduced. Used on the siemens boards.

Signed-off-by: Heiko Schocher <hs at denx.de>
Acked-by: Lukasz Majewski <l.majewski at samsung.com>
Cc: Marek Vasut <marek.vasut at gmail.com>
Cc: Kyungmin Park <kyungmin.park at samsung.com>

---
- changes for v2:
  add Acked-by from Lukasz Majewski
---
 drivers/usb/gadget/g_dnl.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 7a3d507..48cc6a3 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -136,6 +136,23 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev)
 	return 0;
 }
 
+__weak int g_dnl_get_board_bcd_device_number(int gcnum)
+{
+	return gcnum;
+}
+
+static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev)
+{
+	struct usb_gadget *gadget = cdev->gadget;
+	int gcnum;
+
+	gcnum = usb_gadget_controller_number(gadget);
+	if (gcnum > 0)
+		gcnum += 0x200;
+
+	return g_dnl_get_board_bcd_device_number(gcnum);
+}
+
 static int g_dnl_bind(struct usb_composite_dev *cdev)
 {
 	struct usb_gadget *gadget = cdev->gadget;
@@ -170,11 +187,9 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 	if (ret)
 		goto error;
 
-	gcnum = usb_gadget_controller_number(gadget);
-
-	debug("gcnum: %d\n", gcnum);
+	gcnum = g_dnl_get_bcd_device_number(cdev);
 	if (gcnum >= 0)
-		device_desc.bcdDevice = cpu_to_le16(0x0200 + gcnum);
+		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
 			shortname, gadget->name);
-- 
1.8.3.1



More information about the U-Boot mailing list