Adapt the usb-compat.h to uBoot.

Use #ifndef __UBOOT__ for code that is not applicable to uBoot.
Use #ifdef __UBOOT__ to add code that is uBoot specific.

Create linux-compat.h - Linux kernel compatibility definitions that do not
exist in the uBoot.  Moved the compatibility definitions from 
lin_gadget_compat.h
to this file as well.

Create usb-mod-devicetable.h - Is a partial back port of mod_devicetable.h in 
the linux
kernel only taking the portion needed for USB

Already existing header files were modified to pick up the new header files.

Currently musb will not compile.

Signed-off-by: Dan Murphy <dmur...@ti.com>
---
 drivers/usb/musb-new/musb_host.h        |    1 +
 drivers/usb/musb-new/usb-compat.h       |   30 ----
 include/linux/usb/gadget.h              |  184 +++++++++++++++++++-----
 include/linux/usb/linux-compat.h        |  234 +++++++++++++++++++++++++++++++
 include/linux/usb/usb-compat.h          |  186 +++++++++++++++++++++---
 include/linux/usb/usb-mod-devicetable.h |  131 +++++++++++++++++
 include/usb.h                           |  119 +---------------
 include/usb/lin_gadget_compat.h         |   29 +---
 8 files changed, 685 insertions(+), 229 deletions(-)
 create mode 100644 include/linux/usb/linux-compat.h
 create mode 100644 include/linux/usb/usb-mod-devicetable.h

diff --git a/drivers/usb/musb-new/musb_host.h b/drivers/usb/musb-new/musb_host.h
index ebebe0c..49cb094 100644
--- a/drivers/usb/musb-new/musb_host.h
+++ b/drivers/usb/musb-new/musb_host.h
@@ -35,6 +35,7 @@
 #ifndef _MUSB_HOST_H
 #define _MUSB_HOST_H
 #ifdef __UBOOT__
+#include <linux/usb/usb-compat.h>
 #include "usb-compat.h"
 #endif
 
diff --git a/drivers/usb/musb-new/usb-compat.h 
b/drivers/usb/musb-new/usb-compat.h
index 27f656f..bdb5f0e 100644
--- a/drivers/usb/musb-new/usb-compat.h
+++ b/drivers/usb/musb-new/usb-compat.h
@@ -6,13 +6,6 @@
 struct usb_hcd {
        void *hcd_priv;
 };
-
-struct usb_host_endpoint {
-       struct usb_endpoint_descriptor          desc;
-       struct list_head urb_list;
-       void *hcpriv;
-};
-
 /*
  * urb->transfer_flags:
  *
@@ -20,29 +13,6 @@ struct usb_host_endpoint {
  */
 #define URB_SHORT_NOT_OK       0x0001  /* report short reads as errors */
 #define URB_ZERO_PACKET                0x0040  /* Finish bulk OUT with short 
packet */
-
-struct urb;
-
-typedef void (*usb_complete_t)(struct urb *);
-
-struct urb {
-       void *hcpriv;                   /* private data for host controller */
-       struct list_head urb_list;      /* list head for use by the urb's
-                                        * current owner */
-       struct usb_device *dev;         /* (in) pointer to associated device */
-       struct usb_host_endpoint *ep;   /* (internal) pointer to endpoint */
-       unsigned int pipe;              /* (in) pipe information */
-       int status;                     /* (return) non-ISO status */
-       unsigned int transfer_flags;    /* (in) URB_SHORT_NOT_OK | ...*/
-       void *transfer_buffer;          /* (in) associated data buffer */
-       dma_addr_t transfer_dma;        /* (in) dma addr for transfer_buffer */
-       u32 transfer_buffer_length;     /* (in) data buffer length */
-       u32 actual_length;              /* (return) actual transfer length */
-       unsigned char *setup_packet;    /* (in) setup packet (control only) */
-       int start_frame;                /* (modify) start frame (ISO) */
-       usb_complete_t complete;        /* (in) completion routine */
-};
-
 #define usb_hcd_link_urb_to_ep(hcd, urb)       ({              \
        int ret = 0;                                            \
        list_add_tail(&urb->urb_list, &urb->ep->urb_list);      \
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 220d068..f987ff2 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -18,7 +18,11 @@
 #ifndef __LINUX_USB_GADGET_H
 #define __LINUX_USB_GADGET_H
 
+#include <common.h>
 #include <linux/list.h>
+#include <linux/usb/linux-compat.h>
+
+#define USB_GADGET_DELAYED_STATUS       0x7fff /* Impossibly large value */
 
 struct usb_ep;
 
