Commit graph

2391 commits

Author SHA1 Message Date
Vinod Koul
16cab61800 dmaengine: amba-pl08x:remove device_alloc_chan_resources handler
Now that device_alloc_chan_resources handler in not mandatory, remove dummy
implementations

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 22:44:27 +05:30
Ben Dooks
75967b788c dmaengine: pl330: fix return status on pending transfers
The pl330_tx_status() function returns the desc->status if the
dma_cookie_status() call does indicate the cookie completed,
however the desc->status is not look directly compatible. Sparse
throws the following warning:

pl330.c:2262:35: warning: mixing different enum types
pl330.c:2262:35:     int enum desc_status  versus
pl330.c:2262:35:     int enum dma_status

Attempt to fix this by adding a switch statement to turn the
desc->status into a dma_status.

Note, this has only been tested with the dmatest suite.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
Vinod Koul <vinod.koul@intel.com>
Dan Williams <dan.j.williams@intel.com>
DMA List <dmaengine@vger.kernel.org>
Maxime Ripard <maxime.ripard@free-electrons.com>
Jassi Brar <jassisinghbrar@gmail.com>
Liviu Dudau <Liviu.Dudau@arm.com>
Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 22:41:49 +05:30
Ben Dooks
5503aed811 dmaengine: pl330: make unexported functions static
Whilst running sparse on pl330 driver it was noticed there are
two functions that are not static but not exported to any other
users in the kernel.

Fix the following warnings by making 'pl330_pause' and the
'pl330_get_current_xferred_count' static:

pl330.c:2165:5: warning: symbol 'pl330_pause' was not declared. Should it be static?
pl330.c:2206:5: warning: symbol 'pl330_get_current_xferred_count' was not declared. Should it be static?

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
Vinod Koul <vinod.koul@intel.com>
Dan Williams <dan.j.williams@intel.com>
DMA List <dmaengine@vger.kernel.org>
Maxime Ripard <maxime.ripard@free-electrons.com>
Jassi Brar <jassisinghbrar@gmail.com>
Liviu Dudau <Liviu.Dudau@arm.com>
Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 22:41:49 +05:30
Ben Dooks
3a2307f72e dmaengine: pl330: fix issues with big-endian armv7
When running Xilinx Zynq in big-endian mode the pl330 driver
fails to pass the dmatest suite. To fix this, ensure all non
byte values are written in little endian.

As a note, the documentation does not mention if it will do
big-endian descriptor fetches, only that it will swap the
data in flight.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
Vinod Koul <vinod.koul@intel.com>
Dan Williams <dan.j.williams@intel.com>
DMA List <dmaengine@vger.kernel.org>
Maxime Ripard <maxime.ripard@free-electrons.com>
Jassi Brar <jassisinghbrar@gmail.com>
Liviu Dudau <Liviu.Dudau@arm.com>
Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 22:41:48 +05:30
Fabian Frederick
57c0342239 dmaengine: constify of_device_id array
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 22:13:14 +05:30
Mark Brown
ea524c7e3d dmaengine: pl08x: Define capabilities for generic capabilities reporting
Ensure that clients can automatically configure themselves and avoid a
nasty warning at boot by providing capability information.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 21:34:29 +05:30
Kuninori Morimoto
3cd44dcd35 dmaengine: remove Renesas Audio DMAC peri peri
Renesas R-Car sound (= rsnd) needs 2 DMAC which are called as
Audio DMAC (= 1st DMAC) and Audio DMAC peri peri (2nd DMAC).
And rsnd had assumed that 1st / 2nd DMACs are implemented as DMAEngine.
But, in result of DMA ML discussion, 2nd DMAC was concluded that it is
not a general purpose DMAC (2nd DMAC is for Device to Device inside
sound system). Additionally, current DMAEngine can't support Device to
Device, and we don't have correct DT bindings for it at this point.
So the easiest solution for it is that move it from DMAEngine to rsnd
driver.
Audio DMAC peri peri on DMAEngine is no longer needed. remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2015-03-18 13:57:54 +05:30
Fabio Estevam
a572460be9 dmaengine: imx-sdma: Add support for version 3 firmware
Currently when version 3.1 of the mx6q SDMA firmware is used we get:

[    0.392169] imx-sdma 20ec000.sdma: unknown firmware version
[    0.399281] imx-sdma 20ec000.sdma: initialized

Add support for it.

Based on a patch from Shengjiu Wang from the internal FSL kernel.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-18 13:53:33 +05:30
Andy Shevchenko
36111da783 dmaengine: intel-mid-dma: remove the driver
Since the last and the only user of this driver is converted to use dw_dmac we
can remove driver from the tree.

Moreover, besides the driver is unmaintained a long time, it serves for the
DesignWare DMA IP, for which we have already driver in the tree.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-17 12:31:33 +00:00
Kedareswara rao Appana
937abe88ae dmaengine: xilinx-dma: move header file to common location
This patch moves the xilinx_dma.h header file
to the include/linux/dma.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-17 16:23:21 +05:30
Jarkko Nikula
3b62286d0e dmaengine: Remove FSF mailing addresses
Free Software Foundation mailing address has been moved in the past and some
of the addresses here are outdated. Remove them from file headers since the
COPYING file in the kernel sources includes it.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-16 22:28:15 +05:30
Archit Taneja
d51da4d4a9 dmaengine: qcom_bam_dma: Add support for BAM v1.7.0
Add register offset table entry for the newer (v1.7.0) version of the BAM IP
found on MSM8916. Update the DT bindings documentation.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-16 22:21:47 +05:30
Jarkko Nikula
b26072276f dmaengine: dw: Make error prints unique. Part #2
The same error message is printed from different switch cases. Since both of
these jump into same error label we can move error print there and add a DMA
direction in order to make it easier to grep error from sources.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-16 22:11:06 +05:30
Jarkko Nikula
550da64bc8 dmaengine: dw: Make error prints unique. Part #1
The same error message is printed from different functions. Add a function
name to error message in order to make it easier to grep error from sources.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-16 22:10:51 +05:30
Andy Shevchenko
a104a45ba7 dmaengine: dw: append MODULE_ALIAS for platform driver
The commit 9cade1a46c (dma: dw: split driver to library part and platform
code) introduced a separate platform driver but missed to add a
MODULE_ALIAS("platform:dw_dmac"); to that module.

The patch adds this to get driver loaded automatically if platform device is
registered.

Reported-by: "Blin, Jerome" <jerome.blin@intel.com>
Fixes: 9cade1a46c (dma: dw: split driver to library part and platform code)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-16 22:07:03 +05:30
Robin Gong
855832e47c dmaengine: imx-sdma: switch to dynamic context mode after script loaded
Below comments got from Page4724 of Reference Manual of i.mx6q:
http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6DQRM.pdf

--"Static context mode should be used for the first channel called
after reset to ensure that the all context RAM for that channel is
initialized during the context SAVE phase when the channel is
done or yields. Subsequent calls to the same channel or
different channels may use any of the dynamic context modes.
This will ensure that all context locations for the bootload
channel are initialized, and prevent undefined values in context
RAM from being loaded during the context restore if the
channel is re-started later"

Unfortunately, the rule was broken by commit(5b28aa319b)
.This patch just take them back.

Signed-off-by: Robin Gong <b38343@freescale.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-16 15:55:22 +05:30
Torsten Fleischer
bdf6c79278 dmaengine: at_hdmac: Fix calculation of the residual bytes
This patch fixes the following issues regarding to the calculation of the
residue:

1. The residue is always calculated for the current transfer even if the
cookie is associated to a pending transfer.

2. For scatter/gather DMA the calculation of the residue for the current
transfer doesn't include the bytes of the child descriptors that are already
transferred.
It only calculates the difference between the transfer's total length minus
the number of bytes that are already transferred for the current child
descriptor.
For example: There is a scatter/gather DMA transfer with a total length of
1 MByte. Getting the residue several times while the transfer is running shows
something like that:

1: residue = 975584
2: residue = 1002766
3: residue = 992627
4: residue = 983767
5: residue = 985694
6: residue = 1008094
7: residue = 1009741
8: residue = 1011195

3. The driver stores the residue but never resets it when starting a new
transfer.
For example: If there are two subsequent DMA transfers. The first one with
a total length of 1 MByte and the second one with a total length of 1 kByte.
Getting the residue for both transfers shows something like that:

transfer 1: residue = 975584
transfer 2: residue = 1048380

Changes from V1:
   * Fixed coding style of the multi-line comments.
   * Improved accuracy of the residue calculation when the transfer for the
     first descriptor is active.

Changes from V2:
   * Member 'tx_width' of 'struct at_desc' restored, because the transfer width
     can't be derived from the source width when using "slave_sg".
     The transfer width is needed for the calculation of the residue if either
     the transfer of the first or the last descriptor is in progress.
     In the case of a "memory_to_memory_sg" transfer (part of this patch
     series) the transfer width of both descriptors may differ. Thus it is
     required to additionally set 'tx_width' of the last descriptor.
   * Added functions for multiply used calculations.

Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-13 14:58:31 +05:30
Torsten Fleischer
265567fbca dmaengine: at_hdmac: Add support for memory to memory sg transfers
This patch adds support for memory to memory scatter-gather transfers.

Changes from V1:
   * Fixed coding style of the multi-line comments.

Changes from V2:
   * Added setup of 'desc->tx_width' that is needed to calculate the
     residue.

Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-13 14:57:54 +05:30
Greg Kroah-Hartman
355a73f07d Merge 4.0-rc3 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09 08:13:01 +01:00
Greg Kroah-Hartman
becba85f0e Merge 4.0-rc3 into tty-testing
This resolves a merge issue in drivers/tty/serial/8250/8250_pci.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-09 07:08:37 +01:00
Kuninori Morimoto
0aed112443 dmaengine: export symbol of of_dma_request_slave_channel()
Current DMAEngine implementation of DT bindings can't support
DT subnode. This patch export symbols of of_dma_request_slave_channel()
for subnode DMA DT bingings.

ex)

rcar_sound: rcar_sound@ec500000 {
        ...
        rcar_sound,dvc {
                dvc0: dvc@0 {
                        dmas = <&audma0 0xbc>;
                        dma-names = "tx";
                };
                dvc1: dvc@1 {
                        dmas = <&audma0 0xbe>;
                        dma-names = "tx";
                };
        };
        ...
};

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-07 15:03:13 +00:00
Andy Shevchenko
2b49e0c567 dmaengine: append hsu DMA driver
The HSU DMA is developed to support High Speed UART controllers found in
particular on Intel MID platforms such as Intel Medfield.

The existing implementation is tighten to the drivers/tty/serial/mfd.c driver
and has a lot of disadvantages. Besides that we would like to get rid of the
old HS UART driver in regarding to extending the 8250 which supports generic
DMAEngine API. That's why the current driver has been developed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07 03:23:02 +01:00
Robert Jarzmik
ecb9b4241f dmaengine: mmp_pdma: fix warning about slave caps
Fix the dmaengine complaint about missing slave caps :
 - declare the available bus widths
 - declare the available transfer types
 - declare the residue calculation type

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 22:15:35 +05:30
Tapasweni Pathak
26f7af37ee dmaengine: jz4740: Remove extra check
Remove double check on chan->desc.

Found by Coccinelle.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 22:08:46 +05:30
Stanimir Varbanov
90b1047f13 dmaengine: qcom_bam_dma: fix wrong register offsets
The commit fb93f520e (dmaengine: qcom_bam_dma: Generalize BAM
register offset calculations) wrongly populated base offsets
for event registers for bam v1.4.

Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
Reviewed-by: Andy Gross <agross@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 22:07:12 +05:30
Maxime Ripard
bfde98bd76 dmaengine: Remove net_dma_find_channel
Since commit 7bced39751 ("net_dma: simple removal") removed the net_dma
support entirely, net_dma_find_channel has no users left. Remove the function
entirely.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 21:46:48 +05:30
Stanimir Varbanov
fe4be5e9f9 dmaengine: bam-dma: fix a warning about missing capabilities
Avoid the warning below triggered during dmaengine async device
registration.

WARNING: CPU: 1 PID: 1 at linux/drivers/dma/dmaengine.c:863
dma_async_device_register+0x2a8/0x4b8()
this driver doesn't support generic slave capabilities reporting

To do that fill mandatory .directions bit mask,
.src/dst_addr_widths and .residue_granularity dma_device fields
with appropriate values.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 21:44:38 +05:30
Dave Jiang
9ca1c5f2ab dmaengine: ioatdma: workaround for incorrect DMACAP register
BDX-DE IOATDMA reports incorrect DMACAP register for PQ related
ops. Ignoring those bits.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 14:32:02 +05:30
Ludovic Desroches
6eb9d3c1e9 dmaengine: at_xdmac: fix for chan conf simplification
When simplificating the channel configuration, the cyclic case has been
forgotten. It leads to use bad configuration causing many bugs.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 14:29:57 +05:30
Jie Yang
94b3eed7b8 dmaengine: dw: don't handle interrupt when dmaengine is not used
When dma controller is not used by any user and set off,
we should disble interrupt handler, at least the interrupt
reset part, for some subsystem, e.g. ADSP, may use the
dma in its own logic, here reset the interrupt may make
this subsystem work abnormally.

Signed-off-by: Jie Yang <yang.jie@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-05 14:07:48 +05:30
Qiao Zhou
1eed601a5b dma: mmp-tdma: refine dma disable and dma-pos update
Below are the refinements.
1. Set DMA abort bit when disabling dma channel. This will clear
the remaining data in dma FIFO, to fix channel-swap issue.
2. Read DMA HW pointer when updating DMA status. Previously dma
position is calculated by adding one period size in dma interrupt.
This is inaccurate/insufficient for some high-quality audio APP.
Since interrupt bottom half handler has variable schedule delay,
it causes big error when calculating sample delay. Read the actual
HW pointer and feedback can improve the accuracy.
3. Do some minor code clean.

Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-04 18:03:15 +05:30
Colin Ian King
ee655c2968 dmaengine: s3c24xx: Fix spelling mistake in dev_err mistake
Fix spelling mistake, "aquire" -> "acquire" and missing newline (as
spotted by Joe Perches.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-02 22:18:57 +05:30
Geert Uytterhoeven
b6d1778bc5 dmaengine: shdma: Move DMA stop to (runtime) suspend callbacks
During system reboot, the sh-dma-engine device may be runtime-suspended,
causing a crash:

    Unhandled fault: imprecise external abort (0x1406) at 0x0002c02c
    Internal error: : 1406 [#1] SMP ARM
    ...
    PC is at sh_dmae_ctl_stop+0x28/0x64
    LR is at sh_dmae_ctl_stop+0x24/0x64

If the sh-dma-engine is runtime-suspended, its module clock is turned
off, and its registers cannot be accessed.

To fix this, move the call to sh_dmae_ctl_stop(), which touches the
DMAOR register, to the sh_dmae_suspend() and sh_dmae_runtime_suspend()
callbacks.  This makes PM operations more symmetric, as both
sh_dmae_resume() and sh_dmae_runtime_resume() already call sh_dmae_rst()
to re-initialize the DMAOR register.

Remove sh_dmae_shutdown(), as it became empty.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-03-02 22:10:44 +05:30
Dilek Uzulmez
fe146473ca Staging: drivers: dma: Add space before (
This patch fixes checkpatch.pl error in file ste_dma40.c
ERROR: space required before the open parenthesis '('

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-26 15:14:33 -08:00
Qiao Zhou
3a314f143d dmaenegine: mmp-pdma: fix irq handler overwrite physical chan issue
Some dma channels may be reserved for other purpose in other layer,
like secure driver in EL2/EL3. PDMA driver can see the interrupt
status, but it should not try to handle related interrupt, since it
doesn't belong to PDMA driver in kernel. These interrupts should be
handled by corresponding client/module.Otherwise, it will overwrite
illegal memory and cause unexpected issues, since pdma driver only
requests resources for pdma channels.

In PDMA driver, the reserved channels are at the end of total 32
channels. If we find interrupt bit index is not smaller than total
dma channels, we should ignore it.

Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-23 22:09:56 +05:30
Pramod Gurav
81ceefa49e dmaengine: qcom_bam_dma: Fix error path in probe function
Calls tasklet_kill() in error path of the probe function were missing.
Add the same in error path.

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-23 16:56:13 +05:30
Arnd Bergmann
411fdaf846 dmaengine: shdma: use normal interface for passing slave id
in dma_slave_config, which is incompatible with the way that the
dmaengine API normally works.

I've had a closer look at the existing code now and found that all
slave drivers that pass a slave_id in dma_slave_config for SH do that
right after passing the same ID into shdma_chan_filter, so we can just
rely on that. However, the various shdma drivers currently do not
remember the slave ID that was passed into the filter function when
used in non-DT mode and only check the value to find a matching channel,
unlike all other drivers.

There might still be drivers that are not part of the kernel that rely
on setting the slave_id to some other value, so to be on the safe side,
this adds another 'real_slave_id' field to shdma_chan that remembers
the ID and uses it when a driver passes a zero slave_id in dma_slave_config,
like most drivers do.

Eventually, the real_slave_id and slave_id fields should just get merged
into one field, but that requires other changes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-23 16:12:24 +05:30
Linus Torvalds
ce1d3fde87 Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine updates from Vinod Koul:
 "This update brings:

   - the big cleanup up by Maxime for device control and slave
     capabilities.  This makes the API much cleaner.

   - new IMG MDC driver by Andrew

   - new Renesas R-Car Gen2 DMA Controller driver by Laurent along with
     bunch of fixes on rcar drivers

   - odd fixes and updates spread over driver"

* 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (130 commits)
  dmaengine: pl330: add DMA_PAUSE feature
  dmaengine: pl330: improve pl330_tx_status() function
  dmaengine: rcar-dmac: Disable channel 0 when using IOMMU
  dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata
  dmaengine: rcar-dmac: Allocate hardware descriptors with DMAC device
  dmaengine: rcar-dmac: Fix oops due to unintialized list in error ISR
  dmaengine: rcar-dmac: Fix spinlock issues in interrupt
  dmaenegine: edma: fix sparse warnings
  dmaengine: rcar-dmac: Fix uninitialized variable usage
  dmaengine: shdmac: extend PM methods
  dmaengine: shdmac: use SET_RUNTIME_PM_OPS()
  dmaengine: pl330: fix bug that cause start the same descs in cyclic
  dmaengine: at_xdmac: allow muliple dwidths when doing slave transfers
  dmaengine: at_xdmac: simplify channel configuration stuff
  dmaengine: at_xdmac: introduce save_cc field
  dmaengine: at_xdmac: wait for in-progress transaction to complete after pausing a channel
  ioat: fail self-test if wait_for_completion times out
  dmaengine: dw: define DW_DMA_MAX_NR_MASTERS
  dmaengine: dw: amend description of dma_dev field
  dmatest: move src_off, dst_off, len inside loop
  ...
2015-02-18 08:49:20 -08:00
Linus Torvalds
ea7531ac4a ARM: SoC cleanups
This is a good healthy set of various code removals. Total net delta is 8100
 lines removed.
 
 Among the larger cleanups are:
 
 - Removal of old Samsung S3C DMA infrastructure by Arnd
 - Removal of the non-DT version of the 'lager' board by Magnus Damm
 - General stale code removal on OMAP and Davinci by Rickard Strandqvist
 - Removal of non-DT support on am3517 platforms by Tony Lindgren
 
 ... plus several other cleanups of various platforms across the board.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJU4uYeAAoJEIwa5zzehBx3v58P/RGKt5e4CgCdHKjVhbPmADSE
 FVECT4qrIkf4dFgU5qPCBDCtQn/B3ljxZnq6Hqi8VxYD+pRcXt94R50ZyhGUZ6QF
 GLXU8jDSlY906uJwW+CHZFVLmDjTM4ONLn1ZMRtcdOrU3yGC5rZq9+Kla6ZIE6jb
 mUAFMj6e+NBPYDonq93G7968EdyLJOtK4B2ylPW0+wgSRGIEPibCiNi9yyN4hBFr
 LiaOyY/execKUo2K2BFWkfAZWt7GrwBu/qAkz/9YDRDiikLwFG2UBWbaik5Fj8tf
 v8wvpL6Af6iLpRx1wI/HoCgjFS/g/n4O3svMe7aHGyfrkEAxNtoCKlFscO8w/aLc
 eABNAb5j65it8IHvQMR5RhgqWoQe4XMlDcwsxotTe64GfxpTahdhDmhk7RKAY9Xq
 MyITvtZPTPHTSZHNEDE3HtgHn62ndSinYFhdTaBi2FQxLNCUFl2TKZxpb0r65JI/
 2yOf6hcgWGTgV1VOruAc5SHcSkQOY3SptM4n4F1B0VcDrCphBDYhRTdokELFJIIq
 I47Week8o0f+a4ot/sf0QhU68wVZENgUJO3/Q5Buta+UGSZa4NYH7Ymc159e7hGS
 k+7mCeTJC85F0H/EBWvCcZzbpwiq7jBRAY2PhqYF1EQkefdR/+28o1sX090fVaXD
 n0gXv3/ZDvJB2ryv8lR/
 =tsjK
 -----END PGP SIGNATURE-----

Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC cleanups from Olof Johansson:
 "This is a good healthy set of various code removals.  Total net delta
  is 8100 lines removed.

  Among the larger cleanups are:

   - Removal of old Samsung S3C DMA infrastructure by Arnd
   - Removal of the non-DT version of the 'lager' board by Magnus Damm
   - General stale code removal on OMAP and Davinci by Rickard Strandqvist
   - Removal of non-DT support on am3517 platforms by Tony Lindgren

  ... plus several other cleanups of various platforms across the board"

* tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (47 commits)
  ARM: sirf: drop redundant function and marco declaration
  arm: omap: specify PMUs are for ARMv7 CPUs
  arm: shmobile: specify PMUs are for ARMv7 CPUs
  arm: iop: specify PMUs are for XScale CPUs
  arm: pxa: specify PMUs are for XScale CPUs
  arm: realview: specify PMU types
  ARM: SAMSUNG: remove unused DMA infrastructure
  ARM: OMAP3: Add back Kconfig option MACH_OMAP3517EVM for ASoC
  ARM: davinci: Remove CDCE949 driver
  ARM: at91: remove useless at91rm9200_set_type()
  ARM: at91: remove useless at91rm9200_dt_initialize()
  ARM: at91: move debug-macro.S into the common space
  ARM: at91: remove useless at91_sysirq_mask_rtx
  ARM: at91: remove useless config MACH_AT91SAM9_DT
  ARM: at91: remove useless config MACH_AT91RM9200_DT
  ARM: at91: remove unused mach/memory.h
  ARM: at91: remove useless header file includes
  ARM: at91: remove unneeded header file
  rtc: at91/Kconfig: remove useless options
  ARM: at91/Documentation: add a README for Atmel SoCs
  ...
2015-02-17 09:17:33 -08:00
Robert Baldyga
88987d2c75 dmaengine: pl330: add DMA_PAUSE feature
DMA_PAUSE command is used for halting DMA transfer on chosen channel.
It can be useful when we want to safely read residue before terminating
all requests on channel. Otherwise there can be situation when some data
is transferred before channel termination but after reading residue,
which obviously results with data loss. To avoid this situation we can
pause channel, read residue and then terminate all requests.
This scenario is common, for example, in serial port drivers.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:36 +05:30
Robert Baldyga
aee4d1fac8 dmaengine: pl330: improve pl330_tx_status() function
This patch adds possibility to read residue of DMA transfer. It's useful
when we want to know how many bytes have been transferred before we
terminate channel. It can take place, for example, on timeout interrupt.

Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:35 +05:30
Laurent Pinchart
be6893e195 dmaengine: rcar-dmac: Disable channel 0 when using IOMMU
A still unconfirmed hardware bug prevents the IPMMU microTLB 0 to be
flushed correctly, resulting in memory corruption. DMAC 0 channel 0 is
connected to microTLB 0 on currently supported platforms, so we can't
use it with the IPMMU. As the IOMMU API operates at the device level we
can't disable it selectively, so ignore channel 0 for now if the device
is part of an IOMMU group.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:35 +05:30
Laurent Pinchart
3f46306127 dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata
When descriptor memory is accessed through an IOMMU the DMADAR register
isn't initialized automatically from the first descriptor at beginning
of transfer by the DMAC like it should. Initialize it manually with the
destination address of the first chunk.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:34 +05:30
Laurent Pinchart
6a634808e3 dmaengine: rcar-dmac: Allocate hardware descriptors with DMAC device
When wired to an IOMMU to access data, the DMAC accesses the hardware
descriptors through the IOMMU as well. We're using the DMA mapping API
to allocate the descriptors, but with a NULL device at the moment, which
prevents IOMMU mappings from being created. Fix this by passing the DMAC
device instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:33 +05:30
Laurent Pinchart
f7638c904b dmaengine: rcar-dmac: Fix oops due to unintialized list in error ISR
The error interrupt handler stops and reinitializes all channels. This
causes a crash for channels that have never been used, as their
descriptor lists are uninitialized. Fix it by initializing the
descriptor lists at probe time.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:33 +05:30
Laurent Pinchart
f39150720e dmaengine: rcar-dmac: Fix spinlock issues in interrupt
The rcar_dmac_desc_put() function is called in interrupt context and
must thus use spin_lock_irqsave() instead of spin_lock_irq().

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:32 +05:30
Lad, Prabhakar
b7a4fd53d2 dmaenegine: edma: fix sparse warnings
this patch fixes following sparse warnings:

edma.c:537:32: warning: symbol 'edma_prep_dma_memcpy' was not declared. Should it be static?
edma.c:1070:6: warning: symbol 'edma_filter_fn' was not declared. Should it be static?

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-16 09:33:32 +05:30
Laurent Pinchart
a55e07c8a5 dmaengine: rcar-dmac: Fix uninitialized variable usage
The desc variable is used uninitialized in the rcar_dmac_desc_get() and
rcar_dmac_xfer_chunk_get() functions if descriptors need to be
allocated. Fix it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-12 12:52:19 +05:30
Sergei Shtylyov
bf44a4175e dmaengine: shdmac: extend PM methods
In order to make it possible to restore from hibernation not only in Linux but
also in e.g. U-Boot, we have to use sh_dmae_{suspend|resume}() for the {freeze|
thaw|restore}() PM methods. It's handy to achieve this with SIMPLE_DEV_PM_OPS()
macro; since  that macro doesn't do anything when CONFIG_PM_SLEEP  is undefined,
we don't need to #define sh_dmae_{suspend|resume} NULL anymore but we'll have to
enclose sh_dmae_{suspend|resume}() into the new #ifdef...

Based on original patch by Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-12 12:52:18 +05:30
Sergei Shtylyov
82bf90c628 dmaengine: shdmac: use SET_RUNTIME_PM_OPS()
Use SET_RUNTIME_PM_OPS() to initialize the runtime PM method pointers in the
'struct dev_pm_ops';  since that macro doesn't  do anything  if CONFIG_PM is
not defined, we have  to move #ifdef up to also cover the runtime PM methods
in order to avoid compilation warnings.

Based on orignal patch by Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-12 12:52:17 +05:30
Addy Ke
0091b9d6c1 dmaengine: pl330: fix bug that cause start the same descs in cyclic
This bug will cause NULL pointer after commit dfac17, and cause
wrong package in I2S DMA transfer before commit dfac17.

Tested on RK3288-pinky2 board.

Detail:
I2S DMA transfer(sound/core/pcm_dmaengine.c):
dmaengine_pcm_prepare_and_submit -->
dmaengine_prep_dma_cyclic -->
pl330_prep_dma_cyclic -->
the case:
1. pl330_submit_req(desc0): thrd->req[0].desc = desc0, thrd->lstenq = 0
2. pl330_submit_req(desc1): thrd->req[1].desc = desc1, thrd->lstenq = 1
3. _start(desc0) by submit_req: thrd->req_running = 0
   because: idx = 1 - thrd->lstenq = 0
4. pl330_update(desc0 OK): thrd->req[0].desc = NULL, desc0 to req_done list
   because: idx = active = thrd->req_running = 0
5. _start(desc1) by pl330_update: thrd->req_running = 1
   because:
   idx = 1 - thrd->lstenq = 0, but thrd->req[0].desc == NULL,
   so:
   idx = thrd->lstenq = 1
6. pl330_submit_req(desc2): thrd->req[0].desc = desc2, thrd->lstenq = 0
7. _start(desc1) by submit_req: thrd->req_running = 1
   because: idx = 1 - thrd->lstenq = 1
   Note: _start started the same descs
         _start should start desc2 here, NOT desc1

8. pl330_update(desc1 OK): thrd->req[1].desc = NULL, desc1 to req_done list
   because: idx = active = thrd->req_running = 1
9. _start(desc2) by pl330_update : thrd->req_running = 0
   because: idx = 1 - thrd->lstenq = 0
10.pl330_update(desc1 OK, NOT desc2): thrd->req[0].desc = NULL,
   desc2 to req_done list
   because: idx = active = thrd->req_running = 0

11.pl330_submit_req(desc3): thrd->req[0].desc = desc3, thrd->lstenq = 0
12.pl330_submit_req(desc4): thrd->req[1].desc = desc4, thrd->lstenq = 1
13._start(desc3) by submit_req: thrd->req_running = 0
   because: idx = 1 - thrd->lstenq = 0
14.pl330_update(desc2 OK NOT desc3): thrd->req[0].desc = NULL
   desc3 to req_done list
   because: idx = active = thrd->req_running = 0
15._start(desc4) by pl330_update: thrd->req_running = 1
   because:
   idx = 1 - thrd->lstenq = 0, but thrd->req[0].desc == NULL,
   so:
   idx = thrd->lstenq = 1
16.pl330_submit_req(desc5): thrd->req[0].desc = desc5, thrd->lstenq = 0
17._start(desc4) by submit_req: thrd->req_running = 1
   because: idx = 1 - thrd->lstenq = 1
18.pl330_update(desc3 OK NOT desc4): thrd->req[1].desc = NULL
   desc4 to req_done list
   because: idx = active = thrd->req_running = 1
19._start(desc4) by pl330_update: thrd->req_running = 0
   because:
   idx = 1 - thrd->lstenq = 1, but thrd->req[1].desc == NULL,
   so:
   idx = thrd->lstenq = 0
20.pl330_update(desc4 OK): thrd->req[0].desc = NULL, desc5 to req_done list
   because: idx = active = thrd->req_running = 0
21.pl330_update(desc4 OK):
   1) before commit dfac17(set req_running -1 in pl330_update/mark_free()):
      because: active = -1, abort
      result: desc0-desc5's callback are all called,
	      but step 10 and step 18 go wrong.
   2) before commit dfac17:
      idx = active = thrd->req_runnig = 0 -->
      descdone = thrd->req[0] = NULL -->
      list_add_tail(&descdone->rqd, &pl330->req_done); -->
      got NULL pointer!!!

Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-10 16:20:19 -08:00
Jiang Liu
90e9782061 resources: Move struct resource_list_entry from ACPI into resource core
Currently ACPI, PCI and pnp all implement the same resource list
management with different data structure. We need to transfer from
one data structure into another when passing resources from one
subsystem into another subsystem. So move struct resource_list_entry
from ACPI into resource core and rename it as resource_entry,
then it could be reused by different subystems and avoid the data
structure conversion.

Introduce dedicated header file resource_ext.h instead of embedding
it into ioport.h to avoid header file inclusion order issues.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-02-05 15:09:25 +01:00
Ludovic Desroches
6d3a7d9e3a dmaengine: at_xdmac: allow muliple dwidths when doing slave transfers
When using FIFO, we need to support differents data width in a single
transfer. For example, serial device which usually uses 1-byte data
width will use 4-bytes data width when using the FIFO. If the transfer
size is not aligned on 4-bytes then the end of the transfer will be
performed with 1-byte data-width. For that reason,
at_xdmac_prep_slave_sg() now builds linked list descriptors using view 2
instead of view 1 so each of them can update the DWIDTH field into the
Channel Configuration Register.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 23:12:29 -08:00
Ludovic Desroches
be83507482 dmaengine: at_xdmac: simplify channel configuration stuff
This patch simplifies the channel configuration register management.
Relying on a "software snapshot" of the configuration is not safe and
too complex.

Multiple dwidths will be introduced for slave transfers. In this case,
it becomes quite difficult to have an accurate snapshot of the channel
configuration register in the way it is done. Using the channel
configuration available in the lli descriptor simplifies this stuff.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 23:12:29 -08:00
Ludovic Desroches
734bb9a7b3 dmaengine: at_xdmac: introduce save_cc field
When suspending the device, read the channel configuration directly from
the register instead of relying on a software snapshot, it will be
safer.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 23:12:28 -08:00
Cyrille Pitchen
cbb85e6726 dmaengine: at_xdmac: wait for in-progress transaction to complete after pausing a channel
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 23:12:28 -08:00
Nicholas Mc Guire
12385f458a ioat: fail self-test if wait_for_completion times out
wait_for_completion_timeout reaching timeout was being ignored,
fail the self-test if timeout condition occurs.

v2: fixup of coding style issues.

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 22:54:22 -08:00
Andy Shevchenko
d8ded50f8b dmaengine: dw: define DW_DMA_MAX_NR_MASTERS
Instead of using magic number in the code the patch provides
DW_DMA_MAX_NR_MASTERS constant.

While here, restrict the reading of data width array by amount of the actual
number of AHB masters.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 22:39:44 -08:00
Andy Shevchenko
ede23a5868 dmatest: move src_off, dst_off, len inside loop
The scope of those varsiables is in while-loop. This patch moves them there and
removes duplicate code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 18:17:21 -08:00
Andy Shevchenko
a835bb8550 dmatest: fix indentation
Simple fixes an indentation in few places across the code.

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 18:15:28 -08:00
Andrew Bresticker
5689ba7fd9 dmaengine: Add driver for IMG MDC
Add support for the IMG Multi-threaded DMA Controller (MDC) found on
certain IMG SoCs.  Currently this driver supports the variant present
on the MIPS-based Pistachio SoC.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 18:13:32 -08:00
Dan Carpenter
3028718fd0 dmaengine: s3c24xx: missing unlock on an error path
We should unlock here before returning -EINVAL.

Fixes: 39ad460096 ('dmaengine: s3c24xx: Split device_control')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-04 17:52:42 -08:00
Dave Jiang
68a8cc9e9e ioatdma: Adding support for BDX-DE ioatdma.
Adding PCI device IDs and hooks in workarounds for Broadwell DE ioatdma.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-02-03 17:47:40 -08:00
Vinod Koul
46c2eb6459 Merge branch 'topic/rcar' into for-linus 2015-02-02 16:55:43 -08:00
Vinod Koul
2cd6f7928c Merge branch 'topic/slave_caps_device_control_fix_rebased' into for-linus 2015-02-02 16:55:35 -08:00
Wolfram Sang
c914570f28 dmaengine: of: bail out early if "dmas" property is not present
And don't print an error: not configured is not an error.

Reported-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-25 22:44:23 -08:00
Kuninori Morimoto
5cf5aec5b3 dmaengine: shdmac: fixup WARNING of slave caps retrieval
ecc19d1786
(dmaengine: Add a warning for drivers not using the generic slave
caps retrieval) added WARN() for DMA_SLAVE.
Kernel will shows WARNING without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-25 22:37:20 -08:00
Kuninori Morimoto
2b5fbb824f dmaengine: rcar-hpbdma: tidyup residue_granularity
The driver doesn't support residue reporting at all.
residue_granularity should be set to DMA_RESIDUE_GRANULARITY_DESCRIPTOR.
Special thanks to Laurent

Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-25 22:37:05 -08:00
Arnd Bergmann
d50b9e2e78 ARM: SAMSUNG: remove unused DMA infrastructure
Everything uses dmaengine now, so there is no reason to
keep this around any longer. Thanks to everyone who was involved
in moving the users over to use the dmaengine APIs.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
2015-01-24 13:09:54 +09:00
Arnd Bergmann
4d76bbed2d dmaengine: coh901318: fix function return types build warnings
A recent patch that removed coh901318_control() replaced it
with a number of pointers to existing functions, but those
unfortunately have the wrong return  type and need to be
changed to return an 'int' with an error value rather than
a 'void' to avoid these build warnings:

drivers/dma/coh901318.c:2697:32: warning: assignment from incompatible pointer type
  base->dma_slave.device_config = coh901318_dma_set_runtimeconfig;
                                ^
drivers/dma/coh901318.c:2698:31: warning: assignment from incompatible pointer type
  base->dma_slave.device_pause = coh901318_pause;
                               ^
drivers/dma/coh901318.c:2699:32: warning: assignment from incompatible pointer type
  base->dma_slave.device_resume = coh901318_resume

The coh901318_base_init function has the correct return type
already, but needs to be marked 'static' to avoid a sparse
warning about a missing declaration.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 6782af118b ("dmaengine: coh901318: Split device_control")
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-18 20:01:36 +05:30
Maxime Ripard
848e10bb52 dmaengine: s3c24xx: Fix typo
A typo has been introduced in the spin_unlock_irqrestore function. Fix it.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-18 20:01:15 +05:30
Maxime Ripard
a0a51a64f6 dmaengine: sa11x0: Fix warning and compilation errors
The sa11x0_dma_resume conflicts between the dmaengine device_resume callback
and the dev_pm_ops resume implementation.

Also remove some unused variables at the same time.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-18 20:01:15 +05:30
Laurent Pinchart
0d5484b1c3 dmaengine: Move dma_get_slave_caps() implementation to dmaengine.c
The function is too big to be a static inline.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-18 19:55:57 +05:30
Ludovic Desroches
816070ede7 dmaengine: at_hdmac: declare slave capabilities
Declare slave capabilities to suppress "this driver doesn't support generic
slave capabilities reporting" warning.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-14 00:04:02 +05:30
Paul Walmsley
891653ab83 dmaengine: tegra: add slave capabilities reporting
After commit ecc19d1786 ("dmaengine: Add
a warning for drivers not using the generic slave caps retrieval"),
the Tegra APB DMA driver causes this warning during boot:

WARNING: CPU: 0 PID: 1 at drivers/dma/dmaengine.c:830 dma_async_device_register+0x294/0x538()
this driver doesn't support generic slave capabilities reporting

Fix by setting the appropriate reporting structure fields that are
passed to dma_async_device_register().

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-14 00:00:30 +05:30
Kevin Hao
0fdd244fe8 dmaengine: fsldma: remove the unused variable
Fix the following build warning:
  drivers/dma/fsldma.c: In function 'fsl_dma_device_terminate_all':
  drivers/dma/fsldma.c:947:6: warning: unused variable 'size' [-Wunused-variable]

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:58:08 +05:30
Kevin Hao
75dc1775ec dmaengine: fsldma: declare slave capabilities for the generic code
Since commit ecc19d1786 ("dmaengine: Add a warning for drivers not
using the generic slave caps retrieval"), the dma drivers are required
to fill the caps infos in order to support generic slaves caps
retrieval. Otherwise we will get a warning like this:
  WARNING: at drivers/dma/dmaengine.c:830
  Modules linked in:
  CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W       3.19.0-rc2-next-20150106-dirty #271
  task: c0000001f70a0000 ti: c0000001f7044000 task.ti: c0000001f7044000
  NIP: c00000000032b238 LR: c00000000032b234 CTR: c00000000001d258
  REGS: c0000001f7047330 TRAP: 0700   Tainted: G        W        (3.19.0-rc2-next-20150106-dirty)
  MSR: 0000000080029000 <CE,EE,ME>  CR: 24adbe22  XER: 20000000
  SOFTE: 1
  GPR00: c00000000032b234 c0000001f70475b0 c0000000009b4848 0000000000000040
  GPR04: 0000000000000001 0000000000000001 0000000000000000 000000000000000f
  GPR08: 0000000000000000 c000000000902988 c000000000902988 00000000000052c8
  GPR12: 0000000024adbe22 c00000000fff4000 c000000000002038 0000000000000000
  GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
  GPR24: 0000000000000000 0000000000000000 c000000000972dc8 c0000000007e6fd0
  GPR28: c0000001f76d1d30 c0000001f76d1c10 c0000001f76d1c00 0000000000000000
  NIP [c00000000032b238] .dma_async_device_register+0x3f8/0x5b8
  LR [c00000000032b234] .dma_async_device_register+0x3f4/0x5b8
  Call Trace:
  [c0000001f70475b0] [c00000000032b234] .dma_async_device_register+0x3f4/0x5b8 (unreliable)
  [c0000001f70476a0] [c00000000032ca78] .fsldma_of_probe+0x298/0x438
  [c0000001f7047750] [c00000000037080c] .platform_drv_probe+0x50/0x9c
  [c0000001f70477d0] [c00000000036e74c] .really_probe+0xa4/0x29c
  [c0000001f7047870] [c00000000036eae4] .__driver_attach+0x100/0x104
  [c0000001f7047900] [c00000000036c1f0] .bus_for_each_dev+0x84/0xe4
  [c0000001f70479a0] [c00000000036e164] .driver_attach+0x24/0x38
  [c0000001f7047a10] [c00000000036dcc8] .bus_add_driver+0x1c8/0x2ac
  [c0000001f7047ab0] [c00000000036f14c] .driver_register+0x8c/0x158
  [c0000001f7047b30] [c0000000003707a8] .__platform_driver_register+0x6c/0x80
  [c0000001f7047ba0] [c000000000898a3c] .fsldma_init+0x2c/0x40
  [c0000001f7047c10] [c000000000001818] .do_one_initcall+0xb8/0x234
  [c0000001f7047d00] [c000000000878e2c] .kernel_init_freeable+0x188/0x268
  [c0000001f7047db0] [c000000000002054] .kernel_init+0x1c/0xfc8
  [c0000001f7047e30] [c000000000000884] .ret_from_kernel_thread+0x58/0xd4
  Instruction dump:
  7fb9f840 3bffffe0 409effac 7f54d378 48000060 813d0050 2f890000 40befdd0
  3c62ffe3 38632450 482f0aa9 60000000 <0fe00000> 4bfffdb8 7f03c378 482ed465

Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:58:08 +05:30
Kuninori Morimoto
7a96337d05 dmaengine: rcar-hpbdma: fixup WARNING of slave caps retrieval
ecc19d1786
(dmaengine: Add a warning for drivers not using the generic slave
caps retrieval) added WARN() for DMA_SLAVE.
Kernel will shows WARNING without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:53:01 +05:30
Fabio Estevam
63c72e028a dmaengine: imx-sdma: Return a proper error code in platform_get_irq()
There is no need to return a 'fake' value upon platform_get_irq() failure.

Just propagate the real error instead.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:51:07 +05:30
Fabio Estevam
7f24e0ee00 dmaengine: imx-sdma: Use devm functions
By using devm functions we can make the code shorter and cleaner.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:51:07 +05:30
Fabio Estevam
1e4a4f50d2 dmaengine: imx-sdma: Declare slave capabilities for the generic code
Since ecc19d1786 ("dmaengine: Add a warning for drivers not using the
generic slave caps retrieval") the following warning is observed:

[    0.224981] ------------[ cut here ]------------
[    0.225013] WARNING: CPU: 0 PID: 1 at drivers/dma/dmaengine.c:830 dma_async_device_register+0x2a0/0x4c8()
[    0.225023] this driver doesn't support generic slave capabilities reporting

Declare the slave capabilities to avoid such warning.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:51:07 +05:30
Fabio Estevam
ef9d2a9233 dmaengine: mxs-dma: Declare slave capabilities for the generic code
Since ecc19d1786 ("dmaengine: Add a warning for drivers not using the
generic slave caps retrieval") the following warning is observed:

[    0.113023] ------------[ cut here ]------------
[    0.113053] WARNING: CPU: 0 PID: 1 at drivers/dma/dmaengine.c:830 dma_async_device_register+0x2a0/0x4c8()
[    0.113063] this driver doesn't support generic slave capabilities reporting

Declare the slave capabilities to avoid such warning.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:48:40 +05:30
Andy Shevchenko
029a40e97d dmaengine: dw: provide DMA capabilities
The new DMAEngine requirement is to provide what the DMA controller can do,
such as directions, bus widths, and residue granularity. The patch sets those
properties for the DesignWare DMA controller driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:46:00 +05:30
Andy Shevchenko
6acf3998d2 dmaengine: dw: balance PM runtime calls
In case of PCI driver we will get a warning:
	dw_dmac_pci 0000:00:18.0: Unbalanced pm_runtime_enable!
	dw_dmac_pci 0000:00:18.0: DesignWare DMA Controller, 8 channels

This happens due to pm_runtime_enable() call from the driver when PM runtime is
enabled by core.

This patch moves that call to the platform driver where it might make sense.

Fixes: bb32baf76e (dmaengine: dw: enable runtime PM)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:07:58 +05:30
Wolfram Sang
640f204bcd dmaengine: drop owner assignment from platform_drivers
This platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 23:05:04 +05:30
Arnd Bergmann
3c20ba5fb5 dmaengine: mmp-tdma: fix terminate_all return code
In a recent cleanup, the mmp_tdma_terminate_all function was
introduced but does not set a proper return value. Almost
no slave driver uses that return value, but if one does, the
result will be undefined, which the compiler warns about:

dma/mmp_tdma.c: In function 'mmp_tdma_terminate_all':
dma/mmp_tdma.c:474:1: warning: no return statement in function returning non-void [-Wreturn-type]

This changes the driver to return zero, like most other
drivers do.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: f43a6fd400 ("dmaengine: mmp-tdma: Split device_control")
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 21:20:10 +05:30
Arnd Bergmann
2f56eaff20 dmaengine: mmp-tdma: don't include mach/regs-icu.h
The mmp tdma driver does not actually require this header, and
we want to enable multiplatform support for MMP, which would
make it inaccessible and cause a build error.

This patch just removes the old #include.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 21:20:10 +05:30
Arnd Bergmann
10b3e22317 dmaengine: k3: fix duplicate function definition
Commit db08425ebd ("dmaengine: k3: Split device_control") introduced
two new helper functions, which unfortunately have the same names
as the existing suspend/resume functions, resulting in a build error
when CONFIG_PM_SLEEP is enabled:

drivers/dma/k3dma.c:823:12: error: conflicting types for 'k3_dma_resume'
 static int k3_dma_resume(struct device *dev)
            ^
drivers/dma/k3dma.c:625:12: note: previous definition of 'k3_dma_resume' was here
 static int k3_dma_resume(struct dma_chan *chan)
            ^

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: db08425ebd ("dmaengine: k3: Split device_control")
Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 21:20:09 +05:30
Krzysztof Kozlowski
a1a9becbf3 dmaengine: k3: Fix duplicated function name and allmodconfig build
While splitting device control in db08425ebd ("dmaengine: k3:
Split device_control") new function with the same 'k3_dma_resume' name
was added, leading to build error:

drivers/dma/k3dma.c:823:12: error: conflicting types for ‘k3_dma_resume’
drivers/dma/k3dma.c:625:12: note: previous definition of ‘k3_dma_resume’ was here

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2015-01-13 21:19:44 +05:30
Jürg Billeter
ee4b876bbe dmaengine: rcar-dmac: Handle hardware descriptor allocation failure
If the atomic DMA coherent pool is too small, disable use of hardware
descriptor lists instead of crashing the system:

ERROR: 256 KiB atomic DMA coherent pool is too small!
Please increase it with coherent_pool= kernel parameter!

Unable to handle kernel NULL pointer dereference at virtual address 00000004
Internal error: Oops: a07 [#1] PREEMPT SMP ARM

PC is at rcar_dmac_chan_reinit+0x3c/0x160
LR is at _raw_spin_lock_irqsave+0x18/0x5c

[<802132c0>] (rcar_dmac_chan_reinit) from [<80214818>] (rcar_dmac_isr_error+0x84/0xa0)
[<80214818>] (rcar_dmac_isr_error) from [<80060484>] (handle_irq_event_percpu+0x50/0x150)
[<80060484>] (handle_irq_event_percpu) from [<800605c0>] (handle_irq_event+0x3c/0x5c)
[<800605c0>] (handle_irq_event) from [<8006350c>] (handle_fasteoi_irq+0xb8/0x198)
[<8006350c>] (handle_fasteoi_irq) from [<8005fdb0>] (generic_handle_irq+0x20/0x30)
[<8005fdb0>] (generic_handle_irq) from [<8000fcd0>] (handle_IRQ+0x50/0xc4)
[<8000fcd0>] (handle_IRQ) from [<800092cc>] (gic_handle_irq+0x28/0x5c)
[<800092cc>] (gic_handle_irq) from [<80012700>] (__irq_svc+0x40/0x70)

Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Jürg Billeter <j@bitron.ch>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
2014-12-23 11:13:03 +02:00
Laurent Pinchart
1ed1315f9b dmaengine: rcar-dmac: Cache hardware descriptors memory
Unlike DMA transfers descriptors that are preallocated and cached,
memory used to store hardware descriptors is allocated and freed with
the DMA coherent allocation API for every transfer. Besides degrading
performances, this creates a CMA stress test that seems to cause issues.
Running dmatest with the noverify option produces

[   50.066539] alloc_contig_range test_pages_isolated(6b845, 6b846) failed
[   50.235180] alloc_contig_range test_pages_isolated(6b848, 6b84e) failed
[   52.964584] alloc_contig_range test_pages_isolated(6b847, 6b848) failed
[   54.127113] alloc_contig_range test_pages_isolated(6b843, 6b844) failed
[   56.270253] alloc_contig_range test_pages_isolated(6b84c, 6b850) failed

The root cause needs to be fixed, but in the meantime, as a workaround
and a performance improvement, cache hardware descriptors.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2014-12-23 11:13:03 +02:00
Laurent Pinchart
ccadee9b1e dmaengine: rcar-dmac: Implement support for hardware descriptor lists
The DMAC supports hardware-based auto-configuration from descriptor
lists. This reduces the number of interrupts required for processing a
DMA transfer. Support that mode in the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2014-12-23 11:13:02 +02:00
Laurent Pinchart
87244fe5ab dmaengine: rcar-dmac: Add Renesas R-Car Gen2 DMA Controller (DMAC) driver
The DMAC is a general purpose multi-channel DMA controller that supports
both slave and memcpy transfers.

The driver currently supports the DMAC found in the r8a7790 and r8a7791
SoCs. Support for compatible DMA controllers (such as the audio DMAC)
will be added later.

Feature-wise, automatic hardware handling of descriptors chains isn't
supported yet. LPAE support is implemented.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2014-12-23 11:13:01 +02:00
Rickard Strandqvist
9265eaed9c dmaengine: imx-dma.c: Remove unused function
Remove the function is_imx21_dma() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 21:04:16 +05:30
Vinod Koul
fbde286783 dmaengine: nbpfaxi: update the driver comments
driver comment refers to DMA_PAUSE which needs to be updated to
.device_pause

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 20:28:04 +05:30
Vinod Koul
b2be07d001 dmaengine: ep93xx: update the driver comments
driver comment refers to DMA_SLAVE_CONFIG which needs to be updated to
.device_config

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 20:27:25 +05:30
Vinod Koul
295d3e10e6 dmaengine: dw: update the driver comments
driver comment refers to DMA_SLAVE_CONFIG which needs to be updated to
.device_config

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 20:26:45 +05:30
Vinod Koul
3e1152a2f6 dmaengine: at_hdmac: update the driver comments
driver comment refers to DMA_SLAVE_CONFIG which needs to be updated to
.device_config

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 20:24:14 +05:30
Vinod Koul
a7c439a458 dmaengine: tegra: fix incompatible pointer type warns
drivers/dma/tegra20-apb-dma.c:1428:37: warning: assignment from incompatible pointer type [enabled by default]
drivers/dma/ste_dma40.c: In function 'd40_terminate_all':

The function prototype expects return type 'int' whereas these where void

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 12:34:23 +05:30
Vinod Koul
35e639d1f7 dmaengine: ste_dma: fix incompatible pointer type warns
drivers/dma/ste_dma40.c:2627:3: warning: 'return' with a value, in function returning void [enabled by default]
drivers/dma/ste_dma40.c: In function 'd40_ops_init':
drivers/dma/ste_dma40.c:2869:28: warning: assignment from incompatible pointer type [enabled by default]

The function prototype expects return type 'int' whereas these where void

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-12-22 12:34:23 +05:30