kernel/kernel-generic.git
11 years agodmaengine: dw_dmac: move to generic DMA binding
Arnd Bergmann [Wed, 27 Feb 2013 21:36:03 +0000 (21:36 +0000)]
dmaengine: dw_dmac: move to generic DMA binding

The original device tree binding for this driver, from Viresh Kumar
unfortunately conflicted with the generic DMA binding, and did not allow
to completely seperate slave device configuration from the controller.

This is an attempt to replace it with an implementation of the generic
binding, but it is currently completely untested, because I do not have
any hardware with this particular controller.

The patch applies on top of the slave-dma tree, which contains both the base
support for the generic DMA binding, as well as the earlier attempt from
Viresh. Both of these are currently not merged upstream however.

This version incorporates feedback from Viresh Kumar, Andy Shevchenko
and Russell King.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Vinod Koul <vinod.koul@linux.intel.com>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine: add dma_request_slave_channel_compat()
Matt Porter [Fri, 1 Feb 2013 18:22:52 +0000 (18:22 +0000)]
dmaengine: add dma_request_slave_channel_compat()

Adds a dma_request_slave_channel_compat() wrapper which accepts
both the arguments from dma_request_channel() and
dma_request_slave_channel(). Based on whether the driver is
instantiated via DT, the appropriate channel request call will be
made.

This allows for a much cleaner migration of drivers to the
dmaengine DT API as platforms continue to be mixed between those
that boot using DT and those that do not.

Suggested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Matt Porter <mporter@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoRevert "ARM: SPEAr13xx: Pass DW DMAC platform data from DT"
Arnd Bergmann [Fri, 15 Feb 2013 18:21:49 +0000 (19:21 +0100)]
Revert "ARM: SPEAr13xx: Pass DW DMAC platform data from DT"

This reverts commit f9965aa20706860077cfa093d04a6351c0c1e940.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoARM: dts: pl330: Add #dma-cells for generic dma binding support
Padmavathi Venna [Thu, 14 Feb 2013 03:40:08 +0000 (09:10 +0530)]
ARM: dts: pl330: Add #dma-cells for generic dma binding support

This patch adds #dma-cells property to PL330 DMA controller
nodes for supporting generic dma dt bindings on samsung
exynos5250 platform.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoDMA: PL330: Register the DMA controller with the generic DMA helpers
Padmavathi Venna [Thu, 14 Feb 2013 03:40:07 +0000 (09:10 +0530)]
DMA: PL330: Register the DMA controller with the generic DMA helpers

This patch registers the pl330 dma controller driver with the generic
device tree dma helper functions.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoDMA: PL330: Add xlate function
Padmavathi Venna [Thu, 14 Feb 2013 03:40:06 +0000 (09:10 +0530)]
DMA: PL330: Add xlate function

Add xlate to translate the device-tree binding information into
the appropriate format. The filter function requires the dma
controller device and dma channel number as filter_params.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoDMA: PL330: Add new pl330 filter for DT case.
Padmavathi Venna [Thu, 14 Feb 2013 03:40:05 +0000 (09:10 +0530)]
DMA: PL330: Add new pl330 filter for DT case.

This patch adds a new pl330_dt_filter for DT case to filter the
required channel based on the new filter params and modifies the
old filter only for non-DT case as suggested by Arnd Bergmann.

Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: tegra20-apb-dma: remove unnecessary assignment
Andy Shevchenko [Thu, 14 Feb 2013 09:00:20 +0000 (11:00 +0200)]
dma: tegra20-apb-dma: remove unnecessary assignment

There is no need to assign 0 to residue, because dma_cookie_status() does this
for us.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoedma: do not waste memory for dma_mask
Andy Shevchenko [Thu, 14 Feb 2013 09:00:19 +0000 (11:00 +0200)]
edma: do not waste memory for dma_mask

Accordingly to commentary in the platform_device_register_full the memory
allocated for dma_mask will not going to be freed. That's why is better to
assign dma_mask afterwards.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: coh901318: set residue only if dma is in progress
Andy Shevchenko [Thu, 14 Feb 2013 09:00:18 +0000 (11:00 +0200)]
dma: coh901318: set residue only if dma is in progress

When status is DMA_SUCCESS the residue should be zero. Otherwise it's a bug.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: coh901318: avoid unbalanced locking
Andy Shevchenko [Thu, 14 Feb 2013 09:00:17 +0000 (11:00 +0200)]
dma: coh901318: avoid unbalanced locking

In case the len is 0 we must return without trying to unlock the lock that was
not locked.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine.h: remove redundant else keyword
Andy Shevchenko [Thu, 14 Feb 2013 09:00:16 +0000 (11:00 +0200)]
dmaengine.h: remove redundant else keyword

dmaengine_device_control returns -ENOSYS in case the dma driver doesn't have
such functionality.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: of-dma: protect list write operation by spin_lock
Andy Shevchenko [Thu, 14 Feb 2013 09:00:15 +0000 (11:00 +0200)]
dma: of-dma: protect list write operation by spin_lock

It's possible to have an inconsistency in the list due to unprotected operation
on it. The patch adds a proper locking on the list operation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine: ste_dma40: do not remove descriptors for cyclic transfers
Fabio Baltieri [Thu, 14 Feb 2013 09:03:10 +0000 (10:03 +0100)]
dmaengine: ste_dma40: do not remove descriptors for cyclic transfers

Fix dma_tc_handle() to call d40_desc_remove() and d40_desc_done() only
for non-cyclic transfers, as this was breaking ux500_pcm since
introduced in:

