Am Montag, den 26.02.2018, 18:09 +0200 schrieb Ran Shalit:
> On Mon, Feb 26, 2018 at 5:59 PM, Oliver Neukum <[email protected]> wrote:
> > 
> > Am Donnerstag, den 15.02.2018, 11:00 +0200 schrieb Ran Shalit:
> > > 
> > > I actually asked about DMA, because I see that it is possible to send
> > > urb using DMA allocated buffers or not (coherent and non-coherent)
> > > usb_buffer_alloc().
> > > So, How can we actually know if I should use this API with a device or
> > > not ? I mean, is it always possible to use the coherent buffer with
> > > the device ?
> > 
> > Hi,
> > 
> > it is always possible to use usb_alloc_coherent() on a host.
> > But it is generally not sensible. It is for buffers to be reused
> > many times. In general use kmalloc() [once per buffer. That is a rule.
> > You must not share them.]
> > 
> >         HTH
> >                 Oliver
> > 
> Hi Oliver,
> 
> Is the dma engine which is responsible for the transaction is actually
> in the usb device (It's not dma controller in host) ?

OK, I think there is a fundamental misunderstanding here.
There are two sides: host and gadget
Either, both or no side may use DMA. The other side does
not learn of that.

In either case, however, you write a driver for a logical device
or a protocol, if you will. What we call a device driver on the host
(the gadget has its own equivalents) does not talk to hardware.
Essentially you allocate and manipulate URBs.

There is a driver for a host (respectively gadget) controller
which talks to hardware. It does DMA, not your driver.

> If I understand correctly in both ways (kmalloc or
> usb_alloc_coherent), then we are allocating buffers might be used for
> dma.

Yes. We must.

> Even if DMA is not used in the transaction, than is shall still be
> functional with the same DMA-allocated buffers.

Yes. It must.

        HTH
                Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to