cascardo/linux.git
7 years agoMerge branch 'topic/mv_xor' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:48:20 +0000 (09:18 +0530)]
Merge branch 'topic/mv_xor' into for-linus

7 years agoMerge branch 'topic/k3' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:48:14 +0000 (09:18 +0530)]
Merge branch 'topic/k3' into for-linus

7 years agoMerge branch 'topic/iommu' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:48:06 +0000 (09:18 +0530)]
Merge branch 'topic/iommu' into for-linus

7 years agoMerge branch 'topic/ioatdma' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:48:01 +0000 (09:18 +0530)]
Merge branch 'topic/ioatdma' into for-linus

7 years agoMerge branch 'topic/imx' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:47:52 +0000 (09:17 +0530)]
Merge branch 'topic/imx' into for-linus

7 years agoMerge branch 'topic/hsu' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:47:44 +0000 (09:17 +0530)]
Merge branch 'topic/hsu' into for-linus

7 years agoMerge branch 'topic/err_reporting' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:47:33 +0000 (09:17 +0530)]
Merge branch 'topic/err_reporting' into for-linus

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Conflicts:
drivers/dma/cppi41.c

7 years agoMerge branch 'topic/dmatest' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:46:32 +0000 (09:16 +0530)]
Merge branch 'topic/dmatest' into for-linus

7 years agoMerge branch 'topic/cppi' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:46:23 +0000 (09:16 +0530)]
Merge branch 'topic/cppi' into for-linus

7 years agoMerge branch 'topic/core' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:46:13 +0000 (09:16 +0530)]
Merge branch 'topic/core' into for-linus

7 years agoMerge branch 'topic/compile_test' into for-linus
Vinod Koul [Mon, 3 Oct 2016 03:46:03 +0000 (09:16 +0530)]
Merge branch 'topic/compile_test' into for-linus

7 years agodmaengine: virt-dma: move function declarations
Baoyou Xie [Sat, 24 Sep 2016 04:37:05 +0000 (12:37 +0800)]
dmaengine: virt-dma: move function declarations

We get 2 warnings when building kernel with W=1:
drivers/dma/virt-dma.c:22:14: warning: no previous prototype for 'vchan_tx_submit' [-Wmissing-prototypes]
drivers/dma/virt-dma.c:52:5: warning: no previous prototype for 'vchan_tx_desc_free' [-Wmissing-prototypes]

In fact, these two functions are incorrectly declared in a function.

So this patch moves function declarations out of this function.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agoDT: dmaengine: rcar-dmac: document R8A7743/5 support
Sergei Shtylyov [Wed, 28 Sep 2016 22:25:48 +0000 (01:25 +0300)]
DT: dmaengine: rcar-dmac: document R8A7743/5 support

Renesas  RZ/G SoC also have the R-Car gen2/3 compatible DMA controllers.
Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: fsldma: Unmap region obtained by of_iomap
Arvind Yadav [Wed, 28 Sep 2016 10:45:11 +0000 (16:15 +0530)]
dmaengine: fsldma: Unmap region obtained by of_iomap

Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: jz4780: fix resource leaks on error exit return
Colin Ian King [Thu, 29 Sep 2016 17:45:05 +0000 (18:45 +0100)]
dmaengine: jz4780: fix resource leaks on error exit return

In two cases when jz4780_dma_setup_hwdesc fails, there is a memory
leak on the allocated desc and associated DMA pools on the error
exit return path.  Fix this by free'ing the resources before
returning.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodma-debug: fix ia64 build, use PHYS_PFN
Niklas Söderlund [Thu, 29 Sep 2016 19:59:15 +0000 (21:59 +0200)]
dma-debug: fix ia64 build, use PHYS_PFN

kbuild test robot reports:

   lib/dma-debug.c: In function 'debug_dma_map_resource':
>> lib/dma-debug.c:1541:16: error: implicit declaration of function '__phys_to_pfn' [-Werror=implicit-function-declaration]
     entry->pfn  = __phys_to_pfn(addr);
                   ^~~~~~~~~~~~~

ia64 does not provide __phys_to_pfn(), use the PHYS_PFN() alias.

Fixes: 0e74b34dfc3318bf ("dma-debug: add support for resource mappings")
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: coh901318: fix integer overflow when shifting more than 32 places
Colin Ian King [Thu, 29 Sep 2016 18:14:38 +0000 (19:14 +0100)]
dmaengine: coh901318: fix integer overflow when shifting more than 32 places

Currently U300_DMA_CHANNELS is set to 40, meaning that the shift of 1 can
be more than 32 places, which leads to a 32 bit integer overflow. Fix this
by using 1ULL instead of 1 before shifting it.  Also add braces on the
for-loop to keep with coding style conventions.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: edma: avoid uninitialized variable use
Arnd Bergmann [Fri, 30 Sep 2016 16:19:01 +0000 (18:19 +0200)]
dmaengine: edma: avoid uninitialized variable use

If edma_read_slot() gets an invalid argument, it does not set a result,
as found by "gcc -Wmaybe-uninitialized"

