18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * TI EDMA definitions 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2006-2013 Texas Instruments. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* 98c2ecf20Sopenharmony_ci * This EDMA3 programming framework exposes two basic kinds of resource: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Channel Triggers transfers, usually from a hardware event but 128c2ecf20Sopenharmony_ci * also manually or by "chaining" from DMA completions. 138c2ecf20Sopenharmony_ci * Each channel is coupled to a Parameter RAM (PaRAM) slot. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * Slot Each PaRAM slot holds a DMA transfer descriptor (PaRAM 168c2ecf20Sopenharmony_ci * "set"), source and destination addresses, a link to a 178c2ecf20Sopenharmony_ci * next PaRAM slot (if any), options for the transfer, and 188c2ecf20Sopenharmony_ci * instructions for updating those addresses. There are 198c2ecf20Sopenharmony_ci * more than twice as many slots as event channels. 208c2ecf20Sopenharmony_ci * 218c2ecf20Sopenharmony_ci * Each PaRAM set describes a sequence of transfers, either for one large 228c2ecf20Sopenharmony_ci * buffer or for several discontiguous smaller buffers. An EDMA transfer 238c2ecf20Sopenharmony_ci * is driven only from a channel, which performs the transfers specified 248c2ecf20Sopenharmony_ci * in its PaRAM slot until there are no more transfers. When that last 258c2ecf20Sopenharmony_ci * transfer completes, the "link" field may be used to reload the channel's 268c2ecf20Sopenharmony_ci * PaRAM slot with a new transfer descriptor. 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * The EDMA Channel Controller (CC) maps requests from channels into physical 298c2ecf20Sopenharmony_ci * Transfer Controller (TC) requests when the channel triggers (by hardware 308c2ecf20Sopenharmony_ci * or software events, or by chaining). The two physical DMA channels provided 318c2ecf20Sopenharmony_ci * by the TCs are thus shared by many logical channels. 328c2ecf20Sopenharmony_ci * 338c2ecf20Sopenharmony_ci * DaVinci hardware also has a "QDMA" mechanism which is not currently 348c2ecf20Sopenharmony_ci * supported through this interface. (DSP firmware uses it though.) 358c2ecf20Sopenharmony_ci */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#ifndef EDMA_H_ 388c2ecf20Sopenharmony_ci#define EDMA_H_ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cienum dma_event_q { 418c2ecf20Sopenharmony_ci EVENTQ_0 = 0, 428c2ecf20Sopenharmony_ci EVENTQ_1 = 1, 438c2ecf20Sopenharmony_ci EVENTQ_2 = 2, 448c2ecf20Sopenharmony_ci EVENTQ_3 = 3, 458c2ecf20Sopenharmony_ci EVENTQ_DEFAULT = -1 468c2ecf20Sopenharmony_ci}; 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define EDMA_CTLR_CHAN(ctlr, chan) (((ctlr) << 16) | (chan)) 498c2ecf20Sopenharmony_ci#define EDMA_CTLR(i) ((i) >> 16) 508c2ecf20Sopenharmony_ci#define EDMA_CHAN_SLOT(i) ((i) & 0xffff) 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define EDMA_FILTER_PARAM(ctlr, chan) ((int[]) { EDMA_CTLR_CHAN(ctlr, chan) }) 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cistruct edma_rsv_info { 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci const s16 (*rsv_chans)[2]; 578c2ecf20Sopenharmony_ci const s16 (*rsv_slots)[2]; 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cistruct dma_slave_map; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci/* platform_data for EDMA driver */ 638c2ecf20Sopenharmony_cistruct edma_soc_info { 648c2ecf20Sopenharmony_ci /* 658c2ecf20Sopenharmony_ci * Default queue is expected to be a low-priority queue. 668c2ecf20Sopenharmony_ci * This way, long transfers on the default queue started 678c2ecf20Sopenharmony_ci * by the codec engine will not cause audio defects. 688c2ecf20Sopenharmony_ci */ 698c2ecf20Sopenharmony_ci enum dma_event_q default_queue; 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci /* Resource reservation for other cores */ 728c2ecf20Sopenharmony_ci struct edma_rsv_info *rsv; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci /* List of channels allocated for memcpy, terminated with -1 */ 758c2ecf20Sopenharmony_ci s32 *memcpy_channels; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci s8 (*queue_priority_mapping)[2]; 788c2ecf20Sopenharmony_ci const s16 (*xbar_chans)[2]; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci const struct dma_slave_map *slave_map; 818c2ecf20Sopenharmony_ci int slavecnt; 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#endif 85