]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/usb/gadget/g_dnl.c
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / usb / gadget / g_dnl.c
index 7d87050df3d0740674e3d9c99ce0846d7341f1f5..cc3f3449c97c85b2e4fad5ed46f3f55210d845fc 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "gadget_chips.h"
 #include "composite.c"
+#include "f_mass_storage.c"
 
 /*
  * One needs to define the following:
@@ -69,6 +70,7 @@ static struct usb_device_descriptor device_desc = {
 static struct usb_string g_dnl_string_defs[] = {
        { 0, manufacturer, },
        { 1, product, },
+       {  }            /* end of list */
 };
 
 static struct usb_gadget_strings g_dnl_string_tab = {
@@ -83,7 +85,12 @@ static struct usb_gadget_strings *g_dnl_composite_strings[] = {
 
 static int g_dnl_unbind(struct usb_composite_dev *cdev)
 {
-       debug("%s\n", __func__);
+       struct usb_gadget *gadget = cdev->gadget;
+
+       debug("%s: calling usb_gadget_disconnect for "
+                       "controller '%s'\n", shortname, gadget->name);
+       usb_gadget_disconnect(gadget);
+
        return 0;
 }
 
@@ -98,6 +105,8 @@ static int g_dnl_do_config(struct usb_configuration *c)
        printf("GADGET DRIVER: %s\n", s);
        if (!strcmp(s, "usb_dnl_dfu"))
                ret = dfu_add(c);
+       else if (!strcmp(s, "usb_dnl_ums"))
+               ret = fsg_add(c);
 
        return ret;
 }
@@ -153,6 +162,10 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
                device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
        }
 
+       debug("%s: calling usb_gadget_connect for "
+                       "controller '%s'\n", shortname, gadget->name);
+       usb_gadget_connect(gadget);
+
        return 0;
 
  error:
@@ -178,6 +191,9 @@ int g_dnl_register(const char *type)
        if (!strcmp(type, "dfu")) {
                strcpy(name, shortname);
                strcat(name, type);
+       } else if (!strcmp(type, "ums")) {
+               strcpy(name, shortname);
+               strcat(name, type);
        } else {
                printf("%s: unknown command: %s\n", __func__, type);
                return -EINVAL;