drivers/dma/edma.c: In function 'dma_ccerr_handler':
drivers/dma/edma.c:1499:21: error: 'p.a_b_cnt' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/dma/edma.c:1499:21: error: 'p.ccnt' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (p.a_b_cnt == 0 && p.ccnt == 0) {

If we change the function to return an error in this case, we can handle
the failure more gracefully and treat this the same way as a null slot
that we already catch.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodma-mapping: fix m32r build warning
Niklas Söderlund [Thu, 29 Sep 2016 10:02:40 +0000 (12:02 +0200)]
dma-mapping: fix m32r build warning

kbuild test robot reports:

   In file included from include/linux/skbuff.h:34:0,
                    from include/linux/icmpv6.h:4,
                    from include/linux/ipv6.h:75,
                    from include/net/ipv6.h:16,
                    from include/linux/sunrpc/clnt.h:27,
                    from include/linux/nfs_fs.h:30,
                    from fs/lockd/clntlock.c:13:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
>> include/linux/dma-mapping.h:274:16: warning: unused variable 'pfn' [-Wunused-variable]
     unsigned long pfn = __phys_to_pfn(phys_addr);
                   ^~~

The pfn value is only used once in the call to pfn_valid(), remove the
variable and calculate the pfn when it's needed. Note that the kbuild
report is old and PHYS_PFN() is now used instead of __phys_to_pfn() to
calculate the pfn.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodma-mapping: fix ia64 build, use PHYS_PFN
Niklas Söderlund [Thu, 29 Sep 2016 10:02:39 +0000 (12:02 +0200)]
dma-mapping: fix ia64 build, use PHYS_PFN

kbuild test robot reports:

   In file included from include/linux/skbuff.h:34:0,
                    from include/linux/tcp.h:21,
                    from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:119:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
>> include/linux/dma-mapping.h:274:22: error: implicit declaration of function '__phys_to_pfn' [-Werror=implicit-function-declaration]
     unsigned long pfn = __phys_to_pfn(phys_addr);
                         ^~~~~~~~~~~~~

ia64 does not provide __phys_to_pfn(), use the PHYS_PFN() alias.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ti-dma-crossbar: enable COMPILE_TEST
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:35 +0000 (15:41 +0300)]
dmaengine: ti-dma-crossbar: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.
When compile testing eDMA or omap-dma, select also the ti-dma-crossbar so
it is also covered by the compile testing.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: omap-dma: enable COMPILE_TEST
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:34 +0000 (15:41 +0300)]
dmaengine: omap-dma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: edma: enable COMPILE_TEST
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:33 +0000 (15:41 +0300)]
dmaengine: edma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ti-dma-crossbar: Fix of_device_id data parameter usage
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:32 +0000 (15:41 +0300)]
dmaengine: ti-dma-crossbar: Fix of_device_id data parameter usage

Use pointers to static constant variables for crossbar type and for DMA
offset configuration.

Fixes compiler warnings on 64bit architectures:

drivers/dma/ti-dma-crossbar.c: In function ‘ti_dra7_xbar_probe’:
drivers/dma/ti-dma-crossbar.c:398:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  xbar->dma_offset = (u32)match->data;
                     ^
drivers/dma/ti-dma-crossbar.c: In function ‘ti_dma_xbar_probe’:
drivers/dma/ti-dma-crossbar.c:431:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  switch ((u32)match->data) {
          ^

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:31 +0000 (15:41 +0300)]
dmaengine: ti-dma-crossbar: Correct type for of_find_property() third parameter

The correct type is int and not for the third parameter of
of_find_property().
Fixes compilation for 64bit architectures (x86_64, aarch64).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:30 +0000 (15:41 +0300)]
dmaengine/ARM: omap-dma: Fix the DMAengine compile test on non OMAP configs

The DMAengine driver for omap-dma use three function calls from the
plat-omap legacy driver. When the DMAengine driver is built when ARCH_OMAP
is not set, the compilation will fail due to missing symbols.
Add empty inline functions to allow the DMAengine driver to be compiled
with COMPILE_TEST.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: edma: Rename set_bits and remove unused clear_bits helper
Peter Ujfalusi [Thu, 22 Sep 2016 06:31:04 +0000 (09:31 +0300)]
dmaengine: edma: Rename set_bits and remove unused clear_bits helper

The clear_bits() helper is not used by the driver so it can be removed.

powerpc architecture defines the set_bits() in
arch/powerpc/include/asm/bitops.h which results failed compile testing on
powerpc architecture:

>> drivers/dma/edma.c:415:20: error: conflicting types for 'set_bits'
    static inline void set_bits(int offset, int len, unsigned long *p)
                       ^~~~~~~~
   In file included from include/linux/bitops.h:36:0,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from include/linux/dmaengine.h:20,
                    from drivers/dma/edma.c:16:
   arch/powerpc/include/asm/bitops.h:75:14: note: previous definition of 'set_bits' was here
    DEFINE_BITOP(set_bits, or, "")
                 ^
   arch/powerpc/include/asm/bitops.h:58:24: note: in definition of macro 'DEFINE_BITOP'
    static __inline__ void fn(unsigned long mask, \
                           ^~

>> drivers/dma/edma.c:421:20: error: conflicting types for 'clear_bits'
    static inline void clear_bits(int offset, int len, unsigned long *p)
                       ^~~~~~~~~~
   In file included from include/linux/bitops.h:36:0,
                    from include/linux/kernel.h:10,
                    from include/linux/list.h:8,
                    from include/linux/kobject.h:20,
                    from include/linux/device.h:17,
                    from include/linux/dmaengine.h:20,
                    from drivers/dma/edma.c:16:
   arch/powerpc/include/asm/bitops.h:76:14: note: previous definition of 'clear_bits' was here
    DEFINE_BITOP(clear_bits, andc, "")
                 ^
   arch/powerpc/include/asm/bitops.h:58:24: note: in definition of macro 'DEFINE_BITOP'
    static __inline__ void fn(unsigned long mask, \
                           ^~

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: edma: Use correct type for of_find_property() third parameter
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:29 +0000 (15:41 +0300)]
dmaengine: edma: Use correct type for of_find_property() third parameter

The correct type is int and not for the third parameter of
of_find_property().
Fixes compilation for 64bit architectures (x86_64, aarch64).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: edma: Fix of_device_id data parameter usage (legacy vs TPCC)
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:28 +0000 (15:41 +0300)]
dmaengine: edma: Fix of_device_id data parameter usage (legacy vs TPCC)

