Re: How to hook dma_request_chan?

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

 



On 15/11/2016 12:02, Mason wrote:

> I would like to be able to setup my board's DMA engine at the time when
> dma_request_chan() is called by the driver using that specific channel.
> (Or some time later, but before an actual transfer is requested.)
> 
> Does dma_request_chan() call back into the DMA driver at some point?
> If yes, through which function pointer?
> 
> I see that of_dma_request_slave_channel() calls ofdma->of_dma_xlate()
> which is the function registered through of_dma_controller_register()
> in the DMA driver, right?
> 
> Currently, the driver sets up the DMA engine at the time when the
> device_issue_pending() method is called, but this creates a catch-22
> situation where A must be before B, and B must be before A.
> 
> Looking at struct dma_device ...
> http://lxr.free-electrons.com/source/include/linux/dmaengine.h#L637
> Could I use the device_config() call-back for this?
> 
> https://www.kernel.org/doc/Documentation/dmaengine/client.txt

Let me try describing the problem on a higher level.

I'm currently using this DMA driver on my board:
https://github.com/mansr/linux-tangox/blob/master/drivers/dma/tangox-dma.c

The driver configures the DMA HW in device_issue_pending() in two steps
A) switch box (sbox) setup
B) memory bus (mbus) channel setup

And the DMA engine client (a NAND Flash controller driver) starts a
transfer by programming the NFC registers.

The problem is that the steps need to be done in this order:
1) SBOX
2) NAND
3) MBUS

But in the current design, there is no way to have the NAND step
*between* SBOX and MBUS steps.

For now, I have hard-coded the SBOX setup in the driver's probe function,
but that's just a hack. IMO, it makes sense to configure the SBOX
only once, when the client driver "registers" with the DMA driver
(dma_request_chan if I understand correctly) and release the HW
channel when the client driver "unbinds".

I'm eager to hear anyone's comments on this issue.

Vinod, I would like to upstream this DMA driver. What do you think?

I'll run a few more tests tomorrow.

Regards.

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



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux