summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorLukasz Majewski <l.majewski@samsung.com>2012-05-02 17:47:02 +0200
committerMarek Vasut <marex@denx.de>2012-05-20 08:32:33 +0200
commit7010f5b94fa3c8e5daf95d4fab002eddbfa4e9b2 (patch)
tree1cbd81400486cd032a225a6471b5c3035d54e339 /include/usb
parentf3b05ca5335cf37658d28fa1f9c76758482aa6f6 (diff)
downloadblackbird-obmc-uboot-7010f5b94fa3c8e5daf95d4fab002eddbfa4e9b2.tar.gz
blackbird-obmc-uboot-7010f5b94fa3c8e5daf95d4fab002eddbfa4e9b2.zip
usb:gadget:composite USB composite gadget support
USB Composite gadget implementation for u-boot. It builds on top of USB UDC drivers. This commit is based on following files from Linux Kernel v2.6.36: ./include/linux/usb/composite.h ./drivers/usb/gadget/composite.c SHA1: d187abb9a83e6c6b6e9f2ca17962bdeafb4bc903 Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Marek Vasut <marex@denx.de>
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/lin_gadget_compat.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/usb/lin_gadget_compat.h b/include/usb/lin_gadget_compat.h
index 8287b9de9f..5bdcb8d797 100644
--- a/include/usb/lin_gadget_compat.h
+++ b/include/usb/lin_gadget_compat.h
@@ -44,6 +44,25 @@
#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)
+
+static inline void bitmap_zero(unsigned long *dst, int nbits)
+{
+ if (small_const_nbits(nbits))
+ *dst = 0UL;
+ else {
+ int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
+ memset(dst, 0, len);
+ }
+}
+
#define dma_cache_maint(addr, size, mode) cache_flush()
void cache_flush(void);
OpenPOWER on IntegriCloud