1 /*
2  * EDMA Internal Memory Map
3  *
4  * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
5  * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  */
9 
10 #ifndef __EDMA_H__
11 #define __EDMA_H__
12 
13 /*********************************************************************
14 * Enhanced DMA (EDMA)
15 *********************************************************************/
16 
17 /* eDMA module registers */
18 typedef struct edma_ctrl {
19 	u32 cr;			/* 0x00 Control Register */
20 	u32 es;			/* 0x04 Error Status Register */
21 	u16 res1[3];		/* 0x08 - 0x0D */
22 	u16 erq;		/* 0x0E Enable Request Register */
23 	u16 res2[3];		/* 0x10 - 0x15 */
24 	u16 eei;		/* 0x16 Enable Error Interrupt Request */
25 	u8 serq;		/* 0x18 Set Enable Request */
26 	u8 cerq;		/* 0x19 Clear Enable Request */
27 	u8 seei;		/* 0x1A Set En Error Interrupt Request */
28 	u8 ceei;		/* 0x1B Clear En Error Interrupt Request */
29 	u8 cint;		/* 0x1C Clear Interrupt Enable */
30 	u8 cerr;		/* 0x1D Clear Error */
31 	u8 ssrt;		/* 0x1E Set START Bit */
32 	u8 cdne;		/* 0x1F Clear DONE Status Bit */
33 	u16 res3[3];		/* 0x20 - 0x25 */
34 	u16 intr;		/* 0x26 Interrupt Request */
35 	u16 res4[3];		/* 0x28 - 0x2D */
36 	u16 err;		/* 0x2E Error Register */
37 	u32 res5[52];		/* 0x30 - 0xFF */
38 	u8 dchpri0;		/* 0x100 Channel 0 Priority */
39 	u8 dchpri1;		/* 0x101 Channel 1 Priority */
40 	u8 dchpri2;		/* 0x102 Channel 2 Priority */
41 	u8 dchpri3;		/* 0x103 Channel 3 Priority */
42 	u8 dchpri4;		/* 0x104 Channel 4 Priority */
43 	u8 dchpri5;		/* 0x105 Channel 5 Priority */
44 	u8 dchpri6;		/* 0x106 Channel 6 Priority */
45 	u8 dchpri7;		/* 0x107 Channel 7 Priority */
46 	u8 dchpri8;		/* 0x108 Channel 8 Priority */
47 	u8 dchpri9;		/* 0x109 Channel 9 Priority */
48 	u8 dchpri10;		/* 0x110 Channel 10 Priority */
49 	u8 dchpri11;		/* 0x111 Channel 11 Priority */
50 	u8 dchpri12;		/* 0x112 Channel 12 Priority */
51 	u8 dchpri13;		/* 0x113 Channel 13 Priority */
52 	u8 dchpri14;		/* 0x114 Channel 14 Priority */
53 	u8 dchpri15;		/* 0x115 Channel 15 Priority */
54 } edma_t;
55 
56 /* TCD - eDMA*/
57 typedef struct tcd_ctrl {
58 	u32 saddr;		/* 0x00 Source Address */
59 	u16 attr;		/* 0x04 Transfer Attributes */
60 	u16 soff;		/* 0x06 Signed Source Address Offset */
61 	u32 nbytes;		/* 0x08 Minor Byte Count */
62 	u32 slast;		/* 0x0C Last Source Address Adjustment */
63 	u32 daddr;		/* 0x10 Destination address */
64 	u16 citer;		/* 0x14 Cur Minor Loop Link, Major Loop Cnt */
65 	u16 doff;		/* 0x16 Signed Destination Address Offset */
66 	u32 dlast_sga;		/* 0x18 Last Dest Adr Adj/Scatter Gather Adr */
67 	u16 biter;		/* 0x1C Minor Loop Lnk, Major Loop Cnt */
68 	u16 csr;		/* 0x1E Control and Status */
69 } tcd_st;
70 
71 typedef struct tcd_multiple {
72 	tcd_st tcd[16];
73 } tcd_t;
74 
75 /* Bit definitions and macros for EPPAR */
76 #define EPORT_EPPAR_EPPA1(x)		(((x)&0x0003)<<2)
77 #define EPORT_EPPAR_EPPA2(x)		(((x)&0x0003)<<4)
78 #define EPORT_EPPAR_EPPA3(x)		(((x)&0x0003)<<6)
79 #define EPORT_EPPAR_EPPA4(x)		(((x)&0x0003)<<8)
80 #define EPORT_EPPAR_EPPA5(x)		(((x)&0x0003)<<10)
81 #define EPORT_EPPAR_EPPA6(x)		(((x)&0x0003)<<12)
82 #define EPORT_EPPAR_EPPA7(x)		(((x)&0x0003)<<14)
83 #define EPORT_EPPAR_LEVEL		(0)
84 #define EPORT_EPPAR_RISING		(1)
85 #define EPORT_EPPAR_FALLING		(2)
86 #define EPORT_EPPAR_BOTH		(3)
87 #define EPORT_EPPAR_EPPA7_LEVEL		(0x0000)
88 #define EPORT_EPPAR_EPPA7_RISING	(0x4000)
89 #define EPORT_EPPAR_EPPA7_FALLING	(0x8000)
90 #define EPORT_EPPAR_EPPA7_BOTH		(0xC000)
91 #define EPORT_EPPAR_EPPA6_LEVEL		(0x0000)
92 #define EPORT_EPPAR_EPPA6_RISING	(0x1000)
93 #define EPORT_EPPAR_EPPA6_FALLING	(0x2000)
94 #define EPORT_EPPAR_EPPA6_BOTH		(0x3000)
95 #define EPORT_EPPAR_EPPA5_LEVEL		(0x0000)
96 #define EPORT_EPPAR_EPPA5_RISING	(0x0400)
97 #define EPORT_EPPAR_EPPA5_FALLING	(0x0800)
98 #define EPORT_EPPAR_EPPA5_BOTH		(0x0C00)
99 #define EPORT_EPPAR_EPPA4_LEVEL		(0x0000)
100 #define EPORT_EPPAR_EPPA4_RISING	(0x0100)
101 #define EPORT_EPPAR_EPPA4_FALLING	(0x0200)
102 #define EPORT_EPPAR_EPPA4_BOTH		(0x0300)
103 #define EPORT_EPPAR_EPPA3_LEVEL		(0x0000)
104 #define EPORT_EPPAR_EPPA3_RISING	(0x0040)
105 #define EPORT_EPPAR_EPPA3_FALLING	(0x0080)
106 #define EPORT_EPPAR_EPPA3_BOTH		(0x00C0)
107 #define EPORT_EPPAR_EPPA2_LEVEL		(0x0000)
108 #define EPORT_EPPAR_EPPA2_RISING	(0x0010)
109 #define EPORT_EPPAR_EPPA2_FALLING	(0x0020)
110 #define EPORT_EPPAR_EPPA2_BOTH		(0x0030)
111 #define EPORT_EPPAR_EPPA1_LEVEL		(0x0000)
112 #define EPORT_EPPAR_EPPA1_RISING	(0x0004)
113 #define EPORT_EPPAR_EPPA1_FALLING	(0x0008)
114 #define EPORT_EPPAR_EPPA1_BOTH		(0x000C)
115 
116 /* Bit definitions and macros for EPDDR */
117 #define EPORT_EPDDR_EPDD1		(0x02)
118 #define EPORT_EPDDR_EPDD2		(0x04)
119 #define EPORT_EPDDR_EPDD3		(0x08)
120 #define EPORT_EPDDR_EPDD4		(0x10)
121 #define EPORT_EPDDR_EPDD5		(0x20)
122 #define EPORT_EPDDR_EPDD6		(0x40)
123 #define EPORT_EPDDR_EPDD7		(0x80)
124 
125 /* Bit definitions and macros for EPIER */
126 #define EPORT_EPIER_EPIE1		(0x02)
127 #define EPORT_EPIER_EPIE2		(0x04)
128 #define EPORT_EPIER_EPIE3		(0x08)
129 #define EPORT_EPIER_EPIE4		(0x10)
130 #define EPORT_EPIER_EPIE5		(0x20)
131 #define EPORT_EPIER_EPIE6		(0x40)
132 #define EPORT_EPIER_EPIE7		(0x80)
133 
134 /* Bit definitions and macros for EPDR */
135 #define EPORT_EPDR_EPD1			(0x02)
136 #define EPORT_EPDR_EPD2			(0x04)
137 #define EPORT_EPDR_EPD3			(0x08)
138 #define EPORT_EPDR_EPD4			(0x10)
139 #define EPORT_EPDR_EPD5			(0x20)
140 #define EPORT_EPDR_EPD6			(0x40)
141 #define EPORT_EPDR_EPD7			(0x80)
142 
143 /* Bit definitions and macros for EPPDR */
144 #define EPORT_EPPDR_EPPD1		(0x02)
145 #define EPORT_EPPDR_EPPD2		(0x04)
146 #define EPORT_EPPDR_EPPD3		(0x08)
147 #define EPORT_EPPDR_EPPD4		(0x10)
148 #define EPORT_EPPDR_EPPD5		(0x20)
149 #define EPORT_EPPDR_EPPD6		(0x40)
150 #define EPORT_EPPDR_EPPD7		(0x80)
151 
152 /* Bit definitions and macros for EPFR */
153 #define EPORT_EPFR_EPF1			(0x02)
154 #define EPORT_EPFR_EPF2			(0x04)
155 #define EPORT_EPFR_EPF3			(0x08)
156 #define EPORT_EPFR_EPF4			(0x10)
157 #define EPORT_EPFR_EPF5			(0x20)
158 #define EPORT_EPFR_EPF6			(0x40)
159 #define EPORT_EPFR_EPF7			(0x80)
160 
161 #endif					/* __EDMA_H__ */
162