Use pointers to static constant variables for eDMA binding
type (legacy vs TPCC).

Fixes the following warning when compiling the driver for 64bit
architectures (x86_64 for example):
drivers/dma/edma.c:2185:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   if (match && (u32)match->data == EDMA_BINDING_TPCC)
                ^

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs
Peter Ujfalusi [Wed, 21 Sep 2016 12:41:27 +0000 (15:41 +0300)]
dmaengine: edma: Add missing MODULE_DEVICE_TABLE() for of_device_id structs

The MODULE_DEVICE_TABLE() were missing from the driver for the of_device_id
structures.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: tegra-adma: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:31:52 +0000 (16:01 +0530)]
dmaengine: tegra-adma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Suggested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sun6i: Add support for Allwinner A83T (sun8i) variant
Jean-Francois Moine [Sun, 18 Sep 2016 07:59:50 +0000 (09:59 +0200)]
dmaengine: sun6i: Add support for Allwinner A83T (sun8i) variant

The A83T SoC has the same dma engine as the A31 (sun6i), with a reduced
amount of endpoints and physical channels.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: s3c24xx: Add dma_slave_map for s3c2440 devices
Sam Van Den Berge [Thu, 22 Sep 2016 18:51:15 +0000 (20:51 +0200)]
dmaengine: s3c24xx: Add dma_slave_map for s3c2440 devices

This patch updates the s3c24xx dma driver to be able to pass a
dma_slave_map array via the platform data. This is needed to
be able to use the new, simpler dmaengine API [1].
I used the virtual DMA channels as a parameter for the dma_filter
function. By doing that, I could reuse the existing filter function in
drivers/dma/s3c24xx-dma.c.

I have tested this on my mini2440 board with the audio driver.
According to my observations, dma_request_slave_channel in the
function dmaengine_pcm_new in the file
sound/soc/soc-generic-dmaengine-pcm.c now returns a valid DMA channel
whereas before no DMA channel was returned at that point.

Entries for DMACH_XD0, DMACH_XD1 and DMACH_TIMER are missing because I
don't realy know which driver to use for these.

[1]
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/393635.html

Signed-off-by: Sam Van Den Berge <sam.van.den.berge@telenet.be>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: moxart: fix kconfig unmet direct dependencies
Vinod Koul [Tue, 20 Sep 2016 05:02:47 +0000 (10:32 +0530)]
dmaengine: moxart: fix kconfig unmet direct dependencies

We have unmet direct dependencies as DMA_SUN4I selects DMA_OF so remove the
selection

warning: (DMA_SUN4I && MOXART_DMA && STM32_DMA) selects DMA_OF which has
unmet direct dependencies (DMADEVICES && OF)

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sun4i: fix kconfig unmet direct dependencies
Vinod Koul [Tue, 20 Sep 2016 05:02:47 +0000 (10:32 +0530)]
dmaengine: sun4i: fix kconfig unmet direct dependencies

We have unmet direct dependencies as DMA_SUN4I selects DMA_OF so remove the
selection

warning: (DMA_SUN4I && MOXART_DMA && STM32_DMA) selects DMA_OF which has
unmet direct dependencies (DMADEVICES && OF)

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: zxdma: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:40:07 +0000 (16:10 +0530)]
dmaengine: zxdma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: timb-dma: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:37:05 +0000 (16:07 +0530)]
dmaengine: timb-dma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: s3c24xx: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:30:41 +0000 (16:00 +0530)]
dmaengine: s3c24xx: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: s3c24xx: fix pointer cast warnings
Vinod Koul [Wed, 14 Sep 2016 10:51:32 +0000 (16:21 +0530)]
dmaengine: s3c24xx: fix pointer cast warnings

On some systems, pointer can be large than unsigned int, triggering warning
pointer-to-int-cast on conversion.

drivers/dma/s3c24xx-dma.c: In function 's3c24xx_dma_filter':
drivers/dma/s3c24xx-dma.c:1421:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Use a long value for type conversion.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: s3c24xx: use correct print specifiers for size_t
Vinod Koul [Wed, 14 Sep 2016 10:45:20 +0000 (16:15 +0530)]
dmaengine: s3c24xx: use correct print specifiers for size_t

This driver warns:

drivers/dma/s3c24xx-dma.c: In function 's3c24xx_dma_prep_memcpy':
drivers/dma/s3c24xx-dma.c:826:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
drivers/dma/s3c24xx-dma.c:830:3: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]

We should use %zu to print 'size_t' values.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: stm32-dma: make stm32_dma_set_config static
Vinod Koul [Fri, 2 Sep 2016 10:29:10 +0000 (15:59 +0530)]
dmaengine: stm32-dma: make stm32_dma_set_config static

