Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/asm-arm/arch-pxa/dma.h |
| 3 | * |
| 4 | * Author: Nicolas Pitre |
| 5 | * Created: Jun 15, 2001 |
| 6 | * Copyright: MontaVista Software, Inc. |
| 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 __ASM_ARCH_DMA_H |
| 13 | #define __ASM_ARCH_DMA_H |
| 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | /* |
| 16 | * Descriptor structure for PXA's DMA engine |
| 17 | * Note: this structure must always be aligned to a 16-byte boundary. |
| 18 | */ |
| 19 | |
| 20 | typedef struct pxa_dma_desc { |
| 21 | volatile u32 ddadr; /* Points to the next descriptor + flags */ |
| 22 | volatile u32 dsadr; /* DSADR value for the current transfer */ |
| 23 | volatile u32 dtadr; /* DTADR value for the current transfer */ |
| 24 | volatile u32 dcmd; /* DCMD value for the current transfer */ |
| 25 | } pxa_dma_desc; |
| 26 | |
Nicolas Pitre | 9953255 | 2006-05-05 22:32:24 +0100 | [diff] [blame] | 27 | typedef enum { |
| 28 | DMA_PRIO_HIGH = 0, |
| 29 | DMA_PRIO_MEDIUM = 1, |
| 30 | DMA_PRIO_LOW = 2 |
| 31 | } pxa_dma_prio; |
| 32 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #if defined(CONFIG_PXA27x) |
| 34 | |
| 35 | #define PXA_DMA_CHANNELS 32 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
Nicolas Pitre | 9953255 | 2006-05-05 22:32:24 +0100 | [diff] [blame] | 37 | #define pxa_for_each_dma_prio(ch, prio) \ |
| 38 | for ( \ |
| 39 | ch = prio * 4; \ |
| 40 | ch != (4 << prio) + 16; \ |
| 41 | ch = (ch + 1 == (4 << prio)) ? (prio * 4 + 16) : (ch + 1) \ |
| 42 | ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 44 | #elif defined(CONFIG_PXA25x) |
| 45 | |
| 46 | #define PXA_DMA_CHANNELS 16 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Nicolas Pitre | 9953255 | 2006-05-05 22:32:24 +0100 | [diff] [blame] | 48 | #define pxa_for_each_dma_prio(ch, prio) \ |
| 49 | for (ch = prio * 4; ch != (4 << prio); ch++) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
| 51 | #endif |
| 52 | |
| 53 | /* |
| 54 | * DMA registration |
| 55 | */ |
| 56 | |
| 57 | int pxa_request_dma (char *name, |
| 58 | pxa_dma_prio prio, |
Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 59 | void (*irq_handler)(int, void *), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | void *data); |
| 61 | |
| 62 | void pxa_free_dma (int dma_ch); |
| 63 | |
| 64 | #endif /* _ASM_ARCH_DMA_H */ |