Path: blob/master/arch/arm/mach-msm/include/mach/dma.h
17602 views
/* linux/include/asm-arm/arch-msm/dma.h1*2* Copyright (C) 2007 Google, Inc.3*4* This software is licensed under the terms of the GNU General Public5* License version 2, as published by the Free Software Foundation, and6* may be copied, distributed, and modified under those terms.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13*/1415#ifndef __ASM_ARCH_MSM_DMA_H1617#include <linux/list.h>18#include <mach/msm_iomap.h>1920struct msm_dmov_errdata {21uint32_t flush[6];22};2324struct msm_dmov_cmd {25struct list_head list;26unsigned int cmdptr;27void (*complete_func)(struct msm_dmov_cmd *cmd,28unsigned int result,29struct msm_dmov_errdata *err);30void (*execute_func)(struct msm_dmov_cmd *cmd);31void *data;32};3334#ifndef CONFIG_ARCH_MSM8X6035void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd);36void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful);37int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr);38#else39static inline40void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd) { }41static inline42void msm_dmov_stop_cmd(unsigned id, struct msm_dmov_cmd *cmd, int graceful) { }43static inline44int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr) { return -EIO; }45#endif464748#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2))49#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2))50#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2))51#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2))5253#if defined(CONFIG_ARCH_MSM7X30)54#define DMOV_SD_AARM DMOV_SD255#else56#define DMOV_SD_AARM DMOV_SD357#endif5859#define DMOV_CMD_PTR(ch) DMOV_SD_AARM(0x000, ch)60#define DMOV_CMD_LIST (0 << 29) /* does not work */61#define DMOV_CMD_PTR_LIST (1 << 29) /* works */62#define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */63#define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */64#define DMOV_CMD_ADDR(addr) ((addr) >> 3)6566#define DMOV_RSLT(ch) DMOV_SD_AARM(0x040, ch)67#define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */68#define DMOV_RSLT_ERROR (1 << 3)69#define DMOV_RSLT_FLUSH (1 << 2)70#define DMOV_RSLT_DONE (1 << 1) /* top pointer done */71#define DMOV_RSLT_USER (1 << 0) /* command with FR force result */7273#define DMOV_FLUSH0(ch) DMOV_SD_AARM(0x080, ch)74#define DMOV_FLUSH1(ch) DMOV_SD_AARM(0x0C0, ch)75#define DMOV_FLUSH2(ch) DMOV_SD_AARM(0x100, ch)76#define DMOV_FLUSH3(ch) DMOV_SD_AARM(0x140, ch)77#define DMOV_FLUSH4(ch) DMOV_SD_AARM(0x180, ch)78#define DMOV_FLUSH5(ch) DMOV_SD_AARM(0x1C0, ch)7980#define DMOV_STATUS(ch) DMOV_SD_AARM(0x200, ch)81#define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29))82#define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3)83#define DMOV_STATUS_RSLT_VALID (1 << 1)84#define DMOV_STATUS_CMD_PTR_RDY (1 << 0)8586#define DMOV_ISR DMOV_SD_AARM(0x380, 0)8788#define DMOV_CONFIG(ch) DMOV_SD_AARM(0x300, ch)89#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2)90#define DMOV_CONFIG_FORCE_FLUSH_RSLT (1 << 1)91#define DMOV_CONFIG_IRQ_EN (1 << 0)9293/* channel assignments */9495#define DMOV_NAND_CHAN 796#define DMOV_NAND_CRCI_CMD 597#define DMOV_NAND_CRCI_DATA 49899#define DMOV_SDC1_CHAN 8100#define DMOV_SDC1_CRCI 6101102#define DMOV_SDC2_CHAN 8103#define DMOV_SDC2_CRCI 7104105#define DMOV_TSIF_CHAN 10106#define DMOV_TSIF_CRCI 10107108#define DMOV_USB_CHAN 11109110/* no client rate control ifc (eg, ram) */111#define DMOV_NONE_CRCI 0112113114/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover115* is going to walk a list of 32bit pointers as described below. Each116* pointer points to a *array* of dmov_s, etc structs. The last pointer117* in the list is marked with CMD_PTR_LP. The last struct in each array118* is marked with CMD_LC (see below).119*/120#define CMD_PTR_ADDR(addr) ((addr) >> 3)121#define CMD_PTR_LP (1 << 31) /* last pointer */122#define CMD_PTR_PT (3 << 29) /* ? */123124/* Single Item Mode */125typedef struct {126unsigned cmd;127unsigned src;128unsigned dst;129unsigned len;130} dmov_s;131132/* Scatter/Gather Mode */133typedef struct {134unsigned cmd;135unsigned src_dscr;136unsigned dst_dscr;137unsigned _reserved;138} dmov_sg;139140/* Box mode */141typedef struct {142uint32_t cmd;143uint32_t src_row_addr;144uint32_t dst_row_addr;145uint32_t src_dst_len;146uint32_t num_rows;147uint32_t row_offset;148} dmov_box;149150/* bits for the cmd field of the above structures */151152#define CMD_LC (1 << 31) /* last command */153#define CMD_FR (1 << 22) /* force result -- does not work? */154#define CMD_OCU (1 << 21) /* other channel unblock */155#define CMD_OCB (1 << 20) /* other channel block */156#define CMD_TCB (1 << 19) /* ? */157#define CMD_DAH (1 << 18) /* destination address hold -- does not work?*/158#define CMD_SAH (1 << 17) /* source address hold -- does not work? */159160#define CMD_MODE_SINGLE (0 << 0) /* dmov_s structure used */161#define CMD_MODE_SG (1 << 0) /* untested */162#define CMD_MODE_IND_SG (2 << 0) /* untested */163#define CMD_MODE_BOX (3 << 0) /* untested */164165#define CMD_DST_SWAP_BYTES (1 << 14) /* exchange each byte n with byte n+1 */166#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */167#define CMD_DST_SWAP_WORDS (1 << 16) /* exchange each word n with word n+1 */168169#define CMD_SRC_SWAP_BYTES (1 << 11) /* exchange each byte n with byte n+1 */170#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */171#define CMD_SRC_SWAP_WORDS (1 << 13) /* exchange each word n with word n+1 */172173#define CMD_DST_CRCI(n) (((n) & 15) << 7)174#define CMD_SRC_CRCI(n) (((n) & 15) << 3)175176#endif177178179