Sparse complains:
drivers/dma/stm32-dma.c:957:6: warning: symbol 'stm32_dma_set_config' was
not declared. Should it be static?

SO make stm32_dma_set_config static.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: stm32-dma: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:27:51 +0000 (15:57 +0530)]
dmaengine: stm32-dma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: mmp_tdma: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:27:09 +0000 (15:57 +0530)]
dmaengine: mmp_tdma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

While at it, to fix build on other archs, select MMP_SRAM only for ARCH_MMP
and also fix the platform header

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: mmp_pdma: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:25:56 +0000 (15:55 +0530)]
dmaengine: mmp_pdma: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: mmp_tdma: use correct print specifiers for size_t
Vinod Koul [Wed, 14 Sep 2016 10:23:08 +0000 (15:53 +0530)]
dmaengine: mmp_tdma: use correct print specifiers for size_t

This driver warns:

drivers/dma/mmp_tdma.c: In function 'mmp_tdma_prep_dma_cyclic':
drivers/dma/mmp_tdma.c:437:5: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]

We should use %zu to print 'size_t' values.

Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ep93xx: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:08:43 +0000 (15:38 +0530)]
dmaengine: ep93xx: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ep93xx: don't use variables defined in global scope
Vinod Koul [Wed, 14 Sep 2016 10:09:56 +0000 (15:39 +0530)]
dmaengine: ep93xx: don't use variables defined in global scope

The driver uses same variable name in local and global context in a
function, rename the local one for better readability.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ep93xx: use correct print specifiers for size_t
Vinod Koul [Wed, 14 Sep 2016 10:09:56 +0000 (15:39 +0530)]
dmaengine: ep93xx: use correct print specifiers for size_t

This driver warns:

drivers/dma/ep93xx_dma.c: In function 'ep93xx_dma_prep_slave_sg':
drivers/dma/ep93xx_dma.c:1054:6: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]

drivers/dma/ep93xx_dma.c: In function 'ep93xx_dma_prep_dma_cyclic':
drivers/dma/ep93xx_dma.c:1129:5: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]

We should use %zu to print 'size_t' values.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sa11x0: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 10:01:42 +0000 (15:31 +0530)]
dmaengine: sa11x0: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sa11x0: use correct print specifiers for size_t
Vinod Koul [Wed, 14 Sep 2016 09:52:49 +0000 (15:22 +0530)]
dmaengine: sa11x0: use correct print specifiers for size_t

This driver when compiled on 64 bits gave warnings:

drivers/dma/sa11x0-dma.c:602:2: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘size_t’ [-Wformat=]

We should use %zu to print 'size_t' values.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sa11x0: use correct print specifiers for u32
Vinod Koul [Wed, 14 Sep 2016 09:52:49 +0000 (15:22 +0530)]
dmaengine: sa11x0: use correct print specifiers for u32

This driver when compiled on 64 bits gave warnings:

drivers/dma/sa11x0-dma.c:494:2: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘u32’ [-Wformat=]

We should use %x to print 'u32' values.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sa11x0: use correct print specifiers for dma_addr_t
Vinod Koul [Wed, 14 Sep 2016 09:45:43 +0000 (15:15 +0530)]
dmaengine: sa11x0: use correct print specifiers for dma_addr_t

This driver when compiled on 64 bits gave warnings:

drivers/dma/sa11x0-dma.c:466:27: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t' [-Wformat=]
drivers/dma/sa11x0-dma.c:554:31: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Wformat=]
drivers/dma/sa11x0-dma.c:696:34: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'dma_addr_t' [-Wformat=]

We should use %pad to print 'dma_addr_t' values.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: coh901318: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 09:59:49 +0000 (15:29 +0530)]
dmaengine: coh901318: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: coh901318: use NULL for pointer initialization
Vinod Koul [Tue, 13 Sep 2016 17:25:01 +0000 (22:55 +0530)]
dmaengine: coh901318: use NULL for pointer initialization

Sparse complains:
drivers/dma/coh901318_lli.c:78:31: warning: Using plain integer as NULL pointer
drivers/dma/coh901318_lli.c:91:39: warning: Using plain integer as NULL pointer

Use NULL for pointer initialization rather than plain integer

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: coh901318: fix pointer cast warnings
Vinod Koul [Tue, 13 Sep 2016 16:57:53 +0000 (22:27 +0530)]
dmaengine: coh901318: fix pointer cast warnings

On some systems, pointer can be large than unsigned int, triggering warning
pointer-to-int-cast on conversion.

drivers/dma/coh901318.c: In function 'coh901318_filter_id':
drivers/dma/coh901318.c:1769:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  unsigned int ch_nr = (unsigned int) chan_id;

Also, converting an iomem pointer for print leads to warn on some system
which can be avoided with %p specfier

drivers/dma/coh901318.c: In function 'coh901318_probe':
drivers/dma/coh901318.c:2748:3: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   (u32) base->virtbase);

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: coh901318: return ssize_t for coh901318_debugfs_read
Vinod Koul [Tue, 13 Sep 2016 16:55:07 +0000 (22:25 +0530)]
dmaengine: coh901318: return ssize_t for coh901318_debugfs_read

The file_operations.read expects return as ssize_t, so update
coh901318_debugfs_read to return ssize_t to fix the warning:

