diff options
author | Pavel Pisa <ppisa@pikron.com> | 2006-04-02 11:58:37 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-04-02 11:58:37 -0400 |
commit | 999331af456bf6fc1520ea7b68b6a3dbb4af8ff6 (patch) | |
tree | d7610740f58f942fcb46e07bb790dfd785e21508 /include/asm-arm | |
parent | 7ba01f9728a9f1cd1a3e1e2d5206f76061182675 (diff) |
[ARM] 3444/1: i.MX: Scatter-gather DMA emulation for i.MX/MX1
Patch from Pavel Pisa
This patch contains simplified set of changes to add scatter-gather
emulation capability into MX1 DMA support. The result should
be still usable for next combination of DMA transfers
Statter-Gather/linear/2D/FIFO to linear/2D/FIFO and
linear/2D/FIFO to Statter-Gather/2D/FIFO
The patch corrects channel priority allocation to be compatible
with MX1 hardware implementation.
Previous code has not been adapted from its PXA original.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm')
-rw-r--r-- | include/asm-arm/arch-imx/dma.h | 17 | ||||
-rw-r--r-- | include/asm-arm/arch-imx/imx-dma.h | 90 |
2 files changed, 93 insertions, 14 deletions
diff --git a/include/asm-arm/arch-imx/dma.h b/include/asm-arm/arch-imx/dma.h index b45fa367d71e..621ff2c730f2 100644 --- a/include/asm-arm/arch-imx/dma.h +++ b/include/asm-arm/arch-imx/dma.h | |||
@@ -17,27 +17,16 @@ | |||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | */ | 19 | */ |
20 | |||
20 | #ifndef __ASM_ARCH_DMA_H | 21 | #ifndef __ASM_ARCH_DMA_H |
21 | #define __ASM_ARCH_DMA_H | 22 | #define __ASM_ARCH_DMA_H |
22 | 23 | ||
23 | /* | ||
24 | * DMA registration | ||
25 | */ | ||
26 | |||
27 | typedef enum { | 24 | typedef enum { |
28 | DMA_PRIO_HIGH = 0, | 25 | DMA_PRIO_HIGH = 0, |
29 | DMA_PRIO_MEDIUM = 3, | 26 | DMA_PRIO_MEDIUM = 1, |
30 | DMA_PRIO_LOW = 6 | 27 | DMA_PRIO_LOW = 2 |
31 | } imx_dma_prio; | 28 | } imx_dma_prio; |
32 | 29 | ||
33 | int imx_request_dma(char *name, imx_dma_prio prio, | ||
34 | void (*irq_handler) (int, void *, struct pt_regs *), | ||
35 | void (*err_handler) (int, void *, struct pt_regs *), | ||
36 | void *data); | ||
37 | |||
38 | void imx_free_dma(int dma_ch); | ||
39 | |||
40 | |||
41 | #define DMA_REQ_UART3_T 2 | 30 | #define DMA_REQ_UART3_T 2 |
42 | #define DMA_REQ_UART3_R 3 | 31 | #define DMA_REQ_UART3_R 3 |
43 | #define DMA_REQ_SSI2_T 4 | 32 | #define DMA_REQ_SSI2_T 4 |
diff --git a/include/asm-arm/arch-imx/imx-dma.h b/include/asm-arm/arch-imx/imx-dma.h new file mode 100644 index 000000000000..f2063c1d610d --- /dev/null +++ b/include/asm-arm/arch-imx/imx-dma.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * linux/include/asm-arm/imxads/dma.h | ||
3 | * | ||
4 | * Copyright (C) 1997,1998 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #include <asm/dma.h> | ||
22 | |||
23 | #ifndef __ASM_ARCH_IMX_DMA_H | ||
24 | #define __ASM_ARCH_IMX_DMA_H | ||
25 | |||
26 | #define IMX_DMA_CHANNELS 11 | ||
27 | |||
28 | /* | ||
29 | * struct imx_dma_channel - i.MX specific DMA extension | ||
30 | * @name: name specified by DMA client | ||
31 | * @irq_handler: client callback for end of transfer | ||
32 | * @err_handler: client callback for error condition | ||
33 | * @data: clients context data for callbacks | ||
34 | * @dma_mode: direction of the transfer %DMA_MODE_READ or %DMA_MODE_WRITE | ||
35 | * @sg: pointer to the actual read/written chunk for scatter-gather emulation | ||
36 | * @sgbc: counter of processed bytes in the actual read/written chunk | ||
37 | * @resbytes: total residual number of bytes to transfer | ||
38 | * (it can be lower or same as sum of SG mapped chunk sizes) | ||
39 | * @sgcount: number of chunks to be read/written | ||
40 | * | ||
41 | * Structure is used for IMX DMA processing. It would be probably good | ||
42 | * @struct dma_struct in the future for external interfacing and use | ||
43 | * @struct imx_dma_channel only as extension to it. | ||
44 | */ | ||
45 | |||
46 | struct imx_dma_channel { | ||
47 | const char *name; | ||
48 | void (*irq_handler) (int, void *, struct pt_regs *); | ||
49 | void (*err_handler) (int, void *, struct pt_regs *); | ||
50 | void *data; | ||
51 | dmamode_t dma_mode; | ||
52 | struct scatterlist *sg; | ||
53 | unsigned int sgbc; | ||
54 | unsigned int sgcount; | ||
55 | unsigned int resbytes; | ||
56 | int dma_num; | ||
57 | }; | ||
58 | |||
59 | extern struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS]; | ||
60 | |||
61 | |||
62 | /* The type to distinguish channel numbers parameter from ordinal int type */ | ||
63 | typedef int imx_dmach_t; | ||
64 | |||
65 | int | ||
66 | imx_dma_setup_single(imx_dmach_t dma_ch, dma_addr_t dma_address, | ||
67 | unsigned int dma_length, unsigned int dev_addr, dmamode_t dmamode); | ||
68 | |||
69 | int | ||
70 | imx_dma_setup_sg(imx_dmach_t dma_ch, | ||
71 | struct scatterlist *sg, unsigned int sgcount, unsigned int dma_length, | ||
72 | unsigned int dev_addr, dmamode_t dmamode); | ||
73 | |||
74 | int | ||
75 | imx_dma_setup_handlers(imx_dmach_t dma_ch, | ||
76 | void (*irq_handler) (int, void *, struct pt_regs *), | ||
77 | void (*err_handler) (int, void *, struct pt_regs *), void *data); | ||
78 | |||
79 | void imx_dma_enable(imx_dmach_t dma_ch); | ||
80 | |||
81 | void imx_dma_disable(imx_dmach_t dma_ch); | ||
82 | |||
83 | int imx_dma_request(imx_dmach_t dma_ch, const char *name); | ||
84 | |||
85 | void imx_dma_free(imx_dmach_t dma_ch); | ||
86 | |||
87 | int imx_dma_request_by_prio(imx_dmach_t *pdma_ch, const char *name, imx_dma_prio prio); | ||
88 | |||
89 | |||
90 | #endif /* _ASM_ARCH_IMX_DMA_H */ | ||