Skip to content

Commit ca2a650

Browse files
committed
Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dma updates from Vinod Koul: - new driver for BCM2835 used in R-pi - new driver for MOXA ART - dma_get_any_slave_channel API for DT based systems - minor fixes and updates spread acrooss driver [ The fsl-ssi dual fifo mode support addition clashed badly with the other changes to fsl-ssi that came in through the sound merge. I did a very rough cut at fixing up the conflict, but Nicolin Chen (author of both sides) will need to verify and check things ] * 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (36 commits) dmaengine: mmp_pdma: fix mismerge dma: pl08x: Export pl08x_filter_id acpi-dma: align documentation with kernel-doc format dma: fix vchan_cookie_complete() debug print DMA: dmatest: extend the "device" module parameter to 32 characters drivers/dma: fix error return code dma: omap: Set debug level to debugging messages dmaengine: fix kernel-doc style typos for few comments dma: tegra: add support for Tegra148/124 dma: dw: use %pad instead of casting dma_addr_t dma: dw: join split up messages dma: dw: fix style of multiline comment dmaengine: k3dma: fix sparse warnings dma: pl330: Use dma_get_slave_channel() in the of xlate callback dma: pl330: Differentiate between submitted and issued descriptors dmaengine: sirf: Add device_slave_caps interface DMA: Freescale: change BWC from 256 bytes to 1024 bytes dmaengine: Add MOXA ART DMA engine driver dmaengine: Add DMA_PRIVATE to BCM2835 driver dma: imx-sdma: Assign a default script number for ROM firmware cases ...
2 parents e9e352e + 15cec53 commit ca2a650

30 files changed

Lines changed: 1885 additions & 202 deletions
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
* BCM2835 DMA controller
2+
3+
The BCM2835 DMA controller has 16 channels in total.
4+
Only the lower 13 channels have an associated IRQ.
5+
Some arbitrary channels are used by the firmware
6+
(1,3,6,7 in the current firmware version).
7+
The channels 0,2 and 3 have special functionality
8+
and should not be used by the driver.
9+
10+
Required properties:
11+
- compatible: Should be "brcm,bcm2835-dma".
12+
- reg: Should contain DMA registers location and length.
13+
- interrupts: Should contain the DMA interrupts associated
14+
to the DMA channels in ascending order.
15+
- #dma-cells: Must be <1>, the cell in the dmas property of the
16+
client device represents the DREQ number.
17+
- brcm,dma-channel-mask: Bit mask representing the channels
18+
not used by the firmware in ascending order,
19+
i.e. first channel corresponds to LSB.
20+
21+
Example:
22+
23+
dma: dma@7e007000 {
24+
compatible = "brcm,bcm2835-dma";
25+
reg = <0x7e007000 0xf00>;
26+
interrupts = <1 16>,
27+
<1 17>,
28+
<1 18>,
29+
<1 19>,
30+
<1 20>,
31+
<1 21>,
32+
<1 22>,
33+
<1 23>,
34+
<1 24>,
35+
<1 25>,
36+
<1 26>,
37+
<1 27>,
38+
<1 28>;
39+
40+
#dma-cells = <1>;
41+
brcm,dma-channel-mask = <0x7f35>;
42+
};
43+
44+
DMA clients connected to the BCM2835 DMA controller must use the format
45+
described in the dma.txt file, using a two-cell specifier for each channel.
46+
47+
Example:
48+
49+
bcm2835_i2s: i2s@7e203000 {
50+
compatible = "brcm,bcm2835-i2s";
51+
reg = < 0x7e203000 0x20>,
52+
< 0x7e101098 0x02>;
53+
54+
dmas = <&dma 2>,
55+
<&dma 3>;
56+
dma-names = "tx", "rx";
57+
};

‎Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ The full ID of peripheral types can be found below.
4242
19 IPU Memory
4343
20 ASRC
4444
21 ESAI
45+
22 SSI Dual FIFO (needs firmware ver >= 2)
4546

