aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/gadget.h
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-11-22 04:11:50 -0500
committerFelipe Balbi <balbi@ti.com>2011-12-21 06:24:44 -0500
commit898c60867827796f0f6f84e5de446098d776c866 (patch)
tree0d15e6d19db58d1da68ca14a7e53609d729226fe /include/linux/usb/gadget.h
parent14ff96e04c0b29736c8c81fbe75e86dd373c8e22 (diff)
usb: gadget: introduce support for sg lists
Some controllers support scatter/gather transfers and that might be very useful for some gadget drivers. This means that we can make use of larger buffer allocations which means we will have less completion IRQs overtime, thus improving the perceived performance. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb/gadget.h')
-rw-r--r--include/linux/usb/gadget.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 4d99805bcbb7..da653b5c7134 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h>
23#include <linux/types.h> 24#include <linux/types.h>
24#include <linux/usb/ch9.h> 25#include <linux/usb/ch9.h>
25 26
@@ -32,6 +33,9 @@ struct usb_ep;
32 * @dma: DMA address corresponding to 'buf'. If you don't set this 33 * @dma: DMA address corresponding to 'buf'. If you don't set this
33 * field, and the usb controller needs one, it is responsible 34 * field, and the usb controller needs one, it is responsible
34 * for mapping and unmapping the buffer. 35 * for mapping and unmapping the buffer.
36 * @sg: a scatterlist for SG-capable controllers.
37 * @num_sgs: number of SG entries
38 * @num_mapped_sgs: number of SG entries mapped to DMA (internal)
35 * @length: Length of that data 39 * @length: Length of that data
36 * @stream_id: The stream id, when USB3.0 bulk streams are being used 40 * @stream_id: The stream id, when USB3.0 bulk streams are being used
37 * @no_interrupt: If true, hints that no completion irq is needed. 41 * @no_interrupt: If true, hints that no completion irq is needed.
@@ -88,6 +92,10 @@ struct usb_request {
88 unsigned length; 92 unsigned length;
89 dma_addr_t dma; 93 dma_addr_t dma;
90 94
95 struct scatterlist *sg;
96 unsigned num_sgs;
97 unsigned num_mapped_sgs;
98
91 unsigned stream_id:16; 99 unsigned stream_id:16;
92 unsigned no_interrupt:1; 100 unsigned no_interrupt:1;
93 unsigned zero:1; 101 unsigned zero:1;
@@ -479,6 +487,7 @@ struct usb_gadget_ops {
479 * @speed: Speed of current connection to USB host. 487 * @speed: Speed of current connection to USB host.
480 * @max_speed: Maximal speed the UDC can handle. UDC must support this 488 * @max_speed: Maximal speed the UDC can handle. UDC must support this
481 * and all slower speeds. 489 * and all slower speeds.
490 * @sg_supported: true if we can handle scatter-gather
482 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 491 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
483 * gadget driver must provide a USB OTG descriptor. 492 * gadget driver must provide a USB OTG descriptor.
484 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable 493 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
@@ -519,6 +528,7 @@ struct usb_gadget {
519 struct list_head ep_list; /* of usb_ep */ 528 struct list_head ep_list; /* of usb_ep */
520 enum usb_device_speed speed; 529 enum usb_device_speed speed;
521 enum usb_device_speed max_speed; 530 enum usb_device_speed max_speed;
531 unsigned sg_supported:1;
522 unsigned is_otg:1; 532 unsigned is_otg:1;
523 unsigned is_a_peripheral:1; 533 unsigned is_a_peripheral:1;
524 unsigned b_hnp_enable:1; 534 unsigned b_hnp_enable:1;