d49278e dmaengine: dma40: Add support to split up large elements

Reported-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: of-dma.c: fix memory leakage
Cong Ding [Thu, 14 Feb 2013 10:16:10 +0000 (11:16 +0100)]
dma: of-dma.c: fix memory leakage

The memory allocated to ofdma might be a leakage when error occurs.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: apply default dma_mask if needed
Andy Shevchenko [Thu, 14 Feb 2013 08:41:09 +0000 (10:41 +0200)]
dw_dmac: apply default dma_mask if needed

In some cases we got the device without dma_mask configured. We have to apply
the default value to avoid crashes during memory mapping.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine: ioat - fix spare sparse complain
Fengguang Wu [Wed, 13 Feb 2013 01:40:03 +0000 (09:40 +0800)]
dmaengine: ioat - fix spare sparse complain

>> drivers/dma/ioat/dma_v3.c:371:6: sparse: symbol 'ioat3_timer_event' was not declared.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine: move drivers/of/dma.c -> drivers/dma/of-dma.c
Vinod Koul [Tue, 12 Feb 2013 17:15:02 +0000 (09:15 -0800)]
dmaengine: move drivers/of/dma.c -> drivers/dma/of-dma.c

as requested by Rob

Suggested-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoioatdma: fix race between updating ioat->head and IOAT_COMPLETION_PENDING
Dave Jiang [Thu, 7 Feb 2013 21:38:32 +0000 (14:38 -0700)]
ioatdma: fix race between updating ioat->head and IOAT_COMPLETION_PENDING

There is a race that can hit during __cleanup() when the ioat->head pointer is
incremented during descriptor submission. The __cleanup() can clear the
PENDING flag when it does not see any active descriptors. This causes new
submitted descriptors to be ignored because the COMPLETION_PENDING flag is
cleared. This was introduced when code was adapted from ioatdma v1 to ioatdma
v2. For v2 and v3, IOAT_COMPLETION_PENDING flag will be abandoned and a new
flag IOAT_CHAN_ACTIVE will be utilized. This flag will also be protected under
the prep_lock when being modified in order to avoid the race.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <djbw@fb.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: add support for Lynxpoint DMA controllers
Mika Westerberg [Thu, 7 Feb 2013 15:36:28 +0000 (17:36 +0200)]
dw_dmac: add support for Lynxpoint DMA controllers

Intel Lynxpoint PCH Low Power Subsystem has DMA controller to support general
purpose serial buses like SPI, I2C, and HSUART. This controller is enumerated
from ACPI namespace with ACPI ID INTL9C60.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: return proper residue value
Andy Shevchenko [Fri, 25 Jan 2013 09:48:03 +0000 (11:48 +0200)]
dw_dmac: return proper residue value

Currently the driver returns full length of the active descriptor which is
wrong. We have to go throught the active descriptor and substract the length of
each sent children in the chain from the total length along with the actual
data in the DMA channel registers.

The cyclic case is not handled by this patch due to len field in the descriptor
structure is left untouched by the original code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: fill individual length of descriptor
Andy Shevchenko [Fri, 25 Jan 2013 09:48:02 +0000 (11:48 +0200)]
dw_dmac: fill individual length of descriptor

It will be useful to have the length of the transfer in the descriptor. The
cyclic transfer functions remained untouched.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: introduce total_len field in struct dw_desc
Andy Shevchenko [Fri, 25 Jan 2013 09:48:01 +0000 (11:48 +0200)]
dw_dmac: introduce total_len field in struct dw_desc

By this new field we distinguish a total length of the chain and the individual
length of each descriptor in the chain.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: remove unnecessary tx_list field in dw_dma_chan
Andy Shevchenko [Fri, 25 Jan 2013 09:48:00 +0000 (11:48 +0200)]
dw_dmac: remove unnecessary tx_list field in dw_dma_chan

The soft LLP mode is working for active descriptor only. So, we do not need to
have a copy of its pointer.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: print out DW_PARAMS and DWC_PARAMS when debug
Andy Shevchenko [Fri, 18 Jan 2013 15:10:59 +0000 (17:10 +0200)]
dw_dmac: print out DW_PARAMS and DWC_PARAMS when debug

It's usefull to have the values of the DW_PARAMS and DWC_PARAMS printed when
debug mode is enabled.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoDMAEngine: sirf: lock the shared registers access in sirfsoc_dma_terminate_all
Barry Song [Fri, 14 Dec 2012 11:06:58 +0000 (11:06 +0000)]
DMAEngine: sirf: lock the shared registers access in sirfsoc_dma_terminate_all

Just like Russell pointed out in "DMAEngine: sirf: add DMA
pause/resume support" at
http://www.spinics.net/lists/arm-kernel/msg212496.html
here I find sirfsoc_dma_terminate_all() has same problem,
so move the locking to the front of registers access.

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoDMAEngine: sirf: add DMA pause/resume support
Barry Song [Fri, 14 Dec 2012 10:59:22 +0000 (10:59 +0000)]
DMAEngine: sirf: add DMA pause/resume support

pause/resume are important for users like ALSA sound drivers,
this patches make the sirf prima2/marco support DMA commands
DMA_PAUSE and DMA_RESUME.

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agoMerge tag 'ux500-dma40' of //git.linaro.org/people/fabiobaltieri/linux.git
Vinod Koul [Mon, 21 Jan 2013 14:35:12 +0000 (06:35 -0800)]
Merge tag 'ux500-dma40' of //git.linaro.org/people/fabiobaltieri/linux.git