@@ -83,6 +87,11 @@ struct usb_request {
        unsigned                length;
        dma_addr_t              dma;
 
+       struct scatterlist      *sg;
+       unsigned                num_sgs;
+       unsigned                num_mapped_sgs;
+
+       unsigned                stream_id:16;
        unsigned                no_interrupt:1;
        unsigned                zero:1;
        unsigned                short_not_ok:1;
@@ -119,6 +128,8 @@ struct usb_ep_ops {
        int (*dequeue) (struct usb_ep *ep, struct usb_request *req);
 
        int (*set_halt) (struct usb_ep *ep, int value);
+       int (*set_wedge) (struct usb_ep *ep);
+
        int (*fifo_status) (struct usb_ep *ep);
        void (*fifo_flush) (struct usb_ep *ep);
 };
@@ -140,10 +151,17 @@ struct usb_ep_ops {
  */
 struct usb_ep {
        void                    *driver_data;
+
        const char              *name;
        const struct usb_ep_ops *ops;
        struct list_head        ep_list;
        unsigned                maxpacket:16;
+       unsigned                max_streams:16;
+       unsigned                mult:2;
+       unsigned                maxburst:5;
+       u8                      address;
+       const struct usb_endpoint_descriptor    *desc;
+       const struct usb_ss_ep_comp_descriptor  *comp_desc;
 };
 
 /*-------------------------------------------------------------------------*/
@@ -390,10 +408,120 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
                ep->ops->fifo_flush(ep);
 }
 
+/*-------------------------------------------------------------------------*/
+
+struct usb_dcd_config_params {
+       __u8  bU1devExitLat;    /* U1 Device exit Latency */
+#define USB_DEFAULT_U1_DEV_EXIT_LAT    0x01    /* Less then 1 microsec */
+       __le16 bU2DevExitLat;   /* U2 Device exit Latency */
+#define USB_DEFAULT_U2_DEV_EXIT_LAT    0x1F4   /* Less then 500 microsec */
+};
 
 /*-------------------------------------------------------------------------*/
 
 struct usb_gadget;
+struct usb_gadget_driver;
+
+/*-------------------------------------------------------------------------*/
+
+/* utility to simplify dealing with string descriptors */
+
+/**
+ * struct usb_string - wraps a C string and its USB id
+ * @id:the (nonzero) ID for this string
+ * @s:the string, in UTF-8 encoding
+ *
+ * If you're using usb_gadget_get_string(), use this to wrap a string
+ * together with its ID.
+ */
+struct usb_string {
+       u8                      id;
+       const char              *s;
+};
+
+/**
+ * struct usb_gadget_strings - a set of USB strings in a given language
+ * @language:identifies the strings' language (0x0409 for en-us)
+ * @strings:array of strings with their ids
+ *
+ * If you're using usb_gadget_get_string(), use this to wrap all the
+ * strings for a given language.
+ */
+struct usb_gadget_strings {
+       u16                     language;       /* 0x0409 for en-us */
+       struct usb_string       *strings;
+};
+
+struct usb_gadget_string_container {
+       struct list_head        list;
+       u8                      *stash[0];
+};
+
+/* put descriptor for string with that id into buf (buflen >= 256) */
+int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
+
+/*-------------------------------------------------------------------------*/
+
+/* utility to simplify managing config descriptors */
+
+/* write vector of descriptors into buffer */
+int usb_descriptor_fillbuf(void *, unsigned,
+               const struct usb_descriptor_header **);
+
+/* build config descriptor from single descriptor vector */
+int usb_gadget_config_buf(const struct usb_config_descriptor *config,
+       void *buf, unsigned buflen, const struct usb_descriptor_header **desc);
+
+/* copy a NULL-terminated vector of descriptors */
+struct usb_descriptor_header **usb_copy_descriptors(
+               struct usb_descriptor_header **);
+
+/**
+ * usb_free_descriptors - free descriptors returned by usb_copy_descriptors()
+ * @v: vector of descriptors
+ */
+static inline void usb_free_descriptors(struct usb_descriptor_header **v)
+{
+       kfree(v);
+}
+
+struct usb_function;
+int usb_assign_descriptors(struct usb_function *f,
+               struct usb_descriptor_header **fs,
+               struct usb_descriptor_header **hs,
+               struct usb_descriptor_header **ss);
+void usb_free_all_descriptors(struct usb_function *f);
+
+/*-------------------------------------------------------------------------*/
+
+/* utility to simplify map/unmap of usb_requests to/from DMA */
+
+extern int usb_gadget_map_request(struct usb_gadget *gadget,
+               struct usb_request *req, int is_in);
+
+extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
+               struct usb_request *req, int is_in);
+
+/*-------------------------------------------------------------------------*/
+
+/* utility to set gadget state properly */
+
+extern void usb_gadget_set_state(struct usb_gadget *gadget,
+               enum usb_device_state state);
+
+/*-------------------------------------------------------------------------*/
+
+/* utility wrapping a simple endpoint selection policy */
+
+extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
+                       struct usb_endpoint_descriptor *);
+
+
+extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *,
+                       struct usb_endpoint_descriptor *,
+                       struct usb_ss_ep_comp_descriptor *);
+
+extern void usb_ep_autoconfig_reset(struct usb_gadget *);
 
 /* the rest of the api to the controller hardware: device operations,
  * which don't involve endpoints (or i/o).
@@ -407,11 +535,11 @@ struct usb_gadget_ops {
        int     (*pullup) (struct usb_gadget *, int is_on);
        int     (*ioctl)(struct usb_gadget *,
                                unsigned code, unsigned long param);
-};
-
-struct device {
-       void            *driver_data;   /* data private to the driver */
-       void            *device_data;   /* data private to the device */
+       void    (*get_config_params)(struct usb_dcd_config_params *);
+       int     (*udc_start)(struct usb_gadget *,
+                       struct usb_gadget_driver *);
+       int     (*udc_stop)(struct usb_gadget *,
+                       struct usb_gadget_driver *);
 };
 
 /**
@@ -462,6 +590,9 @@ struct usb_gadget {
        struct usb_ep                   *ep0;
        struct list_head                ep_list;        /* of usb_ep */
        enum usb_device_speed           speed;
+       enum usb_device_speed           max_speed;
+       enum usb_device_state           state;
+       unsigned                        sg_supported:1;
        unsigned                        is_dualspeed:1;
        unsigned                        is_otg:1;
        unsigned                        is_a_peripheral:1;
@@ -470,6 +601,9 @@ struct usb_gadget {
        unsigned                        a_alt_hnp_support:1;
        const char                      *name;
        struct device                   dev;
+       unsigned                        out_epnum;
+       unsigned                        in_epnum;
+
 };
 
 static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
@@ -756,16 +890,22 @@ static inline int usb_gadget_disconnect(struct usb_gadget 
*gadget)
  * power is maintained.
  */
 struct usb_gadget_driver {
-       enum usb_device_speed   speed;
-       int                     (*bind)(struct usb_gadget *);
+       char                    *function;
+       enum usb_device_speed   max_speed;
+       int                     (*bind)(struct usb_gadget *gadget,
+                                       struct usb_gadget_driver *driver);
        void                    (*unbind)(struct usb_gadget *);
        int                     (*setup)(struct usb_gadget *,
                                        const struct usb_ctrlrequest *);
        void                    (*disconnect)(struct usb_gadget *);
        void                    (*suspend)(struct usb_gadget *);
        void                    (*resume)(struct usb_gadget *);
-};
 
