Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78e8696c authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'dmaengine-4.21-rc1' of git://git.infradead.org/users/vkoul/slave-dma

Pull dmaengine updates from Vinod Koul:
 "This includes a new driver, removes R-Mobile APE6 as it is no longer
  used, sprd cyclic dma support, last batch of dma_slave_config
  direction removal and random updates to bunch of drivers.

  Summary:
   - New driver for UniPhier MIO DMA controller
   - Remove R-Mobile APE6 support
   - Sprd driver updates and support for cyclic link-list
   - Remove dma_slave_config direction usage from rest of drivers
   - Minor updates to dmatest, dw-dmac, zynqmp and bcm dma drivers"

* tag 'dmaengine-4.21-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (48 commits)
  dmaengine: qcom_hidma: convert to DEFINE_SHOW_ATTRIBUTE
  dmaengine: pxa: remove DBGFS_FUNC_DECL()
  dmaengine: mic_x100_dma: convert to DEFINE_SHOW_ATTRIBUTE
  dmaengine: amba-pl08x: convert to DEFINE_SHOW_ATTRIBUTE
  dmaengine: Documentation: Add documentation for multi chan testing
  dmaengine: dmatest: Add transfer_size parameter
  dmaengine: dmatest: Add alignment parameter
  dmaengine: dmatest: Use fixed point div to calculate iops
  dmaengine: dmatest: Add support for multi channel testing
  dmaengine: rcar-dmac: Document R8A774C0 bindings
  dt-bindings: dmaengine: usb-dmac: Add binding for r8a774c0
  dmaengine: zynqmp_dma: replace spin_lock_bh with spin_lock_irqsave
  dmaengine: sprd: Add me as one of the module authors
  dmaengine: sprd: Support DMA 2-stage transfer mode
  dmaengine: sprd: Support DMA link-list cyclic callback
  dmaengine: sprd: Set cur_desc as NULL when free or terminate one dma channel
  dmaengine: sprd: Fix the last link-list configuration
  dmaengine: sprd: Get transfer residue depending on the transfer direction
  dmaengine: sprd: Remove direction usage from struct dma_slave_config
  dmaengine: dmatest: fix a small memory leak in dmatest_func()
  ...
parents fcf01044 66061182
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
* Renesas R-Car (RZ/G) DMA Controller Device Tree bindings
* Renesas R-Car (RZ/G) DMA Controller Device Tree bindings


Renesas R-Car Generation 2 SoCs have multiple multi-channel DMA
Renesas R-Car (Gen 2/3) and RZ/G SoCs have multiple multi-channel DMA
controller instances named DMAC capable of serving multiple clients. Channels
controller instances named DMAC capable of serving multiple clients. Channels
can be dedicated to specific clients or shared between a large number of
can be dedicated to specific clients or shared between a large number of
clients.
clients.
@@ -20,6 +20,8 @@ Required Properties:
		- "renesas,dmac-r8a7744" (RZ/G1N)
		- "renesas,dmac-r8a7744" (RZ/G1N)
		- "renesas,dmac-r8a7745" (RZ/G1E)
		- "renesas,dmac-r8a7745" (RZ/G1E)
		- "renesas,dmac-r8a77470" (RZ/G1C)
		- "renesas,dmac-r8a77470" (RZ/G1C)
		- "renesas,dmac-r8a774a1" (RZ/G2M)
		- "renesas,dmac-r8a774c0" (RZ/G2E)
		- "renesas,dmac-r8a7790" (R-Car H2)
		- "renesas,dmac-r8a7790" (R-Car H2)
		- "renesas,dmac-r8a7791" (R-Car M2-W)
		- "renesas,dmac-r8a7791" (R-Car M2-W)
		- "renesas,dmac-r8a7792" (R-Car V2H)
		- "renesas,dmac-r8a7792" (R-Car V2H)
