aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorRobert Morell <rmorell@nvidia.com>2011-01-26 22:06:48 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-02-04 14:48:55 -0500
commit2694a48d9007a8bdf1731c1b97d4942c9cc49296 (patch)
tree9f5394c7aca54d6ee0565428e91c12f240be89bd /include/linux/usb
parentc8cf203a1d228fa001b95534f639ffb7a23d5386 (diff)
USB: HCD: Add driver hooks for (un)?map_urb_for_dma
Provide optional hooks for the host controller driver to override the default DMA mapping and unmapping routines. In general, these shouldn't be necessary unless the host controller has special DMA requirements, such as alignment contraints. If these are not specified, the general usb_hcd_(un)?map_urb_for_dma functions will be used instead. Also, pass the status to unmap_urb_for_dma so it can know whether the DMA buffer has been overwritten. Finally, add a flag to be used by these implementations if they allocated a temporary buffer so it can be freed properly when unmapping. Signed-off-by: Robert Morell <rmorell@nvidia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/hcd.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 395704bdf5cc..92b96fe39307 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -233,6 +233,19 @@ struct hc_driver {
233 int (*urb_dequeue)(struct usb_hcd *hcd, 233 int (*urb_dequeue)(struct usb_hcd *hcd,
234 struct urb *urb, int status); 234 struct urb *urb, int status);
235 235
236 /*
237 * (optional) these hooks allow an HCD to override the default DMA
238 * mapping and unmapping routines. In general, they shouldn't be
239 * necessary unless the host controller has special DMA requirements,
240 * such as alignment contraints. If these are not specified, the
241 * general usb_hcd_(un)?map_urb_for_dma functions will be used instead
242 * (and it may be a good idea to call these functions in your HCD
243 * implementation)
244 */
245 int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
246 gfp_t mem_flags);
247 void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
248
236 /* hw synch, freeing endpoint resources that urb_dequeue can't */ 249 /* hw synch, freeing endpoint resources that urb_dequeue can't */
237 void (*endpoint_disable)(struct usb_hcd *hcd, 250 void (*endpoint_disable)(struct usb_hcd *hcd,
238 struct usb_host_endpoint *ep); 251 struct usb_host_endpoint *ep);
@@ -329,6 +342,8 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
329extern int usb_hcd_unlink_urb(struct urb *urb, int status); 342extern int usb_hcd_unlink_urb(struct urb *urb, int status);
330extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, 343extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
331 int status); 344 int status);
345extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
346 gfp_t mem_flags);
332extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); 347extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *);
333extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *); 348extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *);
334extern void usb_hcd_flush_endpoint(struct usb_device *udev, 349extern void usb_hcd_flush_endpoint(struct usb_device *udev,