4647
The third cell specifies the transfer priority as below.
4748

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
MOXA ART DMA Controller
2+
3+
See dma.txt first
4+
5+
Required properties:
6+
7+
- compatible : Must be "moxa,moxart-dma"
8+
- reg : Should contain registers location and length
9+
- interrupts : Should contain an interrupt-specifier for the sole
10+
interrupt generated by the device
11+
- #dma-cells : Should be 1, a single cell holding a line request number
12+
13+
Example:
14+
15+
dma: dma@90500000 {
16+
compatible = "moxa,moxart-dma";
17+
reg = <0x90500080 0x40>;
18+
interrupts = <24 0>;
19+
#dma-cells = <1>;
20+
};
21+
22+
23+
Clients:
24+
25+
DMA clients connected to the MOXA ART DMA controller must use the format
26+
described in the dma.txt file, using a two-cell specifier for each channel:
27+
a phandle plus one integer cells.
28+
The two cells in order are:
29+
30+
1. A phandle pointing to the DMA controller.
31+
2. Peripheral identifier for the hardware handshaking interface.
32+
33+
Example:
34+
Use specific request line passing from dma
35+
For example, MMC request line is 5
36+
37+
sdhci: sdhci@98e00000 {
38+
compatible = "moxa,moxart-sdhci";
39+
reg = <0x98e00000 0x5C>;
40+
interrupts = <5 0>;
41+
clocks = <&clk_apb>;
42+
dmas = <&dma 5>,
43+
<&dma 5>;
44+
dma-names = "tx", "rx";
45+
};

‎drivers/dma/Kconfig‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ config DMA_OMAP
306306
select DMA_ENGINE
307307
select DMA_VIRTUAL_CHANNELS
308308

309+
config DMA_BCM2835
310+
tristate "BCM2835 DMA engine support"
311+
depends on (ARCH_BCM2835 || MACH_BCM2708)
312+
select DMA_ENGINE
313+
select DMA_VIRTUAL_CHANNELS
314+
309315
config TI_CPPI41
310316
tristate "AM33xx CPPI41 DMA support"
311317
depends on ARCH_OMAP
@@ -336,6 +342,14 @@ config K3_DMA
336342
Support the DMA engine for Hisilicon K3 platform
337343
devices.
338344

345+
config MOXART_DMA
346+
tristate "MOXART DMA support"
347+
depends on ARCH_MOXART
348+
select DMA_ENGINE
349+
select DMA_VIRTUAL_CHANNELS
350+
help
351+
Enable support for the MOXA ART SoC DMA controller.
352+
339353
config DMA_ENGINE
340354
bool
341355

‎drivers/dma/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ obj-$(CONFIG_EP93XX_DMA) += ep93xx_dma.o
3838
obj-$(CONFIG_DMA_SA11X0) += sa11x0-dma.o
3939
obj-$(CONFIG_MMP_TDMA) += mmp_tdma.o
4040
obj-$(CONFIG_DMA_OMAP) += omap-dma.o
41+
obj-$(CONFIG_DMA_BCM2835) += bcm2835-dma.o
4142
obj-$(CONFIG_MMP_PDMA) += mmp_pdma.o
4243
obj-$(CONFIG_DMA_JZ4740) += dma-jz4740.o
4344
obj-$(CONFIG_TI_CPPI41) += cppi41.o
4445
obj-$(CONFIG_K3_DMA) += k3dma.o
46+
obj-$(CONFIG_MOXART_DMA) += moxart-dma.o

