18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  arch/arm/include/asm/mach/dma.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 1998-2000 Russell King
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *  This header file describes the interface between the generic DMA handler
88c2ecf20Sopenharmony_ci *  (dma.c) and the architecture-specific DMA backends (dma-*.c)
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct dma_struct;
128c2ecf20Sopenharmony_citypedef struct dma_struct dma_t;
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct dma_ops {
158c2ecf20Sopenharmony_ci	int	(*request)(unsigned int, dma_t *);		/* optional */
168c2ecf20Sopenharmony_ci	void	(*free)(unsigned int, dma_t *);			/* optional */
178c2ecf20Sopenharmony_ci	void	(*enable)(unsigned int, dma_t *);		/* mandatory */
188c2ecf20Sopenharmony_ci	void 	(*disable)(unsigned int, dma_t *);		/* mandatory */
198c2ecf20Sopenharmony_ci	int	(*residue)(unsigned int, dma_t *);		/* optional */
208c2ecf20Sopenharmony_ci	int	(*setspeed)(unsigned int, dma_t *, int);	/* optional */
218c2ecf20Sopenharmony_ci	const char *type;
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct dma_struct {
258c2ecf20Sopenharmony_ci	void		*addr;		/* single DMA address		*/
268c2ecf20Sopenharmony_ci	unsigned long	count;		/* single DMA size		*/
278c2ecf20Sopenharmony_ci	struct scatterlist buf;		/* single DMA			*/
288c2ecf20Sopenharmony_ci	int		sgcount;	/* number of DMA SG		*/
298c2ecf20Sopenharmony_ci	struct scatterlist *sg;		/* DMA Scatter-Gather List	*/
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	unsigned int	active:1;	/* Transfer active		*/
328c2ecf20Sopenharmony_ci	unsigned int	invalid:1;	/* Address/Count changed	*/
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci	unsigned int	dma_mode;	/* DMA mode			*/
358c2ecf20Sopenharmony_ci	int		speed;		/* DMA speed			*/
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	unsigned int	lock;		/* Device is allocated		*/
388c2ecf20Sopenharmony_ci	const char	*device_id;	/* Device name			*/
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	const struct dma_ops *d_ops;
418c2ecf20Sopenharmony_ci};
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * isa_dma_add - add an ISA-style DMA channel
458c2ecf20Sopenharmony_ci */
468c2ecf20Sopenharmony_ciextern int isa_dma_add(unsigned int, dma_t *dma);
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * Add the ISA DMA controller.  Always takes channels 0-7.
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ciextern void isa_init_dma(void);
52