+       /* FIXME support safe rmmod */
+       struct device_driver    driver;
+       enum usb_device_speed   speed;
+
+};
 
 /*-------------------------------------------------------------------------*/
 
@@ -806,34 +946,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver 
*driver);
 
 /*-------------------------------------------------------------------------*/
 
-/* utility to simplify dealing with string descriptors */
-
-/**
- * struct usb_string - wraps a C string and its USB id
- * @id:the (nonzero) ID for this string
- * @s:the string, in UTF-8 encoding
- *
- * If you're using usb_gadget_get_string(), use this to wrap a string
- * together with its ID.
- */
-struct usb_string {
-       u8                      id;
-       const char              *s;
-};
-
-/**
- * struct usb_gadget_strings - a set of USB strings in a given language
- * @language:identifies the strings' language (0x0409 for en-us)
- * @strings:array of strings with their ids
- *
- * If you're using usb_gadget_get_string(), use this to wrap all the
- * strings for a given language.
- */
-struct usb_gadget_strings {
-       u16                     language;       /* 0x0409 for en-us */
-       struct usb_string       *strings;
-};
-
 /* put descriptor for string with that id into buf (buflen >= 256) */
 int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
 
diff --git a/include/linux/usb/linux-compat.h b/include/linux/usb/linux-compat.h
new file mode 100644
index 0000000..123cc2e
--- /dev/null
+++ b/include/linux/usb/linux-compat.h
@@ -0,0 +1,234 @@
+/*
+ * linux_compat.h -- linux compatibility header file
+ *
+ * Copyright (C) 2013
+ * Texas Instruments Incorporated.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __LINUX_COMPAT_H__
+#define __LINUX_COMPAT_H__
+
+#include <malloc.h>
+#include <linux/list.h>
+#include <linux/compat.h>
+#include <asm-generic/errno.h>
+
+#define __init
+#define __devinit
+#define __devinitdata
+#define __devinitconst
+#define __iomem
+
+struct unused {};
+typedef struct unused unused_t;
+
+typedef int irqreturn_t;
+typedef unused_t spinlock_t;
+
+struct work_struct {};
+
+struct timer_list {};
+struct notifier_block {};
+
+typedef unsigned long dmaaddr_t;
+#define BUS_ID_SIZE            20
+
+struct device {
+       struct device           *parent;
+       struct class            *class;
+       char bus_id[BUS_ID_SIZE];       /* position on parent bus */
+       dev_t devt;     /* dev_t, creates the sysfs "dev" */
+       void (*release)(struct device *dev);
+       void *driver_data;      /* data private to the driver */
+       void *device_data;   /* data private to the device */
+};
+
+/**
+ * struct device_driver - The basic device driver structure
+ * @name:      Name of the device driver.
+ * @bus:       The bus which the device of this driver belongs to.
+ * @suppress_bind_attrs: Disables bind/unbind via sysfs.
+ *
+ * The device driver-model tracks all of the drivers known to the system.
+ * The main reason for this tracking is to enable the driver core to match
+ * up drivers with new devices. Once drivers are known objects within the
+ * system, however, a number of other things become possible. Device drivers
+ * can export information and configuration variables that are independent
+ * of any specific device.
+ */
+struct device_driver {
+       const char              *name;
+       struct bus_type         *bus;
+
+       bool suppress_bind_attrs;       /* disables bind/unbind via sysfs */
+
+};
+
+/*
+ * Loop over each sg element, following the pointer to a new list if necessary
+ */
+#define for_each_sg(sglist, sg, nr, __i)       \
+       for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
+
+/* Errors */
+#define        EOPNOTSUPP 95
+
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+
+#define setup_timer(timer, func, data) do {} while (0)
+#define del_timer_sync(timer) do {} while (0)
+#define schedule_work(work) do {} while (0)
+#define INIT_WORK(work, fun) do {} while (0)
+
+#define cpu_relax() do {} while (0)
+
+#define dev_dbg(dev, fmt, args...)             \
+       debug(fmt, ##args)
+#define dev_vdbg(dev, fmt, args...)            \
+       debug(fmt, ##args)
+#define dev_info(dev, fmt, args...)            \
+       printf(fmt, ##args)
+#define dev_err(dev, fmt, args...)             \
+       printf(fmt, ##args)
+#define printk printf
+
+#define WARN(condition, fmt, args...) ({       \
+       int ret_warn = !!condition;             \
+       if (ret_warn)                           \
+               printf(fmt, ##args);            \
+       ret_warn; })
+
+#define KERN_DEBUG
+#define KERN_NOTICE
+#define KERN_WARNING
+#define KERN_ERR
+#define WARN_ON_ONCE WARN_ON
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n) (0)
+
+#define kfree(ptr) free(ptr)
+
+/* common */
+#define spin_lock_init(...)
+#define spin_lock(...)
+#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while (0)
+#define spin_unlock(...)
+#define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
+#define disable_irq(...)
+#define enable_irq(...)
+
+#define mutex_init(...)
+#define mutex_lock(...)
+#define mutex_unlock(...)
+
+#define GFP_KERNEL     0
+
+#define IRQ_HANDLED    1
+
+#define        EOPNOTSUPP      95
+#define ENOTSUPP       524     /* Operation is not supported */
+
+#define BITS_PER_BYTE                          8
+#define BITS_TO_LONGS(nr) \
+       DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
+#define DECLARE_BITMAP(name, bits) \
+       unsigned long name[BITS_TO_LONGS(bits)]
+
+#define small_const_nbits(nbits) \
+       (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
+
+/* TODO: Figure out these structs */
+static inline int pm_runtime_get_sync(struct device *dev) { return 0; }
+#define pm_runtime_put(dev) do {} while (0)
+#define pm_runtime_put_sync(dev) do {} while (0)
+#define pm_runtime_use_autosuspend(dev) do {} while (0)
+#define pm_runtime_set_autosuspend_delay(dev, delay) do {} while (0)
+#define pm_runtime_enable(dev) do {} while (0)
+#define pm_runtime_disable(dev) do {} while (0)
+
+#define MODULE_DESCRIPTION(desc)
+#define MODULE_AUTHOR(author)
+#define MODULE_LICENSE(license)
+#define MODULE_ALIAS(alias)
+#define module_param(name, type, perm)
+#define MODULE_PARM_DESC(name, desc)
+#define EXPORT_SYMBOL_GPL(name)
+#define MODULE_DEVICE_TABLE(type, name)
+
+#define writesl(a, d, s) __raw_writesl((unsigned long)a, d, s)
+#define readsl(a, d, s) __raw_readsl((unsigned long)a, d, s)
+#define writesw(a, d, s) __raw_writesw((unsigned long)a, d, s)
+#define readsw(a, d, s) __raw_readsw((unsigned long)a, d, s)
+#define writesb(a, d, s) __raw_writesb((unsigned long)a, d, s)
+#define readsb(a, d, s) __raw_readsb((unsigned long)a, d, s)
+
+/* IRQ */
+#define IRQ_NONE 0
+#define IRQ_WAKE_THREAD 0
+#define IRQF_SHARED 0
+#define IRQF_ONESHOT 0
+#define GFP_KERNEL     0
+
+#define dev_set_drvdata(dev, data) do {} while (0)
+
+#define disable_irq_wake(irq) do {} while (0)
+#define enable_irq_wake(irq) -EINVAL
+#define free_irq(irq, data) do {} while (0)
+#define request_irq(nr, f, flags, nm, data) 0
+
+#define device_init_wakeup(dev, a) do {} while (0)
+
+#define platform_data device_data
+
+#ifndef wmb
+#define wmb()                  asm volatile (""   : : : "memory")
+#endif
+
+#define msleep(a)      udelay(a * 1000)
+
+/*
+ * Map U-Boot config options to Linux ones
+ */
+#ifdef CONFIG_OMAP34XX
+#define CONFIG_SOC_OMAP3430
+#endif
+
+/* TODO: Figure out these structs
+static inline int IS_ENABLED(option) { return option; };*/
+#define lower_32_bits(n) ((u32)(n))
+#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
+#define PTR_ALIGN(p, a)                ((typeof(p))ALIGN((unsigned long)(p), 
(a)))
+#define IS_ALIGNED(x, a)               (((x) & ((typeof(x))(a) - 1)) == 0)
+#define DMA_BIT_MASK(n)        (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
+
+
+static inline void *dma_alloc_coherent(void *dev, size_t size,
+               dma_addr_t *dma_handle, gfp_t gfp)
+{
+       void *p;
+
+       p = malloc(size);
+       *dma_handle = (unsigned long)p;
+       return p;
+}
+
+static inline void dma_free_coherent(struct device *dev, size_t size,
+               void *vaddr, dma_addr_t bus)
+{
+       free(vaddr);
+}
+
+#endif /* __LINUX_COMPAT_H__ */
diff --git a/include/linux/usb/usb-compat.h b/include/linux/usb/usb-compat.h
index a0bee5a..a46d1e6 100644
--- a/include/linux/usb/usb-compat.h
+++ b/include/linux/usb/usb-compat.h
@@ -1,15 +1,36 @@
+/*
+ * Copyright (C) 2013
+ * Texas Instruments Incorporated.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * Note: This code has been backported from linux source include/linux/usb.h
+ * At the time of the backport the linux source did not contain a license
+ * nor a copyright.
+ *
+ */
+
 #ifndef __LINUX_USB_H
 #define __LINUX_USB_H
 
+#define __UBOOT__
+
+#ifndef __UBOOT__
 #include <linux/mod_devicetable.h>
 #include <linux/usb/ch9.h>
-
-#define USB_MAJOR                      180
-#define USB_DEVICE_MAJOR               189
-
-
-#ifdef __KERNEL__
-
 #include <linux/errno.h>        /* for -ENODEV */
 #include <linux/delay.h>       /* for mdelay() */
 #include <linux/interrupt.h>   /* for in_interrupt() */
@@ -22,6 +43,20 @@
 #include <linux/mutex.h>       /* for struct mutex */
 #include <linux/pm_runtime.h>  /* for runtime PM */
 
+#else
+
+#include <common.h>
+#include <linux/list.h>                /* for struct list_head */
+#include <linux/usb/ch9.h>
+#include <linux/usb/linux-compat.h>
+
+#include "usb-mod-devicetable.h"
+
+#endif
+
+#define USB_MAJOR                      180
+#define USB_DEVICE_MAJOR               189
+
 struct usb_device;
 struct usb_driver;
 struct wusb_dev;
@@ -95,6 +130,16 @@ enum usb_interface_condition {
        USB_INTERFACE_UNBINDING,
 };
 
+#ifdef __UBOOT__
+enum {
+       /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
+       PACKET_SIZE_8   = 0,
+       PACKET_SIZE_16  = 1,
+       PACKET_SIZE_32  = 2,
+       PACKET_SIZE_64  = 3,
+};
+#endif
+
 /**
  * struct usb_interface - what usb device drivers talk to
  * @altsetting: array of interface structures, one for each alternate
@@ -169,7 +214,14 @@ struct usb_interface {
        /* If there is an interface association descriptor then it will list
         * the associated interfaces */
        struct usb_interface_assoc_descriptor *intf_assoc;
-
+#ifdef __UBOOT__
+#define USB_MAXENDPOINTS               16
+       struct usb_interface_descriptor desc;
+       struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
+       unsigned char   no_of_ep;
+       unsigned char   act_altsetting;
+       struct usb_ss_ep_comp_descriptor ss_ep_comp_desc[USB_MAXENDPOINTS];
+#endif
        int minor;                      /* minor number this interface is
                                         * bound to */
        enum usb_interface_condition condition;         /* state of binding */
@@ -184,19 +236,31 @@ struct usb_interface {
 
        struct device dev;              /* interface specific device info */
        struct device *usb_dev;
+#ifndef __UBOOT__
        atomic_t pm_usage_cnt;          /* usage counter for autosuspend */
        struct work_struct reset_ws;    /* for resets in atomic context */
+#endif
 };
 #define        to_usb_interface(d) container_of(d, struct usb_interface, dev)
 
 static inline void *usb_get_intfdata(struct usb_interface *intf)
 {
+#ifndef __UBOOT__
        return dev_get_drvdata(&intf->dev);
+#else
+       /* TODO Need to implement this to return the correct pointer */
+       return NULL;
+#endif
 }
 
 static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
 {
+#ifndef __UBOOT__
        dev_set_drvdata(&intf->dev, data);
+#else
+       /* TODO Need to implement this to return the correct pointer */
+       return;
+#endif
 }
 
 struct usb_interface *usb_get_intf(struct usb_interface *intf);
@@ -222,17 +286,29 @@ void usb_put_intf(struct usb_interface *intf);
  */
 struct usb_interface_cache {
        unsigned num_altsetting;        /* number of alternate settings */
+#ifndef __UBOOT__
        struct kref ref;                /* reference counter */
-
+#endif
        /* variable-length array of alternate settings for this interface,
         * stored in no particular order */
        struct usb_host_interface altsetting[0];
 };
+
 #define        ref_to_usb_interface_cache(r) \
                container_of(r, struct usb_interface_cache, ref)
 #define        altsetting_to_usb_interface_cache(a) \
                container_of(a, struct usb_interface_cache, altsetting[0])
 
+#ifdef __UBOOT__
+/* Configuration information.. */
+struct usb_config {
+       struct usb_config_descriptor desc;
+
+       unsigned char   no_of_if;       /* number of interfaces */
+       struct usb_interface if_desc[USB_MAXINTERFACES];
+} __attribute__ ((packed));
+#endif
+
 /**
  * struct usb_host_config - representation of a device's configuration
  * @desc: the device's configuration descriptor.
@@ -501,6 +577,35 @@ struct usb3_lpm_parameters {
 struct usb_device {
        int             devnum;
        char            devpath[16];
+#ifdef __UBOOT__
+       /* Legacy uBoot usb_device definitions */
+       char    mf[32];                 /* manufacturer */
+       char    prod[32];               /* product */
+
+       struct usb_device *children[USB_MAXCHILDREN];
+       struct usb_config config; /* config descriptor */
+
+       int epmaxpacketin[16];          /* INput endpoint specific maximums */
+       int epmaxpacketout[16];         /* OUTput endpoint specific maximums */
+       int configno;                   /* selected config number */
+       int act_len;                    /* transfered bytes */
+       int portnr;
+       /* Maximum packet size; one of: PACKET_SIZE_* */
+       int maxpacketsize;
+       int irq_act_len;                /* transfered bytes */
+       int (*irq_handle)(struct usb_device *dev);
+
+       /* endpoint halts; one bit per endpoint # & direction;
+        * [0] = IN, [1] = OUT
+        */
+       unsigned int halted[2];
+       unsigned long status;
+       unsigned long irq_status;
+
+       void *controller;               /* hardware controller private data */
+       void *privptr;
+#endif
+
        u32             route;
        enum usb_device_state   state;
        enum usb_device_speed   speed;
@@ -518,8 +623,13 @@ struct usb_device {
 
        struct usb_device_descriptor descriptor;
        struct usb_host_bos *bos;
-       struct usb_host_config *config;
 
+#ifndef __UBOOT__
+       /* This conflicts with legacy uBoot config */
+       struct usb_host_config *config;
+#else
+       struct usb_host_config *host_config;
+#endif
        struct usb_host_config *actconfig;
        struct usb_host_endpoint *ep_in[16];
        struct usb_host_endpoint *ep_out[16];
@@ -552,8 +662,9 @@ struct usb_device {
        int maxchild;
 
        u32 quirks;
+#ifndef __UBOOT__
        atomic_t urbnum;
-
+#endif
        unsigned long active_duration;
 
 #ifdef CONFIG_PM
@@ -707,7 +818,11 @@ extern int usb_driver_claim_interface(struct usb_driver 
*driver,
  */
 static inline int usb_interface_claimed(struct usb_interface *iface)
 {
+#ifndef __UBOOT__
        return (iface->dev.driver != NULL);
+#else
+       return true;
+#endif
 }
 
 extern void usb_driver_release_interface(struct usb_driver *driver,
@@ -1032,11 +1147,11 @@ struct usb_driver {
 
        int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
                        void *buf);
-
+#ifdef CONFIG_PM
        int (*suspend) (struct usb_interface *intf, pm_message_t message);
        int (*resume) (struct usb_interface *intf);
        int (*reset_resume)(struct usb_interface *intf);
-
+#endif
        int (*pre_reset)(struct usb_interface *intf);
        int (*post_reset)(struct usb_interface *intf);
 
@@ -1075,9 +1190,11 @@ struct usb_device_driver {
 
        int (*probe) (struct usb_device *udev);
        void (*disconnect) (struct usb_device *udev);
-
+#ifdef CONFIG_PM
        int (*suspend) (struct usb_device *udev, pm_message_t message);
        int (*resume) (struct usb_device *udev, pm_message_t message);
+#endif
+
        struct usbdrv_wrap drvwrap;
        unsigned int supports_autosuspend:1;
 };
@@ -1104,7 +1221,7 @@ struct usb_class_driver {
        const struct file_operations *fops;
        int minor_base;
 };
-
+#ifndef __UBOOT__
 /*
  * use these in module_init()/module_exit()
  * and don't forget MODULE_DEVICE_TABLE(usb, ...)
@@ -1140,6 +1257,7 @@ extern void usb_deregister_dev(struct usb_interface *intf,
                               struct usb_class_driver *class_driver);
 
 extern int usb_disabled(void);
+#endif /* __UBOOT__ */
 
 /* ----------------------------------------------------------------------- */
 
@@ -1187,7 +1305,9 @@ struct urb;
 
 struct usb_anchor {
        struct list_head urb_list;
+#ifndef __UBOOT__
        wait_queue_head_t wait;
+#endif
        spinlock_t lock;
        unsigned int poisoned:1;
 };
@@ -1195,7 +1315,9 @@ struct usb_anchor {
 static inline void init_usb_anchor(struct usb_anchor *anchor)
 {
        INIT_LIST_HEAD(&anchor->urb_list);
+#ifndef __UBOOT__
        init_waitqueue_head(&anchor->wait);
+#endif
        spin_lock_init(&anchor->lock);
 }
 
@@ -1383,11 +1505,15 @@ typedef void (*usb_complete_t)(struct urb *);
  * usb_submit_urb() till the entry into the completion routine.
  */
 struct urb {
+#ifndef __UBOOT__
        /* private: usb core and host controller only fields in the urb */
        struct kref kref;               /* reference count of the URB */
+#endif
        void *hcpriv;                   /* private data for host controller */
+#ifndef __UBOOT__
        atomic_t use_count;             /* concurrent submissions counter */
        atomic_t reject;                /* submissions will fail */
+#endif
        int unlinked;                   /* unlink error code */
 
        /* public: documented fields in the urb that can be used by drivers */
@@ -1403,13 +1529,17 @@ struct urb {
        unsigned int transfer_flags;    /* (in) URB_SHORT_NOT_OK | ...*/
        void *transfer_buffer;          /* (in) associated data buffer */
        dma_addr_t transfer_dma;        /* (in) dma addr for transfer_buffer */
+#ifndef __UBOOT__
        struct scatterlist *sg;         /* (in) scatter gather buffer list */
+#endif
        int num_mapped_sgs;             /* (internal) mapped sg entries */
        int num_sgs;                    /* (in) number of entries in the sg 
list */
        u32 transfer_buffer_length;     /* (in) data buffer length */
        u32 actual_length;              /* (return) actual transfer length */
        unsigned char *setup_packet;    /* (in) setup packet (control only) */
+#ifndef __UBOOT__
        dma_addr_t setup_dma;           /* (in) dma addr for setup_packet */
+#endif
        int start_frame;                /* (modify) start frame (ISO) */
        int number_of_packets;          /* (in) number of ISO packets */
        int interval;                   /* (modify) transfer interval
@@ -1604,7 +1734,7 @@ void usb_buffer_unmap_sg(const struct usb_device *dev, 
int is_in,
 /*-------------------------------------------------------------------*
  *                         SYNCHRONOUS CALL SUPPORT                  *
  *-------------------------------------------------------------------*/
-
+#ifndef __UBOOT__
 extern int usb_control_msg(struct usb_device *dev, unsigned int pipe,
        __u8 request, __u8 requesttype, __u16 value, __u16 index,
        void *data, __u16 size, int timeout);
@@ -1630,6 +1760,7 @@ extern void usb_reset_endpoint(struct usb_device *dev, 
unsigned int epaddr);
 
 /* this request isn't really synchronous, but it belongs with the others */
 extern int usb_driver_set_configuration(struct usb_device *udev, int config);
+#endif
 
 /*
  * timeouts, in milliseconds, used for sending/receiving control messages
@@ -1674,7 +1805,9 @@ struct usb_sg_request {
        struct urb              **urbs;
 
        int                     count;
+#ifndef __UBOOT__
        struct completion       complete;
+#endif
 };
 
 int usb_sg_init(
@@ -1762,7 +1895,7 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int 
pipe)
 }
 
 /*-------------------------------------------------------------------------*/
-
+#ifndef __UBOOT__
 static inline __u16
 usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
 {
@@ -1770,10 +1903,16 @@ usb_maxpacket(struct usb_device *udev, int pipe, int 
is_out)
        unsigned                        epnum = usb_pipeendpoint(pipe);
 
        if (is_out) {
+#ifndef __UBOOT__
+               /* Fix this warning */
                WARN_ON(usb_pipein(pipe));
+#endif
                ep = udev->ep_out[epnum];
        } else {
+#ifndef __UBOOT__
+               /* Fix this warning */
                WARN_ON(usb_pipeout(pipe));
+#endif
                ep = udev->ep_in[epnum];
        }
        if (!ep)
@@ -1782,6 +1921,7 @@ usb_maxpacket(struct usb_device *udev, int pipe, int 
is_out)
        /* NOTE:  only 0x07ff bits are for packet size... */
        return usb_endpoint_maxp(&ep->desc);
 }
+#endif
 
 /* ----------------------------------------------------------------------- */
 
@@ -1810,6 +1950,16 @@ extern void usb_unregister_notify(struct notifier_block 
*nb);
 /* debugfs stuff */
 extern struct dentry *usb_debug_root;
 
-#endif  /* __KERNEL__ */
+#ifdef __UBOOT__
+/* device request (setup) */
+struct devrequest {
+       unsigned char   requesttype;
+       unsigned char   request;
+       unsigned short  value;
+       unsigned short  index;
+       unsigned short  length;
+} __attribute__ ((packed));
 
 #endif
+
+#endif  /* __KERNEL__ */
diff --git a/include/linux/usb/usb-mod-devicetable.h 
b/include/linux/usb/usb-mod-devicetable.h
new file mode 100644
index 0000000..c90691c
--- /dev/null
+++ b/include/linux/usb/usb-mod-devicetable.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2013
+ * Texas Instruments Incorporated.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * Note: This part of code has been derived from linux source mod_devicetable.h
+ *
+ */
+
+#ifndef LINUX_MOD_DEVICETABLE_H
+#define LINUX_MOD_DEVICETABLE_H
+
+#define __UBOOT__
+/**
+ * struct usb_device_id - identifies USB devices for probing and hotplugging
+ * @match_flags: Bit mask controlling of the other fields are used to match
+ *     against new devices.  Any field except for driver_info may be used,
+ *     although some only make sense in conjunction with other fields.
+ *     This is usually set by a USB_DEVICE_*() macro, which sets all
+ *     other fields in this structure except for driver_info.
+ * @idVendor: USB vendor ID for a device; numbers are assigned
+ *     by the USB forum to its members.
+ * @idProduct: Vendor-assigned product ID.
+ * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
+ *     This is also used to identify individual product versions, for
+ *     a range consisting of a single device.
+ * @bcdDevice_hi: High end of version number range.  The range of product
+ *     versions is inclusive.
+ * @bDeviceClass: Class of device; numbers are assigned
+ *     by the USB forum.  Products may choose to implement classes,
+ *     or be vendor-specific.  Device classes specify behavior of all
+ *     the interfaces on a devices.
+ * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
+ * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
+ * @bInterfaceClass: Class of interface; numbers are assigned
+ *     by the USB forum.  Products may choose to implement classes,
+ *     or be vendor-specific.  Interface classes specify behavior only
+ *     of a given interface; other interfaces may support other classes.
+ * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
+ * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
+ * @bInterfaceNumber: Number of interface; composite devices may use
+ *     fixed interface numbers to differentiate between vendor-specific
+ *     interfaces.
+ * @driver_info: Holds information used by the driver.  Usually it holds
+ *     a pointer to a descriptor understood by the driver, or perhaps
+ *     device flags.
+ *
+ * In most cases, drivers will create a table of device IDs by using
+ * USB_DEVICE(), or similar macros designed for that purpose.
+ * They will then export it to userspace using MODULE_DEVICE_TABLE(),
+ * and provide it to the USB core through their usb_driver structure.
+ *
+ * See the usb_match_id() function for information about how matches are
+ * performed.  Briefly, you will normally use one of several macros to help
+ * construct these entries.  Each entry you provide will either identify
+ * one or more specific products, or will identify a class of products
+ * which have agreed to behave the same.  You should put the more specific
+ * matches towards the beginning of your table, so that driver_info can
+ * record quirks of specific products.
+ */
+struct usb_device_id {
+       /* which fields to match against? */
+       __u16           match_flags;
+
+       /* Used for product specific matches; range is inclusive */
+       __u16           idVendor;
+       __u16           idProduct;
+       __u16           bcdDevice_lo;
+       __u16           bcdDevice_hi;
+
+       /* Used for device class matches */
+       __u8            bDeviceClass;
+       __u8            bDeviceSubClass;
+       __u8            bDeviceProtocol;
+
+       /* Used for interface class matches */
+       __u8            bInterfaceClass;
+       __u8            bInterfaceSubClass;
+       __u8            bInterfaceProtocol;
+
+       /* Used for vendor-specific interface matches */
+       __u8            bInterfaceNumber;
+#ifndef __UBOOT__
+       /* not matched against */
+       kernel_ulong_t  driver_info
+               __attribute__((aligned(sizeof(kernel_ulong_t))));
+#endif
+};
+
+/* Some useful macros to use to create struct usb_device_id */
+#define USB_DEVICE_ID_MATCH_VENDOR             0x0001
+#define USB_DEVICE_ID_MATCH_PRODUCT            0x0002
+#define USB_DEVICE_ID_MATCH_DEV_LO             0x0004
+#define USB_DEVICE_ID_MATCH_DEV_HI             0x0008
+#define USB_DEVICE_ID_MATCH_DEV_CLASS          0x0010
+#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS       0x0020
+#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL       0x0040
+#define USB_DEVICE_ID_MATCH_INT_CLASS          0x0080
+#define USB_DEVICE_ID_MATCH_INT_SUBCLASS       0x0100
+#define USB_DEVICE_ID_MATCH_INT_PROTOCOL       0x0200
+#define USB_DEVICE_ID_MATCH_INT_NUMBER         0x0400
+
+#define HID_ANY_ID                             (~0)
+#define HID_BUS_ANY                            0xffff
+#define HID_GROUP_ANY                          0x0000
+
+struct hid_device_id {
+       __u16 bus;
+       __u16 group;
+       __u32 vendor;
+       __u32 product;
+#ifndef __UBOOT__
+       kernel_ulong_t driver_data;
+#endif
+};
+
+#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/usb.h b/include/usb.h
index d7b082d..0598972 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -28,6 +28,7 @@
 
 #include <usb_defs.h>
 #include <linux/usb/ch9.h>
+#include <linux/usb/usb-compat.h>
 
 /*
  * The EHCI spec says that we must align to at least 32 bytes.  However,
@@ -45,9 +46,7 @@
 
 #define USB_MAX_DEVICE                 32
 #define USB_MAXCONFIG                  8
-#define USB_MAXINTERFACES              8
 #define USB_MAXENDPOINTS               16
-#define USB_MAXCHILDREN                        8       /* This is arbitrary */
 #define USB_MAX_HUB                    16
 
 #define USB_CNTL_TIMEOUT 100 /* 100ms timeout */
@@ -58,92 +57,6 @@
  */
 #define USB_TIMEOUT_MS(pipe) (usb_pipebulk(pipe) ? 5000 : 1000)
 
-/* device request (setup) */
-struct devrequest {
-       unsigned char   requesttype;
-       unsigned char   request;
-       unsigned short  value;
-       unsigned short  index;
-       unsigned short  length;
-} __attribute__ ((packed));
-
-/* Interface */
-struct usb_interface {
-       struct usb_interface_descriptor desc;
-
-       unsigned char   no_of_ep;
-       unsigned char   num_altsetting;
-       unsigned char   act_altsetting;
-
-       struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
-       /*
-        * Super Speed Device will have Super Speed Endpoint
-        * Companion Descriptor  (section 9.6.7 of usb 3.0 spec)
-        * Revision 1.0 June 6th 2011
-        */
-       struct usb_ss_ep_comp_descriptor ss_ep_comp_desc[USB_MAXENDPOINTS];
-} __attribute__ ((packed));
-
-/* Configuration information.. */
-struct usb_config {
-       struct usb_config_descriptor desc;
-
-       unsigned char   no_of_if;       /* number of interfaces */
-       struct usb_interface if_desc[USB_MAXINTERFACES];
-} __attribute__ ((packed));
-
-enum {
-       /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
-       PACKET_SIZE_8   = 0,
-       PACKET_SIZE_16  = 1,
-       PACKET_SIZE_32  = 2,
-       PACKET_SIZE_64  = 3,
-};
-
-struct usb_device {
-       int     devnum;                 /* Device number on USB bus */
-       int     speed;                  /* full/low/high */
-       char    mf[32];                 /* manufacturer */
-       char    prod[32];               /* product */
-       char    serial[32];             /* serial number */
-
-       /* Maximum packet size; one of: PACKET_SIZE_* */
-       int maxpacketsize;
-       /* one bit for each endpoint ([0] = IN, [1] = OUT) */
-       unsigned int toggle[2];
-       /* endpoint halts; one bit per endpoint # & direction;
-        * [0] = IN, [1] = OUT
-        */
-       unsigned int halted[2];
-       int epmaxpacketin[16];          /* INput endpoint specific maximums */
-       int epmaxpacketout[16];         /* OUTput endpoint specific maximums */
-
-       int configno;                   /* selected config number */
-       /* Device Descriptor */
-       struct usb_device_descriptor descriptor
-               __attribute__((aligned(ARCH_DMA_MINALIGN)));
-       struct usb_config config; /* config descriptor */
-
-       int have_langid;                /* whether string_langid is valid yet */
-       int string_langid;              /* language ID for strings */
-       int (*irq_handle)(struct usb_device *dev);
-       unsigned long irq_status;
-       int irq_act_len;                /* transfered bytes */
-       void *privptr;
-       /*
-        * Child devices -  if this is a hub device
-        * Each instance needs its own set of data structures.
-        */
-       unsigned long status;
-       int act_len;                    /* transfered bytes */
-       int maxchild;                   /* Number of ports if hub */
-       int portnr;
-       struct usb_device *parent;
-       struct usb_device *children[USB_MAXCHILDREN];
-
-       void *controller;               /* hardware controller private data */
-};
-
 /**********************************************************************
  * this is how the lowlevel part communicate with the outer world
  */
@@ -155,7 +68,7 @@ struct usb_device {
        defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
        defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \
        defined(CONFIG_USB_MUSB_DSPS) || defined(CONFIG_USB_MUSB_AM35X) || \
-       defined(CONFIG_USB_MUSB_OMAP2PLUS)
+       defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined(CONFIG_USB_DWC3)
 
 int usb_lowlevel_init(int index, void **controller);
 int usb_lowlevel_stop(int index);
@@ -226,7 +139,6 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
 int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
                        void *buffer, int transfer_len, int interval);
 int usb_disable_asynch(int disable);
-int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
 int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
                                int cfgno);
 int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
@@ -295,32 +207,7 @@ int usb_set_interface(struct usb_device *dev, int 
interface, int alternate);
  * specification, so that much of the uhci driver can just mask the bits
  * appropriately.
  */
-/* Create various pipes... */
-#define create_pipe(dev,endpoint) \
-               (((dev)->devnum << 8) | ((endpoint) << 15) | \
-               (dev)->maxpacketsize)
 #define default_pipe(dev) ((dev)->speed << 26)
-
-#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
-                                        create_pipe(dev, endpoint))
-#define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
-                                        create_pipe(dev, endpoint) | \
-                                        USB_DIR_IN)
-#define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
-                                        create_pipe(dev, endpoint))
-#define usb_rcvisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
-                                        create_pipe(dev, endpoint) | \
-                                        USB_DIR_IN)
-#define usb_sndbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
-                                        create_pipe(dev, endpoint))
-#define usb_rcvbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
-                                        create_pipe(dev, endpoint) | \
-                                        USB_DIR_IN)
-#define usb_sndintpipe(dev, endpoint)  ((PIPE_INTERRUPT << 30) | \
-                                        create_pipe(dev, endpoint))
-#define usb_rcvintpipe(dev, endpoint)  ((PIPE_INTERRUPT << 30) | \
-                                        create_pipe(dev, endpoint) | \
-                                        USB_DIR_IN)
 #define usb_snddefctrl(dev)            ((PIPE_CONTROL << 30) | \
                                         default_pipe(dev))
 #define usb_rcvdefctrl(dev)            ((PIPE_CONTROL << 30) | \
