diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/dmaengine.h | 71 | ||||
| -rw-r--r-- | include/linux/intel_mid_dma.h | 86 | ||||
| -rw-r--r-- | include/linux/pch_dma.h | 37 |
3 files changed, 194 insertions, 0 deletions
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 5204f018931b..c61d4ca27bcc 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -114,11 +114,17 @@ enum dma_ctrl_flags { | |||
| 114 | * @DMA_TERMINATE_ALL: terminate all ongoing transfers | 114 | * @DMA_TERMINATE_ALL: terminate all ongoing transfers |
| 115 | * @DMA_PAUSE: pause ongoing transfers | 115 | * @DMA_PAUSE: pause ongoing transfers |
| 116 | * @DMA_RESUME: resume paused transfer | 116 | * @DMA_RESUME: resume paused transfer |
| 117 | * @DMA_SLAVE_CONFIG: this command is only implemented by DMA controllers | ||
| 118 | * that need to runtime reconfigure the slave channels (as opposed to passing | ||
| 119 | * configuration data in statically from the platform). An additional | ||
| 120 | * argument of struct dma_slave_config must be passed in with this | ||
| 121 | * command. | ||
| 117 | */ | 122 | */ |
| 118 | enum dma_ctrl_cmd { | 123 | enum dma_ctrl_cmd { |
| 119 | DMA_TERMINATE_ALL, | 124 | DMA_TERMINATE_ALL, |
| 120 | DMA_PAUSE, | 125 | DMA_PAUSE, |
| 121 | DMA_RESUME, | 126 | DMA_RESUME, |
| 127 | DMA_SLAVE_CONFIG, | ||
| 122 | }; | 128 | }; |
| 123 | 129 | ||
| 124 | /** | 130 | /** |
| @@ -199,6 +205,71 @@ struct dma_chan_dev { | |||
| 199 | atomic_t *idr_ref; | 205 | atomic_t *idr_ref; |
| 200 | }; | 206 | }; |
| 201 | 207 | ||
| 208 | /** | ||
| 209 | * enum dma_slave_buswidth - defines bus with of the DMA slave | ||
| 210 | * device, source or target buses | ||
| 211 | */ | ||
| 212 | enum dma_slave_buswidth { | ||
| 213 | DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, | ||
| 214 | DMA_SLAVE_BUSWIDTH_1_BYTE = 1, | ||
| 215 | DMA_SLAVE_BUSWIDTH_2_BYTES = 2, | ||
| 216 | DMA_SLAVE_BUSWIDTH_4_BYTES = 4, | ||
| 217 | DMA_SLAVE_BUSWIDTH_8_BYTES = 8, | ||
| 218 | }; | ||
| 219 | |||
| 220 | /** | ||
| 221 | * struct dma_slave_config - dma slave channel runtime config | ||
| 222 | * @direction: whether the data shall go in or out on this slave | ||
| 223 | * channel, right now. DMA_TO_DEVICE and DMA_FROM_DEVICE are | ||
| 224 | * legal values, DMA_BIDIRECTIONAL is not acceptable since we | ||
| 225 | * need to differentiate source and target addresses. | ||
| 226 | * @src_addr: this is the physical address where DMA slave data | ||
| 227 | * should be read (RX), if the source is memory this argument is | ||
| 228 | * ignored. | ||
| 229 | * @dst_addr: this is the physical address where DMA slave data | ||
| 230 | * should be written (TX), if the source is memory this argument | ||
| 231 | * is ignored. | ||
| 232 | * @src_addr_width: this is the width in bytes of the source (RX) | ||
| 233 | * register where DMA data shall be read. If the source | ||
| 234 | * is memory this may be ignored depending on architecture. | ||
| 235 | * Legal values: 1, 2, 4, 8. | ||
| 236 | * @dst_addr_width: same as src_addr_width but for destination | ||
| 237 | * target (TX) mutatis mutandis. | ||
| 238 | * @src_maxburst: the maximum number of words (note: words, as in | ||
| 239 | * units of the src_addr_width member, not bytes) that can be sent | ||
| 240 | * in one burst to the device. Typically something like half the | ||
| 241 | * FIFO depth on I/O peripherals so you don't overflow it. This | ||
| 242 | * may or may not be applicable on memory sources. | ||
| 243 | * @dst_maxburst: same as src_maxburst but for destination target | ||
| 244 | * mutatis mutandis. | ||
| 245 | * | ||
| 246 | * This struct is passed in as configuration data to a DMA engine | ||
| 247 | * in order to set up a certain channel for DMA transport at runtime. | ||
| 248 | * The DMA device/engine has to provide support for an additional | ||
| 249 | * command in the channel config interface, DMA_SLAVE_CONFIG | ||
| 250 | * and this struct will then be passed in as an argument to the | ||
| 251 | * DMA engine device_control() function. | ||
| 252 | * | ||
| 253 | * The rationale for adding configuration information to this struct | ||
| 254 | * is as follows: if it is likely that most DMA slave controllers in | ||
| 255 | * the world will support the configuration option, then make it | ||
| 256 | * generic. If not: if it is fixed so that it be sent in static from | ||
| 257 | * the platform data, then prefer to do that. Else, if it is neither | ||
| 258 | * fixed at runtime, nor generic enough (such as bus mastership on | ||
| 259 | * some CPU family and whatnot) then create a custom slave config | ||
| 260 | * struct and pass that, then make this config a member of that | ||
| 261 | * struct, if applicable. | ||
| 262 | */ | ||
| 263 | struct dma_slave_config { | ||
| 264 | enum dma_data_direction direction; | ||
| 265 | dma_addr_t src_addr; | ||
| 266 | dma_addr_t dst_addr; | ||
| 267 | enum dma_slave_buswidth src_addr_width; | ||
| 268 | enum dma_slave_buswidth dst_addr_width; | ||
| 269 | u32 src_maxburst; | ||
| 270 | u32 dst_maxburst; | ||
| 271 | }; | ||
| 272 | |||
| 202 | static inline const char *dma_chan_name(struct dma_chan *chan) | 273 | static inline const char *dma_chan_name(struct dma_chan *chan) |
| 203 | { | 274 | { |
| 204 | return dev_name(&chan->dev->device); | 275 | return dev_name(&chan->dev->device); |
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h new file mode 100644 index 000000000000..d9d08b6269b6 --- /dev/null +++ b/include/linux/intel_mid_dma.h | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | /* | ||
| 2 | * intel_mid_dma.h - Intel MID DMA Drivers | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-10 Intel Corp | ||
| 5 | * Author: Vinod Koul <vinod.koul@intel.com> | ||
| 6 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 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 as published by | ||
| 10 | * the Free Software Foundation; version 2 of the License. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | ||
| 20 | * | ||
| 21 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 22 | * | ||
| 23 | * | ||
| 24 | */ | ||
| 25 | #ifndef __INTEL_MID_DMA_H__ | ||
| 26 | #define __INTEL_MID_DMA_H__ | ||
| 27 | |||
| 28 | #include <linux/dmaengine.h> | ||
| 29 | |||
| 30 | /*DMA transaction width, src and dstn width would be same | ||
| 31 | The DMA length must be width aligned, | ||
| 32 | for 32 bit width the length must be 32 bit (4bytes) aligned only*/ | ||
| 33 | enum intel_mid_dma_width { | ||
| 34 | LNW_DMA_WIDTH_8BIT = 0x0, | ||
| 35 | LNW_DMA_WIDTH_16BIT = 0x1, | ||
| 36 | LNW_DMA_WIDTH_32BIT = 0x2, | ||
| 37 | }; | ||
| 38 | |||
| 39 | /*DMA mode configurations*/ | ||
| 40 | enum intel_mid_dma_mode { | ||
| 41 | LNW_DMA_PER_TO_MEM = 0, /*periphral to memory configuration*/ | ||
| 42 | LNW_DMA_MEM_TO_PER, /*memory to periphral configuration*/ | ||
| 43 | LNW_DMA_MEM_TO_MEM, /*mem to mem confg (testing only)*/ | ||
| 44 | }; | ||
| 45 | |||
| 46 | /*DMA handshaking*/ | ||
| 47 | enum intel_mid_dma_hs_mode { | ||
| 48 | LNW_DMA_HW_HS = 0, /*HW Handshaking only*/ | ||
| 49 | LNW_DMA_SW_HS = 1, /*SW Handshaking not recommended*/ | ||
| 50 | }; | ||
| 51 | |||
| 52 | /*Burst size configuration*/ | ||
| 53 | enum intel_mid_dma_msize { | ||
| 54 | LNW_DMA_MSIZE_1 = 0x0, | ||
| 55 | LNW_DMA_MSIZE_4 = 0x1, | ||
| 56 | LNW_DMA_MSIZE_8 = 0x2, | ||
| 57 | LNW_DMA_MSIZE_16 = 0x3, | ||
| 58 | LNW_DMA_MSIZE_32 = 0x4, | ||
| 59 | LNW_DMA_MSIZE_64 = 0x5, | ||
| 60 | }; | ||
| 61 | |||
| 62 | /** | ||
| 63 | * struct intel_mid_dma_slave - DMA slave structure | ||
| 64 | * | ||
| 65 | * @dirn: DMA trf direction | ||
| 66 | * @src_width: tx register width | ||
| 67 | * @dst_width: rx register width | ||
| 68 | * @hs_mode: HW/SW handshaking mode | ||
| 69 | * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem) | ||
| 70 | * @src_msize: Source DMA burst size | ||
| 71 | * @dst_msize: Dst DMA burst size | ||
| 72 | * @device_instance: DMA peripheral device instance, we can have multiple | ||
| 73 | * peripheral device connected to single DMAC | ||
| 74 | */ | ||
| 75 | struct intel_mid_dma_slave { | ||
| 76 | enum dma_data_direction dirn; | ||
| 77 | enum intel_mid_dma_width src_width; /*width of DMA src txn*/ | ||
| 78 | enum intel_mid_dma_width dst_width; /*width of DMA dst txn*/ | ||
| 79 | enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/ | ||
| 80 | enum intel_mid_dma_mode cfg_mode; /*mode configuration*/ | ||
| 81 | enum intel_mid_dma_msize src_msize; /*size if src burst*/ | ||
| 82 | enum intel_mid_dma_msize dst_msize; /*size of dst burst*/ | ||
| 83 | unsigned int device_instance; /*0, 1 for periphral instance*/ | ||
| 84 | }; | ||
| 85 | |||
| 86 | #endif /*__INTEL_MID_DMA_H__*/ | ||
diff --git a/include/linux/pch_dma.h b/include/linux/pch_dma.h new file mode 100644 index 000000000000..fdafe529ef8a --- /dev/null +++ b/include/linux/pch_dma.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010 Intel Corporation | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License version 2 as | ||
| 6 | * published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program; if not, write to the Free Software | ||
| 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #ifndef PCH_DMA_H | ||
| 19 | #define PCH_DMA_H | ||
| 20 | |||
| 21 | #include <linux/dmaengine.h> | ||
| 22 | |||
| 23 | enum pch_dma_width { | ||
| 24 | PCH_DMA_WIDTH_1_BYTE, | ||
| 25 | PCH_DMA_WIDTH_2_BYTES, | ||
| 26 | PCH_DMA_WIDTH_4_BYTES, | ||
| 27 | }; | ||
| 28 | |||
| 29 | struct pch_dma_slave { | ||
| 30 | struct device *dma_dev; | ||
| 31 | unsigned int chan_id; | ||
| 32 | dma_addr_t tx_reg; | ||
| 33 | dma_addr_t rx_reg; | ||
| 34 | enum pch_dma_width width; | ||
| 35 | }; | ||
| 36 | |||
| 37 | #endif | ||
