lkml.org 
[lkml]   [2014]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] usb: gadget: Add xilinx axi usb2 device support
Hi,

On Wed, Apr 16, 2014 at 04:09:28PM +0530, sundeep subbaraya wrote:
> Hi Felipe,
>
> On Thu, Apr 3, 2014 at 8:28 PM, Felipe Balbi <balbi@ti.com> wrote:
>
> >> +static int start_dma(struct xusb_ep *ep, u32 src, u32 dst, u32 length)
> >
> > please prepend this with xudc_, it makes tracing a lot easier.
> >
> >> +{
> >> + struct xusb_udc *udc;
> >> + int rc = 0;
> >> + unsigned long timeout;
> >> +
> >> + udc = ep->udc;
> >> + /*
> >> + * Set the addresses in the DMA source and
> >> + * destination registers and then set the length
> >> + * into the DMA length register.
> >> + */
> >> + udc->write_fn(udc->base_address, XUSB_DMA_DSAR_ADDR_OFFSET, src);
> >> + udc->write_fn(udc->base_address, XUSB_DMA_DDAR_ADDR_OFFSET, dst);
> >> + udc->write_fn(udc->base_address, XUSB_DMA_LENGTH_OFFSET, length);
> >> +
> >> + /*
> >> + * Wait till DMA transaction is complete and
> >> + * check whether the DMA transaction was
> >> + * successful.
> >> + */
> >> + while ((udc->read_fn(ep->udc->base_address + XUSB_DMA_STATUS_OFFSET) &
> >> + XUSB_DMA_DMASR_BUSY) == XUSB_DMA_DMASR_BUSY) {
> >> + timeout = jiffies + 10000;
> >> +
> >> + if (time_after(jiffies, timeout)) {
> >> + rc = -ETIMEDOUT;
> >> + goto clean;
> >> + }
> >> + }
> >
> > don't you get an IRQ for DMA completion ? If you do, you could be using
> > wait_for_completion()
>
> This function is called in interrupt context when buffer is ready or
> free. It initiates DMA to transfer data from IP buffer to memory.
> Hence it waits in busy loop till DMA completes

wait, so you start_dma() before your gadget driver asks you to ?

--
balbi
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2014-04-16 20:41    [W:0.162 / U:19.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site