aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-09 12:46:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-09 12:46:45 -0400
commit1763e735b0a093a6747078b3bd101f079e576ab6 (patch)
tree75203a3229977d12dc5a5990d1122e7a3d5f30fc /Documentation
parentb29bdba51924f6fd5971352ba111784dee3a5853 (diff)
parent3065c194670b61e213656ce25976d7c8a95e3c93 (diff)
Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine updates from Vinod Koul: "This time we have dmatest improvements from Andy along with dw_dmac fixes. He has also done support for acpi for dmanegine. Also we have bunch of fixes going in DT support for dmanegine for various folks. Then Haswell and other ioat changes from Dave and SUDMAC support from Shimoda." * 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (53 commits) dma: tegra: implement suspend/resume callbacks dma:of: Use a mutex to protect the of_dma_list dma: of: Fix of_node reference leak dmaengine: sirf: move driver init from module_init to subsys_initcall sudmac: add support for SUDMAC dma: sh: add Kconfig at_hdmac: move to generic DMA binding ioatdma: ioat3_alloc_sed can be static ioatdma: Adding write back descriptor error status support for ioatdma 3.3 ioatdma: S1200 platforms ioatdma channel 2 and 3 falsely advertise RAID cap ioatdma: Adding support for 16 src PQ ops and super extended descriptors ioatdma: Removing hw bug workaround for CB3.x .2 and earlier dw_dmac: add ACPI support dmaengine: call acpi_dma_request_slave_channel as well dma: acpi-dma: introduce ACPI DMA helpers dma: of: Remove unnecessary list_empty check DMA: OF: Check properties value before running be32_to_cpup() on it DMA: of: Constant names ioatdma: skip silicon bug workaround for pq_align for cb3.3 ioatdma: Removing PQ val disable for cb3.3 ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/acpi/enumeration.txt77
-rw-r--r--Documentation/devicetree/bindings/dma/atmel-dma.txt35
-rw-r--r--Documentation/dmatest.txt81
3 files changed, 188 insertions, 5 deletions
diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
index b0d541042ac6..d9be7a97dff3 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -66,6 +66,83 @@ the ACPI device explicitly to acpi_platform_device_ids list defined in
66drivers/acpi/acpi_platform.c. This limitation is only for the platform 66drivers/acpi/acpi_platform.c. This limitation is only for the platform
67devices, SPI and I2C devices are created automatically as described below. 67devices, SPI and I2C devices are created automatically as described below.
68 68
69DMA support
70~~~~~~~~~~~
71DMA controllers enumerated via ACPI should be registered in the system to
72provide generic access to their resources. For example, a driver that would
73like to be accessible to slave devices via generic API call
74dma_request_slave_channel() must register itself at the end of the probe
75function like this:
76
77 err = devm_acpi_dma_controller_register(dev, xlate_func, dw);
78 /* Handle the error if it's not a case of !CONFIG_ACPI */
79
80and implement custom xlate function if needed (usually acpi_dma_simple_xlate()
81is enough) which converts the FixedDMA resource provided by struct
82acpi_dma_spec into the corresponding DMA channel. A piece of code for that case
83could look like:
84
85 #ifdef CONFIG_ACPI
86 struct filter_args {
87 /* Provide necessary information for the filter_func */
88 ...
89 };
90
91 static bool filter_func(struct dma_chan *chan, void *param)
92 {
93 /* Choose the proper channel */
94 ...
95 }
96
97 static struct dma_chan *xlate_func(struct acpi_dma_spec *dma_spec,
98 struct acpi_dma *adma)
99 {
100 dma_cap_mask_t cap;
101 struct filter_args args;
102
103 /* Prepare arguments for filter_func */
104 ...
105 return dma_request_channel(cap, filter_func, &args);
106 }
107 #else
108 static struct dma_chan *xlate_func(struct acpi_dma_spec *dma_spec,
109 struct acpi_dma *adma)
110 {
111 return NULL;
112 }
113 #endif
114
115dma_request_slave_channel() will call xlate_func() for each registered DMA
116controller. In the xlate function the proper channel must be chosen based on
117information in struct acpi_dma_spec and the properties of the controller
118provided by struct acpi_dma.
119
120Clients must call dma_request_slave_channel() with the string parameter that
121corresponds to a specific FixedDMA resource. By default "tx" means the first
122entry of the FixedDMA resource array, "rx" means the second entry. The table
123below shows a layout:
124
125 Device (I2C0)
126 {
127 ...
128 Method (_CRS, 0, NotSerialized)
129 {
130 Name (DBUF, ResourceTemplate ()
131 {
132 FixedDMA (0x0018, 0x0004, Width32bit, _Y48)
133 FixedDMA (0x0019, 0x0005, Width32bit, )
134 })
135 ...
136 }
137 }
138
139So, the FixedDMA with request line 0x0018 is "tx" and next one is "rx" in
140this example.
141
142In robust cases the client unfortunately needs to call
143acpi_dma_request_slave_chan_by_index() directly and therefore choose the
144specific FixedDMA resource by its index.
145
69SPI serial bus support 146SPI serial bus support
70~~~~~~~~~~~~~~~~~~~~~~ 147~~~~~~~~~~~~~~~~~~~~~~
71Slave devices behind SPI bus have SpiSerialBus resource attached to them. 148Slave devices behind SPI bus have SpiSerialBus resource attached to them.
diff --git a/Documentation/devicetree/bindings/dma/atmel-dma.txt b/Documentation/devicetree/bindings/dma/atmel-dma.txt
index 3c046ee6e8b5..c80e8a3402f0 100644
--- a/Documentation/devicetree/bindings/dma/atmel-dma.txt
+++ b/Documentation/devicetree/bindings/dma/atmel-dma.txt
@@ -1,14 +1,39 @@
1* Atmel Direct Memory Access Controller (DMA) 1* Atmel Direct Memory Access Controller (DMA)
2 2
3Required properties: 3Required properties:
4- compatible: Should be "atmel,<chip>-dma" 4- compatible: Should be "atmel,<chip>-dma".
5- reg: Should contain DMA registers location and length 5- reg: Should contain DMA registers location and length.
6- interrupts: Should contain DMA interrupt 6- interrupts: Should contain DMA interrupt.
7- #dma-cells: Must be <2>, used to represent the number of integer cells in
8the dmas property of client devices.
7 9
8Examples: 10Example:
9 11
10dma@ffffec00 { 12dma0: dma@ffffec00 {
11 compatible = "atmel,at91sam9g45-dma"; 13 compatible = "atmel,at91sam9g45-dma";
12 reg = <0xffffec00 0x200>; 14 reg = <0xffffec00 0x200>;
13 interrupts = <21>; 15 interrupts = <21>;
16 #dma-cells = <2>;
17};
18
19DMA clients connected to the Atmel DMA controller must use the format
20described in the dma.txt file, using a three-cell specifier for each channel:
21a phandle plus two interger cells.
22The three cells in order are:
23
241. A phandle pointing to the DMA controller.
252. The memory interface (16 most significant bits), the peripheral interface
26(16 less significant bits).
273. The peripheral identifier for the hardware handshaking interface. The
28identifier can be different for tx and rx.
29
30Example:
31
32i2c0@i2c@f8010000 {
33 compatible = "atmel,at91sam9x5-i2c";
34 reg = <0xf8010000 0x100>;
35 interrupts = <9 4 6>;
36 dmas = <&dma0 1 7>,
37 <&dma0 1 8>;
38 dma-names = "tx", "rx";
14}; 39};
diff --git a/Documentation/dmatest.txt b/Documentation/dmatest.txt
new file mode 100644
index 000000000000..279ac0a8c5b1
--- /dev/null
+++ b/Documentation/dmatest.txt
@@ -0,0 +1,81 @@
1 DMA Test Guide
2 ==============
3
4 Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5
6This small document introduces how to test DMA drivers using dmatest module.
7
8 Part 1 - How to build the test module
9
10The menuconfig contains an option that could be found by following path:
11 Device Drivers -> DMA Engine support -> DMA Test client
12
13In the configuration file the option called CONFIG_DMATEST. The dmatest could
14be built as module or inside kernel. Let's consider those cases.
15
16 Part 2 - When dmatest is built as a module...
17
18After mounting debugfs and loading the module, the /sys/kernel/debug/dmatest
19folder with nodes will be created. They are the same as module parameters with
20addition of the 'run' node that controls run and stop phases of the test.
21
22Note that in this case test will not run on load automatically.
23
24Example of usage:
25 % echo dma0chan0 > /sys/kernel/debug/dmatest/channel
26 % echo 2000 > /sys/kernel/debug/dmatest/timeout
27 % echo 1 > /sys/kernel/debug/dmatest/iterations
28 % echo 1 > /sys/kernel/debug/dmatest/run
29
30Hint: available channel list could be extracted by running the following
31command:
32 % ls -1 /sys/class/dma/
33
34After a while you will start to get messages about current status or error like
35in the original code.
36
37Note that running a new test will stop any in progress test.
38
39The following command should return actual state of the test.
40 % cat /sys/kernel/debug/dmatest/run
41
42To wait for test done the user may perform a busy loop that checks the state.
43
44 % while [ $(cat /sys/kernel/debug/dmatest/run) = "Y" ]
45 > do
46 > echo -n "."
47 > sleep 1
48 > done
49 > echo
50
51 Part 3 - When built-in in the kernel...
52
53The module parameters that is supplied to the kernel command line will be used
54for the first performed test. After user gets a control, the test could be
55interrupted or re-run with same or different parameters. For the details see
56the above section "Part 2 - When dmatest is built as a module..."
57
58In both cases the module parameters are used as initial values for the test case.
59You always could check them at run-time by running
60 % grep -H . /sys/module/dmatest/parameters/*
61
62 Part 4 - Gathering the test results
63
64The module provides a storage for the test results in the memory. The gathered
65data could be used after test is done.
66
67The special file 'results' in the debugfs represents gathered data of the in
68progress test. The messages collected are printed to the kernel log as well.
69
70Example of output:
71 % cat /sys/kernel/debug/dmatest/results
72 dma0chan0-copy0: #1: No errors with src_off=0x7bf dst_off=0x8ad len=0x3fea (0)
73
74The message format is unified across the different types of errors. A number in
75the parens represents additional information, e.g. error code, error counter,
76or status.
77
78Comparison between buffers is stored to the dedicated structure.
79
80Note that the verify result is now accessible only via file 'results' in the
81debugfs.