Patchwork [U-Boot] usb, g_dnl: make possibility to fixup the device_desc board specific

login
register
mail settings
Submitter Heiko Schocher
Date June 4, 2013, 9:19 a.m.
Message ID <1370337590-16615-1-git-send-email-hs@denx.de>
Download mbox | patch
Permalink /patch/248512/
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Comments

Heiko Schocher - June 4, 2013, 9:19 a.m.
add a weak dummy function g_dnl_fixup to add the possibility to update
the device_desc board specific. Used on the upcoming siemens board
support, where idVendor and idProduct is stored in an eeprom.

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/usb/gadget/g_dnl.c | 7 +++++++
 include/g_dnl.h            | 2 +-
 2 Dateien geändert, 8 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
Łukasz Majewski - June 4, 2013, 10:14 a.m.
Hi Heiko,

> add a weak dummy function g_dnl_fixup to add the possibility to update
> the device_desc board specific. Used on the upcoming siemens board
> support, where idVendor and idProduct is stored in an eeprom.
> 

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

> Signed-off-by: Heiko Schocher <hs@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/usb/gadget/g_dnl.c | 7 +++++++
>  include/g_dnl.h            | 2 +-
>  2 Dateien geändert, 8 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)
> 
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index cc3f344..8a3777b 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -125,6 +125,12 @@ static int g_dnl_config_register(struct
> usb_composite_dev *cdev) return usb_add_config(cdev, &config);
>  }
>  
> +__weak
> +int g_dnl_bind_fixup(struct usb_device_descriptor *dev)
> +{
> +	return 0;
> +}
> +
>  static int g_dnl_bind(struct usb_composite_dev *cdev)
>  {
>  	struct usb_gadget *gadget = cdev->gadget;
> @@ -147,6 +153,7 @@ static int g_dnl_bind(struct usb_composite_dev
> *cdev) g_dnl_string_defs[1].id = id;
>  	device_desc.iProduct = id;
>  
> +	g_dnl_bind_fixup(&device_desc);
>  	ret = g_dnl_config_register(cdev);
>  	if (ret)
>  		goto error;
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index f47395f..f8affd8 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -23,7 +23,7 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> -
> +int g_dnl_bind_fixup(struct usb_device_descriptor *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
>

Patch

diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index cc3f344..8a3777b 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -125,6 +125,12 @@  static int g_dnl_config_register(struct usb_composite_dev *cdev)
 	return usb_add_config(cdev, &config);
 }
 
+__weak
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev)
+{
+	return 0;
+}
+
 static int g_dnl_bind(struct usb_composite_dev *cdev)
 {
 	struct usb_gadget *gadget = cdev->gadget;
@@ -147,6 +153,7 @@  static int g_dnl_bind(struct usb_composite_dev *cdev)
 	g_dnl_string_defs[1].id = id;
 	device_desc.iProduct = id;
 
+	g_dnl_bind_fixup(&device_desc);
 	ret = g_dnl_config_register(cdev);
 	if (ret)
 		goto error;
diff --git a/include/g_dnl.h b/include/g_dnl.h
index f47395f..f8affd8 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -23,7 +23,7 @@ 
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
-
+int g_dnl_bind_fixup(struct usb_device_descriptor *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);