Re: [PATCH 1/3]USB: add Freescale high-speed USB SOC device controller driver

"Li Yang-r58472" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <989B956029373F45A0B8AF0297081890811AFB@zch01exm26.fsl.freescale.net>
> -----Original Message-----
> From: David Brownell [mailto:[email protected]]
> Sent: Friday, April 20, 2007 12:53 PM
> To: Li Yang-r58472
> Cc: [email protected]; [email protected]; Schmid Bruce-R62923
> Subject: Re: [linux-usb-devel] [PATCH 1/3]USB: add Freescale high-speed USB SOC
> device controller driver
> 
> On Thursday 19 April 2007 8:56 pm, Li Yang-r58472 wrote:
> >
> > > > > On Thursday 19 April 2007 2:53 am, Li Yang wrote:
> > > > > > +static void *fsl_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
> > > > > > +               dma_addr_t *dma, gfp_t gfp_flags)
> > > > > > +{...
> > > > > > +}
> > > > >
> > > > > You still need to fix this to use dma_alloc_coherent(), and its
> > > > > sibling function to use dma_free_coherent().
> > > > >
> > > > > This particular code assumes !CONFIG_NOT_COHERENT_CACHE ... which
> > > > > ISTR you've said is not true on all the relevant PPC platforms, and
> > > > > is certainly not true on the versions found (already?) in Freescale
> > > > > ARM products.
> > > >
> > > > This buffer is synced using dma_sync_single_*/dma_(un)map_single when
> > > > the request is queued and when the transmission is complete.  To
> > >
> > > No.  See <linux/usb_gadget.h> for the definition of usb_ep_alloc_buffer();
> > > it says explicitly that such mapping calls are not required.
> > >
> > > The only portable way to guarantee that is to allocate coherent memory.
> >
> > Then I can remove the dma_sync_single calls from ep_queue() and done()?
> 
> Not a good idea.  There are two ways that a DMA address gets
> provided to the lower level code:  (a) coherent buffer allocation,
> as above, and (b) mapping done by driver, and re-used.  The former
> doesn't need dma_sync_single().  The latter does.

Do you mean that the buf of a usb_request could be allocated other than calling usb_ep_alloc_buffer()?  If not, the buf would be guaranteed to be coherent buffer.
And will usb_ep_alloc_buffer() be used to allocate buffer other than buffer to be queued with ep_queue()?

I mean if usb_ep_alloc_buffer() is required and only used in allocating buffer to be processed by ep_queue() and done().  We can choose to use one of the ways you mentioned above, not both.  In this case, I preferred to choose the second way for better performance.

- Leo

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.