Pull ste_dma40 fixes from Fabio

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: move soft LLP code from tasklet to dwc_scan_descriptors
Andy Shevchenko [Fri, 18 Jan 2013 12:14:15 +0000 (14:14 +0200)]
dw_dmac: move soft LLP code from tasklet to dwc_scan_descriptors

The proper place for the main logic of the soft LLP mode is
dwc_scan_descriptors. It prevents to get the transfer unexpectedly aborted in
case the user calls dwc_tx_status.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: don't exceed AHB master number in dwc_get_data_width
Andy Shevchenko [Thu, 17 Jan 2013 08:03:01 +0000 (10:03 +0200)]
dw_dmac: don't exceed AHB master number in dwc_get_data_width

The driver assumes that hardware has two AHB masters which might not be always
true. In such cases we must not exceed number of the AHB masters present in the
hardware. In the proposed scheme in this patch, we would choose the master with
highest possible number whenever we exceed max AHB masters.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: allocate dma descriptors from DMA_COHERENT memory
Andy Shevchenko [Wed, 16 Jan 2013 13:48:50 +0000 (15:48 +0200)]
dw_dmac: allocate dma descriptors from DMA_COHERENT memory

Currently descriptors are allocated from normal cacheable memory and that slows
down filling the descriptors, as we need to call cache_coherency routines
afterwards. It would be better to allocate memory for these descriptors from
DMA_COHERENT memory. This would make code much cleaner too.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: sh/shdma-base.c: remove unnecessary null pointer check
Cong Ding [Tue, 15 Jan 2013 00:23:48 +0000 (01:23 +0100)]
dma: sh/shdma-base.c: remove unnecessary null pointer check

the variable chan is dereferenced in line 635, so it is no reason to check
null again in line 641.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: remove unnecessary null pointer check in mmp_pdma.c
Cong Ding [Tue, 15 Jan 2013 00:19:48 +0000 (01:19 +0100)]
dma: remove unnecessary null pointer check in mmp_pdma.c

the pointer cfg is dereferenced in line 594, so it's no reason to check null
again in line 620.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: edma: fix slave config dependency on direction
Matt Porter [Thu, 10 Jan 2013 18:41:04 +0000 (13:41 -0500)]
dma: edma: fix slave config dependency on direction

The edma_slave_config() implementation depends on the
direction field such that it will not properly configure
a slave channel when called without direction set.

This fixes the implementation so that the slave config
is copied as is and prep_slave_sg() handles the
direction dependent handling. spi-omap2-mcspi and
omap_hsmmc both expose this bug as they configure the
slave channel config from a common path with an unconfigured
direction field.

Signed-off-by: Matt Porter <mporter@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine: set_dma40: balance clock in probe fail code
Fabio Baltieri [Mon, 7 Jan 2013 09:58:35 +0000 (10:58 +0100)]
dmaengine: set_dma40: balance clock in probe fail code

Clock code was changed to use clk_prepare_enable in:

b707c65 dma/ste_dma40: Fixup clock usage during probe

but clk_disable on probe fail path was not updated.  This patch fix this
by using clk_disable_unprepare in place of clk_disable.

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: set_dma40: ignore spurious interrupts
Fabio Baltieri [Wed, 19 Dec 2012 13:41:56 +0000 (14:41 +0100)]
dmaengine: set_dma40: ignore spurious interrupts

Some DMA channels may be used by other cores in the SoC.  This patch
modifies the dma interrupt handler to ignore interrupts from unknown
channels.

Cc: Rabin Vincent <rabin.vincent@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: add software lli support
Fabio Baltieri [Tue, 18 Dec 2012 11:25:14 +0000 (12:25 +0100)]
dmaengine: ste_dma40: add software lli support

This patch add support to manage LLI by SW for select phy channels.

There is a HW issue in certain controllers due to which on certain
occassions HW LLI cannot be used on some physical channels.  To avoid
the HW issue on a specific phy channel, the phy channel number can be
added to the list of soft_lli_channels and there after all the transfers
on that channel will use software LLI, for peripheral to memory
transfers.

SoftLLI introduces relink overhead, that could impact performace for
certain use cases.

This is based on a previous patch of Narayanan Gopalakrishnan.

Cc: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: minor code readability fixes
Fabio Baltieri [Tue, 18 Dec 2012 15:59:09 +0000 (16:59 +0100)]
dmaengine: ste_dma40: minor code readability fixes

Use internal variables to the cycles to improve code readability, no
functional changes.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: minor cosmetic fixes
Fabio Baltieri [Thu, 13 Dec 2012 16:12:37 +0000 (17:12 +0100)]
dmaengine: ste_dma40: minor cosmetic fixes

This patch contains various non functional cosmetic fixes.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: add missing kernel-doc entry
Fabio Baltieri [Thu, 13 Dec 2012 10:38:39 +0000 (11:38 +0100)]
dmaengine: ste_dma40: add missing kernel-doc entry

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: add a done queue for completed descriptors
Fabio Baltieri [Thu, 13 Dec 2012 12:46:16 +0000 (13:46 +0100)]
dmaengine: ste_dma40: add a done queue for completed descriptors

This is to keep the active queue for only those transfers which are
actually active in the hardware.  Descriptors will be moved to the done
queue after they are completed in the hardware (interrupt handler) but
before all the cleanup work has been completed (tasklet).

Mostly based on a previous patch by Rabin Vincent.

Cc: Rabin Vincent <rabin.vincent@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: support more than 128 event lines
Tong Liu [Wed, 26 Sep 2012 10:07:30 +0000 (10:07 +0000)]
dmaengine: ste_dma40: support more than 128 event lines