+3 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,9 @@ Required Properties:
	  - "renesas,r8a7743-usb-dmac" (RZ/G1M)
	  - "renesas,r8a7743-usb-dmac" (RZ/G1M)
	  - "renesas,r8a7744-usb-dmac" (RZ/G1N)
	  - "renesas,r8a7744-usb-dmac" (RZ/G1N)
	  - "renesas,r8a7745-usb-dmac" (RZ/G1E)
	  - "renesas,r8a7745-usb-dmac" (RZ/G1E)
	  - "renesas,r8a77470-usb-dmac" (RZ/G1C)
	  - "renesas,r8a774a1-usb-dmac" (RZ/G2M)
	  - "renesas,r8a774c0-usb-dmac" (RZ/G2E)
	  - "renesas,r8a7790-usb-dmac" (R-Car H2)
	  - "renesas,r8a7790-usb-dmac" (R-Car H2)
	  - "renesas,r8a7791-usb-dmac" (R-Car M2-W)
	  - "renesas,r8a7791-usb-dmac" (R-Car M2-W)
	  - "renesas,r8a7793-usb-dmac" (R-Car M2-N)
	  - "renesas,r8a7793-usb-dmac" (R-Car M2-N)
+4 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,10 @@ Optional properties:
  general purpose DMA channel allocator. False if not passed.
  general purpose DMA channel allocator. False if not passed.
- multi-block: Multi block transfers supported by hardware. Array property with
- multi-block: Multi block transfers supported by hardware. Array property with
  one cell per channel. 0: not supported, 1 (default): supported.
  one cell per channel. 0: not supported, 1 (default): supported.
- snps,dma-protection-control: AHB HPROT[3:1] protection setting.
  The default value is 0 (for non-cacheable, non-buffered,
  unprivileged data access).
  Refer to include/dt-bindings/dma/dw-dmac.h for possible values.


Example:
Example:


+25 −0
Original line number Original line Diff line number Diff line
UniPhier Media IO DMA controller

This works as an external DMA engine for SD/eMMC controllers etc.
found in UniPhier LD4, Pro4, sLD8 SoCs.

Required properties:
- compatible: should be "socionext,uniphier-mio-dmac".
- reg: offset and length of the register set for the device.
- interrupts: a list of interrupt specifiers associated with the DMA channels.
- clocks: a single clock specifier.
- #dma-cells: should be <1>. The single cell represents the channel index.

Example:
	dmac: dma-controller@5a000000 {
		compatible = "socionext,uniphier-mio-dmac";
		reg = <0x5a000000 0x1000>;
		interrupts = <0 68 4>, <0 68 4>, <0 69 4>, <0 70 4>,
			     <0 71 4>, <0 72 4>, <0 73 4>, <0 74 4>;
		clocks = <&mio_clk 7>;
		#dma-cells = <1>;
	};

Note:
In the example above, "interrupts = <0 68 4>, <0 68 4>, ..." is not a typo.
The first two channels share a single interrupt line.
+103 −6
Original line number Original line Diff line number Diff line
@@ -30,28 +30,43 @@ Part 2 - When dmatest is built as a module


Example of usage::
Example of usage::


    % modprobe dmatest channel=dma0chan0 timeout=2000 iterations=1 run=1
    % modprobe dmatest timeout=2000 iterations=1 channel=dma0chan0 run=1


...or::
...or::


    % modprobe dmatest
    % modprobe dmatest
    % echo dma0chan0 > /sys/module/dmatest/parameters/channel
    % echo 2000 > /sys/module/dmatest/parameters/timeout
    % echo 2000 > /sys/module/dmatest/parameters/timeout
    % echo 1 > /sys/module/dmatest/parameters/iterations
    % echo 1 > /sys/module/dmatest/parameters/iterations
    % echo dma0chan0 > /sys/module/dmatest/parameters/channel
    % echo 1 > /sys/module/dmatest/parameters/run
    % echo 1 > /sys/module/dmatest/parameters/run


...or on the kernel command line::
...or on the kernel command line::


    dmatest.channel=dma0chan0 dmatest.timeout=2000 dmatest.iterations=1 dmatest.run=1
    dmatest.timeout=2000 dmatest.iterations=1 dmatest.channel=dma0chan0 dmatest.run=1