@@ -343,8 +230,6 @@ int usb_set_interface(struct usb_device *dev, int 
interface, int alternate);
 #define usb_packetid(pipe)     (((pipe) & USB_DIR_IN) ? USB_PID_IN : \
                                 USB_PID_OUT)
 
-#define usb_pipeout(pipe)      ((((pipe) >> 7) & 1) ^ 1)
-#define usb_pipein(pipe)       (((pipe) >> 7) & 1)
 #define usb_pipedevice(pipe)   (((pipe) >> 8) & 0x7f)
 #define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
 #define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
diff --git a/include/usb/lin_gadget_compat.h b/include/usb/lin_gadget_compat.h
index 5bdcb8d..93305e0 100644
--- a/include/usb/lin_gadget_compat.h
+++ b/include/usb/lin_gadget_compat.h
@@ -24,34 +24,7 @@
 #define __LIN_COMPAT_H__
 
 #include <linux/compat.h>
-
-/* common */
-#define spin_lock_init(...)
-#define spin_lock(...)
-#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while (0)
-#define spin_unlock(...)
-#define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0)
-#define disable_irq(...)
-#define enable_irq(...)
-
-#define mutex_init(...)
-#define mutex_lock(...)
-#define mutex_unlock(...)
-
-#define GFP_KERNEL     0
-
-#define IRQ_HANDLED    1
-
-#define ENOTSUPP       524     /* Operation is not supported */
-
-#define BITS_PER_BYTE                          8
-#define BITS_TO_LONGS(nr) \
-       DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
-#define DECLARE_BITMAP(name, bits) \
-       unsigned long name[BITS_TO_LONGS(bits)]
-
-#define small_const_nbits(nbits) \
-       (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
+#include <linux/usb/linux-compat.h>
 
 static inline void bitmap_zero(unsigned long *dst, int nbits)
 {
-- 
1.7.9.5

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

Reply via email to