U8540 DMA controller is different from u9540 we need define new
registers and use them to support handling more than 128 event lines.

Signed-off-by: Tong Liu <tong.liu@stericsson.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: physical channels number correction
Gerald Baeza [Fri, 21 Sep 2012 19:21:37 +0000 (21:21 +0200)]
dmaengine: ste_dma40: physical channels number correction

DMAC_ICFG[0:2]=SCHNB only allows to count 'multiple of 4' physical
channels so it was ok with platforms having 8 channels but cannot be
used for next versions (with 10 or 14 channels).  This patch allows to
provide the number of physical channels for a DMA device via
platform_data, or still rely on SCHNB if platform_data announces 0
channel.

Signed-off-by: Gerald Baeza <gerald.baeza@stericsson.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: support fixed physical channel allocation
Gerald Baeza [Thu, 8 Nov 2012 13:39:07 +0000 (14:39 +0100)]
dmaengine: ste_dma40: support fixed physical channel allocation

This patch makes existing use_fixed_channel field (of stedma40_chan_cfg
structure) applicable to physical channels.

Signed-off-by: Gerald Baeza <gerald.baeza@stericsson.com>
Tested-by: Yannick Fertre <yannick.fertre@stericsson.com>
Reviewed-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: don't allow high priority dest event lines
Rabin Vincent [Thu, 17 May 2012 08:17:38 +0000 (13:47 +0530)]
dmaengine: ste_dma40: don't allow high priority dest event lines

Hardware bug: when a logical channel is triggerred by a high priority
destination event line, an extra packet transaction is generated in case
of important data write response latency on previous logical channel A
and if the source transfer of current logical channel B is already
completed and if no other channel with a higher priority than B is
waiting for execution.

Software workaround: do not set the high priority level for the
destination event lines that trigger logical channels.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: don't check for pm_runtime_suspended()
Narayanan G [Fri, 20 Jan 2012 08:26:14 +0000 (13:56 +0530)]
dmaengine: ste_dma40: don't check for pm_runtime_suspended()

The check for runtime suspend is not needed during a regular suspend, as
the framework takes care of this.  This fixes the issue of DMA driver
not letting the system to go to deepsleep in the first attempt.

Signed-off-by: Narayanan G <narayanan.gopalakrishnan@stericsson.com>
Reviewed-by: Rabin Vincent <rabin.vincent@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: limit burst size to 16
Per Forlin [Thu, 13 Oct 2011 10:11:36 +0000 (12:11 +0200)]
dmaengine: ste_dma40: limit burst size to 16

The client is not aware of the maximum burst size in the dma driver.  If
the size exceeds 16 set max to 16.

Signed-off-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: set dma max seg size
Per Forlin [Tue, 18 Oct 2011 16:39:47 +0000 (18:39 +0200)]
dmaengine: ste_dma40: set dma max seg size

Maximum DMA seg size is (0xffff x data_width).  If max seg
size is not set it deafults to 64k.  This results in failure
if transferring 64k in byte mode.
Large seg sizes may be supported by splitting large transfer.

Signed-off-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: use writel_relaxed for lcxa
Per Forlin [Wed, 28 Sep 2011 07:32:20 +0000 (09:32 +0200)]
dmaengine: ste_dma40: use writel_relaxed for lcxa

lcpa and lcla are written often and the cache_sync() overhead in writel
is costly, especially for wlan where every single network packet (in RX
mode) corresponds to a separate DMA transfer.

Signed-off-by: Per Forlin <per.forlin@stericsson.com>
Reviewed-by: Narayanan Gopalakrishnan <narayanan.gopalakrishnan@stericsson.com>
Reviewed-by: Rabin Vincent <rabin.vincent@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agodmaengine: ste_dma40: reset priority bit for logical channels
Narayanan [Tue, 13 Sep 2011 11:30:22 +0000 (17:00 +0530)]
dmaengine: ste_dma40: reset priority bit for logical channels

This patch sets the SSCFG/SDCFG bit[7] PRI only for physical channel
requests with high priority.  For logical channels, this bit will be
zero.

Signed-off-by: Narayanan G <narayanan.gopalakrishnan@stericsson.com>
Reviewed-by: Rabin Vincent <rabin.vincent@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
11 years agopl080.h: moved from arm/include/asm/hardware to include/linux/amba/
Alessandro Rubini [Sat, 24 Nov 2012 00:22:56 +0000 (00:22 +0000)]
pl080.h: moved from arm/include/asm/hardware to include/linux/amba/

The header is used by drivers/dma/amba-pl08x.c, which can be compiled
under x86, where PL080 exists under a PCI-to-AMBA bridge. This patche
moves it where it can be accessed by other architectures, and fixes
all users.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: dw_dmac: clear suspend bit during termination
Heikki Krogerus [Thu, 10 Jan 2013 08:53:06 +0000 (10:53 +0200)]
dma: dw_dmac: clear suspend bit during termination

The DMA transfer could not be established if previously it was paused and
terminated. In that case the channel's suspend bit remains set that prevents to
transfer anything until channel is resumed.

The patch adds the dwc_chan_resume() call instead of a plain flag assignment.
That clears the DWC_CFGL_CH_SUSP bit as well during termination.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: backlink to dw_dma in dw_dma_chan is superfluous
Andy Shevchenko [Thu, 10 Jan 2013 08:53:05 +0000 (10:53 +0200)]
dw_dmac: backlink to dw_dma in dw_dma_chan is superfluous