Example of multi-channel test usage:
    % modprobe dmatest
    % echo 2000 > /sys/module/dmatest/parameters/timeout
    % echo 1 > /sys/module/dmatest/parameters/iterations
    % echo dma0chan0 > /sys/module/dmatest/parameters/channel
    % echo dma0chan1 > /sys/module/dmatest/parameters/channel
    % echo dma0chan2 > /sys/module/dmatest/parameters/channel
    % echo 1 > /sys/module/dmatest/parameters/run


Note: the channel parameter should always be the last parameter set prior to
running the test (setting run=1), this is because upon setting the channel
parameter, that specific channel is requested using the dmaengine and a thread
is created with the existing parameters. This thread is set as pending
and will be executed once run is set to 1. Any parameters set after the thread
is created are not applied.
.. hint::
.. hint::
  available channel list could be extracted by running the following command::
  available channel list could be extracted by running the following command::


    % ls -1 /sys/class/dma/
    % ls -1 /sys/class/dma/


Once started a message like "dmatest: Started 1 threads using dma0chan0" is
Once started a message like " dmatest: Added 1 threads using dma0chan0" is
emitted. After that only test failure messages are reported until the test
emitted. A thread for that specific channel is created and is now pending, the
stops.
pending thread is started once run is to 1.


Note that running a new test will not stop any in progress test.
Note that running a new test will not stop any in progress test.


@@ -116,3 +131,85 @@ Example::


The details of a data miscompare error are also emitted, but do not follow the
The details of a data miscompare error are also emitted, but do not follow the
above format.
above format.

Part 5 - Handling channel allocation
====================================

Allocating Channels
-------------------

Channels are required to be configured prior to starting the test run.
Attempting to run the test without configuring the channels will fail.

Example::

    % echo 1 > /sys/module/dmatest/parameters/run
    dmatest: Could not start test, no channels configured

Channels are registered using the "channel" parameter. Channels can be requested by their
name, once requested, the channel is registered and a pending thread is added to the test list.

Example::

    % echo dma0chan2 > /sys/module/dmatest/parameters/channel
    dmatest: Added 1 threads using dma0chan2

More channels can be added by repeating the example above.
Reading back the channel parameter will return the name of last channel that was added successfully.

Example::

    % echo dma0chan1 > /sys/module/dmatest/parameters/channel
    dmatest: Added 1 threads using dma0chan1
    % echo dma0chan2 > /sys/module/dmatest/parameters/channel
    dmatest: Added 1 threads using dma0chan2
    % cat /sys/module/dmatest/parameters/channel
    dma0chan2

Another method of requesting channels is to request a channel with an empty string, Doing so
will request all channels available to be tested:

Example::

    % echo "" > /sys/module/dmatest/parameters/channel
    dmatest: Added 1 threads using dma0chan0
    dmatest: Added 1 threads using dma0chan3
    dmatest: Added 1 threads using dma0chan4
    dmatest: Added 1 threads using dma0chan5
    dmatest: Added 1 threads using dma0chan6
    dmatest: Added 1 threads using dma0chan7
    dmatest: Added 1 threads using dma0chan8

At any point during the test configuration, reading the "test_list" parameter will
print the list of currently pending tests.

Example::

    % cat /sys/module/dmatest/parameters/test_list
    dmatest: 1 threads using dma0chan0
    dmatest: 1 threads using dma0chan3
    dmatest: 1 threads using dma0chan4
    dmatest: 1 threads using dma0chan5
    dmatest: 1 threads using dma0chan6
    dmatest: 1 threads using dma0chan7
    dmatest: 1 threads using dma0chan8

Note: Channels will have to be configured for each test run as channel configurations do not
carry across to the next test run.

Releasing Channels
-------------------

Channels can be freed by setting run to 0.

Example::
    % echo dma0chan1 > /sys/module/dmatest/parameters/channel
    dmatest: Added 1 threads using dma0chan1
    % cat /sys/class/dma/dma0chan1/in_use
    1
    % echo 0 > /sys/module/dmatest/parameters/run
    % cat /sys/class/dma/dma0chan1/in_use
    0

Channels allocated by previous test runs are automatically freed when a new
channel is requested after completing a successful test run.
Loading