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

David Brownell <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
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.



> > I guess it's just my taste that I'd include a comment right there
> > highlighting that this doesn't actually implement the OTG feature
> > it claims to implement ... but that's OK until something sets is_otg.
> 
> Is it ok that I indicate this in the patch comment?

Comment, please -- folk will mostly be reading the code, not the
patch comments.  Just a brief comment will suffice.

- Dave

-------------------------------------------------------------------------
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.