The same information could be extracted from the struct dma_chan.
The patch introduces helper function dwc_get_data_width() as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: make usage of dw_dma_slave optional
Andy Shevchenko [Thu, 10 Jan 2013 09:11:41 +0000 (11:11 +0200)]
dw_dmac: make usage of dw_dma_slave optional

The driver requires a custom slave configuration to be present to be able to
make the slave transfers. Nevertheless, in some cases we need only the request
line as an additional information to the generic slave configuration.  The
request line is provided by slave_id parameter of the dma_slave_config
structure. That's why the custom slave configuration could be optional for such
cases.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: store direction in the custom channel structure
Andy Shevchenko [Thu, 10 Jan 2013 08:53:03 +0000 (10:53 +0200)]
dw_dmac: store direction in the custom channel structure

Currently the direction value comes from the generic slave configuration
structure and explicitly as a preparation function parameter. The first one is
kinda obsoleted. Thus, we have to store the value passed to the preparation
function somewhere in our structures to be able to use it later. The best
candidate to provide the storage is a custom channel structure. Until now we
still keep and check the direction field of the slave config structure as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: call .probe after we have a device in place
Andy Shevchenko [Thu, 10 Jan 2013 08:53:02 +0000 (10:53 +0200)]
dw_dmac: call .probe after we have a device in place

If we don't yet have the platform device for the driver when it is being loaded
we fail to probe the driver. So instead of calling probe() directly we call
platform_driver_register(). It will call the probe() immediately if we have the
device but also makes the driver to work on platforms where the platform device
is created later.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: ste_dma40: reuse is_slave_direction helper
Andy Shevchenko [Thu, 10 Jan 2013 08:53:01 +0000 (10:53 +0200)]
dma: ste_dma40: reuse is_slave_direction helper

The is_slave_direction helps to check if the transfer type is slave.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: ipu_idmac: reuse is_slave_direction helper
Andy Shevchenko [Thu, 10 Jan 2013 08:53:00 +0000 (10:53 +0200)]
dma: ipu_idmac: reuse is_slave_direction helper

The is_slave_direction helps to check if the transfer type is slave.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: ep93xx_dma: reuse is_slave_direction helper
Andy Shevchenko [Thu, 10 Jan 2013 08:52:59 +0000 (10:52 +0200)]
dma: ep93xx_dma: reuse is_slave_direction helper

The is_slave_direction helps to check if the transfer type is slave.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: dw_dmac: check direction properly in dw_dma_cyclic_prep
Andy Shevchenko [Thu, 10 Jan 2013 08:52:58 +0000 (10:52 +0200)]
dma: dw_dmac: check direction properly in dw_dma_cyclic_prep

dma_transfer_direction is a normal enum. It means we can't usually use the
values as bit fields. Let's adjust this check and move it above the usage of
the direction parameter, due to the nature of the following usage of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: at_hdmac: check direction properly for cyclic transfers
Andy Shevchenko [Thu, 10 Jan 2013 08:52:57 +0000 (10:52 +0200)]
dma: at_hdmac: check direction properly for cyclic transfers

dma_transfer_direction is a normal enum. It means we can't usually use the
values as bit fields. Let's adjust this check and move it above the usage of
the direction parameter, due to the nature of the following usage of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodmaengine: introduce is_slave_direction function
Andy Shevchenko [Thu, 10 Jan 2013 08:52:56 +0000 (10:52 +0200)]
dmaengine: introduce is_slave_direction function

This function helps to distinguish the slave type of transfer by checking the
direction parameter.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: dw_dmac: add dwc_chan_pause and dwc_chan_resume
Andy Shevchenko [Wed, 9 Jan 2013 08:17:14 +0000 (10:17 +0200)]
dma: dw_dmac: add dwc_chan_pause and dwc_chan_resume

We will use at least the dwc_chan_resume() later.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: update tx_node_active in dwc_do_single_block
Andy Shevchenko [Wed, 9 Jan 2013 08:17:13 +0000 (10:17 +0200)]
dw_dmac: update tx_node_active in dwc_do_single_block

The "else" keyword in the dw_dma_tasklet is removed as well. All together
simplifies the logic of the code and understanding of what is happening there.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: remove redundant check
Andy Shevchenko [Wed, 9 Jan 2013 08:17:12 +0000 (10:17 +0200)]
dw_dmac: remove redundant check

There is no need to check the callback_required parameter, due to we check the
callback pointer to be a non-NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: check for mapping errors
Andy Shevchenko [Wed, 9 Jan 2013 08:17:11 +0000 (10:17 +0200)]
dw_dmac: check for mapping errors

Otherwise we get a warning in case of CONFIG_DMA_API_DEBUG=y

[   45.775943] WARNING: at lib/dma-debug.c:933 check_unmap+0x5d6/0x6ac()
[   45.782369] dw_dmac dw_dmac.0: DMA-API: device driver failed to check map error[device address=0x00000000356efcc0] [size=28 bytes] [mapped as single]

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodw_dmac: absence of pdata isn't critical when autocfg is set
Andy Shevchenko [Wed, 9 Jan 2013 08:17:01 +0000 (10:17 +0200)]
dw_dmac: absence of pdata isn't critical when autocfg is set

The patch allows to probe the device when platform data is absent and hardware
auto configuration is enabled. In that case the default platform data is used
where the channel allocation order is set to ascending, channel priority is set
to ascending, and private property is set to true.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: mxs-dma: Fix build warnings with W=1
Fabio Estevam [Tue, 8 Jan 2013 01:48:39 +0000 (23:48 -0200)]
dma: mxs-dma: Fix build warnings with W=1

