blob: 1506422af3832201938fa4e7265a71fad7e4d20e [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Russell King4baa9922008-08-02 10:55:55 +01003 * arch/arm/include/asm/mach/dma.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Copyright (C) 1998-2000 Russell King
6 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * This header file describes the interface between the generic DMA handler
8 * (dma.c) and the architecture-specific DMA backends (dma-*.c)
9 */
10
11struct dma_struct;
12typedef struct dma_struct dma_t;
13
14struct dma_ops {
Russell King1df81302008-12-08 15:58:50 +000015 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 King8c56afc2008-12-11 14:50:39 +000021 const char *type;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022};
23
24struct dma_struct {
Russell King7cdad482006-01-04 15:08:30 +000025 void *addr; /* single DMA address */
26 unsigned long count; /* single DMA size */
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 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 King7cdad482006-01-04 15:08:30 +000033
Russell Kingf0ffc812009-01-02 12:34:55 +000034 unsigned int dma_mode; /* DMA mode */
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 int speed; /* DMA speed */
36
37 unsigned int lock; /* Device is allocated */
38 const char *device_id; /* Device name */
39
Russell King8c56afc2008-12-11 14:50:39 +000040 const struct dma_ops *d_ops;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041};
42
Russell King2f757f22008-12-08 16:33:30 +000043/*
44 * isa_dma_add - add an ISA-style DMA channel
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 */
Russell King2f757f22008-12-08 16:33:30 +000046extern int isa_dma_add(unsigned int, dma_t *dma);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Russell King2f757f22008-12-08 16:33:30 +000048/*
49 * Add the ISA DMA controller. Always takes channels 0-7.
50 */
51extern void isa_init_dma(void);