From: Heiko Schocher Date: Mon, 4 Nov 2013 13:05:02 +0000 (+0100) Subject: usb, g_dnl: make bcdDevice value configurable X-Git-Tag: v2014.01-rc2~42^2~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a0d463f587b0c00f6abfd33d96fae9fdd0dc55a;p=oweals%2Fu-boot.git usb, g_dnl: make bcdDevice value configurable 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 Acked-by: Lukasz Majewski Cc: Marek Vasut Cc: Kyungmin Park --- diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index 8dc3d9f8a8..dd95afe86a 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -147,6 +147,23 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) 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; @@ -181,11 +198,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);