Fix the following warnings when building with W=1 option:

drivers/dma/mxs-dma.c: In function 'mxs_dma_alloc_chan_resources':
drivers/dma/mxs-dma.c:368:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/dma/mxs-dma.c: In function 'mxs_dma_prep_slave_sg':
drivers/dma/mxs-dma.c:481:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/dma/mxs-dma.c:494:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/dma/mxs-dma.c:515:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
drivers/dma/mxs-dma.c: In function 'mxs_dma_prep_dma_cyclic':
drivers/dma/mxs-dma.c:563:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: tegra: add support for Tegra114 SoC
Laxman Dewangan [Sun, 6 Jan 2013 16:22:03 +0000 (21:52 +0530)]
dma: tegra: add support for Tegra114 SoC

NVIDIA's Tegra114 has APB DMA controller which has 32 dma channels
and support support channel wise pause control.

Add support for Tegra114 which uses the channel wise pause control
hardware feature.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: tegra: add support for channel wise pause
Laxman Dewangan [Sun, 6 Jan 2013 16:22:02 +0000 (21:52 +0530)]
dma: tegra: add support for channel wise pause

NVIDIA's some SoCs like Tegra114 support the channel wise pause control
inplace of global pause which pauses all DMA channels. When SoCs support
the channel wise pause control then it uses the global pause for clock
gating for register access as well as all DMA channel pause. Hence DMA
registers are not accessible if DMAs are globally paused on these new SoCs.

Add support for channel wise pause feature if SoCs support it.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
11 years agodma: ipu: Drop unused spinlock
Jean Delvare [Thu, 6 Sep 2012 07:19:35 +0000 (09:19 +0200)]
dma: ipu: Drop unused spinlock

I was checking why this spinlock was never initialized, but it turns
out it's not used anywhere, so we can drop it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agodca: check against empty dca_domains list before unregister provider
Maciej Sosnowski [Wed, 23 May 2012 15:27:07 +0000 (17:27 +0200)]
dca: check against empty dca_domains list before unregister provider

When providers get blocked unregister_dca_providers() is called ending up
with dca_providers and dca_domain lists emptied. Dca should be prevented from
trying to unregister any provider if dca_domain list is found empty.

Cc: <stable@vger.kernel.org>
Reported-by: Jiang Liu <jiang.liu@huawei.com>
Tested-by: Gaohuai Han <hangaohuai@huawei.com>
Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoioat: remove chanerr mask setting for IOAT v3.x
Dave Jiang [Tue, 27 Nov 2012 22:16:08 +0000 (15:16 -0700)]
ioat: remove chanerr mask setting for IOAT v3.x

The existing code set a value in the PCI_CHANERRMSK_INT register
for a workaround to address a pre-silicon bug on the Intel 5520 IO hub that
has been fixed when the hardware was released. There is no need for this
code.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoioat: Add alignment workaround for IVB platforms
Dave Jiang [Mon, 3 Dec 2012 23:08:37 +0000 (16:08 -0700)]
ioat: Add alignment workaround for IVB platforms

The PCI IDs for IvyBridge IOAT DMA needs to go into a header file since
dma_v3.c looks them up for certain hardware workarounds. Need to add to the
alignment workaround for IOAT 3.2 since it wasn't fixed in IVB.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoasync_tx: fix checking of dma_wait_for_async_tx() return value
Bartlomiej Zolnierkiewicz [Thu, 8 Nov 2012 10:03:16 +0000 (10:03 +0000)]
async_tx: fix checking of dma_wait_for_async_tx() return value

dma_wait_for_async_tx() can also return DMA_PAUSED (which
should be considered as error).

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agodmaengine: add cpu_relax() to busy-loop in dma_sync_wait()
Bartlomiej Zolnierkiewicz [Thu, 8 Nov 2012 10:02:07 +0000 (10:02 +0000)]
dmaengine: add cpu_relax() to busy-loop in dma_sync_wait()

Removal of the busy-loop from dma_sync_wait() is not a trivial
task so just add cpu_relax() to the loop for now.

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agodmaengine: remove dma_async_memcpy_complete() macro
Bartlomiej Zolnierkiewicz [Thu, 8 Nov 2012 10:01:01 +0000 (10:01 +0000)]
dmaengine: remove dma_async_memcpy_complete() macro

Just use dma_async_is_tx_complete() directly.

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agodmaengine: remove dma_async_memcpy_pending() macro
Bartlomiej Zolnierkiewicz [Thu, 8 Nov 2012 09:59:54 +0000 (09:59 +0000)]
dmaengine: remove dma_async_memcpy_pending() macro

Just use dma_async_issue_pending() directly.

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoasync_tx: fix build for async_memset
Bartlomiej Zolnierkiewicz [Mon, 5 Nov 2012 10:00:20 +0000 (10:00 +0000)]
async_tx: fix build for async_memset

Add missing <linux/module.h> include.

Cc: Dan Williams <djbw@fb.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoioat3: add missing DMA unmap to ioat_xor_val_self_test()
Bartlomiej Zolnierkiewicz [Mon, 5 Nov 2012 10:00:19 +0000 (10:00 +0000)]
ioat3: add missing DMA unmap to ioat_xor_val_self_test()

Make ioat_xor_val_self_test() do DMA unmapping itself and fix handling
of failure cases.

Cc: Dan Williams <djbw@fb.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agodmaengine/dmatest: terminate transfers only in case of errors
Shiraz Hashim [Fri, 9 Nov 2012 15:26:29 +0000 (15:26 +0000)]
dmaengine/dmatest: terminate transfers only in case of errors