drivers/dma/coh901318.c:1369:2: warning: initialization from incompatible pointer type [enabled by default]
  .read  = coh901318_debugfs_read,

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: coh901318: use correct print specifiers
Vinod Koul [Tue, 13 Sep 2016 16:48:32 +0000 (22:18 +0530)]
dmaengine: coh901318: use correct print specifiers

This driver when compiled on 64 bits gave warnings:

drivers/dma/coh901318.c: In function 'coh901318_list_print':
warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat=]
warning: format '%x' expects argument of type 'unsigned int', but argument 8 has type 'dma_addr_t' [-Wformat=]
warning: format '%x' expects argument of type 'unsigned int', but argument 9 has type 'dma_addr_t' [-Wformat=]

drivers/dma/coh901318.c: In function 'coh901318_prep_memcpy':
warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t' [-Wformat=]
warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'dma_addr_t' [-Wformat=]
warning: format '%d' expects argument of type 'int', but argument 8 has type 'size_t' [-Wformat=]

We should use %pad to print 'dma_addr_t' values and %zu to print size_t
values

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: jz4780: make jz4780_dma_prep_dma_memcpy static
Vinod Koul [Fri, 2 Sep 2016 09:57:55 +0000 (15:27 +0530)]
dmaengine: jz4780: make jz4780_dma_prep_dma_memcpy static

Sparse complains:
drivers/dma/dma-jz4780.c:399:32: warning: symbol
'jz4780_dma_prep_dma_memcpy' was not declared. Should it be static?

So make this static

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: jz4780: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 09:57:20 +0000 (15:27 +0530)]
dmaengine: jz4780: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: jz4740: enable COMPILE_TEST
Vinod Koul [Fri, 2 Sep 2016 09:55:11 +0000 (15:25 +0530)]
dmaengine: jz4740: enable COMPILE_TEST

To get more coverage, enable COMPILE_TEST for this driver.

Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: jz4740: remove unused arch header
Vinod Koul [Tue, 20 Sep 2016 03:32:43 +0000 (09:02 +0530)]
dmaengine: jz4740: remove unused arch header

The defines in asm/mach-jz4740/dma.h are not used by driver so remove it

Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: rcar-dmac: add iommu support for slave transfers
Niklas Söderlund [Wed, 10 Aug 2016 11:22:19 +0000 (13:22 +0200)]
dmaengine: rcar-dmac: add iommu support for slave transfers

Enable slave transfers to a device behind a IPMMU by mapping the slave
addresses using the dma-mapping API.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: rcar-dmac: group slave configuration
Niklas Söderlund [Wed, 10 Aug 2016 11:22:18 +0000 (13:22 +0200)]
dmaengine: rcar-dmac: group slave configuration

Group slave address and transfer size in own structs for source and
destination. This is in preparation for hooking up the dma-mapping API
to the slave addresses.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agoarm: dma-mapping: add {map,unmap}_resource for iommu ops
Niklas Söderlund [Wed, 10 Aug 2016 11:22:17 +0000 (13:22 +0200)]
arm: dma-mapping: add {map,unmap}_resource for iommu ops

Add methods to map/unmap device resources addresses for dma_map_ops that
are IOMMU aware. This is needed to map a device MMIO register from a
physical address.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodma-mapping: add dma_{map,unmap}_resource
Niklas Söderlund [Wed, 10 Aug 2016 11:22:16 +0000 (13:22 +0200)]
dma-mapping: add dma_{map,unmap}_resource

Map/Unmap a device MMIO resource from a physical address. If no dma_map_ops
method is available the operation is a no-op.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodma-debug: add support for resource mappings
Niklas Söderlund [Wed, 10 Aug 2016 11:22:15 +0000 (13:22 +0200)]
dma-debug: add support for resource mappings

A MMIO mapped resource can not be represented by a struct page so a new
debug type is needed to handle this. This patch add such type and
functionality to add/remove entries and how to translate them to a
physical address.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodma-mapping: add {map,unmap}_resource to dma_map_ops
Niklas Söderlund [Wed, 10 Aug 2016 11:22:14 +0000 (13:22 +0200)]
dma-mapping: add {map,unmap}_resource to dma_map_ops

Add methods to handle mapping of device resources from a physical
address. This is needed for example to be able to map MMIO FIFO
registers to a IOMMU.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: dmatest: Restore "memcpy" as default mode
Eugeniy Paltsev [Wed, 14 Sep 2016 17:40:38 +0000 (20:40 +0300)]
dmaengine: dmatest: Restore "memcpy" as default mode

Commit 0d4cb44da6ca0e8 ("dmaengine: dmatest: Add support for
scatter-gather DMA mode") changes default "dmatest" behavior by
changing default mode from "memcpy" to "scatter-gather".
Now "memcpy" gets back as default mode.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: hsu: refactor hsu_dma_do_irq() to return int
Andy Shevchenko [Tue, 23 Aug 2016 13:09:40 +0000 (16:09 +0300)]
dmaengine: hsu: refactor hsu_dma_do_irq() to return int

Since we have nice macro IRQ_RETVAL() we would use it to convert a flag of
handled interrupt from int to irqreturn_t.

The rationale of doing this is:
a) hence we implicitly mark hsu_dma_do_irq() as an auxiliary function that
   can't be used as interrupt handler directly, and
b) to be in align with serial driver which is using serial8250_handle_irq()
   that returns plain int by design.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: mv_xor: Add support for IO (PCIe) src/dst areas
