Re: [U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-05 Thread Marek Vasut
Dear Lukasz Majewski,

 Hi Marek,
 
  Dear Lukasz Majewski,
  
   Hi Heiko,
   
add the possibility to set the iSerialNumber board specific.
Default value for iSerialNumber is 0x0. This value can
changed board specific through the new function
g_dnl_set_serialnumber() which must be called from the
board specific function g_dnl_bind_fixup().
   
   Tested-by: Lukasz Majewski l.majew...@samsung.com
   
   Test HW: TRATS.
   
   I will apply it to u-boot-dfu.
  
  Is this u-boot-dfu a new thing ?
 
 Yes. As we spoken at the mini summit.
 
 Marek, as a result you shall have less work :-)

Cool, are you sending this directly to Tom or am I getting pullRQ from you ?

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-05 Thread Lukasz Majewski
Hi Marek,

 Dear Lukasz Majewski,
 
  Hi Marek,
  
   Dear Lukasz Majewski,
   
Hi Heiko,

 add the possibility to set the iSerialNumber board specific.
 Default value for iSerialNumber is 0x0. This value can
 changed board specific through the new function
 g_dnl_set_serialnumber() which must be called from the
 board specific function g_dnl_bind_fixup().

Tested-by: Lukasz Majewski l.majew...@samsung.com

Test HW: TRATS.

I will apply it to u-boot-dfu.
   
   Is this u-boot-dfu a new thing ?
  
  Yes. As we spoken at the mini summit.
  
  Marek, as a result you shall have less work :-)
 
 Cool, are you sending this directly to Tom or am I getting pullRQ
 from you ?

I guess, that it is up to You and Tom.

 
 Best regards,
 Marek Vasut



-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-04 Thread Heiko Schocher
add the possibility to set the iSerialNumber board specific.
Default value for iSerialNumber is 0x0. This value can
changed board specific through the new function
g_dnl_set_serialnumber() which must be called from the
board specific function g_dnl_bind_fixup().

Signed-off-by: Heiko Schocher h...@denx.de
Cc: Marek Vasut marek.va...@gmail.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com

---
- changes for v3
  rebase against current u-boot/master
  509dca7a11aad394d781a9d31a7bfa6692562741
changes for v2:
- as Lukasz Majewski suggested, remove CONFIG_G_DNL_SERIAL_STRING
  define
---
 drivers/usb/gadget/g_dnl.c | 20 
 include/g_dnl.h|  1 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 43f413a..8dc3d9f 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -33,6 +33,9 @@
 #define STRING_PRODUCT 2
 /* Index of String Descriptor describing this configuration */
 #define STRING_USBDOWN 2
+/* Index of String serial */
+#define STRING_SERIAL  3
+#define MAX_STRING_SERIAL  32
 /* Number of supported configurations */
 #define CONFIGURATION_NUMBER 1
 
@@ -40,8 +43,16 @@
 
 static const char shortname[] = usb_dnl_;
 static const char product[] = USB download gadget;
+static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
 
+void g_dnl_set_serialnumber(char *s)
+{
+   memset(g_dnl_serial, 0, MAX_STRING_SERIAL);
+   if (strlen(s)  MAX_STRING_SERIAL)
+   strncpy(g_dnl_serial, s, strlen(s));
+}
+
 static struct usb_device_descriptor device_desc = {
.bLength = sizeof device_desc,
.bDescriptorType = USB_DT_DEVICE,
@@ -53,6 +64,7 @@ static struct usb_device_descriptor device_desc = {
.idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
.idProduct = __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM),
.iProduct = STRING_PRODUCT,
+   .iSerialNumber = STRING_SERIAL,
.bNumConfigurations = 1,
 };
 
