162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/****************************************************************************/ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci/* 562306a36Sopenharmony_ci * mcfdma.h -- Coldfire internal DMA support defines. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * (C) Copyright 1999, Rob Scott (rscott@mtrob.ml.org) 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/****************************************************************************/ 1162306a36Sopenharmony_ci#ifndef mcfdma_h 1262306a36Sopenharmony_ci#define mcfdma_h 1362306a36Sopenharmony_ci/****************************************************************************/ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#if !defined(CONFIG_M5272) 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci/* 1862306a36Sopenharmony_ci * Define the DMA register set addresses. 1962306a36Sopenharmony_ci * Note: these are longword registers, use unsigned long as data type 2062306a36Sopenharmony_ci */ 2162306a36Sopenharmony_ci#define MCFDMA_SAR 0x00 /* DMA source address (r/w) */ 2262306a36Sopenharmony_ci#define MCFDMA_DAR 0x01 /* DMA destination adr (r/w) */ 2362306a36Sopenharmony_ci/* these are word registers, use unsigned short data type */ 2462306a36Sopenharmony_ci#define MCFDMA_DCR 0x04 /* DMA control reg (r/w) */ 2562306a36Sopenharmony_ci#define MCFDMA_BCR 0x06 /* DMA byte count reg (r/w) */ 2662306a36Sopenharmony_ci/* these are byte registers, use unsiged char data type */ 2762306a36Sopenharmony_ci#define MCFDMA_DSR 0x10 /* DMA status reg (r/w) */ 2862306a36Sopenharmony_ci#define MCFDMA_DIVR 0x14 /* DMA interrupt vec (r/w) */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci/* 3162306a36Sopenharmony_ci * Bit definitions for the DMA Control Register (DCR). 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci#define MCFDMA_DCR_INT 0x8000 /* Enable completion irq */ 3462306a36Sopenharmony_ci#define MCFDMA_DCR_EEXT 0x4000 /* Enable external DMA req */ 3562306a36Sopenharmony_ci#define MCFDMA_DCR_CS 0x2000 /* Enable cycle steal */ 3662306a36Sopenharmony_ci#define MCFDMA_DCR_AA 0x1000 /* Enable auto alignment */ 3762306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_MASK 0x0E00 /* Bandwidth ctl mask */ 3862306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_512 0x0200 /* Bandwidth: 512 Bytes */ 3962306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_1024 0x0400 /* Bandwidth: 1024 Bytes */ 4062306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_2048 0x0600 /* Bandwidth: 2048 Bytes */ 4162306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_4096 0x0800 /* Bandwidth: 4096 Bytes */ 4262306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_8192 0x0a00 /* Bandwidth: 8192 Bytes */ 4362306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_16384 0x0c00 /* Bandwidth: 16384 Bytes */ 4462306a36Sopenharmony_ci#define MCFDMA_DCR_BWC_32768 0x0e00 /* Bandwidth: 32768 Bytes */ 4562306a36Sopenharmony_ci#define MCFDMA_DCR_SAA 0x0100 /* Single Address Access */ 4662306a36Sopenharmony_ci#define MCFDMA_DCR_S_RW 0x0080 /* SAA read/write value */ 4762306a36Sopenharmony_ci#define MCFDMA_DCR_SINC 0x0040 /* Source addr inc enable */ 4862306a36Sopenharmony_ci#define MCFDMA_DCR_SSIZE_MASK 0x0030 /* Src xfer size */ 4962306a36Sopenharmony_ci#define MCFDMA_DCR_SSIZE_LONG 0x0000 /* Src xfer size, 00 = longw */ 5062306a36Sopenharmony_ci#define MCFDMA_DCR_SSIZE_BYTE 0x0010 /* Src xfer size, 01 = byte */ 5162306a36Sopenharmony_ci#define MCFDMA_DCR_SSIZE_WORD 0x0020 /* Src xfer size, 10 = word */ 5262306a36Sopenharmony_ci#define MCFDMA_DCR_SSIZE_LINE 0x0030 /* Src xfer size, 11 = line */ 5362306a36Sopenharmony_ci#define MCFDMA_DCR_DINC 0x0008 /* Dest addr inc enable */ 5462306a36Sopenharmony_ci#define MCFDMA_DCR_DSIZE_MASK 0x0006 /* Dest xfer size */ 5562306a36Sopenharmony_ci#define MCFDMA_DCR_DSIZE_LONG 0x0000 /* Dest xfer size, 00 = long */ 5662306a36Sopenharmony_ci#define MCFDMA_DCR_DSIZE_BYTE 0x0002 /* Dest xfer size, 01 = byte */ 5762306a36Sopenharmony_ci#define MCFDMA_DCR_DSIZE_WORD 0x0004 /* Dest xfer size, 10 = word */ 5862306a36Sopenharmony_ci#define MCFDMA_DCR_DSIZE_LINE 0x0006 /* Dest xfer size, 11 = line */ 5962306a36Sopenharmony_ci#define MCFDMA_DCR_START 0x0001 /* Start transfer */ 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci/* 6262306a36Sopenharmony_ci * Bit definitions for the DMA Status Register (DSR). 6362306a36Sopenharmony_ci */ 6462306a36Sopenharmony_ci#define MCFDMA_DSR_CE 0x40 /* Config error */ 6562306a36Sopenharmony_ci#define MCFDMA_DSR_BES 0x20 /* Bus Error on source */ 6662306a36Sopenharmony_ci#define MCFDMA_DSR_BED 0x10 /* Bus Error on dest */ 6762306a36Sopenharmony_ci#define MCFDMA_DSR_REQ 0x04 /* Requests remaining */ 6862306a36Sopenharmony_ci#define MCFDMA_DSR_BSY 0x02 /* Busy */ 6962306a36Sopenharmony_ci#define MCFDMA_DSR_DONE 0x01 /* DMA transfer complete */ 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#else /* This is an MCF5272 */ 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define MCFDMA_DMR 0x00 /* Mode Register (r/w) */ 7462306a36Sopenharmony_ci#define MCFDMA_DIR 0x03 /* Interrupt trigger register (r/w) */ 7562306a36Sopenharmony_ci#define MCFDMA_DSAR 0x03 /* Source Address register (r/w) */ 7662306a36Sopenharmony_ci#define MCFDMA_DDAR 0x04 /* Destination Address register (r/w) */ 7762306a36Sopenharmony_ci#define MCFDMA_DBCR 0x02 /* Byte Count Register (r/w) */ 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/* Bit definitions for the DMA Mode Register (DMR) */ 8062306a36Sopenharmony_ci#define MCFDMA_DMR_RESET 0x80000000L /* Reset bit */ 8162306a36Sopenharmony_ci#define MCFDMA_DMR_EN 0x40000000L /* DMA enable */ 8262306a36Sopenharmony_ci#define MCFDMA_DMR_RQM 0x000C0000L /* Request Mode Mask */ 8362306a36Sopenharmony_ci#define MCFDMA_DMR_RQM_DUAL 0x000C0000L /* Dual address mode, the only valid mode */ 8462306a36Sopenharmony_ci#define MCFDMA_DMR_DSTM 0x00002000L /* Destination addressing mask */ 8562306a36Sopenharmony_ci#define MCFDMA_DMR_DSTM_SA 0x00000000L /* Destination uses static addressing */ 8662306a36Sopenharmony_ci#define MCFDMA_DMR_DSTM_IA 0x00002000L /* Destination uses incremental addressing */ 8762306a36Sopenharmony_ci#define MCFDMA_DMR_DSTT_UD 0x00000400L /* Destination is user data */ 8862306a36Sopenharmony_ci#define MCFDMA_DMR_DSTT_UC 0x00000800L /* Destination is user code */ 8962306a36Sopenharmony_ci#define MCFDMA_DMR_DSTT_SD 0x00001400L /* Destination is supervisor data */ 9062306a36Sopenharmony_ci#define MCFDMA_DMR_DSTT_SC 0x00001800L /* Destination is supervisor code */ 9162306a36Sopenharmony_ci#define MCFDMA_DMR_DSTS_OFF 0x8 /* offset to the destination size bits */ 9262306a36Sopenharmony_ci#define MCFDMA_DMR_DSTS_LONG 0x00000000L /* Long destination size */ 9362306a36Sopenharmony_ci#define MCFDMA_DMR_DSTS_BYTE 0x00000100L /* Byte destination size */ 9462306a36Sopenharmony_ci#define MCFDMA_DMR_DSTS_WORD 0x00000200L /* Word destination size */ 9562306a36Sopenharmony_ci#define MCFDMA_DMR_DSTS_LINE 0x00000300L /* Line destination size */ 9662306a36Sopenharmony_ci#define MCFDMA_DMR_SRCM 0x00000020L /* Source addressing mask */ 9762306a36Sopenharmony_ci#define MCFDMA_DMR_SRCM_SA 0x00000000L /* Source uses static addressing */ 9862306a36Sopenharmony_ci#define MCFDMA_DMR_SRCM_IA 0x00000020L /* Source uses incremental addressing */ 9962306a36Sopenharmony_ci#define MCFDMA_DMR_SRCT_UD 0x00000004L /* Source is user data */ 10062306a36Sopenharmony_ci#define MCFDMA_DMR_SRCT_UC 0x00000008L /* Source is user code */ 10162306a36Sopenharmony_ci#define MCFDMA_DMR_SRCT_SD 0x00000014L /* Source is supervisor data */ 10262306a36Sopenharmony_ci#define MCFDMA_DMR_SRCT_SC 0x00000018L /* Source is supervisor code */ 10362306a36Sopenharmony_ci#define MCFDMA_DMR_SRCS_OFF 0x0 /* Offset to the source size bits */ 10462306a36Sopenharmony_ci#define MCFDMA_DMR_SRCS_LONG 0x00000000L /* Long source size */ 10562306a36Sopenharmony_ci#define MCFDMA_DMR_SRCS_BYTE 0x00000001L /* Byte source size */ 10662306a36Sopenharmony_ci#define MCFDMA_DMR_SRCS_WORD 0x00000002L /* Word source size */ 10762306a36Sopenharmony_ci#define MCFDMA_DMR_SRCS_LINE 0x00000003L /* Line source size */ 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci/* Bit definitions for the DMA interrupt register (DIR) */ 11062306a36Sopenharmony_ci#define MCFDMA_DIR_INVEN 0x1000 /* Invalid Combination interrupt enable */ 11162306a36Sopenharmony_ci#define MCFDMA_DIR_ASCEN 0x0800 /* Address Sequence Complete (Completion) interrupt enable */ 11262306a36Sopenharmony_ci#define MCFDMA_DIR_TEEN 0x0200 /* Transfer Error interrupt enable */ 11362306a36Sopenharmony_ci#define MCFDMA_DIR_TCEN 0x0100 /* Transfer Complete (a bus transfer, that is) interrupt enable */ 11462306a36Sopenharmony_ci#define MCFDMA_DIR_INV 0x0010 /* Invalid Combination */ 11562306a36Sopenharmony_ci#define MCFDMA_DIR_ASC 0x0008 /* Address Sequence Complete (DMA Completion) */ 11662306a36Sopenharmony_ci#define MCFDMA_DIR_TE 0x0002 /* Transfer Error */ 11762306a36Sopenharmony_ci#define MCFDMA_DIR_TC 0x0001 /* Transfer Complete */ 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#endif /* !defined(CONFIG_M5272) */ 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci/****************************************************************************/ 12262306a36Sopenharmony_ci#endif /* mcfdma_h */ 123