Stefan Roese [Thu, 15 Sep 2016 05:37:31 +0000 (07:37 +0200)]
dmaengine: mv_xor: Add support for IO (PCIe) src/dst areas

To enable the access to a specific area, the MVEBU XOR controllers needs
to have this area enabled / mapped via an address window. Right now,
only the DRAM memory area is enabled via such memory windows. So
using this driver to DMA to / from a e.g. PCIe memory region is
currently not supported.

This patch now adds support for such PCIe / IO regions by checking
if the src / dst address is located in an IO memory area in contrast
to being located in DRAM. This is done by using the newly introduced
MBus function mvebu_mbus_get_io_win_info(). If the src / dst address
is located in such an IO area, a new address window is created in
the XOR DMA controller. Enabling the controller to access this area.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agobus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()
Stefan Roese [Thu, 15 Sep 2016 05:37:30 +0000 (07:37 +0200)]
bus: mvebu-mbus: Provide stub function for mvebu_mbus_get_io_win_info()

This patch provides a stub function for mvebu_mbus_get_io_win_info(),
which will be used for all non-Orion (ARM32 MVEBU) platforms for
compile test coverage.

On such platforms this function will return an error so that drivers
might detect a potential problem.

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Marcin Wojtas <mw@semihalf.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: cppi41: Ignore EINPROGRESS for PM runtime
Tony Lindgren [Tue, 13 Sep 2016 17:22:43 +0000 (10:22 -0700)]
dmaengine: cppi41: Ignore EINPROGRESS for PM runtime

We can occasionally get -EINPROGRESS for pm_runtime_get. In that case
we can just continue as we're queueing transfers anyways when
pm_runtime_active is not set.

Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: cleanup with list_first_entry_or_null()
Masahiro Yamada [Mon, 12 Sep 2016 18:08:17 +0000 (03:08 +0900)]
dmaengine: cleanup with list_first_entry_or_null()

The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: NO_IRQ removal from powerpc-only drivers
Michael Ellerman [Sat, 10 Sep 2016 09:56:04 +0000 (19:56 +1000)]
dmaengine: NO_IRQ removal from powerpc-only drivers

We'd like to eventually remove NO_IRQ on powerpc, so remove usages of it
from powerpc-only drivers.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: dmatest: Apply copy_align to DMA_SG as well
Nicolin Chen [Thu, 8 Sep 2016 01:24:28 +0000 (18:24 -0700)]
dmaengine: dmatest: Apply copy_align to DMA_SG as well

The DMA_SG is still a type of memory copy operation that should
conform the hardware restriction. So this patch just applies the
copy_align to DMA_SG as well.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: cppi41: mark PM functions as __maybe_unused
Arnd Bergmann [Tue, 6 Sep 2016 13:20:05 +0000 (15:20 +0200)]
dmaengine: cppi41: mark PM functions as __maybe_unused

When CONFIG_PM_SLEEP is disabled, we get a build error in
the cppi41 dmaengine driver, since the runtime-pm functions
are hidden within the wrong #ifdef:

drivers/dma/cppi41.c:1158:21: error: 'cppi41_runtime_suspend' undeclared here (not in a function)

This removes the #ifdef and instead uses __maybe_unused
annotations that cannot have this problem.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: fdea2d09b997 ("dmaengine: cppi41: Add basic PM runtime support")
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: k3dma: use correct format string for debug output
Arnd Bergmann [Tue, 6 Sep 2016 13:17:49 +0000 (15:17 +0200)]
dmaengine: k3dma: use correct format string for debug output

The newly added k3_dma_prep_dma_cyclic function has some debug output
that uses incorrect typecasts, some of which cause a warning like:

drivers/dma/k3dma.c: In function 'k3_dma_prep_dma_cyclic':
drivers/dma/k3dma.c:589:671: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

In general, we have to print 'dma_addr_t' values using special
'%pad' format to get the correct behavior on kernels that have
a 64-bit dma_addr_t type but 32-bit pointers.

Similarly, printing size_t values should be done using the %z
modifier to get the correct behavior on 64-bit kernels.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a7e08fa6cc78 ("k3dma: Add cyclic mode for audio")
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: dmatest: exclude compare and fill time during perf report
Sinan Kaya [Thu, 1 Sep 2016 14:02:55 +0000 (10:02 -0400)]
dmaengine: dmatest: exclude compare and fill time during perf report

Dmatest is currently including compare and fill time into the
calculated performance numbers. This does not reflect the HW
capability and the results vary based on the CPU speed instead of
the HW speed.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: qcom_hidma: add error reporting for tx_status
Sinan Kaya [Wed, 31 Aug 2016 15:10:29 +0000 (11:10 -0400)]
dmaengine: qcom_hidma: add error reporting for tx_status

The HIDMA driver is capable of error detection. However, the error was
not being passed back to the client when tx_status API is called.

Changing the error handling behavior to follow this oder.

1. dmaengine asserts error interrupt
2. Driver receives and mark's the txn as error
3. Driver completes the txn and intimates the client. No further
   submissions. Drop the locks before calling callback, as subsequent
   processing by client maybe in callback thread.
4. Client invokes status and you can return error
5. On error, client calls terminate_all. You can reset channel, free all
   descriptors in the active, pending and completed lists
6. Client prepares new txn and so on.

