diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-18 21:11:04 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-18 21:11:04 -0400 |
| commit | 52d589a01d4545ce1dc5c3892bb8c7b55edfe714 (patch) | |
| tree | 864858dae5d01aae411497e926679cf92392b4f6 /include/linux | |
| parent | 0a582821d4f8edf41d9b56ae057ee2002fc275f0 (diff) | |
| parent | 6b997bab20448cfe85456e4789d5d9222ab6b830 (diff) | |
Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
Pull slave-dmaengine updates from Vinod Koul:
"For dmaengine contributions we have:
- designware cleanup by Andy
- my series moving device_control users to dmanegine_xxx APIs for
later removal of device_control API
- minor fixes spread over drivers mainly mv_xor, pl330, mmp, imx-sdma
etc"
* 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (60 commits)
serial: atmel: add missing dmaengine header
dmaengine: remove FSLDMA_EXTERNAL_START
dmaengine: freescale: remove FSLDMA_EXTERNAL_START control method
carma-fpga: move to fsl_dma_external_start()
carma-fpga: use dmaengine_xxx() API
dmaengine: freescale: add and export fsl_dma_external_start()
dmaengine: add dmaengine_prep_dma_sg() helper
video: mx3fb: use dmaengine_terminate_all() API
serial: sh-sci: use dmaengine_terminate_all() API
net: ks8842: use dmaengine_terminate_all() API
mtd: sh_flctl: use dmaengine_terminate_all() API
mtd: fsmc_nand: use dmaengine_terminate_all() API
V4L2: mx3_camer: use dmaengine_pause() API
dmaengine: coh901318: use dmaengine_terminate_all() API
pata_arasan_cf: use dmaengine_terminate_all() API
dmaengine: edma: check for echan->edesc => NULL in edma_dma_pause()
dmaengine: dw: export probe()/remove() and Co to users
dmaengine: dw: enable and disable controller when needed
dmaengine: dw: always export dw_dma_{en,dis}able
dmaengine: dw: introduce dw_dma_on() helper
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/dma/dw.h | 64 | ||||
| -rw-r--r-- | include/linux/dmaengine.h | 17 | ||||
| -rw-r--r-- | include/linux/dw_dmac.h | 111 | ||||
| -rw-r--r-- | include/linux/fsldma.h | 13 | ||||
| -rw-r--r-- | include/linux/platform_data/dma-dw.h | 59 | ||||
| -rw-r--r-- | include/linux/spi/pxa2xx_spi.h | 9 |
6 files changed, 154 insertions, 119 deletions
diff --git a/include/linux/dma/dw.h b/include/linux/dma/dw.h new file mode 100644 index 000000000000..71456442ebe3 --- /dev/null +++ b/include/linux/dma/dw.h | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | /* | ||
| 2 | * Driver for the Synopsys DesignWare DMA Controller | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 Atmel Corporation | ||
| 5 | * Copyright (C) 2010-2011 ST Microelectronics | ||
| 6 | * Copyright (C) 2014 Intel Corporation | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | #ifndef _DMA_DW_H | ||
| 13 | #define _DMA_DW_H | ||
| 14 | |||
| 15 | #include <linux/clk.h> | ||
| 16 | #include <linux/device.h> | ||
| 17 | #include <linux/dmaengine.h> | ||
| 18 | |||
| 19 | #include <linux/platform_data/dma-dw.h> | ||
| 20 | |||
| 21 | struct dw_dma; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * struct dw_dma_chip - representation of DesignWare DMA controller hardware | ||
| 25 | * @dev: struct device of the DMA controller | ||
| 26 | * @irq: irq line | ||
| 27 | * @regs: memory mapped I/O space | ||
| 28 | * @clk: hclk clock | ||
| 29 | * @dw: struct dw_dma that is filed by dw_dma_probe() | ||
| 30 | */ | ||
| 31 | struct dw_dma_chip { | ||
| 32 | struct device *dev; | ||
| 33 | int irq; | ||
| 34 | void __iomem *regs; | ||
| 35 | struct clk *clk; | ||
| 36 | struct dw_dma *dw; | ||
| 37 | }; | ||
| 38 | |||
| 39 | /* Export to the platform drivers */ | ||
| 40 | int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata); | ||
| 41 | int dw_dma_remove(struct dw_dma_chip *chip); | ||
| 42 | |||
| 43 | /* DMA API extensions */ | ||
| 44 | struct dw_desc; | ||
| 45 | |||
| 46 | struct dw_cyclic_desc { | ||
| 47 | struct dw_desc **desc; | ||
| 48 | unsigned long periods; | ||
| 49 | void (*period_callback)(void *param); | ||
| 50 | void *period_callback_param; | ||
| 51 | }; | ||
| 52 | |||
| 53 | struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan, | ||
| 54 | dma_addr_t buf_addr, size_t buf_len, size_t period_len, | ||
| 55 | enum dma_transfer_direction direction); | ||
| 56 | void dw_dma_cyclic_free(struct dma_chan *chan); | ||
| 57 | int dw_dma_cyclic_start(struct dma_chan *chan); | ||
| 58 | void dw_dma_cyclic_stop(struct dma_chan *chan); | ||
| 59 | |||
| 60 | dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan); | ||
| 61 | |||
| 62 | dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan); | ||
| 63 | |||
| 64 | #endif /* _DMA_DW_H */ | ||
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 212c5b9ac106..653a1fd07ae8 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -199,15 +199,12 @@ enum dma_ctrl_flags { | |||
| 199 | * configuration data in statically from the platform). An additional | 199 | * configuration data in statically from the platform). An additional |
| 200 | * argument of struct dma_slave_config must be passed in with this | 200 | * argument of struct dma_slave_config must be passed in with this |
| 201 | * command. | 201 | * command. |
| 202 | * @FSLDMA_EXTERNAL_START: this command will put the Freescale DMA controller | ||
| 203 | * into external start mode. | ||
| 204 | */ | 202 | */ |
| 205 | enum dma_ctrl_cmd { | 203 | enum dma_ctrl_cmd { |
| 206 | DMA_TERMINATE_ALL, | 204 | DMA_TERMINATE_ALL, |
| 207 | DMA_PAUSE, | 205 | DMA_PAUSE, |
| 208 | DMA_RESUME, | 206 | DMA_RESUME, |
| 209 | DMA_SLAVE_CONFIG, | 207 | DMA_SLAVE_CONFIG, |
| 210 | FSLDMA_EXTERNAL_START, | ||
| 211 | }; | 208 | }; |
| 212 | 209 | ||
| 213 | /** | 210 | /** |
| @@ -307,7 +304,9 @@ enum dma_slave_buswidth { | |||
| 307 | * struct dma_slave_config - dma slave channel runtime config | 304 | * struct dma_slave_config - dma slave channel runtime config |
| 308 | * @direction: whether the data shall go in or out on this slave | 305 | * @direction: whether the data shall go in or out on this slave |
| 309 | * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are | 306 | * channel, right now. DMA_MEM_TO_DEV and DMA_DEV_TO_MEM are |
| 310 | * legal values. | 307 | * legal values. DEPRECATED, drivers should use the direction argument |
| 308 | * to the device_prep_slave_sg and device_prep_dma_cyclic functions or | ||
| 309 | * the dir field in the dma_interleaved_template structure. | ||
| 311 | * @src_addr: this is the physical address where DMA slave data | 310 | * @src_addr: this is the physical address where DMA slave data |
| 312 | * should be read (RX), if the source is memory this argument is | 311 | * should be read (RX), if the source is memory this argument is |
| 313 | * ignored. | 312 | * ignored. |
| @@ -755,6 +754,16 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_interleaved_dma( | |||
| 755 | return chan->device->device_prep_interleaved_dma(chan, xt, flags); | 754 | return chan->device->device_prep_interleaved_dma(chan, xt, flags); |
| 756 | } | 755 | } |
| 757 | 756 | ||
| 757 | static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_sg( | ||
| 758 | struct dma_chan *chan, | ||
| 759 | struct scatterlist *dst_sg, unsigned int dst_nents, | ||
| 760 | struct scatterlist *src_sg, unsigned int src_nents, | ||
| 761 | unsigned long flags) | ||
| 762 | { | ||
| 763 | return chan->device->device_prep_dma_sg(chan, dst_sg, dst_nents, | ||
| 764 | src_sg, src_nents, flags); | ||
| 765 | } | ||
| 766 | |||
| 758 | static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) | 767 | static inline int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps) |
| 759 | { | 768 | { |
| 760 | if (!chan || !caps) | 769 | if (!chan || !caps) |
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h deleted file mode 100644 index 68b4024184de..000000000000 --- a/include/linux/dw_dmac.h +++ /dev/null | |||
| @@ -1,111 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Driver for the Synopsys DesignWare DMA Controller | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 Atmel Corporation | ||
| 5 | * Copyright (C) 2010-2011 ST Microelectronics | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #ifndef DW_DMAC_H | ||
| 12 | #define DW_DMAC_H | ||
| 13 | |||
| 14 | #include <linux/dmaengine.h> | ||
| 15 | |||
| 16 | /** | ||
| 17 | * struct dw_dma_slave - Controller-specific information about a slave | ||
| 18 | * | ||
| 19 | * @dma_dev: required DMA master device. Depricated. | ||
| 20 | * @bus_id: name of this device channel, not just a device name since | ||
| 21 | * devices may have more than one channel e.g. "foo_tx" | ||
| 22 | * @cfg_hi: Platform-specific initializer for the CFG_HI register | ||
| 23 | * @cfg_lo: Platform-specific initializer for the CFG_LO register | ||
| 24 | * @src_master: src master for transfers on allocated channel. | ||
| 25 | * @dst_master: dest master for transfers on allocated channel. | ||
| 26 | */ | ||
| 27 | struct dw_dma_slave { | ||
| 28 | struct device *dma_dev; | ||
| 29 | u32 cfg_hi; | ||
| 30 | u32 cfg_lo; | ||
| 31 | u8 src_master; | ||
| 32 | u8 dst_master; | ||
| 33 | }; | ||
| 34 | |||
| 35 | /** | ||
| 36 | * struct dw_dma_platform_data - Controller configuration parameters | ||
| 37 | * @nr_channels: Number of channels supported by hardware (max 8) | ||
| 38 | * @is_private: The device channels should be marked as private and not for | ||
| 39 | * by the general purpose DMA channel allocator. | ||
| 40 | * @chan_allocation_order: Allocate channels starting from 0 or 7 | ||
| 41 | * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0. | ||
| 42 | * @block_size: Maximum block size supported by the controller | ||
| 43 | * @nr_masters: Number of AHB masters supported by the controller | ||
| 44 | * @data_width: Maximum data width supported by hardware per AHB master | ||
| 45 | * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) | ||
| 46 | */ | ||
| 47 | struct dw_dma_platform_data { | ||
| 48 | unsigned int nr_channels; | ||
| 49 | bool is_private; | ||
| 50 | #define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */ | ||
| 51 | #define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */ | ||
| 52 | unsigned char chan_allocation_order; | ||
| 53 | #define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */ | ||
| 54 | #define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */ | ||
| 55 | unsigned char chan_priority; | ||
| 56 | unsigned short block_size; | ||
| 57 | unsigned char nr_masters; | ||
| 58 | unsigned char data_width[4]; | ||
| 59 | }; | ||
| 60 | |||
| 61 | /* bursts size */ | ||
| 62 | enum dw_dma_msize { | ||
| 63 | DW_DMA_MSIZE_1, | ||
| 64 | DW_DMA_MSIZE_4, | ||
| 65 | DW_DMA_MSIZE_8, | ||
| 66 | DW_DMA_MSIZE_16, | ||
| 67 | DW_DMA_MSIZE_32, | ||
| 68 | DW_DMA_MSIZE_64, | ||
| 69 | DW_DMA_MSIZE_128, | ||
| 70 | DW_DMA_MSIZE_256, | ||
| 71 | }; | ||
| 72 | |||
| 73 | /* Platform-configurable bits in CFG_HI */ | ||
| 74 | #define DWC_CFGH_FCMODE (1 << 0) | ||
| 75 | #define DWC_CFGH_FIFO_MODE (1 << 1) | ||
| 76 | #define DWC_CFGH_PROTCTL(x) ((x) << 2) | ||
| 77 | #define DWC_CFGH_SRC_PER(x) ((x) << 7) | ||
| 78 | #define DWC_CFGH_DST_PER(x) ((x) << 11) | ||
| 79 | |||
| 80 | /* Platform-configurable bits in CFG_LO */ | ||
| 81 | #define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */ | ||
| 82 | #define DWC_CFGL_LOCK_CH_BLOCK (1 << 12) | ||
| 83 | #define DWC_CFGL_LOCK_CH_XACT (2 << 12) | ||
| 84 | #define DWC_CFGL_LOCK_BUS_XFER (0 << 14) /* scope of LOCK_BUS */ | ||
| 85 | #define DWC_CFGL_LOCK_BUS_BLOCK (1 << 14) | ||
| 86 | #define DWC_CFGL_LOCK_BUS_XACT (2 << 14) | ||
| 87 | #define DWC_CFGL_LOCK_CH (1 << 15) /* channel lockout */ | ||
| 88 | #define DWC_CFGL_LOCK_BUS (1 << 16) /* busmaster lockout */ | ||
| 89 | #define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ | ||
| 90 | #define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ | ||
| 91 | |||
| 92 | /* DMA API extensions */ | ||
| 93 | struct dw_cyclic_desc { | ||
| 94 | struct dw_desc **desc; | ||
| 95 | unsigned long periods; | ||
| 96 | void (*period_callback)(void *param); | ||
| 97 | void *period_callback_param; | ||
| 98 | }; | ||
| 99 | |||
| 100 | struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan, | ||
| 101 | dma_addr_t buf_addr, size_t buf_len, size_t period_len, | ||
| 102 | enum dma_transfer_direction direction); | ||
| 103 | void dw_dma_cyclic_free(struct dma_chan *chan); | ||
| 104 | int dw_dma_cyclic_start(struct dma_chan *chan); | ||
| 105 | void dw_dma_cyclic_stop(struct dma_chan *chan); | ||
| 106 | |||
| 107 | dma_addr_t dw_dma_get_src_addr(struct dma_chan *chan); | ||
| 108 | |||
| 109 | dma_addr_t dw_dma_get_dst_addr(struct dma_chan *chan); | ||
| 110 | |||
| 111 | #endif /* DW_DMAC_H */ | ||
diff --git a/include/linux/fsldma.h b/include/linux/fsldma.h new file mode 100644 index 000000000000..b213c02963c9 --- /dev/null +++ b/include/linux/fsldma.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | /* | ||
| 2 | * This is free software; you can redistribute it and/or modify | ||
| 3 | * it under the terms of the GNU General Public License as published by | ||
| 4 | * the Free Software Foundation; either version 2 of the License, or | ||
| 5 | * (at your option) any later version. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef FSL_DMA_H | ||
| 9 | #define FSL_DMA_H | ||
| 10 | /* fsl dma API for enxternal start */ | ||
| 11 | int fsl_dma_external_start(struct dma_chan *dchan, int enable); | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/include/linux/platform_data/dma-dw.h b/include/linux/platform_data/dma-dw.h new file mode 100644 index 000000000000..d8155c005242 --- /dev/null +++ b/include/linux/platform_data/dma-dw.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* | ||
| 2 | * Driver for the Synopsys DesignWare DMA Controller | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007 Atmel Corporation | ||
| 5 | * Copyright (C) 2010-2011 ST Microelectronics | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | #ifndef _PLATFORM_DATA_DMA_DW_H | ||
| 12 | #define _PLATFORM_DATA_DMA_DW_H | ||
| 13 | |||
| 14 | #include <linux/device.h> | ||
| 15 | |||
| 16 | /** | ||
| 17 | * struct dw_dma_slave - Controller-specific information about a slave | ||
| 18 | * | ||
| 19 | * @dma_dev: required DMA master device. Depricated. | ||
| 20 | * @src_id: src request line | ||
| 21 | * @dst_id: dst request line | ||
| 22 | * @src_master: src master for transfers on allocated channel. | ||
| 23 | * @dst_master: dest master for transfers on allocated channel. | ||
| 24 | */ | ||
| 25 | struct dw_dma_slave { | ||
| 26 | struct device *dma_dev; | ||
| 27 | u8 src_id; | ||
| 28 | u8 dst_id; | ||
| 29 | u8 src_master; | ||
| 30 | u8 dst_master; | ||
| 31 | }; | ||
| 32 | |||
| 33 | /** | ||
| 34 | * struct dw_dma_platform_data - Controller configuration parameters | ||
| 35 | * @nr_channels: Number of channels supported by hardware (max 8) | ||
| 36 | * @is_private: The device channels should be marked as private and not for | ||
| 37 | * by the general purpose DMA channel allocator. | ||
| 38 | * @chan_allocation_order: Allocate channels starting from 0 or 7 | ||
| 39 | * @chan_priority: Set channel priority increasing from 0 to 7 or 7 to 0. | ||
| 40 | * @block_size: Maximum block size supported by the controller | ||
| 41 | * @nr_masters: Number of AHB masters supported by the controller | ||
| 42 | * @data_width: Maximum data width supported by hardware per AHB master | ||
| 43 | * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) | ||
| 44 | */ | ||
| 45 | struct dw_dma_platform_data { | ||
| 46 | unsigned int nr_channels; | ||
| 47 | bool is_private; | ||
| 48 | #define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */ | ||
| 49 | #define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */ | ||
| 50 | unsigned char chan_allocation_order; | ||
| 51 | #define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */ | ||
| 52 | #define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */ | ||
| 53 | unsigned char chan_priority; | ||
| 54 | unsigned short block_size; | ||
| 55 | unsigned char nr_masters; | ||
| 56 | unsigned char data_width[4]; | ||
| 57 | }; | ||
| 58 | |||
| 59 | #endif /* _PLATFORM_DATA_DMA_DW_H */ | ||
diff --git a/include/linux/spi/pxa2xx_spi.h b/include/linux/spi/pxa2xx_spi.h index 82d5111cd0c2..d5a316550177 100644 --- a/include/linux/spi/pxa2xx_spi.h +++ b/include/linux/spi/pxa2xx_spi.h | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | #define PXA2XX_CS_ASSERT (0x01) | 23 | #define PXA2XX_CS_ASSERT (0x01) |
| 24 | #define PXA2XX_CS_DEASSERT (0x02) | 24 | #define PXA2XX_CS_DEASSERT (0x02) |
| 25 | 25 | ||
| 26 | struct dma_chan; | ||
| 27 | |||
| 26 | /* device.platform_data for SSP controller devices */ | 28 | /* device.platform_data for SSP controller devices */ |
| 27 | struct pxa2xx_spi_master { | 29 | struct pxa2xx_spi_master { |
| 28 | u32 clock_enable; | 30 | u32 clock_enable; |
| @@ -30,10 +32,9 @@ struct pxa2xx_spi_master { | |||
| 30 | u8 enable_dma; | 32 | u8 enable_dma; |
| 31 | 33 | ||
| 32 | /* DMA engine specific config */ | 34 | /* DMA engine specific config */ |
| 33 | int rx_chan_id; | 35 | bool (*dma_filter)(struct dma_chan *chan, void *param); |
| 34 | int tx_chan_id; | 36 | void *tx_param; |
| 35 | int rx_slave_id; | 37 | void *rx_param; |
| 36 | int tx_slave_id; | ||
| 37 | 38 | ||
| 38 | /* For non-PXA arches */ | 39 | /* For non-PXA arches */ |
| 39 | struct ssp_device ssp; | 40 | struct ssp_device ssp; |
