linux/include/linux/omap-dma.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_OMAP_DMA_H
#define __LINUX_OMAP_DMA_H
/*
 *  Legacy OMAP DMA handling defines and functions
 *
 *  NOTE: Do not use these any longer.
 *
 *  Use the generic dmaengine functions as defined in
 *  include/linux/dmaengine.h.
 *
 *  Copyright (C) 2003 Nokia Corporation
 *  Author: Juha Yrjölä <[email protected]>
 *
 */

#include <linux/platform_device.h>

#define INT_DMA_LCD

#define OMAP1_DMA_TOUT_IRQ
#define OMAP_DMA_DROP_IRQ
#define OMAP_DMA_HALF_IRQ
#define OMAP_DMA_FRAME_IRQ
#define OMAP_DMA_LAST_IRQ
#define OMAP_DMA_BLOCK_IRQ
#define OMAP1_DMA_SYNC_IRQ
#define OMAP2_DMA_PKT_IRQ
#define OMAP2_DMA_TRANS_ERR_IRQ
#define OMAP2_DMA_SECURE_ERR_IRQ
#define OMAP2_DMA_SUPERVISOR_ERR_IRQ
#define OMAP2_DMA_MISALIGNED_ERR_IRQ

#define OMAP_DMA_CCR_EN
#define OMAP_DMA_CCR_RD_ACTIVE
#define OMAP_DMA_CCR_WR_ACTIVE
#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC
#define OMAP_DMA_CCR_BUFFERING_DISABLE

#define OMAP_DMA_DATA_TYPE_S8
#define OMAP_DMA_DATA_TYPE_S16
#define OMAP_DMA_DATA_TYPE_S32

#define OMAP_DMA_SYNC_ELEMENT
#define OMAP_DMA_SYNC_FRAME
#define OMAP_DMA_SYNC_BLOCK
#define OMAP_DMA_SYNC_PACKET

#define OMAP_DMA_DST_SYNC_PREFETCH
#define OMAP_DMA_SRC_SYNC
#define OMAP_DMA_DST_SYNC

#define OMAP_DMA_PORT_EMIFF
#define OMAP_DMA_PORT_EMIFS
#define OMAP_DMA_PORT_OCP_T1
#define OMAP_DMA_PORT_TIPB
#define OMAP_DMA_PORT_OCP_T2
#define OMAP_DMA_PORT_MPUI

#define OMAP_DMA_AMODE_CONSTANT
#define OMAP_DMA_AMODE_POST_INC
#define OMAP_DMA_AMODE_SINGLE_IDX
#define OMAP_DMA_AMODE_DOUBLE_IDX

#define DMA_DEFAULT_FIFO_DEPTH
#define DMA_DEFAULT_ARB_RATE
/* Pass THREAD_RESERVE ORed with THREAD_FIFO for tparams */
#define DMA_THREAD_RESERVE_NORM
#define DMA_THREAD_RESERVE_ONET
#define DMA_THREAD_RESERVE_TWOT
#define DMA_THREAD_RESERVE_THREET
#define DMA_THREAD_FIFO_NONE
#define DMA_THREAD_FIFO_75
#define DMA_THREAD_FIFO_25
#define DMA_THREAD_FIFO_50

/* DMA4_OCP_SYSCONFIG bits */
#define DMA_SYSCONFIG_MIDLEMODE_MASK
#define DMA_SYSCONFIG_CLOCKACTIVITY_MASK
#define DMA_SYSCONFIG_EMUFREE
#define DMA_SYSCONFIG_SIDLEMODE_MASK
#define DMA_SYSCONFIG_SOFTRESET
#define DMA_SYSCONFIG_AUTOIDLE

#define DMA_SYSCONFIG_MIDLEMODE(n)
#define DMA_SYSCONFIG_SIDLEMODE(n)

#define DMA_IDLEMODE_SMARTIDLE
#define DMA_IDLEMODE_NO_IDLE
#define DMA_IDLEMODE_FORCE_IDLE

/* Chaining modes*/
#ifndef CONFIG_ARCH_OMAP1
#define OMAP_DMA_STATIC_CHAIN
#define OMAP_DMA_DYNAMIC_CHAIN
#define OMAP_DMA_CHAIN_ACTIVE
#define OMAP_DMA_CHAIN_INACTIVE
#endif

