Re: [PATCH 1/3] usb: musb: introduce api for dma code to check compatibility with usb request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 27-12-2010 11:13, Mian Yousaf Kaukab wrote:

Gadget MUSB driver handles dma mappings in musb_gadget_queue(). Where as it is
possible for dma code to reject the usb request later at ->channel_program()
call, called from txstate()/rxstate()

The same is true for host also.

   Well, not exactly. Host side maps the DMA buffers in the upper layer.

Are you going to introduce the separate
method for the host mode? :-/

Anyway, we should aim for a symmetric, universal solution, not the gadget only one.

For example ->channel_program in tusb6010_omap.c:

static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
u8 rndis_mode, dma_addr_t dma_addr, u32 len)
{
...
if (unlikely(dma_addr& 0x1) || (len< 32) || (len> packet_sz))
return false;
...
if (dma_addr& 0x2)
return false;
...
}

In this case, usb request will be handled in PIO mode which renders dma
mapping
operations unnecessary.
This patch adds an api to allow dma code to indicate incompatibility with usb
request. Gadget musb driver call this api, if available, before dma
mappings to
avoid any unnecessary mapping operations.

Signed-off-by: Mian Yousaf Kaukab<mian.yousaf.kaukab@xxxxxxxxxxxxxx>

---
This patch is based on git://gitorious.org/usb/usb.git musb-hw

drivers/usb/musb/musb_dma.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h
index 916065b..870e5b4 100644
--- a/drivers/usb/musb/musb_dma.h
+++ b/drivers/usb/musb/musb_dma.h
@@ -169,6 +169,8 @@ struct dma_controller {
dma_addr_t dma_addr,
u32 length);
int (*channel_abort)(struct dma_channel *);
+ int (*is_req_compatible)(struct dma_controller *,
+ struct musb_ep *, struct usb_request *);

I suggest passing DMA address and length

In fact, probably the same set of argumets that channel_program() method takes.

to the method ISO 'struct
usb_request' and call the method just is_compatible() or is_supported().

Ok I will update the name and the arguments.

   Thanks.

Thanks,

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux