diff options
author | Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> | 2011-01-04 06:47:02 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-02-01 03:41:30 -0500 |
commit | c65bfa62b7185bdeb063c2a637f501f00997d068 (patch) | |
tree | f2b0a848f0994f9570d149dc60948dfbd32abcf4 /drivers/usb/musb/musb_gadget.h | |
parent | 0662481855c389b75a0a54c32870cc90563d80a9 (diff) |
usb: musb: maintain three states for buffer mappings instead of two
If dma buffers are mapped by a higher layer, with a boolean musb_request.mapped
it is still possible to call dma_sync_single_for_device() from
musb_g_giveback(), even if txstate()/rxstate() has called unmap_dma_buffer()
before falling back to pio mode.
Moreover, check for musb_ep->dma is moved within map_dma_buffer() so where
applicable checks for it are removed. And where possible, checks for
is_dma_capable() are merged with buffer map state check.
Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_gadget.h')
-rw-r--r-- | drivers/usb/musb/musb_gadget.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h index dec8dc008191..a55354fbccf5 100644 --- a/drivers/usb/musb/musb_gadget.h +++ b/drivers/usb/musb/musb_gadget.h | |||
@@ -35,13 +35,19 @@ | |||
35 | #ifndef __MUSB_GADGET_H | 35 | #ifndef __MUSB_GADGET_H |
36 | #define __MUSB_GADGET_H | 36 | #define __MUSB_GADGET_H |
37 | 37 | ||
38 | enum buffer_map_state { | ||
39 | UN_MAPPED = 0, | ||
40 | PRE_MAPPED, | ||
41 | MUSB_MAPPED | ||
42 | }; | ||
43 | |||
38 | struct musb_request { | 44 | struct musb_request { |
39 | struct usb_request request; | 45 | struct usb_request request; |
40 | struct musb_ep *ep; | 46 | struct musb_ep *ep; |
41 | struct musb *musb; | 47 | struct musb *musb; |
42 | u8 tx; /* endpoint direction */ | 48 | u8 tx; /* endpoint direction */ |
43 | u8 epnum; | 49 | u8 epnum; |
44 | u8 mapped; | 50 | enum buffer_map_state map_state; |
45 | }; | 51 | }; |
46 | 52 | ||
47 | static inline struct musb_request *to_musb_request(struct usb_request *req) | 53 | static inline struct musb_request *to_musb_request(struct usb_request *req) |