summaryrefslogtreecommitdiff
path: root/drivers/dma
AgeCommit message (Collapse)Author
2012-07-01dmaengine: sa11x0-dma: add cyclic DMA supportRussell King
Add support for cyclic DMA on sa11x0 platforms. This follows the discussed behaviour that the callback will be called at some point after period expires, and may coalesce multiple period expiries into one callback (due to the tasklet behaviour.) Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: sa11x0-dma: fix DMA residue supportRussell King
The semantics now implemented are: - If the cookie has completed successfully, the residue will be zero. - If the cookie is in progress or the channel is paused, it will be the number of bytes yet to be transferred. [*] - If the cookie is queued, it will be the number of bytes in the descriptor. * - where this is the number of bytes yet to be transferred to/from RAM. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: ensure all descriptors are freed when channel is releasedRussell King
Ensure all queued descriptors are freed when the channel is released, ensuring we don't leak memory Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: get rid of write only pool_ctr and free_txd lockingRussell King
The free function says the pl08x lock should be taken before calling it. However, the DMA pool allocation/freeing is already properly locked. The only thing that would need this is pool_ctr, which happens to be a write-only variable. Let's get rid of this, and eliminate any need for additional locking here. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: get rid of pl08x_prep_channel_resourcesRussell King
This function is now unnecessary; we can move its internals inline instead. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: fix tx_status function to return correct residueRussell King
Now that we're converted to use the generic vchan support, we can fix the residue return from tx_status to be compliant with dmaengine. This returns the number of bytes remaining for the _specified_ cookie, not the number of bytes in all pending transfers on the channel. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: convert to use vchan done listRussell King
Convert to use the virtual dma channel done list, tasklet, and descriptor freeing. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: convert to use vchan submitted/issued listsRussell King
Convert to use the virtual dma channel submitted/issued descriptor lists rather than our own private lists, and use the virtual dma channel support functions to manage these lists. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: use vchan's spinlockRussell King
Initialize the vchan struct, and use the provided spinlock rather than our own. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: convert to use virt-dma structsRussell King
Convert PL08x to use the virt-dma structures. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: rejig physical channel allocationRussell King
Rework the physical channel allocation mechanism to only allocate physical channels to virtual channels when they're about to be used. This eliminates all the complexity with holding channels while descriptors are being prepared, which is completely unnecessary. This also brings this driver to a state where the generic virtual DMA code can be used with this driver, and opens up the possibility of properly scheduling and prioritorising physical DMA channels to virtual DMA channels. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: start next descriptor from irq contextRussell King
Rather than waiting for the tasklet to run, we can start the next descriptor from interrupt context, as soon as we know that the previous descriptor has completed. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: split the pend_list in twoRussell King
Our behaviour wasn't correct; issue_pending is supposed to be called before any submitted descriptors are available for processing by the DMA engine. Split the pend_list in two, one for submitted descriptors and another list for issued descriptors. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: re-jig the starting of txdsRussell King
Rather than code the de-queue of the txd several times, move that into the start_txd function. Rename this to better illustrate what it's now doing, and call this function when starting a delayed memcpy(). Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: remove waiting descriptor pointerRussell King
As we no longer need to pass a descriptor to prep_phy_channel(), we don't need to keep track of the descriptor which is waiting for a channel to become available. So let's get rid of it. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: move DMA signal muxing into slave prepare codeRussell King
Move the DMA request muxing into the slave prepare code and txd release/completion code. This means we only hold the DMA request mux while there are descriptors waiting to be started or are in progress. This leaves txd->direction as a write-only variable; remove it. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: convert to a list of completed descriptorsRussell King
Convert PL08x to use a list of completed descriptors rather than merely relying upon a single pointer. This makes it possible to schedule the tasklet for other purposes, and makes our behaviour similar to virt-dma. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: track mux usage on a per-channel basis.Russell King
Keep track of the number of descriptors currently using a MUX setting on a per-channel basis. This allows us to know when we have descriptors queued somewhere which have been assigned a DMA request signal. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: move DMA signal muxing into pl08x_dma_chan structRussell King
Move the signal handling out of the physical channel structure into the virtual channel structure, where it should belong as it has more to do with the virtual channel than the physical one. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: split DMA signal muxing from channel allocRussell King
Split the DMA request mux signal handling from the physical channel allocation code. The physical channel has very little to do with the DMA request input which will be used, so these should be two separate operations. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: get rid of unnecessary checks in dma_slave_configRussell King
Get rid of the unnecessary checks in dma_slave_config utilizing the DMA direction. This allows us to move the computation of cctl to the prepare function. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: ignore 'direction' argument in dma_slave_configRussell King
Ignore the direction argument in dma_slave_config, and configure both directions independently. We still check that the configuration for the intended direction is valid; this check will eventually be dropped. This check is just for debugging at present. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: extract function to to generate cctl valuesRussell King
Extract the functionality from dma_slave_config to generate the cctl values for a given bus width and burst size. This allows us to use this elsewhere in the driver, namely the prepare functions. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: move the bus and increment selection to dma prepare functionRussell King
Move the bus and transfer increment selection to the DMA prepare function rather than the slave configuration function. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: get rid of device_fc in struct pl08x_dma_chanRussell King
As we now store the dma_slave_config in pl08x_dma_chan, we don't need to store this separately. Use the one in dma_slave_config directly. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: get src/dst addr direct from dma_slave_config structRussell King
Add a dma_slave_config struct to struct pl08x_dma_chan, and move the src_addr/dst_addr arguments into this struct. This is a step away from using the dma_slave_config's direction member. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: constify channel names and bus_id stringsRussell King
Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: move private data structures into amba-pl08x.cRussell King
Move the driver private data structures into the driver itself, rather than having them exposed to everyone in a header file. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: clean up get_signal/put_signalRussell King
Try to avoid dereferencing the DMA engine's channel struct in these platform helpers; instead, pass a pointer to the channel data into get_signal(), and the returned signal number to put_signal(). Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: remove circular_buffer boolean from channel dataRussell King
Circular buffers are not handled in this way; we have a separate API call now to setup circular buffers. So lets not mislead people with this bool. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: remove redundant spinlockRussell King
The pl08x_driver_data spinlock is only ever initialized. Nothing else uses it. Let's get rid of it. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: fix missed dma_transfer_direction fixupRussell King
db8196df4 (dmaengine: move drivers to dma_transfer_direction) missed fixing up the "DMA_NONE" case. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: PL08x: remove runtime PM supportRussell King
The runtime PM support conflicts with the generic AMBA bus PM, and also causes a potential deadlock with the PL011 driver as it results in interrupts being enabled beneath a spinlock. I don't presently see any solution to this other than by removing the runtime PM support entirely from the DMA engine driver. Alternative suggestions welcome. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: virt-dma: add support for cyclic DMA periodic callbacksRussell King
Add support for cyclic DMA's periodic callbacks. Drivers are expected to call vchan_cyclic_callback() when a period has completed, which will schedule the tasklet to make the callback into the driver. As callbacks are made from tasklet context, it is important to realise that we don't guarantee a callback for each completed period, but for N completed periods where N may be greater than one. Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: virt-dma: vchan_find_desc()Russell King
Add a function to find a descriptor within the depths of the virtualized DMA channel support. Needed for tx_status functionality. Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-07-01dmaengine: split out virtual channel DMA support from sa11x0 driverRussell King
Split the virtual slave channel DMA support from the sa11x0 driver so this code can be shared with other slave DMA engine drivers. Acked-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-06-27dma: tegra: set DMA_CYCLIC capabilityLaxman Dewangan
Tegra's APB DMA driver support the cyclic mode of data transfer and hence setting the DMA_CYCLIC caps for dma channels. This is require when generic sound dmaengine pcm driver request for dma channel with CYCLIC capability. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-27dma: tegra: do not set transfer desc flag to DMA_CTRL_ACK in cyclic modeLaxman Dewangan
The sound dmaengine pcm driver uses the dma in cyclic mode and it does not ack the transfer descriptor after transfer stops. This may lead to hold that desc in chip's dma driver and does not allow to reuse/free that descriptors. Hence not enabling flag DMA_CTRL_ACK when dma runs in cyclic mode. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-27dma: tegra: add clk_prepare/clk_unpreparePrashant Gaikwad
Use clk_prepare/clk_unprepare as required by the generic clk framework. Signed-off-by: Prashant Gaikwad <pgaikwad@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-27dma: tegra: use sg_dma_address() for getting dma buffer addressLaxman Dewangan
Use the sg_dma_address() to get the segment buffer address for DMA transfer in place of sg_phys() which returns the physical address of an sg entry. The sg_dma_address() returns the correct buffer memory address for DMA transfer. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-23dmaengine: mmp_tdma: fix the arch dependencyVinod Koul
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dmaLinus Torvalds
Pull slave-dmaengine fixes from Vinod Koul: "A few fixes in pl330 and imx-sdma drivers." * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma: DMA: PL330: Fix racy mutex unlock DMA: PL330: Add missing static storage class specifier dma: imx-sdma: buf_tail should be initialize in prepare function dmaengine: pl330: dont complete descriptor for cyclic dma
2012-06-21dw_dmac: introduce dwc_chan_disableAndy Shevchenko
This piece of code is used often. Make it as a separate function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: move from __init to __devinitAndy Shevchenko
We usually have more than one DMA device. Thus, the probe function should serve for all of them in case when the driver is built as a module. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: introduce dwc_fast_fls()Andy Shevchenko
There were three places where such function is used. We still avoid to use native fls() because in one case it requires to use 64bit version which is suboptimal in our case. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: disable BLOCK interruptsAndy Shevchenko
Just to be sure we are in known state we disable the BLOCK interupts. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: disable dma in optimal way in probeAndy Shevchenko
The dw_dma_off call needs to have the all_chan_mask calculated. So, done this calculations before the call. Moreover, remove duplicate code that masks the DMA interrupts. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: use __func__ constant in the debug printsAndy Shevchenko
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: print correct number of scanned descriptorsAndy Shevchenko
In case the first descriptor we found is available, the counter still remains 0 value which is wrong. This patch fixes the counter behaviour. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-06-21dw_dmac: introduce dwc_dump_chan_regs to dump registersAndy Shevchenko
There is three places where values of the most significant registers were printed. Make such piece of code as separate function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>