#define DMA_CH_PRIO_HIGH
#define DMA_CH_PRIO_LOW

/* Errata handling */
#define IS_DMA_ERRATA(id)
#define SET_DMA_ERRATA(id)

#define DMA_ERRATA_IFRAME_BUFFERING
#define DMA_ERRATA_PARALLEL_CHANNELS
#define DMA_ERRATA_i378
#define DMA_ERRATA_i541
#define DMA_ERRATA_i88
#define DMA_ERRATA_3_3
#define DMA_ROMCODE_BUG

/* Attributes for OMAP DMA Contrller */
#define DMA_LINKED_LCH
#define GLOBAL_PRIORITY
#define RESERVE_CHANNEL
#define IS_CSSA_32
#define IS_CDSA_32
#define IS_RW_PRIORITY
#define ENABLE_1510_MODE
#define SRC_PORT
#define DST_PORT
#define SRC_INDEX
#define DST_INDEX
#define IS_BURST_ONLY4
#define CLEAR_CSR_ON_READ
#define IS_WORD_16
#define ENABLE_16XX_MODE
#define HS_CHANNELS_RESERVED

/* Defines for DMA Capabilities */
#define DMA_HAS_TRANSPARENT_CAPS
#define DMA_HAS_CONSTANT_FILL_CAPS
#define DMA_HAS_DESCRIPTOR_CAPS

enum omap_reg_offsets {};

enum omap_dma_burst_mode {};

enum end_type {};

enum omap_dma_color_mode {};

enum omap_dma_write_mode {};

enum omap_dma_channel_mode {};

struct omap_dma_channel_params {};

struct omap_dma_lch {};

struct omap_dma_dev_attr {};

enum {};

struct omap_dma_reg {};

#define SDMA_FILTER_PARAM(hw_req)
struct dma_slave_map;

/* System DMA platform data structure */
struct omap_system_dma_plat_info {};

#ifdef CONFIG_ARCH_OMAP2PLUS
#define dma_omap2plus
#else
#define dma_omap2plus()
#endif
#define dma_omap1()
#define __dma_omap15xx(d)
#define __dma_omap16xx(d)
#define dma_omap15xx()
#define dma_omap16xx()

extern struct omap_system_dma_plat_info *omap_get_plat_info(void);

#if defined(CONFIG_ARCH_OMAP1)
extern void omap_set_dma_priority(int lch, int dst_port, int priority);
#else
static inline void omap_set_dma_priority(int lch, int dst_port, int priority)
{}
#endif

extern int omap_request_dma(int dev_id, const char *dev_name,
			void (*callback)(int lch, u16 ch_status, void *data),
			void *data, int *dma_ch);
extern void omap_free_dma(int ch);
#if IS_ENABLED(CONFIG_USB_OMAP)
extern void omap_disable_dma_irq(int ch, u16 irq_bits);
extern void omap_start_dma(int lch);
extern void omap_stop_dma(int lch);
extern void omap_set_dma_transfer_params(int lch, int data_type,
					 int elem_count, int frame_count,
					 int sync_mode,
					 int dma_trigger, int src_or_dst_synch);
extern void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode);

extern void omap_set_dma_src_params(int lch, int src_port, int src_amode,
				    unsigned long src_start,
				    int src_ei, int src_fi);
extern void omap_set_dma_src_data_pack(int lch, int enable);
extern void omap_set_dma_src_burst_mode(int lch,
					enum omap_dma_burst_mode burst_mode);

extern void omap_set_dma_dest_params(int lch, int dest_port, int dest_amode,
				     unsigned long dest_start,
				     int dst_ei, int dst_fi);
extern void omap_set_dma_dest_data_pack(int lch, int enable);
extern void omap_set_dma_dest_burst_mode(int lch,
					 enum omap_dma_burst_mode burst_mode);

extern dma_addr_t omap_get_dma_src_pos(int lch);
extern dma_addr_t omap_get_dma_dst_pos(int lch);
extern int omap_get_dma_active_status(int lch);
#endif

extern int omap_dma_running(void);

#if IS_ENABLED(CONFIG_FB_OMAP)
extern int omap_lcd_dma_running(void);
#else
static inline int omap_lcd_dma_running(void)
{}
#endif

#endif /* __LINUX_OMAP_DMA_H */