As part of this work, got rid of the reset in the interrupt handler when
an error happens and the HW is put into disabled state. The only way to
recover is for the client to terminate the channel.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: qcom_hidma: report transfer errors with new interface
Sinan Kaya [Wed, 31 Aug 2016 15:10:28 +0000 (11:10 -0400)]
dmaengine: qcom_hidma: report transfer errors with new interface

Pass the DMA errors to the client by passing a result argument. The HW only
supports a generic error when something goes wrong. That's why, using
DMA_TRANS_ABORTED all the time.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: qcom_hidma: release the descriptor before the callback
Sinan Kaya [Wed, 31 Aug 2016 15:10:27 +0000 (11:10 -0400)]
dmaengine: qcom_hidma: release the descriptor before the callback

There is a race condition between data transfer callback and descriptor
free code. The callback routine may decide to clear the resources even
though the descriptor has not yet been freed.

Instead of calling the callback first and then releasing the memory,
this code is changing the order to return the descriptor back to the
free pool and then call the user provided callback.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: cppi41: Add basic PM runtime support
Tony Lindgren [Wed, 31 Aug 2016 14:19:59 +0000 (07:19 -0700)]
dmaengine: cppi41: Add basic PM runtime support

Let's keep the device enabled between cppi41_dma_issue_pending()
and dmaengine_desc_get_callback_invoke() and rely on the PM runtime
autoidle timeout elsewhere.

As the PM runtime is for whole device, not for each channel,
we need to queue pending transfers if the device is PM runtime
suspended. Then we start the pending transfers in PM runtime
resume.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: cppi41: Prepare to add PM runtime support
Tony Lindgren [Fri, 19 Aug 2016 22:59:39 +0000 (15:59 -0700)]
dmaengine: cppi41: Prepare to add PM runtime support

Let's just move code from cppi41_dma_issue_pending() to
push_desc_queue() as that's the only call to push_desc_queue().

We want to do this for PM runtime as we need to call push_desc_queue()
also for pending queued transfers from PM runtime resume.

No functional changes, just moves code around.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agoKconfig: Allow k3dma driver to be selected for more then HISI3xx platforms
John Stultz [Mon, 29 Aug 2016 17:30:53 +0000 (10:30 -0700)]
Kconfig: Allow k3dma driver to be selected for more then HISI3xx platforms

This allows the k3dma driver to be selected on HiKey via the ARCH_HISI
dependency.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agok3dma: Add cyclic mode for audio
Andy Green [Mon, 29 Aug 2016 17:30:52 +0000 (10:30 -0700)]
k3dma: Add cyclic mode for audio

Currently the k3dma driver doesn't offer the cyclic mode
necessary for handling audio.

