162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __ASM_SPARC_EBUS_DMA_H
362306a36Sopenharmony_ci#define __ASM_SPARC_EBUS_DMA_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_cistruct ebus_dma_info {
662306a36Sopenharmony_ci	spinlock_t	lock;
762306a36Sopenharmony_ci	void __iomem	*regs;
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci	unsigned int	flags;
1062306a36Sopenharmony_ci#define EBUS_DMA_FLAG_USE_EBDMA_HANDLER		0x00000001
1162306a36Sopenharmony_ci#define EBUS_DMA_FLAG_TCI_DISABLE		0x00000002
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci	/* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
1462306a36Sopenharmony_ci	 * set.
1562306a36Sopenharmony_ci	 */
1662306a36Sopenharmony_ci	void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
1762306a36Sopenharmony_ci	void *client_cookie;
1862306a36Sopenharmony_ci	unsigned int	irq;
1962306a36Sopenharmony_ci#define EBUS_DMA_EVENT_ERROR	1
2062306a36Sopenharmony_ci#define EBUS_DMA_EVENT_DMA	2
2162306a36Sopenharmony_ci#define EBUS_DMA_EVENT_DEVICE	4
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	unsigned char	name[64];
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciint ebus_dma_register(struct ebus_dma_info *p);
2762306a36Sopenharmony_ciint ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
2862306a36Sopenharmony_civoid ebus_dma_unregister(struct ebus_dma_info *p);
2962306a36Sopenharmony_ciint ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
3062306a36Sopenharmony_ci			    size_t len);
3162306a36Sopenharmony_civoid ebus_dma_prepare(struct ebus_dma_info *p, int write);
3262306a36Sopenharmony_ciunsigned int ebus_dma_residue(struct ebus_dma_info *p);
3362306a36Sopenharmony_ciunsigned int ebus_dma_addr(struct ebus_dma_info *p);
3462306a36Sopenharmony_civoid ebus_dma_enable(struct ebus_dma_info *p, int on);
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#endif /* __ASM_SPARC_EBUS_DMA_H */
37