@@ -63,6 +75,7 @@ static struct usb_device_descriptor device_desc = {
 static struct usb_string g_dnl_string_defs[] = {
{.s = manufacturer},
{.s = product},
+   {.s = g_dnl_serial},
{ } /* end of list */
 };
 
@@ -156,6 +169,13 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
g_dnl_string_defs[1].id = id;
device_desc.iProduct = id;
 
+   id = usb_string_id(cdev);
+   if (id  0)
+   return id;
+
+   g_dnl_string_defs[2].id = id;
+   device_desc.iSerialNumber = id;
+
g_dnl_bind_fixup(device_desc, cdev-driver-name);
ret = g_dnl_config_register(cdev);
if (ret)
diff --git a/include/g_dnl.h b/include/g_dnl.h
index de669fb..8f813c2 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -13,5 +13,6 @@
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
+void g_dnl_set_serialnumber(char *);
 
 #endif /* __G_DOWNLOAD_H_ */
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-04 Thread Lukasz Majewski
Hi Heiko,

 add the possibility to set the iSerialNumber board specific.
 Default value for iSerialNumber is 0x0. This value can
 changed board specific through the new function
 g_dnl_set_serialnumber() which must be called from the
 board specific function g_dnl_bind_fixup().
 

Tested-by: Lukasz Majewski l.majew...@samsung.com

Test HW: TRATS.

I will apply it to u-boot-dfu.

 Signed-off-by: Heiko Schocher h...@denx.de
 Cc: Marek Vasut marek.va...@gmail.com
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 
 ---
 - changes for v3
   rebase against current u-boot/master
   509dca7a11aad394d781a9d31a7bfa6692562741
 changes for v2:
 - as Lukasz Majewski suggested, remove CONFIG_G_DNL_SERIAL_STRING
   define
 ---
  drivers/usb/gadget/g_dnl.c | 20 
  include/g_dnl.h|  1 +
  2 files changed, 21 insertions(+)
 
 diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
 index 43f413a..8dc3d9f 100644
 --- a/drivers/usb/gadget/g_dnl.c
 +++ b/drivers/usb/gadget/g_dnl.c
 @@ -33,6 +33,9 @@
  #define STRING_PRODUCT 2
  /* Index of String Descriptor describing this configuration */
  #define STRING_USBDOWN 2
 +/* Index of String serial */
 +#define STRING_SERIAL  3
 +#define MAX_STRING_SERIAL32
  /* Number of supported configurations */
  #define CONFIGURATION_NUMBER 1
  
 @@ -40,8 +43,16 @@
  
  static const char shortname[] = usb_dnl_;
  static const char product[] = USB download gadget;
 +static char g_dnl_serial[MAX_STRING_SERIAL];
  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
  
 +void g_dnl_set_serialnumber(char *s)
 +{
 + memset(g_dnl_serial, 0, MAX_STRING_SERIAL);
 + if (strlen(s)  MAX_STRING_SERIAL)
 + strncpy(g_dnl_serial, s, strlen(s));
 +}
 +
  static struct usb_device_descriptor device_desc = {
   .bLength = sizeof device_desc,
   .bDescriptorType = USB_DT_DEVICE,
 @@ -53,6 +64,7 @@ static struct usb_device_descriptor device_desc = {
   .idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
   .idProduct =
 __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM), .iProduct =
 STRING_PRODUCT,
 + .iSerialNumber = STRING_SERIAL,
   .bNumConfigurations = 1,
  };
  
 @@ -63,6 +75,7 @@ static struct usb_device_descriptor device_desc = {
  static struct usb_string g_dnl_string_defs[] = {
   {.s = manufacturer},
   {.s = product},
 + {.s = g_dnl_serial},
   { } /* end of list */
  };
  
 @@ -156,6 +169,13 @@ static int g_dnl_bind(struct usb_composite_dev
 *cdev) g_dnl_string_defs[1].id = id;
   device_desc.iProduct = id;
  
 + id = usb_string_id(cdev);
 + if (id  0)
 + return id;
 +
 + g_dnl_string_defs[2].id = id;
 + device_desc.iSerialNumber = id;
 +
   g_dnl_bind_fixup(device_desc, cdev-driver-name);
   ret = g_dnl_config_register(cdev);
   if (ret)
 diff --git a/include/g_dnl.h b/include/g_dnl.h
 index de669fb..8f813c2 100644
 --- a/include/g_dnl.h
 +++ b/include/g_dnl.h
 @@ -13,5 +13,6 @@
  int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
  int g_dnl_register(const char *s);
  void g_dnl_unregister(void);
 +void g_dnl_set_serialnumber(char *);
  
  #endif /* __G_DOWNLOAD_H_ */



-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-04 Thread Heiko Schocher

Hello Lukasz,

Am 04.11.2013 16:12, schrieb Lukasz Majewski:

Hi Heiko,


add the possibility to set the iSerialNumber board specific.
Default value for iSerialNumber is 0x0. This value can
changed board specific through the new function
g_dnl_set_serialnumber() which must be called from the
board specific function g_dnl_bind_fixup().



Tested-by: Lukasz Majewskil.majew...@samsung.com

Test HW: TRATS.

I will apply it to u-boot-dfu.


Thanks!

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-04 Thread Marek Vasut
Dear Lukasz Majewski,

 Hi Heiko,
 
  add the possibility to set the iSerialNumber board specific.
  Default value for iSerialNumber is 0x0. This value can
  changed board specific through the new function
  g_dnl_set_serialnumber() which must be called from the
  board specific function g_dnl_bind_fixup().
 
 Tested-by: Lukasz Majewski l.majew...@samsung.com
 
 Test HW: TRATS.
 
 I will apply it to u-boot-dfu.

Is this u-boot-dfu a new thing ?

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/5] usb, g_dnl: make iSerialNumber board configurable

2013-11-04 Thread Lukasz Majewski
Hi Marek,

 Dear Lukasz Majewski,
 
  Hi Heiko,
  
   add the possibility to set the iSerialNumber board specific.
   Default value for iSerialNumber is 0x0. This value can
   changed board specific through the new function
   g_dnl_set_serialnumber() which must be called from the
   board specific function g_dnl_bind_fixup().
  
  Tested-by: Lukasz Majewski l.majew...@samsung.com
  
  Test HW: TRATS.
  
  I will apply it to u-boot-dfu.
 
 Is this u-boot-dfu a new thing ?

Yes. As we spoken at the mini summit. 

Marek, as a result you shall have less work :-)

 
 Best regards,
 Marek Vasut



-- 
Best regards,

Lukasz Majewski

Samsung RD Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot