Commit Graph

796667 Commits

Author SHA1 Message Date
Vinod Koul
69ca36b3d6 Merge branch 'topic/uniphier' into for-linus 2018-12-31 19:32:27 +05:30
Vinod Koul
990beed934 Merge branch 'topic/sprd' into for-linus 2018-12-31 19:32:21 +05:30
Vinod Koul
f782086a49 Merge branch 'topic/sh' into for-linus 2018-12-31 19:32:16 +05:30
Vinod Koul
56e8e1a118 Merge branch 'topic/sa11x0' into for-linus 2018-12-31 19:32:10 +05:30
Vinod Koul
68ded1dcd1 Merge branch 'topic/mtk' into for-linus 2018-12-31 19:31:59 +05:30
Vinod Koul
23a1bff764 Merge branch 'topic/imx' into for-linus 2018-12-31 19:31:54 +05:30
Vinod Koul
b7ff66ca30 Merge branch 'topic/ep93xx' into for-linus 2018-12-31 19:31:47 +05:30
Vinod Koul
010299bfc2 Merge branch 'topic/dw' into for-linus 2018-12-31 19:31:42 +05:30
Vinod Koul
466e601a68 Merge branch 'topic/dmatest' into for-linus 2018-12-31 19:31:37 +05:30
Vinod Koul
77ee1aacdd Merge branch 'topic/dirn_remove' into for-linus 2018-12-31 19:31:31 +05:30
Vinod Koul
5f443256e3 Merge branch 'topic/coh' into for-linus 2018-12-31 19:31:25 +05:30
Vinod Koul
7c2269e958 Merge branch 'topic/bcm' into for-linus 2018-12-31 19:31:21 +05:30
Yangtao Li
f7f41722ef dmaengine: qcom_hidma: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Sinan Kaya <okaya@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:49:41 +05:30
Yangtao Li
e00f50a79e dmaengine: pxa: remove DBGFS_FUNC_DECL()
We already have the DEFINE_SHOW_ATTRIBUTE, There is no need to define
such a macro, so remove DBGFS_FUNC_DECL.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:49:41 +05:30
Yangtao Li
0f7ab39a6b dmaengine: mic_x100_dma: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:49:41 +05:30
Yangtao Li
8e1897bc8e dmaengine: amba-pl08x: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:49:41 +05:30
Seraj Alijan
f80f9988a2 dmaengine: Documentation: Add documentation for multi chan testing
Modify documentation to add multi channel testing support.

Signed-off-by: Seraj Alijan <seraj.alijan@sondrel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:45:11 +05:30
Seraj Alijan
13396a130f dmaengine: dmatest: Add transfer_size parameter
Existing transfer size "len" is either generated randomly or set to the
size of test_buf_size. In some cases we need to explicitly specify a
transfer size that is different from the buffer size and non aligned to
test the target device's ability to handle unaligned transfers.

This patch adds optional parameter "transfer_size" to allow setting
explicit transfer size for dma transfers.

Signed-off-by: Seraj Alijan <seraj.alijan@sondrel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:45:11 +05:30
Seraj Alijan
a875abfadf dmaengine: dmatest: Add alignment parameter
Add parameter "alignment" to allow setting the address alignment
manually. Having the ability to configure address alignment from
user space adds new testing capabilities where different alignments can
be configured for testing without having to modify the dma device
alignment properties.

If configured, the alignment value will override the device alignment
property of the target device.

Signed-off-by: Seraj Alijan <seraj.alijan@sondrel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:45:11 +05:30
Seraj Alijan
6138f967bc dmaengine: dmatest: Use fixed point div to calculate iops
Use fixed point division to calculate iops to prevent reporting 0 iops
when operations last for longer than a second.

Signed-off-by: Seraj Alijan <seraj.alijan@sondrel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:45:11 +05:30
Seraj Alijan
d53513d5dc dmaengine: dmatest: Add support for multi channel testing
Add support for running tests on multiple channels simultaneously as the
driver currently limits to 1 channel per test run. This will add support
for stress testing DMA controllers with multi channel capabilities.

This is done by adding a callback function to the "channel" parameter
that registers the requested channel prior to the "run" parameter being
set to 1. Each time the "channel" parameter is populated with a new
dma channel, a new test is appended to the thread queue. Once the "run"
parameter is set to 1, the test will kick start all pending threads.

Signed-off-by: Seraj Alijan <seraj.alijan@sondrel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:45:11 +05:30
Fabrizio Castro
47ec4cf405 dmaengine: rcar-dmac: Document R8A774C0 bindings
Renesas' RZ/G2E (R8A774C0) SoC has DMA controllers compatible
with this driver, therefore document RZ/G2E specific bindings.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:01:05 +05:30
Fabrizio Castro
3eaba568b5 dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0
This patch adds bindings for the r8a774c0 (RZ/G2E).

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-17 11:01:05 +05:30
Michael Tretter
a5b21a8ba2 dmaengine: zynqmp_dma: replace spin_lock_bh with spin_lock_irqsave
All device_prep_dma_* functions and device_issue_pending can be called
from an interrupt context. As this includes hard IRQs, we must use
spin_lock_irqsave() instead of spin_lock_bh() to access chan->lock.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:37:32 +05:30
Eric Long
531971231d dmaengine: sprd: Add me as one of the module authors
Add me as one of the module authors.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:12 +05:30
Eric Long
770399df90 dmaengine: sprd: Support DMA 2-stage transfer mode
The Spreadtrum DMA controller supports channel 2-stage tansfer mode,
that means we can request 2 dma channels, one for source channel, and
another one for destination channel. Once the source channel's transaction
is done, it will trigger the destination channel's transaction automatically
by hardware signal.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:12 +05:30
Eric Long
97dbd6ea02 dmaengine: sprd: Support DMA link-list cyclic callback
The Spreadtrum DMA link-list mode is always one cyclic transfer,
so we should clear the SPRD_DMA_LLIST_END flag for the link-list
configuration. Moreover add cyclic callback support for the cyclic
transfer.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:12 +05:30
Eric Long
0e5d7b1eb6 dmaengine: sprd: Set cur_desc as NULL when free or terminate one dma channel
It will be failed to start one new transfer if the channel started one
none interrupt transfer before, since we will only set the schan->cur_desc
as NULL depending on the transfer interrupt now. Thus we should set
schan->cur_desc as NULL when free or terminate one dma channel to
avoid this issue.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:12 +05:30
Eric Long
13e8997924 dmaengine: sprd: Fix the last link-list configuration
We will pass sglen as 0 configure the last link-list configuration
when filling the descriptor, which will cause the incorrect link-list
configuration. Thus we should check if the sglen is 0 to configure
the correct link-list configuration.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:11 +05:30
Eric Long
d762ab33cc dmaengine: sprd: Get transfer residue depending on the transfer direction
Add one field to save the transfer direction for struct sprd_dma_desc,
which is used to get correct transfer residue depending on the transfer
direction.

[Baolin Wang adds one field to present the transfer direction]
Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:11 +05:30
Baolin Wang
a0ecabf503 dmaengine: sprd: Remove direction usage from struct dma_slave_config
The direction field of struct dma_slave_config was marked deprecated,
thus remove the usage.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 14:27:11 +05:30
Dan Carpenter
3f3c75541f dmaengine: dmatest: fix a small memory leak in dmatest_func()
We recently moved the test size tests around but it means we need to
adjust the error handling as well or we leak the "pq_coefs" memory.  I
updated the label name to reflect that we're freeing coefs.

