18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __LINUX_OMAP_DMA_H 38c2ecf20Sopenharmony_ci#define __LINUX_OMAP_DMA_H 48c2ecf20Sopenharmony_ci/* 58c2ecf20Sopenharmony_ci * Legacy OMAP DMA handling defines and functions 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * NOTE: Do not use these any longer. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Use the generic dmaengine functions as defined in 108c2ecf20Sopenharmony_ci * include/linux/dmaengine.h. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Copyright (C) 2003 Nokia Corporation 138c2ecf20Sopenharmony_ci * Author: Juha Yrjölä <juha.yrjola@nokia.com> 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define INT_DMA_LCD (NR_IRQS_LEGACY + 25) 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define OMAP1_DMA_TOUT_IRQ (1 << 0) 228c2ecf20Sopenharmony_ci#define OMAP_DMA_DROP_IRQ (1 << 1) 238c2ecf20Sopenharmony_ci#define OMAP_DMA_HALF_IRQ (1 << 2) 248c2ecf20Sopenharmony_ci#define OMAP_DMA_FRAME_IRQ (1 << 3) 258c2ecf20Sopenharmony_ci#define OMAP_DMA_LAST_IRQ (1 << 4) 268c2ecf20Sopenharmony_ci#define OMAP_DMA_BLOCK_IRQ (1 << 5) 278c2ecf20Sopenharmony_ci#define OMAP1_DMA_SYNC_IRQ (1 << 6) 288c2ecf20Sopenharmony_ci#define OMAP2_DMA_PKT_IRQ (1 << 7) 298c2ecf20Sopenharmony_ci#define OMAP2_DMA_TRANS_ERR_IRQ (1 << 8) 308c2ecf20Sopenharmony_ci#define OMAP2_DMA_SECURE_ERR_IRQ (1 << 9) 318c2ecf20Sopenharmony_ci#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10) 328c2ecf20Sopenharmony_ci#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define OMAP_DMA_CCR_EN (1 << 7) 358c2ecf20Sopenharmony_ci#define OMAP_DMA_CCR_RD_ACTIVE (1 << 9) 368c2ecf20Sopenharmony_ci#define OMAP_DMA_CCR_WR_ACTIVE (1 << 10) 378c2ecf20Sopenharmony_ci#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24) 388c2ecf20Sopenharmony_ci#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25) 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define OMAP_DMA_DATA_TYPE_S8 0x00 418c2ecf20Sopenharmony_ci#define OMAP_DMA_DATA_TYPE_S16 0x01 428c2ecf20Sopenharmony_ci#define OMAP_DMA_DATA_TYPE_S32 0x02 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define OMAP_DMA_SYNC_ELEMENT 0x00 458c2ecf20Sopenharmony_ci#define OMAP_DMA_SYNC_FRAME 0x01 468c2ecf20Sopenharmony_ci#define OMAP_DMA_SYNC_BLOCK 0x02 478c2ecf20Sopenharmony_ci#define OMAP_DMA_SYNC_PACKET 0x03 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define OMAP_DMA_DST_SYNC_PREFETCH 0x02 508c2ecf20Sopenharmony_ci#define OMAP_DMA_SRC_SYNC 0x01 518c2ecf20Sopenharmony_ci#define OMAP_DMA_DST_SYNC 0x00 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define OMAP_DMA_PORT_EMIFF 0x00 548c2ecf20Sopenharmony_ci#define OMAP_DMA_PORT_EMIFS 0x01 558c2ecf20Sopenharmony_ci#define OMAP_DMA_PORT_OCP_T1 0x02 568c2ecf20Sopenharmony_ci#define OMAP_DMA_PORT_TIPB 0x03 578c2ecf20Sopenharmony_ci#define OMAP_DMA_PORT_OCP_T2 0x04 588c2ecf20Sopenharmony_ci#define OMAP_DMA_PORT_MPUI 0x05 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define OMAP_DMA_AMODE_CONSTANT 0x00 618c2ecf20Sopenharmony_ci#define OMAP_DMA_AMODE_POST_INC 0x01 628c2ecf20Sopenharmony_ci#define OMAP_DMA_AMODE_SINGLE_IDX 0x02 638c2ecf20Sopenharmony_ci#define OMAP_DMA_AMODE_DOUBLE_IDX 0x03 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define DMA_DEFAULT_FIFO_DEPTH 0x10 668c2ecf20Sopenharmony_ci#define DMA_DEFAULT_ARB_RATE 0x01 678c2ecf20Sopenharmony_ci/* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */ 688c2ecf20Sopenharmony_ci#define DMA_THREAD_RESERVE_NORM (0x00 << 12) /* Def */ 698c2ecf20Sopenharmony_ci#define DMA_THREAD_RESERVE_ONET (0x01 << 12) 708c2ecf20Sopenharmony_ci#define DMA_THREAD_RESERVE_TWOT (0x02 << 12) 718c2ecf20Sopenharmony_ci#define DMA_THREAD_RESERVE_THREET (0x03 << 12) 728c2ecf20Sopenharmony_ci#define DMA_THREAD_FIFO_NONE (0x00 << 14) /* Def */ 738c2ecf20Sopenharmony_ci#define DMA_THREAD_FIFO_75 (0x01 << 14) 748c2ecf20Sopenharmony_ci#define DMA_THREAD_FIFO_25 (0x02 << 14) 758c2ecf20Sopenharmony_ci#define DMA_THREAD_FIFO_50 (0x03 << 14) 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* DMA4_OCP_SYSCONFIG bits */ 788c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_MIDLEMODE_MASK (3 << 12) 798c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_CLOCKACTIVITY_MASK (3 << 8) 808c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_EMUFREE (1 << 5) 818c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_SIDLEMODE_MASK (3 << 3) 828c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_SOFTRESET (1 << 2) 838c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_AUTOIDLE (1 << 0) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_MIDLEMODE(n) ((n) << 12) 868c2ecf20Sopenharmony_ci#define DMA_SYSCONFIG_SIDLEMODE(n) ((n) << 3) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define DMA_IDLEMODE_SMARTIDLE 0x2 898c2ecf20Sopenharmony_ci#define DMA_IDLEMODE_NO_IDLE 0x1 908c2ecf20Sopenharmony_ci#define DMA_IDLEMODE_FORCE_IDLE 0x0 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci/* Chaining modes*/ 938c2ecf20Sopenharmony_ci#ifndef CONFIG_ARCH_OMAP1 948c2ecf20Sopenharmony_ci#define OMAP_DMA_STATIC_CHAIN 0x1 958c2ecf20Sopenharmony_ci#define OMAP_DMA_DYNAMIC_CHAIN 0x2 968c2ecf20Sopenharmony_ci#define OMAP_DMA_CHAIN_ACTIVE 0x1 978c2ecf20Sopenharmony_ci#define OMAP_DMA_CHAIN_INACTIVE 0x0 988c2ecf20Sopenharmony_ci#endif 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci#define DMA_CH_PRIO_HIGH 0x1 1018c2ecf20Sopenharmony_ci#define DMA_CH_PRIO_LOW 0x0 /* Def */ 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci/* Errata handling */ 1048c2ecf20Sopenharmony_ci#define IS_DMA_ERRATA(id) (errata & (id)) 1058c2ecf20Sopenharmony_ci#define SET_DMA_ERRATA(id) (errata |= (id)) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define DMA_ERRATA_IFRAME_BUFFERING BIT(0x0) 1088c2ecf20Sopenharmony_ci#define DMA_ERRATA_PARALLEL_CHANNELS BIT(0x1) 1098c2ecf20Sopenharmony_ci#define DMA_ERRATA_i378 BIT(0x2) 1108c2ecf20Sopenharmony_ci#define DMA_ERRATA_i541 BIT(0x3) 1118c2ecf20Sopenharmony_ci#define DMA_ERRATA_i88 BIT(0x4) 1128c2ecf20Sopenharmony_ci#define DMA_ERRATA_3_3 BIT(0x5) 1138c2ecf20Sopenharmony_ci#define DMA_ROMCODE_BUG BIT(0x6) 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* Attributes for OMAP DMA Contrller */ 1168c2ecf20Sopenharmony_ci#define DMA_LINKED_LCH BIT(0x0) 1178c2ecf20Sopenharmony_ci#define GLOBAL_PRIORITY BIT(0x1) 1188c2ecf20Sopenharmony_ci#define RESERVE_CHANNEL BIT(0x2) 1198c2ecf20Sopenharmony_ci#define IS_CSSA_32 BIT(0x3) 1208c2ecf20Sopenharmony_ci#define IS_CDSA_32 BIT(0x4) 1218c2ecf20Sopenharmony_ci#define IS_RW_PRIORITY BIT(0x5) 1228c2ecf20Sopenharmony_ci#define ENABLE_1510_MODE BIT(0x6) 1238c2ecf20Sopenharmony_ci#define SRC_PORT BIT(0x7) 1248c2ecf20Sopenharmony_ci#define DST_PORT BIT(0x8) 1258c2ecf20Sopenharmony_ci#define SRC_INDEX BIT(0x9) 1268c2ecf20Sopenharmony_ci#define DST_INDEX BIT(0xa) 1278c2ecf20Sopenharmony_ci#define IS_BURST_ONLY4 BIT(0xb) 1288c2ecf20Sopenharmony_ci#define CLEAR_CSR_ON_READ BIT(0xc) 1298c2ecf20Sopenharmony_ci#define IS_WORD_16 BIT(0xd) 1308c2ecf20Sopenharmony_ci#define ENABLE_16XX_MODE BIT(0xe) 1318c2ecf20Sopenharmony_ci#define HS_CHANNELS_RESERVED BIT(0xf) 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci/* Defines for DMA Capabilities */ 1348c2ecf20Sopenharmony_ci#define DMA_HAS_TRANSPARENT_CAPS (0x1 << 18) 1358c2ecf20Sopenharmony_ci#define DMA_HAS_CONSTANT_FILL_CAPS (0x1 << 19) 1368c2ecf20Sopenharmony_ci#define DMA_HAS_DESCRIPTOR_CAPS (0x3 << 20) 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cienum omap_reg_offsets { 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ciGCR, GSCR, GRST1, HW_ID, 1418c2ecf20Sopenharmony_ciPCH2_ID, PCH0_ID, PCH1_ID, PCHG_ID, 1428c2ecf20Sopenharmony_ciPCHD_ID, CAPS_0, CAPS_1, CAPS_2, 1438c2ecf20Sopenharmony_ciCAPS_3, CAPS_4, PCH2_SR, PCH0_SR, 1448c2ecf20Sopenharmony_ciPCH1_SR, PCHD_SR, REVISION, IRQSTATUS_L0, 1458c2ecf20Sopenharmony_ciIRQSTATUS_L1, IRQSTATUS_L2, IRQSTATUS_L3, IRQENABLE_L0, 1468c2ecf20Sopenharmony_ciIRQENABLE_L1, IRQENABLE_L2, IRQENABLE_L3, SYSSTATUS, 1478c2ecf20Sopenharmony_ciOCP_SYSCONFIG, 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci/* omap1+ specific */ 1508c2ecf20Sopenharmony_ciCPC, CCR2, LCH_CTRL, 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci/* Common registers for all omap's */ 1538c2ecf20Sopenharmony_ciCSDP, CCR, CICR, CSR, 1548c2ecf20Sopenharmony_ciCEN, CFN, CSFI, CSEI, 1558c2ecf20Sopenharmony_ciCSAC, CDAC, CDEI, 1568c2ecf20Sopenharmony_ciCDFI, CLNK_CTRL, 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci/* Channel specific registers */ 1598c2ecf20Sopenharmony_ciCSSA, CDSA, COLOR, 1608c2ecf20Sopenharmony_ciCCEN, CCFN, 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci/* omap3630 and omap4 specific */ 1638c2ecf20Sopenharmony_ciCDP, CNDP, CCDN, 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_cienum omap_dma_burst_mode { 1688c2ecf20Sopenharmony_ci OMAP_DMA_DATA_BURST_DIS = 0, 1698c2ecf20Sopenharmony_ci OMAP_DMA_DATA_BURST_4, 1708c2ecf20Sopenharmony_ci OMAP_DMA_DATA_BURST_8, 1718c2ecf20Sopenharmony_ci OMAP_DMA_DATA_BURST_16, 1728c2ecf20Sopenharmony_ci}; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cienum end_type { 1758c2ecf20Sopenharmony_ci OMAP_DMA_LITTLE_ENDIAN = 0, 1768c2ecf20Sopenharmony_ci OMAP_DMA_BIG_ENDIAN 1778c2ecf20Sopenharmony_ci}; 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_cienum omap_dma_color_mode { 1808c2ecf20Sopenharmony_ci OMAP_DMA_COLOR_DIS = 0, 1818c2ecf20Sopenharmony_ci OMAP_DMA_CONSTANT_FILL, 1828c2ecf20Sopenharmony_ci OMAP_DMA_TRANSPARENT_COPY 1838c2ecf20Sopenharmony_ci}; 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_cienum omap_dma_write_mode { 1868c2ecf20Sopenharmony_ci OMAP_DMA_WRITE_NON_POSTED = 0, 1878c2ecf20Sopenharmony_ci OMAP_DMA_WRITE_POSTED, 1888c2ecf20Sopenharmony_ci OMAP_DMA_WRITE_LAST_NON_POSTED 1898c2ecf20Sopenharmony_ci}; 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_cienum omap_dma_channel_mode { 1928c2ecf20Sopenharmony_ci OMAP_DMA_LCH_2D = 0, 1938c2ecf20Sopenharmony_ci OMAP_DMA_LCH_G, 1948c2ecf20Sopenharmony_ci OMAP_DMA_LCH_P, 1958c2ecf20Sopenharmony_ci OMAP_DMA_LCH_PD 1968c2ecf20Sopenharmony_ci}; 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_cistruct omap_dma_channel_params { 1998c2ecf20Sopenharmony_ci int data_type; /* data type 8,16,32 */ 2008c2ecf20Sopenharmony_ci int elem_count; /* number of elements in a frame */ 2018c2ecf20Sopenharmony_ci int frame_count; /* number of frames in a element */ 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci int src_port; /* Only on OMAP1 REVISIT: Is this needed? */ 2048c2ecf20Sopenharmony_ci int src_amode; /* constant, post increment, indexed, 2058c2ecf20Sopenharmony_ci double indexed */ 2068c2ecf20Sopenharmony_ci unsigned long src_start; /* source address : physical */ 2078c2ecf20Sopenharmony_ci int src_ei; /* source element index */ 2088c2ecf20Sopenharmony_ci int src_fi; /* source frame index */ 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci int dst_port; /* Only on OMAP1 REVISIT: Is this needed? */ 2118c2ecf20Sopenharmony_ci int dst_amode; /* constant, post increment, indexed, 2128c2ecf20Sopenharmony_ci double indexed */ 2138c2ecf20Sopenharmony_ci unsigned long dst_start; /* source address : physical */ 2148c2ecf20Sopenharmony_ci int dst_ei; /* source element index */ 2158c2ecf20Sopenharmony_ci int dst_fi; /* source frame index */ 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci int trigger; /* trigger attached if the channel is 2188c2ecf20Sopenharmony_ci synchronized */ 2198c2ecf20Sopenharmony_ci int sync_mode; /* sycn on element, frame , block or packet */ 2208c2ecf20Sopenharmony_ci int src_or_dst_synch; /* source synch(1) or destination synch(0) */ 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci int ie; /* interrupt enabled */ 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci unsigned char read_prio;/* read priority */ 2258c2ecf20Sopenharmony_ci unsigned char write_prio;/* write priority */ 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci#ifndef CONFIG_ARCH_OMAP1 2288c2ecf20Sopenharmony_ci enum omap_dma_burst_mode burst_mode; /* Burst mode 4/8/16 words */ 2298c2ecf20Sopenharmony_ci#endif 2308c2ecf20Sopenharmony_ci}; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cistruct omap_dma_lch { 2338c2ecf20Sopenharmony_ci int next_lch; 2348c2ecf20Sopenharmony_ci int dev_id; 2358c2ecf20Sopenharmony_ci u16 saved_csr; 2368c2ecf20Sopenharmony_ci u16 enabled_irqs; 2378c2ecf20Sopenharmony_ci const char *dev_name; 2388c2ecf20Sopenharmony_ci void (*callback)(int lch, u16 ch_status, void *data); 2398c2ecf20Sopenharmony_ci void *data; 2408c2ecf20Sopenharmony_ci long flags; 2418c2ecf20Sopenharmony_ci int state; 2428c2ecf20Sopenharmony_ci int chain_id; 2438c2ecf20Sopenharmony_ci int status; 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cistruct omap_dma_dev_attr { 2478c2ecf20Sopenharmony_ci u32 dev_caps; 2488c2ecf20Sopenharmony_ci u16 lch_count; 2498c2ecf20Sopenharmony_ci u16 chan_count; 2508c2ecf20Sopenharmony_ci}; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_cienum { 2538c2ecf20Sopenharmony_ci OMAP_DMA_REG_NONE, 2548c2ecf20Sopenharmony_ci OMAP_DMA_REG_16BIT, 2558c2ecf20Sopenharmony_ci OMAP_DMA_REG_2X16BIT, 2568c2ecf20Sopenharmony_ci OMAP_DMA_REG_32BIT, 2578c2ecf20Sopenharmony_ci}; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_cistruct omap_dma_reg { 2608c2ecf20Sopenharmony_ci u16 offset; 2618c2ecf20Sopenharmony_ci u8 stride; 2628c2ecf20Sopenharmony_ci u8 type; 2638c2ecf20Sopenharmony_ci}; 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci#define SDMA_FILTER_PARAM(hw_req) ((int[]) { (hw_req) }) 2668c2ecf20Sopenharmony_cistruct dma_slave_map; 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci/* System DMA platform data structure */ 2698c2ecf20Sopenharmony_cistruct omap_system_dma_plat_info { 2708c2ecf20Sopenharmony_ci const struct omap_dma_reg *reg_map; 2718c2ecf20Sopenharmony_ci unsigned channel_stride; 2728c2ecf20Sopenharmony_ci struct omap_dma_dev_attr *dma_attr; 2738c2ecf20Sopenharmony_ci u32 errata; 2748c2ecf20Sopenharmony_ci void (*show_dma_caps)(void); 2758c2ecf20Sopenharmony_ci void (*clear_lch_regs)(int lch); 2768c2ecf20Sopenharmony_ci void (*clear_dma)(int lch); 2778c2ecf20Sopenharmony_ci void (*dma_write)(u32 val, int reg, int lch); 2788c2ecf20Sopenharmony_ci u32 (*dma_read)(int reg, int lch); 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci const struct dma_slave_map *slave_map; 2818c2ecf20Sopenharmony_ci int slavecnt; 2828c2ecf20Sopenharmony_ci}; 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci#ifdef CONFIG_ARCH_OMAP2PLUS 2858c2ecf20Sopenharmony_ci#define dma_omap2plus() 1 2868c2ecf20Sopenharmony_ci#else 2878c2ecf20Sopenharmony_ci#define dma_omap2plus() 0 2888c2ecf20Sopenharmony_ci#endif 2898c2ecf20Sopenharmony_ci#define dma_omap1() (!dma_omap2plus()) 2908c2ecf20Sopenharmony_ci#define __dma_omap15xx(d) (dma_omap1() && (d)->dev_caps & ENABLE_1510_MODE) 2918c2ecf20Sopenharmony_ci#define __dma_omap16xx(d) (dma_omap1() && (d)->dev_caps & ENABLE_16XX_MODE) 2928c2ecf20Sopenharmony_ci#define dma_omap15xx() __dma_omap15xx(d) 2938c2ecf20Sopenharmony_ci#define dma_omap16xx() __dma_omap16xx(d) 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#if defined(CONFIG_ARCH_OMAP) 2968c2ecf20Sopenharmony_ciextern struct omap_system_dma_plat_info *omap_get_plat_info(void); 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ciextern void omap_set_dma_priority(int lch, int dst_port, int priority); 2998c2ecf20Sopenharmony_ciextern int omap_request_dma(int dev_id, const char *dev_name, 3008c2ecf20Sopenharmony_ci void (*callback)(int lch, u16 ch_status, void *data), 3018c2ecf20Sopenharmony_ci void *data, int *dma_ch); 3028c2ecf20Sopenharmony_ciextern void omap_disable_dma_irq(int ch, u16 irq_bits); 3038c2ecf20Sopenharmony_ciextern void omap_free_dma(int ch); 3048c2ecf20Sopenharmony_ciextern void omap_start_dma(int lch); 3058c2ecf20Sopenharmony_ciextern void omap_stop_dma(int lch); 3068c2ecf20Sopenharmony_ciextern void omap_set_dma_transfer_params(int lch, int data_type, 3078c2ecf20Sopenharmony_ci int elem_count, int frame_count, 3088c2ecf20Sopenharmony_ci int sync_mode, 3098c2ecf20Sopenharmony_ci int dma_trigger, int src_or_dst_synch); 3108c2ecf20Sopenharmony_ciextern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode); 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ciextern void omap_set_dma_src_params(int lch, int src_port, int src_amode, 3138c2ecf20Sopenharmony_ci unsigned long src_start, 3148c2ecf20Sopenharmony_ci int src_ei, int src_fi); 3158c2ecf20Sopenharmony_ciextern void omap_set_dma_src_data_pack(int lch, int enable); 3168c2ecf20Sopenharmony_ciextern void omap_set_dma_src_burst_mode(int lch, 3178c2ecf20Sopenharmony_ci enum omap_dma_burst_mode burst_mode); 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ciextern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode, 3208c2ecf20Sopenharmony_ci unsigned long dest_start, 3218c2ecf20Sopenharmony_ci int dst_ei, int dst_fi); 3228c2ecf20Sopenharmony_ciextern void omap_set_dma_dest_data_pack(int lch, int enable); 3238c2ecf20Sopenharmony_ciextern void omap_set_dma_dest_burst_mode(int lch, 3248c2ecf20Sopenharmony_ci enum omap_dma_burst_mode burst_mode); 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ciextern dma_addr_t omap_get_dma_src_pos(int lch); 3278c2ecf20Sopenharmony_ciextern dma_addr_t omap_get_dma_dst_pos(int lch); 3288c2ecf20Sopenharmony_ciextern int omap_get_dma_active_status(int lch); 3298c2ecf20Sopenharmony_ciextern int omap_dma_running(void); 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_ci#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP) 3328c2ecf20Sopenharmony_ci#include <mach/lcd_dma.h> 3338c2ecf20Sopenharmony_ci#else 3348c2ecf20Sopenharmony_cistatic inline int omap_lcd_dma_running(void) 3358c2ecf20Sopenharmony_ci{ 3368c2ecf20Sopenharmony_ci return 0; 3378c2ecf20Sopenharmony_ci} 3388c2ecf20Sopenharmony_ci#endif 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci#else /* CONFIG_ARCH_OMAP */ 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_cistatic inline struct omap_system_dma_plat_info *omap_get_plat_info(void) 3438c2ecf20Sopenharmony_ci{ 3448c2ecf20Sopenharmony_ci return NULL; 3458c2ecf20Sopenharmony_ci} 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_cistatic inline int omap_request_dma(int dev_id, const char *dev_name, 3488c2ecf20Sopenharmony_ci void (*callback)(int lch, u16 ch_status, void *data), 3498c2ecf20Sopenharmony_ci void *data, int *dma_ch) 3508c2ecf20Sopenharmony_ci{ 3518c2ecf20Sopenharmony_ci return -ENODEV; 3528c2ecf20Sopenharmony_ci} 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_cistatic inline void omap_free_dma(int ch) { } 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci#endif /* CONFIG_ARCH_OMAP */ 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci#endif /* __LINUX_OMAP_DMA_H */ 359