‎drivers/dma/acpi-dma.c‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ static DEFINE_MUTEX(acpi_dma_lock);
3030
* @adev: ACPI device to match with
3131
* @adma: struct acpi_dma of the given DMA controller
3232
*
33-
* Returns 1 on success, 0 when no information is available, or appropriate
34-
* errno value on error.
35-
*
3633
* In order to match a device from DSDT table to the corresponding CSRT device
3734
* we use MMIO address and IRQ.
35+
*
36+
* Return:
37+
* 1 on success, 0 when no information is available, or appropriate errno value
38+
* on error.
3839
*/
3940
static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp,
4041
struct acpi_device *adev, struct acpi_dma *adma)
@@ -101,7 +102,6 @@ static int acpi_dma_parse_resource_group(const struct acpi_csrt_group *grp,
101102
*
102103
* We are using this table to get the request line range of the specific DMA
103104
* controller to be used later.
104-
*
105105
*/
106106
static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma)
107107
{
@@ -141,10 +141,11 @@ static void acpi_dma_parse_csrt(struct acpi_device *adev, struct acpi_dma *adma)
141141
* @data pointer to controller specific data to be used by
142142
* translation function
143143
*
144-
* Returns 0 on success or appropriate errno value on error.
145-
*
146144
* Allocated memory should be freed with appropriate acpi_dma_controller_free()
147145
* call.
146+
*
147+
* Return:
148+
* 0 on success or appropriate errno value on error.
148149
*/
149150
int acpi_dma_controller_register(struct device *dev,
150151
struct dma_chan *(*acpi_dma_xlate)
@@ -188,6 +189,9 @@ EXPORT_SYMBOL_GPL(acpi_dma_controller_register);
188189
* @dev: struct device of DMA controller
189190
*
190191
* Memory allocated by acpi_dma_controller_register() is freed here.
192+
*
193+
* Return:
194+
* 0 on success or appropriate errno value on error.
191195
*/
192196
int acpi_dma_controller_free(struct device *dev)
193197
{
@@ -225,6 +229,9 @@ static void devm_acpi_dma_release(struct device *dev, void *res)
225229
* Managed acpi_dma_controller_register(). DMA controller registered by this
226230
* function are automatically freed on driver detach. See
227231
* acpi_dma_controller_register() for more information.
232+
*
233+
* Return:
234+
* 0 on success or appropriate errno value on error.
228235
*/
229236
int devm_acpi_dma_controller_register(struct device *dev,
230237
struct dma_chan *(*acpi_dma_xlate)
@@ -267,15 +274,16 @@ EXPORT_SYMBOL_GPL(devm_acpi_dma_controller_free);
267274
* @adma: struct acpi_dma of DMA controller
268275
* @dma_spec: dma specifier to update
269276
*
270-
* Returns 0, if no information is avaiable, -1 on mismatch, and 1 otherwise.
271-
*
272277
* Accordingly to ACPI 5.0 Specification Table 6-170 "Fixed DMA Resource
273278
* Descriptor":
274279
* DMA Request Line bits is a platform-relative number uniquely
275280
* identifying the request line assigned. Request line-to-Controller
276281
* mapping is done in a controller-specific OS driver.
277282
* That's why we can safely adjust slave_id when the appropriate controller is
278283
* found.
284+
*
285+
* Return:
286+
* 0, if no information is avaiable, -1 on mismatch, and 1 otherwise.
279287
*/
280288
static int acpi_dma_update_dma_spec(struct acpi_dma *adma,
281289
struct acpi_dma_spec *dma_spec)
@@ -334,7 +342,8 @@ static int acpi_dma_parse_fixed_dma(struct acpi_resource *res, void *data)
334342
* @dev: struct device to get DMA request from
335343
* @index: index of FixedDMA descriptor for @dev
336344
*
337-
* Returns pointer to appropriate dma channel on success or NULL on error.
345+
* Return:
346+
* Pointer to appropriate dma channel on success or NULL on error.
338347
*/
339348
struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev,
340349
size_t index)
@@ -403,7 +412,8 @@ EXPORT_SYMBOL_GPL(acpi_dma_request_slave_chan_by_index);
403412
* translate the names "tx" and "rx" here based on the most common case where
404413
* the first FixedDMA descriptor is TX and second is RX.
405414
*
406-
* Returns pointer to appropriate dma channel on success or NULL on error.
415+
* Return:
416+
* Pointer to appropriate dma channel on success or NULL on error.
407417
*/
408418
struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev,
409419
const char *name)
@@ -427,8 +437,10 @@ EXPORT_SYMBOL_GPL(acpi_dma_request_slave_chan_by_name);
427437
* @adma: pointer to ACPI DMA controller data
428438
*
429439
* A simple translation function for ACPI based devices. Passes &struct
430-
* dma_spec to the DMA controller driver provided filter function. Returns
431-
* pointer to the channel if found or %NULL otherwise.
440+
* dma_spec to the DMA controller driver provided filter function.
441+
*
442+
* Return:
443+
* Pointer to the channel if found or %NULL otherwise.
432444
*/
433445
struct dma_chan *acpi_dma_simple_xlate(struct acpi_dma_spec *dma_spec,
434446
struct acpi_dma *adma)

‎drivers/dma/amba-pl08x.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#include <linux/dmaengine.h>
8484
#include <linux/dmapool.h>
8585
#include <linux/dma-mapping.h>
86+
#include <linux/export.h>
8687
#include <linux/init.h>
8788
#include <linux/interrupt.h>
8889
#include <linux/module.h>
@@ -1771,6 +1772,7 @@ bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
17711772

17721773
return false;
17731774
}
1775+
EXPORT_SYMBOL_GPL(pl08x_filter_id);
17741776

17751777
/*
17761778
* Just check that the device is there and active
@@ -2167,7 +2169,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
21672169
/* Register slave channels */
21682170
ret = pl08x_dma_init_virtual_channels(pl08x, &pl08x->slave,
21692171
pl08x->pd->num_slave_channels, true);
2170-
if (ret <= 0) {
2172+
if (ret < 0) {
21712173
dev_warn(&pl08x->adev->dev,
21722174
"%s failed to enumerate slave channels - %d\n",
21732175
__func__, ret);

0 commit comments

Comments
 (0)