Fixes: 787d3083ca ("dmaengine: dmatest: move size checks earlier in function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 13:37:46 +05:30
Geert Uytterhoeven
a19788612f dmaengine: sh: Remove R-Mobile APE6 support
Renesas R-Mobile APE6 support is currently unused:
  - DMA slaves were never enabled in r8a73a4.dtsi,
  - The driver relies on legacy filter matching and describing all
    slaves and MID/RIDs in a table, unlike modern DMA engine drivers for
    similar hardware like rcar-dmac,
  - The driver doesn't seem to work well.

Remove the driver, it can be resurrected from git history when needed.

As this was the last user of SH_DMAE_BASE on Renesas ARM SoCs, the
sh-dma-engine driver core is now used on SuperH only.

Note that the DT bindings are still present, as r8a73a4.dtsi uses them.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-12-05 13:01:54 +05:30
Vinod Koul
35faaf0df4 dmaengine: coh901318: Remove unused variable
Commit 627469e444 ("dmaengine: coh901318: Fix a double-lock bug") left
flags variable unused, so remove it to fix the warning.

drivers/dma/coh901318.c: In function 'coh901318_config':
drivers/dma/coh901318.c:1805:16: warning: unused variable 'flags' [-Wunused-variable]
  unsigned long flags;
                ^~~~~

Fixes: 627469e444 ("dmaengine: coh901318: Fix a double-lock bug")
Reported-By: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-26 13:35:52 +05:30
Vinod Koul
9e314ef35c dmaengine: ste_dma40: remove dma_slave_config direction usage
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:22:21 +05:30
Vinod Koul
445897cbc9 dmaengine: pl330: remove dma_slave_config direction usage
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed

Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:22:21 +05:30
Vinod Koul
107d06441b dmaengine: imx-sdma: remove dma_slave_config direction usage and leave sdma_event_enable()
dma_slave_config direction was marked as deprecated quite some
time back, remove the usage from this driver so that the field
can be removed

ENBLn bit should be set before any dma request triggered, please
refer to the below information from i.mx6sololite RM. Otherwise,
spi/uart test will be fail because there is dma request from tx
fifo always before dmaengine_prep_slave_sg() in where ENBLn set
and violate the below rule.

https://www.nxp.com/docs/en/reference-manual/IMX6SLRM.pdf:

40.8.28 Channel Enable RAM (SDMAARM_CHNENBLn)
"It is thus essential for the Arm platform to program them before
any DMA request is triggered to the SDMA, otherwise an unpredictable
combination of channels may be started".

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
[vkoul: sqashed patch from Robin into direction change]
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:22:09 +05:30
Christian Lamparter
7b0c03ecc4 dmaengine: dw-dmac: implement dma protection control setting
This patch adds a new device-tree property that allows to
specify the dma protection control bits for the all of the
DMA controller's channel uniformly.

Setting the "correct" bits can have a huge impact on the
PPC460EX and APM82181 that use this DMA engine in combination
with a DesignWare' SATA-II core (sata_dwc_460ex driver).

In the OpenWrt Forum, the user takimata reported that:
|It seems your patch unleashed the full power of the SATA port.
|Where I was previously hitting a really hard limit at around
|82 MB/s for reading and 27 MB/s for writing, I am now getting this:
|
|root@OpenWrt:/mnt# time dd if=/dev/zero of=tempfile bs=1M count=1024
|1024+0 records in
|1024+0 records out
|real    0m 13.65s
|user    0m 0.01s
|sys     0m 11.89s
|
|root@OpenWrt:/mnt# time dd if=tempfile of=/dev/null bs=1M count=1024
|1024+0 records in
|1024+0 records out
|real    0m 8.41s
|user    0m 0.01s
|sys     0m 4.70s
|
|This means: 121 MB/s reading and 75 MB/s writing!
|
|The drive is a WD Green WD10EARX taken from an older MBL Single.
|I repeated the test a few times with even larger files to rule out
|any caching, I'm still seeing the same great performance. OpenWrt is
|now completely on par with the original MBL firmware's performance.

Another user And.short reported:
|I can report that your fix worked! Boots up fine with two
|drives even with more partitions, and no more reboot on
|concurrent disk access!

A closer look into the sata_dwc_460ex code revealed that
the driver did initally set the correct protection control
bits. However, this feature was lost when the sata_dwc_460ex
driver was converted to the generic DMA driver framework.

BugLink: https://forum.openwrt.org/t/wd-mybook-live-duo-two-disks/16195/55
BugLink: https://forum.openwrt.org/t/wd-mybook-live-duo-two-disks/16195/50
Fixes: 8b3444852a ("sata_dwc_460ex: move to generic DMA driver")
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:07:22 +05:30
Christian Lamparter
538098281c dt-bindings: dmaengine: dw-dmac: add protection control property
This patch for the DesignWare AHB Central
Direct Memory Access Controller adds the dma
protection control property:
	"snps,dma-protection-control"

as well as the properties specific values defines into
a new include file: include/dt-bindings/dma/dw-dmac.h

Note: The protection control signals are one-to-one
mapped to the AHB HPROT[1:3] signals for this controller.
The HPROT0 (Data Access) is always hardwired to 1.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:07:22 +05:30
Biju Das
b9b4ed2103 dt-bindings: dmaengine: usb-dmac: Add binding for r8a774a1
This patch adds binding for r8a774a1 (RZ/G2M).

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:02:31 +05:30
Fabrizio Castro
9693f67089 dmaengine: rcar-dmac: Document R8A774A1 bindings
Renesas' RZ/G2M (R8A774A1) SoC has DMA controllers compatible
with this driver, therefore document RZ/G2M specific bindings.

Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 20:02:27 +05:30
Jia-Ju Bai
627469e444 dmaengine: coh901318: Fix a double-lock bug
The function coh901318_alloc_chan_resources() calls spin_lock_irqsave()
before calling coh901318_config().
But coh901318_config() calls spin_lock_irqsave() again in its
definition, which may cause a double-lock bug.

Because coh901318_config() is only called by
coh901318_alloc_chan_resources(), the bug fix is to remove the
calls to spin-lock and -unlock functions in coh901318_config().

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:59:54 +05:30
Masahiro Yamada
32e74aabeb dmaengine: uniphier-mdmac: add UniPhier MIO DMAC driver
The MIO DMAC (Media IO DMA Controller) is used in UniPhier LD4,
Pro4, and sLD8 SoCs.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:42:59 +05:30
Masahiro Yamada
eeea81474b dt-bindings: dmaengine: add DT binding for UniPhier MIO DMAC
The MIO DMAC (Media IO DMA Controller) is used in UniPhier LD4,
Pro4, and sLD8 SoCs.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:42:59 +05:30
Alexandru Ardelean
787d3083ca dmaengine: dmatest: move size checks earlier in function
There's no need to allocate all that memory if these sizes are invalid
anyway.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:21:16 +05:30
Alexandru Ardelean
fbffb6b4d4 dmaengine: dmatest: use dmaengine_terminate_sync() instead
The `dmaengine_terminate_all()` is marked as deprecated, so update the test
with `dmaengine_terminate_sync()` which is the recommended alternative.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:16:46 +05:30
Alexandru Ardelean
0255200bd2 dmaengine: dmatest: unmap data on a single code-path when xfer done
After the DMA transfer is done, we don't need to call the un-mapping code
in 3 places. One is enough.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:16:46 +05:30
Fabio Estevam
af8bf89a8e dmaengine: imx-sdma: Use a single line for dma_alloc_coherent()
Make the call to dma_alloc_coherent() to fit into a single line, which
helps readability.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-24 19:07:39 +05:30
Shun-Chih Yu
b1f01e48df dmaengine: mediatek: Add MediaTek Command-Queue DMA controller for MT6765 SoC
MediaTek Command-Queue DMA controller (CQDMA) on MT6765 SoC is dedicated
to memory-to-memory transfer through queue based descriptor management.

There are only 3 physical channels inside CQDMA, while the driver is
extended to support 32 virtual channels for multiple dma users to issue
dma requests onto the CQDMA simultaneously.

Signed-off-by: Shun-Chih Yu <shun-chih.yu@mediatek.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-11 15:15:18 +05:30
Biju Das
6a1abe4cbc dt-bindings: dmaengine: usb-dmac: Add binding for r8a77470
This patch adds usb high-speed dmac binding for r8a77470 (RZ/G1C) SoC.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-11-11 15:00:32 +05:30