Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Russell King | 4baa992 | 2008-08-02 10:55:55 +0100 | [diff] [blame] | 3 | * arch/arm/include/asm/mach/dma.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
| 5 | * Copyright (C) 1998-2000 Russell King |
| 6 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * This header file describes the interface between the generic DMA handler |
| 8 | * (dma.c) and the architecture-specific DMA backends (dma-*.c) |
| 9 | */ |
| 10 | |
| 11 | struct dma_struct; |
| 12 | typedef struct dma_struct dma_t; |
| 13 | |
| 14 | struct dma_ops { |
Russell King | 1df8130 | 2008-12-08 15:58:50 +0000 | [diff] [blame] | 15 | int (*request)(unsigned int, dma_t *); /* optional */ |
| 16 | void (*free)(unsigned int, dma_t *); /* optional */ |
| 17 | void (*enable)(unsigned int, dma_t *); /* mandatory */ |
| 18 | void (*disable)(unsigned int, dma_t *); /* mandatory */ |
| 19 | int (*residue)(unsigned int, dma_t *); /* optional */ |
| 20 | int (*setspeed)(unsigned int, dma_t *, int); /* optional */ |
Russell King | 8c56afc | 2008-12-11 14:50:39 +0000 | [diff] [blame] | 21 | const char *type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | struct dma_struct { |
Russell King | 7cdad48 | 2006-01-04 15:08:30 +0000 | [diff] [blame] | 25 | void *addr; /* single DMA address */ |
| 26 | unsigned long count; /* single DMA size */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | struct scatterlist buf; /* single DMA */ |
| 28 | int sgcount; /* number of DMA SG */ |
| 29 | struct scatterlist *sg; /* DMA Scatter-Gather List */ |
| 30 | |
| 31 | unsigned int active:1; /* Transfer active */ |
| 32 | unsigned int invalid:1; /* Address/Count changed */ |
Russell King | 7cdad48 | 2006-01-04 15:08:30 +0000 | [diff] [blame] | 33 | |
Russell King | f0ffc81 | 2009-01-02 12:34:55 +0000 | [diff] [blame] | 34 | unsigned int dma_mode; /* DMA mode */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | int speed; /* DMA speed */ |
| 36 | |
| 37 | unsigned int lock; /* Device is allocated */ |
| 38 | const char *device_id; /* Device name */ |
| 39 | |
Russell King | 8c56afc | 2008-12-11 14:50:39 +0000 | [diff] [blame] | 40 | const struct dma_ops *d_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | }; |
| 42 | |
Russell King | 2f757f2 | 2008-12-08 16:33:30 +0000 | [diff] [blame] | 43 | /* |
| 44 | * isa_dma_add - add an ISA-style DMA channel |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | */ |
Russell King | 2f757f2 | 2008-12-08 16:33:30 +0000 | [diff] [blame] | 46 | extern int isa_dma_add(unsigned int, dma_t *dma); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
Russell King | 2f757f2 | 2008-12-08 16:33:30 +0000 | [diff] [blame] | 48 | /* |
| 49 | * Add the ISA DMA controller. Always takes channels 0-7. |
| 50 | */ |
| 51 | extern void isa_init_dma(void); |