18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This header provides macros for at91 dma bindings.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2013 Ludovic Desroches <ludovic.desroches@atmel.com>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __DT_BINDINGS_AT91_DMA_H__
98c2ecf20Sopenharmony_ci#define __DT_BINDINGS_AT91_DMA_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* ---------- HDMAC ---------- */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/*
148c2ecf20Sopenharmony_ci * Source and/or destination peripheral ID
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_PER_ID_MASK	(0xff)
178c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_PER_ID(id)		(id & AT91_DMA_CFG_PER_ID_MASK)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/*
208c2ecf20Sopenharmony_ci * FIFO configuration: it defines when a request is serviced.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_FIFOCFG_OFFSET	(8)
238c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_FIFOCFG_MASK	(0xf << AT91_DMA_CFG_FIFOCFG_OFFSET)
248c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_FIFOCFG_HALF	(0x0 << AT91_DMA_CFG_FIFOCFG_OFFSET)	/* half FIFO (default behavior) */
258c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_FIFOCFG_ALAP	(0x1 << AT91_DMA_CFG_FIFOCFG_OFFSET)	/* largest defined AHB burst */
268c2ecf20Sopenharmony_ci#define AT91_DMA_CFG_FIFOCFG_ASAP	(0x2 << AT91_DMA_CFG_FIFOCFG_OFFSET)	/* single AHB access */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* ---------- XDMAC ---------- */
308c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_MEM_IF_MASK	(0x1)
318c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_MEM_IF_OFFSET	(13)
328c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_MEM_IF(mem_if)	(((mem_if) & AT91_XDMAC_DT_MEM_IF_MASK) \
338c2ecf20Sopenharmony_ci					<< AT91_XDMAC_DT_MEM_IF_OFFSET)
348c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_GET_MEM_IF(cfg)	(((cfg) >> AT91_XDMAC_DT_MEM_IF_OFFSET) \
358c2ecf20Sopenharmony_ci					& AT91_XDMAC_DT_MEM_IF_MASK)
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_PER_IF_MASK	(0x1)
388c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_PER_IF_OFFSET	(14)
398c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_PER_IF(per_if)	(((per_if) & AT91_XDMAC_DT_PER_IF_MASK) \
408c2ecf20Sopenharmony_ci					<< AT91_XDMAC_DT_PER_IF_OFFSET)
418c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_GET_PER_IF(cfg)	(((cfg) >> AT91_XDMAC_DT_PER_IF_OFFSET) \
428c2ecf20Sopenharmony_ci					& AT91_XDMAC_DT_PER_IF_MASK)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_PERID_MASK	(0x7f)
458c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_PERID_OFFSET	(24)
468c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_PERID(perid)	(((perid) & AT91_XDMAC_DT_PERID_MASK) \
478c2ecf20Sopenharmony_ci					<< AT91_XDMAC_DT_PERID_OFFSET)
488c2ecf20Sopenharmony_ci#define AT91_XDMAC_DT_GET_PERID(cfg)	(((cfg) >> AT91_XDMAC_DT_PERID_OFFSET) \
498c2ecf20Sopenharmony_ci					& AT91_XDMAC_DT_PERID_MASK)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#endif /* __DT_BINDINGS_AT91_DMA_H__ */
52