This patch adds it.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
[jstultz: Forward ported to mainline, removed a few
 bits of logic that didn't seem to have much effect]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agok3dma: Fix memory handling in preparation for cyclic mode
John Stultz [Mon, 29 Aug 2016 17:30:51 +0000 (10:30 -0700)]
k3dma: Fix memory handling in preparation for cyclic mode

With cyclic mode, the shared virt-dma logic doesn't actually
manage the descriptor state, nor the calling of the descriptor
free callback. This results in leaking a desc structure every
time we start an audio transfer.

Thus we must manage it ourselves. The k3dma driver already keeps
track of the active and finished descriptors via ds_run and ds_done
pointers, so cleanup how we handle those two values, so when we
tear down everything in terminate_all, call free_desc on the ds_run
and ds_done pointers if they are not null.

NOTE: HiKey doesn't use the non-cyclic dma modes, so I'm not been
able to test those modes. But with this patch we no longer leak
the desc structures.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agok3dma: Fix occasional DMA ERR issue by using proper dma api
John Stultz [Mon, 29 Aug 2016 17:30:50 +0000 (10:30 -0700)]
k3dma: Fix occasional DMA ERR issue by using proper dma api

After lots of debugging on an occasional DMA ERR issue, I realized
that the desc structures which we point the dma hardware are being
allocated out of regular memory. This means when we fill the desc
structures, that data doesn't always get flushed out to memory by
the time we start the dma transfer, resulting in the dma engine getting
some null values, resulting in a DMA ERR on the first irq.

Thus, this patch adopts mechanism similar to the zx296702_dma of
allocating the desc structures from a dma pool, so the memory caching
rules are properly set to avoid this issue.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: John Stutlz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agok3dma: Fix "nobody cared" message seen on any error
Andy Green [Mon, 29 Aug 2016 17:30:49 +0000 (10:30 -0700)]
k3dma: Fix "nobody cared" message seen on any error

As it was before, as soon as the DMAC IP felt there was an error
he would return IRQ_NONE since no actual transfer had completed.

After spinning on that for 100K interrupts, Linux yanks the IRQ with
a "nobody cared" error.

This patch lets it handle the interrupt and keep the IRQ alive.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
[jstultz: Forward ported to mainline]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agok3dma: Fix dma err offsets
Andy Green [Mon, 29 Aug 2016 17:30:48 +0000 (10:30 -0700)]
k3dma: Fix dma err offsets

The offsets for ERR1 and ERR2 are wrong actually.
That's why you can never clear an error.

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
[jstultz: Forward ported to mainline]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agok3dma: Fix hisi burst clipping
Andy Green [Mon, 29 Aug 2016 17:30:47 +0000 (10:30 -0700)]
k3dma: Fix hisi burst clipping

Max burst len is a 4-bit field, but at the moment it's clipped with
a 5-bit constant... reduce it to that which can be expressed

Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Andy Green <andy@warmcat.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
[jstultz: Forward ported to mainline]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: imx-sdma: Add i.MX7 support
Fabio Estevam [Wed, 10 Aug 2016 16:05:05 +0000 (13:05 -0300)]
dmaengine: imx-sdma: Add i.MX7 support

Allow i.MX7 to work with the imx-sdma driver.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Tested-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: device must have at least one channel
Viresh Kumar [Wed, 27 Jul 2016 21:32:58 +0000 (14:32 -0700)]
dmaengine: device must have at least one channel

The DMA device can't be registered if it doesn't have any channels
registered at all. Moreover, it leads to memory leak and is reported by
kmemleak as (on 3.10 kernel, and same shall happen on mainline):

unreferenced object 0xffffffc09e597240 (size 64):
  comm "swapper/0", pid 1, jiffies 4294877736 (age 7060.280s)
  hex dump (first 32 bytes):
    00 00 00 00 c0 ff ff ff 30 00 00 ff 00 00 00 ff  ........0.......
    00 00 00 ff 00 00 00 ff 00 00 00 ff 00 00 00 ff  ................
  backtrace:
    [<ffffffc0003079ec>] create_object+0x148/0x2a0
    [<ffffffc000cc150c>] kmemleak_alloc+0x80/0xbc
    [<ffffffc000303a7c>] kmem_cache_alloc_trace+0x120/0x1ac
    [<ffffffc00054771c>] dma_async_device_register+0x160/0x46c
    [<ffffffc000548958>] foo_probe+0x1a0/0x264
    [<ffffffc0005d6658>] platform_drv_probe+0x14/0x20
    [<ffffffc0005d50cc>] driver_probe_device+0x160/0x374
    [<ffffffc0005d538c>] __driver_attach+0x60/0x90
    [<ffffffc0005d3e78>] bus_for_each_dev+0x7c/0xb0
    [<ffffffc0005d4a0c>] driver_attach+0x1c/0x28
    [<ffffffc0005d459c>] bus_add_driver+0x124/0x248
    [<ffffffc0005d59cc>] driver_register+0x90/0x110
    [<ffffffc0005d6bf4>] platform_driver_register+0x58/0x64
    [<ffffffc00142a70c>] foo_driver_init+0x10/0x1c
    [<ffffffc000200878>] do_one_initcall+0xac/0x148
    [<ffffffc00140096c>] kernel_init_freeable+0x1a0/0x258

Return -ENODEV from dma_async_device_register() on such a case.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: imx-sdma: (trivial) fix a typo
Martin Kaiser [Mon, 8 Aug 2016 20:45:58 +0000 (22:45 +0200)]
dmaengine: imx-sdma: (trivial) fix a typo

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: sh_shdma-base: convert callback to helper function
Dave Jiang [Wed, 20 Jul 2016 21:13:09 +0000 (14:13 -0700)]
dmaengine: sh_shdma-base: convert callback to helper function

This is in preperation of moving to a callback that provides results to the
callback for the transaction. The conversion will maintain current behavior
and the driver must convert to new callback mechanism at a later time in
order to receive results.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmengine: xilinx_dma: convert callback to helper function
Vinod Koul [Thu, 4 Aug 2016 12:36:13 +0000 (18:06 +0530)]
dmengine: xilinx_dma: convert callback to helper function

Move the xilinx driver to new dmaengine callback

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: documentation to the new callback mechanism
Dave Jiang [Wed, 20 Jul 2016 20:14:19 +0000 (13:14 -0700)]
dmaengine: documentation to the new callback mechanism

Adding documentation in dmaengine/provider.txt on the usage of callback
with result, callback_result, function pointer to retrieve transanction
result from a DMA submission.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agontb: add DMA error handling for RX DMA
Dave Jiang [Wed, 20 Jul 2016 20:14:13 +0000 (13:14 -0700)]
ntb: add DMA error handling for RX DMA

Adding support on the rx DMA path to allow recovery of errors when
DMA responds with error status and abort all the subsequent ops.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Allen Hubbe <Allen.Hubbe@emc.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: linux-ntb@googlegroups.com
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agontb: add DMA error handling for TX DMA
Dave Jiang [Wed, 20 Jul 2016 20:14:07 +0000 (13:14 -0700)]
ntb: add DMA error handling for TX DMA

Adding support on the tx DMA path to allow recovery of errors when
DMA responds with error status and abort all the subsequent ops.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Allen Hubbe <Allen.Hubbe@emc.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: linux-ntb@googlegroups.com
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ioatdma: add error strings to chanerr output
Dave Jiang [Wed, 20 Jul 2016 20:14:01 +0000 (13:14 -0700)]
dmaengine: ioatdma: add error strings to chanerr output

Provide a mechanism to translate CHANERR bits to English strings in order
to allow user to report more concise errors.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
7 years agodmaengine: ioatdma: Add error handling to ioat driver
Dave Jiang [Wed, 20 Jul 2016 20:13:55 +0000 (13:13 -0700)]
dmaengine: ioatdma: Add error handling to ioat driver

Adding error handling to the ioatdma driver so that when a
read/write error occurs the error results are reported back and
all the remaining descriptors are aborted. This utilizes the new
dmaengine callback function that allows reporting of results.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>