dmatest erroneously terminated transfers in normal cases also leading to
test failures for multiple threads over a channel. Fix this and
terminate transfers only in case of errors.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Deepak Sikri <deepak.sikri@st.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodma: sh: Don't use ENODEV for failing slave lookup
Guennadi Liakhovetski [Wed, 28 Nov 2012 06:49:47 +0000 (06:49 +0000)]
dma: sh: Don't use ENODEV for failing slave lookup

If dmaengine driver's .device_alloc_chan_resources() method returns -ENODEV,
dma_request_channel() will decide, that the driver has been removed and will
remove the device from its list. To prevent this use ENXIO if a slave lookup
fails.

Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: stable@vger.kernel.org
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodmatest: Fix NULL pointer dereference on ioat
Jon Mason [Sun, 11 Nov 2012 23:03:20 +0000 (23:03 +0000)]
dmatest: Fix NULL pointer dereference on ioat

device_control is an optional and not implemented in all DMA drivers.
Any calls to these will result in a NULL pointer dereference.  dmatest
makes two of these calls when completing the kernel thread and removing
the module.  These are corrected by calling the dmaengine_device_control
wrapper and checking for a non-existant device_control function pointer
there.

Signed-off-by: Jon Mason <jon.mason@intel.com>
CC: Vinod Koul <vinod.koul@intel.com>
CC: Dan Williams <djbw@fb.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agoDMA: PL330: Use devm_* functions
Sachin Kamat [Thu, 15 Nov 2012 06:27:50 +0000 (06:27 +0000)]
DMA: PL330: Use devm_* functions

devm_* functions are device managed and make the code and error
handling a bit simpler.

Cc: Jassi Brar <jassisinghbrar@gmail.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agoDMAEngine: add dmaengine_prep_interleaved_dma wrapper for interleaved api
Barry Song [Tue, 6 Nov 2012 13:32:39 +0000 (21:32 +0800)]
DMAEngine: add dmaengine_prep_interleaved_dma wrapper for interleaved api

commit b14dab792dee(DMAEngine: Define interleaved transfer request api) adds
interleaved request api, this patch adds the dmaengine_prep_interleaved_dma
just like we have dmaengine_prep_ for other modes to avoid drivers call:
xxx_chan->device->device_prep_interleaved_dma().

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodmaengine: sirf: enable the driver support new SiRFmarco SoC
Barry Song [Thu, 1 Nov 2012 14:54:43 +0000 (22:54 +0800)]
dmaengine: sirf: enable the driver support new SiRFmarco SoC

The driver supports old up SiRFprimaII SoCs, this patch makes it support
the new SiRFmarco as well.
SiRFmarco, as a SMP SoC, adds new DMA_INT_EN_CLR and DMA_CH_LOOP_CTRL_CLR
registers, to disable IRQ/Channel, we should write 1 to the corresponding
bit in the two CLEAR register.

Tested on SiRFmarco using SPI driver:
    $ /mnt/spidev-sirftest -D /dev/spidev32766.0
    spi mode: 0
    bits per word: 8
    max speed: 500000 Hz (500 KHz)

    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00 00 00
    00 00 00 00

    $ cat /proc/interrupts
               CPU0       CPU1
     32:       1593          0       GIC  sirfsoc_timer0
     33:          0       3533       GIC  sirfsoc_timer1
     44:          0          0       GIC  sirfsoc_dma
     45:         16          0       GIC  sirfsoc_dma
     47:          6          0       GIC  sirfsoc_spi
     50:       5654          0       GIC  sirfsoc-uart
     ...

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodmaengine: fix !of_dma compilation warning
Vinod Koul [Thu, 29 Nov 2012 06:47:22 +0000 (12:17 +0530)]
dmaengine: fix !of_dma compilation warning

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agoof: dma: fix protection of DMA controller data stored by DMA helpers
Jon Hunter [Thu, 11 Oct 2012 19:43:01 +0000 (14:43 -0500)]
of: dma: fix protection of DMA controller data stored by DMA helpers

In the current implementation of the OF DMA helpers, read-copy-update (RCU)
linked lists are being used for storing and accessing the DMA controller data.
This part of implementation is based upon V2 of the DMA helpers by Nicolas [1].
During a recent review of RCU, it became apparent that the code is missing the
required rcu_read_lock()/unlock() calls as well as synchronisation calls before
freeing any memory protected by RCU.

Having looked into adding the appropriate RCU calls to protect the DMA data it
became apparent that with the current DMA helper implementation, using RCU is
not as attractive as it may have been before. The main reasons being that ...

1. We need to protect the DMA data around calls to the xlate function.
2. The of_dma_simple_xlate() function calls the DMA engine function
   dma_request_channel() which employs a mutex and so could sleep.
3. The RCU read-side critical sections must not sleep and so we cannot hold
   an RCU read lock around the xlate function.

Therefore, instead of using RCU, an alternative for this use-case is to employ
a simple spinlock inconjunction with a usage count variable to keep track of
how many current users of the DMA data structure there are. With this
implementation, the DMA data cannot be freed until all current users of the
DMA data are finished.

This patch is based upon the DMA helpers fix for potential deadlock [2].

[1] http://article.gmane.org/gmane.linux.ports.arm.omap/73622
[2] http://marc.info/?l=linux-arm-kernel&m=134859982520984&w=2

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agoof: dma: fix potential deadlock when requesting a slave channel
Jon Hunter [Tue, 25 Sep 2012 18:59:31 +0000 (13:59 -0500)]
of: dma: fix potential deadlock when requesting a slave channel

In the latest version of the OF dma handlers I added support (rather hastily)
to exhaustively search for an available dma slave channel, for the use-case
where we have alternative slave channels that can be used. In the current
implementation a deadlock scenario can occur causing the CPU to loop forever.
The scenario is as follows ...

1. There are alternative channels avaialble
2. The first channel that is found by calling of_dma_find_channel() is not
   available and so the call to the xlate function returns NULL. In this case
   we will call of_dma_find_channel() again but we will return the same channel
   that we found the first time and hence, again the xlate will return NULL and
   we will loop here forever.

Fix this potential deadlock by just using a single for-loop and not a for-loop
nested in a do-while loop. This change also replaces the function
of_dma_find_channel() with of_dma_match_channel() which performs a simple check
to see if a DMA channel matches the name specified.

I have tested this implementation on an OMAP4 panda board by adding a dummy
DMA specifier, that will cause the xlate function to return NULL, to the
beginning of a list of DMA specifiers for a DMA client.

Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agocarma-fpga: pass correct flags to ->device_prep_dma_memcpy()
Bartlomiej Zolnierkiewicz [Mon, 5 Nov 2012 10:00:15 +0000 (10:00 +0000)]
carma-fpga: pass correct flags to ->device_prep_dma_memcpy()

DMA unmapping is handled by a driver so tell fsldma.c driver
(which is the DMA engine driver used by carma-fpga) to skip
unmapping destination and source buffers.

Cc: Ira W. Snyder <iws@ovro.caltech.edu>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agomtd: fsmc_nand: add missing DMA unmap to dma_xfer()
Bartlomiej Zolnierkiewicz [Mon, 5 Nov 2012 10:00:14 +0000 (10:00 +0000)]
mtd: fsmc_nand: add missing DMA unmap to dma_xfer()

Make dma_xfer() do DMA unmapping itself and fix handling
of failure cases.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Vipin Kumar <vipin.kumar@st.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoioat: add missing DMA unmap to ioat_dma_self_test()
Bartlomiej Zolnierkiewicz [Mon, 5 Nov 2012 10:00:13 +0000 (10:00 +0000)]
ioat: add missing DMA unmap to ioat_dma_self_test()

Make ioat_dma_self_test() do DMA unmapping itself and fix handling
of failure cases.

Cc: Dan Williams <djbw@fb.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoasync_tx: add missing DMA unmap to async_memcpy()
Bartlomiej Zolnierkiewicz [Mon, 5 Nov 2012 10:00:12 +0000 (10:00 +0000)]
async_tx: add missing DMA unmap to async_memcpy()

Do DMA unmap on ->device_prep_dma_memcpy failure.

Cc: Dan Williams <djbw@fb.com>
Cc: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dan Williams <djbw@fb.com>
11 years agoasync_tx: use memchr_inv
Akinobu Mita [Sat, 27 Oct 2012 15:49:33 +0000 (00:49 +0900)]
async_tx: use memchr_inv

Use memchr_inv() to check the specified page is filled with zero.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodma: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
Joe Perches [Sun, 28 Oct 2012 08:05:44 +0000 (01:05 -0700)]
dma: Convert dev_printk(KERN_<LEVEL> to dev_<level>(

dev_<level> calls take less code than dev_printk(KERN_<LEVEL>
and reducing object size is good.
Coalesce formats for easier grep.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodmatest: adjust invalid module parameters for number of source buffers
Akinobu Mita [Sat, 27 Oct 2012 15:49:32 +0000 (00:49 +0900)]
dmatest: adjust invalid module parameters for number of source buffers

DMA Engine test module has module parameters to set the number of source
buffers for xor and pq operations.  We can set these values larger than the
maximum number of sources that the device can support.  These values are
not adjusted and the unsupported number of source buffers are passed to the
device.  But most drivers don't check it, so unexpected results will happen.

This makes an appropriate adjustment for these module parameters before use.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodma: amba-pl08x: use vchan_dma_desc_free_list
Akinobu Mita [Sat, 27 Oct 2012 15:49:31 +0000 (00:49 +0900)]
dma: amba-pl08x: use vchan_dma_desc_free_list

vchan_dma_desc_free_list() iterates through each virt_dma_desc in the
specified list_head and calls vchan->desc_free().

We can use it instead of repeated execution of pl08x_desc_free() for each
virt_dma_desc in the list_head.  Because vchan->desc_free callback is set
as pl08x_desc_free() for amba-pl08x driver.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodmaengine: use for_each_set_bit
Akinobu Mita [Fri, 26 Oct 2012 14:35:15 +0000 (23:35 +0900)]
dmaengine: use for_each_set_bit

Use for_each_set_bit() to implement for_each_dma_cap_mask() and
remove unused first_dma_cap() and next_dma_cap().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <djbw@fb.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodw_dmac: introduce to_dw_desc() macro
Andy Shevchenko [Thu, 18 Oct 2012 14:34:12 +0000 (17:34 +0300)]
dw_dmac: introduce to_dw_desc() macro

The to_dw_desc() macro helps to retrieve the dw_desc node from the
corresponding list_head structure.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
11 years agodw_dmac: change dev_crit to dev_WARN in dwc_handle_error
Andy Shevchenko [Thu, 18 Oct 2012 14:34:11 +0000 (17:34 +0300)]
dw_dmac: change dev_crit to dev_WARN in dwc_handle_error

In case of handling a bad descriptor the dwc_handle_error() will dump a stack
as well. It's a lot more verbose and more likely to get user's attention.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>