162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  arch/arm/include/asm/mach/dma.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 1998-2000 Russell King
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  This header file describes the interface between the generic DMA handler
862306a36Sopenharmony_ci *  (dma.c) and the architecture-specific DMA backends (dma-*.c)
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_cistruct dma_struct;
1262306a36Sopenharmony_citypedef struct dma_struct dma_t;
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct dma_ops {
1562306a36Sopenharmony_ci	int	(*request)(unsigned int, dma_t *);		/* optional */
1662306a36Sopenharmony_ci	void	(*free)(unsigned int, dma_t *);			/* optional */
1762306a36Sopenharmony_ci	void	(*enable)(unsigned int, dma_t *);		/* mandatory */
1862306a36Sopenharmony_ci	void 	(*disable)(unsigned int, dma_t *);		/* mandatory */
1962306a36Sopenharmony_ci	int	(*residue)(unsigned int, dma_t *);		/* optional */
2062306a36Sopenharmony_ci	int	(*setspeed)(unsigned int, dma_t *, int);	/* optional */
2162306a36Sopenharmony_ci	const char *type;
2262306a36Sopenharmony_ci};
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct dma_struct {
2562306a36Sopenharmony_ci	void		*addr;		/* single DMA address		*/
2662306a36Sopenharmony_ci	unsigned long	count;		/* single DMA size		*/
2762306a36Sopenharmony_ci	struct scatterlist buf;		/* single DMA			*/
2862306a36Sopenharmony_ci	int		sgcount;	/* number of DMA SG		*/
2962306a36Sopenharmony_ci	struct scatterlist *sg;		/* DMA Scatter-Gather List	*/
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	unsigned int	active:1;	/* Transfer active		*/
3262306a36Sopenharmony_ci	unsigned int	invalid:1;	/* Address/Count changed	*/
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	unsigned int	dma_mode;	/* DMA mode			*/
3562306a36Sopenharmony_ci	int		speed;		/* DMA speed			*/
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci	unsigned int	lock;		/* Device is allocated		*/
3862306a36Sopenharmony_ci	const char	*device_id;	/* Device name			*/
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci	const struct dma_ops *d_ops;
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/*
4462306a36Sopenharmony_ci * isa_dma_add - add an ISA-style DMA channel
4562306a36Sopenharmony_ci */
4662306a36Sopenharmony_ciextern int isa_dma_add(unsigned int, dma_t *dma);
47