xref: /openbmc/linux/drivers/dma/ste_dma40_ll.h (revision 3cb645dc85a050c8a6b5c2cbdcbe4b8f39dba1b8)
18d318a50SLinus Walleij /*
2767a9675SJonas Aaberg  * Copyright (C) ST-Ericsson SA 2007-2010
3767a9675SJonas Aaberg  * Author: Per Friden <per.friden@stericsson.com> for ST-Ericsson SA
4767a9675SJonas Aaberg  * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson SA
58d318a50SLinus Walleij  * License terms: GNU General Public License (GPL) version 2
68d318a50SLinus Walleij  */
78d318a50SLinus Walleij #ifndef STE_DMA40_LL_H
88d318a50SLinus Walleij #define STE_DMA40_LL_H
98d318a50SLinus Walleij 
108d318a50SLinus Walleij #define D40_DREG_PCBASE		0x400
118d318a50SLinus Walleij #define D40_DREG_PCDELTA	(8 * 4)
128d318a50SLinus Walleij #define D40_LLI_ALIGN		16 /* LLI alignment must be 16 bytes. */
138d318a50SLinus Walleij 
14ef1872ecSLinus Walleij #define D40_LCPA_CHAN_SIZE 32
15ef1872ecSLinus Walleij #define D40_LCPA_CHAN_DST_DELTA 16
16ef1872ecSLinus Walleij 
178d318a50SLinus Walleij #define D40_TYPE_TO_GROUP(type) (type / 16)
188d318a50SLinus Walleij #define D40_TYPE_TO_EVENT(type) (type % 16)
197fb3e75eSNarayanan G #define D40_GROUP_SIZE 8
207fb3e75eSNarayanan G #define D40_PHYS_TO_GROUP(phys) ((phys & (D40_GROUP_SIZE - 1)) / 2)
218d318a50SLinus Walleij 
228d318a50SLinus Walleij /* Most bits of the CFG register are the same in log as in phy mode */
238d318a50SLinus Walleij #define D40_SREG_CFG_MST_POS		15
248d318a50SLinus Walleij #define D40_SREG_CFG_TIM_POS		14
258d318a50SLinus Walleij #define D40_SREG_CFG_EIM_POS		13
268d318a50SLinus Walleij #define D40_SREG_CFG_LOG_INCR_POS	12
278d318a50SLinus Walleij #define D40_SREG_CFG_PHY_PEN_POS	12
288d318a50SLinus Walleij #define D40_SREG_CFG_PSIZE_POS		10
298d318a50SLinus Walleij #define D40_SREG_CFG_ESIZE_POS		 8
308d318a50SLinus Walleij #define D40_SREG_CFG_PRI_POS		 7
318d318a50SLinus Walleij #define D40_SREG_CFG_LBE_POS		 6
328d318a50SLinus Walleij #define D40_SREG_CFG_LOG_GIM_POS	 5
338d318a50SLinus Walleij #define D40_SREG_CFG_LOG_MFU_POS	 4
348d318a50SLinus Walleij #define D40_SREG_CFG_PHY_TM_POS		 4
358d318a50SLinus Walleij #define D40_SREG_CFG_PHY_EVTL_POS	 0
368d318a50SLinus Walleij 
378d318a50SLinus Walleij 
388d318a50SLinus Walleij /* Standard channel parameters - basic mode (element register) */
398d318a50SLinus Walleij #define D40_SREG_ELEM_PHY_ECNT_POS	16
408d318a50SLinus Walleij #define D40_SREG_ELEM_PHY_EIDX_POS	 0
418d318a50SLinus Walleij 
428d318a50SLinus Walleij #define D40_SREG_ELEM_PHY_ECNT_MASK	(0xFFFF << D40_SREG_ELEM_PHY_ECNT_POS)
438d318a50SLinus Walleij 
448d318a50SLinus Walleij /* Standard channel parameters - basic mode (Link register) */
458d318a50SLinus Walleij #define D40_SREG_LNK_PHY_TCP_POS	0
468d318a50SLinus Walleij #define D40_SREG_LNK_PHY_LMP_POS	1
478d318a50SLinus Walleij #define D40_SREG_LNK_PHY_PRE_POS	2
488d318a50SLinus Walleij /*
498d318a50SLinus Walleij  * Source  destination link address. Contains the
508d318a50SLinus Walleij  * 29-bit byte word aligned address of the reload area.
518d318a50SLinus Walleij  */
528d318a50SLinus Walleij #define D40_SREG_LNK_PHYS_LNK_MASK	0xFFFFFFF8UL
538d318a50SLinus Walleij 
548d318a50SLinus Walleij /* Standard basic channel logical mode */
558d318a50SLinus Walleij 
568d318a50SLinus Walleij /* Element register */
578d318a50SLinus Walleij #define D40_SREG_ELEM_LOG_ECNT_POS	16
588d318a50SLinus Walleij #define D40_SREG_ELEM_LOG_LIDX_POS	 8
598d318a50SLinus Walleij #define D40_SREG_ELEM_LOG_LOS_POS	 1
608d318a50SLinus Walleij #define D40_SREG_ELEM_LOG_TCP_POS	 0
618d318a50SLinus Walleij 
628d318a50SLinus Walleij #define D40_SREG_ELEM_LOG_LIDX_MASK	(0xFF << D40_SREG_ELEM_LOG_LIDX_POS)
638d318a50SLinus Walleij 
648d318a50SLinus Walleij /* Link register */
658d318a50SLinus Walleij #define D40_EVENTLINE_POS(i)		(2 * i)
668d318a50SLinus Walleij #define D40_EVENTLINE_MASK(i)		(0x3 << D40_EVENTLINE_POS(i))
678d318a50SLinus Walleij 
688d318a50SLinus Walleij /* Standard basic channel logical params in memory */
698d318a50SLinus Walleij 
708d318a50SLinus Walleij /* LCSP0 */
718d318a50SLinus Walleij #define D40_MEM_LCSP0_ECNT_POS		16
728d318a50SLinus Walleij #define D40_MEM_LCSP0_SPTR_POS		 0
738d318a50SLinus Walleij 
748d318a50SLinus Walleij #define D40_MEM_LCSP0_ECNT_MASK		(0xFFFF << D40_MEM_LCSP0_ECNT_POS)
758d318a50SLinus Walleij #define D40_MEM_LCSP0_SPTR_MASK		(0xFFFF << D40_MEM_LCSP0_SPTR_POS)
768d318a50SLinus Walleij 
778d318a50SLinus Walleij /* LCSP1 */
788d318a50SLinus Walleij #define D40_MEM_LCSP1_SPTR_POS		16
798d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_MST_POS	15
808d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_TIM_POS	14
818d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_EIM_POS	13
828d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_INCR_POS	12
838d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_PSIZE_POS	10
848d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_ESIZE_POS	 8
858d318a50SLinus Walleij #define D40_MEM_LCSP1_SLOS_POS		 1
868d318a50SLinus Walleij #define D40_MEM_LCSP1_STCP_POS		 0
878d318a50SLinus Walleij 
888d318a50SLinus Walleij #define D40_MEM_LCSP1_SPTR_MASK		(0xFFFF << D40_MEM_LCSP1_SPTR_POS)
898d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_TIM_MASK	(0x1 << D40_MEM_LCSP1_SCFG_TIM_POS)
908d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_INCR_MASK	(0x1 << D40_MEM_LCSP1_SCFG_INCR_POS)
918d318a50SLinus Walleij #define D40_MEM_LCSP1_SCFG_PSIZE_MASK	(0x3 << D40_MEM_LCSP1_SCFG_PSIZE_POS)
928d318a50SLinus Walleij #define D40_MEM_LCSP1_SLOS_MASK		(0x7F << D40_MEM_LCSP1_SLOS_POS)
938d318a50SLinus Walleij #define D40_MEM_LCSP1_STCP_MASK		(0x1 << D40_MEM_LCSP1_STCP_POS)
948d318a50SLinus Walleij 
958d318a50SLinus Walleij /* LCSP2 */
968d318a50SLinus Walleij #define D40_MEM_LCSP2_ECNT_POS		16
978d318a50SLinus Walleij 
988d318a50SLinus Walleij #define D40_MEM_LCSP2_ECNT_MASK		(0xFFFF << D40_MEM_LCSP2_ECNT_POS)
998d318a50SLinus Walleij 
1008d318a50SLinus Walleij /* LCSP3 */
1018d318a50SLinus Walleij #define D40_MEM_LCSP3_DCFG_MST_POS	15
1028d318a50SLinus Walleij #define D40_MEM_LCSP3_DCFG_TIM_POS	14
1038d318a50SLinus Walleij #define D40_MEM_LCSP3_DCFG_EIM_POS	13
1048d318a50SLinus Walleij #define D40_MEM_LCSP3_DCFG_INCR_POS	12
1058d318a50SLinus Walleij #define D40_MEM_LCSP3_DCFG_PSIZE_POS	10
1068d318a50SLinus Walleij #define D40_MEM_LCSP3_DCFG_ESIZE_POS	 8
1078d318a50SLinus Walleij #define D40_MEM_LCSP3_DLOS_POS		 1
1088d318a50SLinus Walleij #define D40_MEM_LCSP3_DTCP_POS		 0
1098d318a50SLinus Walleij 
1108d318a50SLinus Walleij #define D40_MEM_LCSP3_DLOS_MASK		(0x7F << D40_MEM_LCSP3_DLOS_POS)
1118d318a50SLinus Walleij #define D40_MEM_LCSP3_DTCP_MASK		(0x1 << D40_MEM_LCSP3_DTCP_POS)
1128d318a50SLinus Walleij 
1138d318a50SLinus Walleij 
1148d318a50SLinus Walleij /* Standard channel parameter register offsets */
1158d318a50SLinus Walleij #define D40_CHAN_REG_SSCFG	0x00
1168d318a50SLinus Walleij #define D40_CHAN_REG_SSELT	0x04
1178d318a50SLinus Walleij #define D40_CHAN_REG_SSPTR	0x08
1188d318a50SLinus Walleij #define D40_CHAN_REG_SSLNK	0x0C
1198d318a50SLinus Walleij #define D40_CHAN_REG_SDCFG	0x10
1208d318a50SLinus Walleij #define D40_CHAN_REG_SDELT	0x14
1218d318a50SLinus Walleij #define D40_CHAN_REG_SDPTR	0x18
1228d318a50SLinus Walleij #define D40_CHAN_REG_SDLNK	0x1C
1238d318a50SLinus Walleij 
1248d318a50SLinus Walleij /* DMA Register Offsets */
1258d318a50SLinus Walleij #define D40_DREG_GCC		0x000
1267fb3e75eSNarayanan G #define D40_DREG_GCC_ENA	0x1
1277fb3e75eSNarayanan G /* This assumes that there are only 4 event groups */
128*3cb645dcSTong Liu #define D40_DREG_GCC_ENABLE_ALL	0x3ff01
1297fb3e75eSNarayanan G #define D40_DREG_GCC_EVTGRP_POS 8
1307fb3e75eSNarayanan G #define D40_DREG_GCC_SRC 0
1317fb3e75eSNarayanan G #define D40_DREG_GCC_DST 1
1327fb3e75eSNarayanan G #define D40_DREG_GCC_EVTGRP_ENA(x, y) \
1337fb3e75eSNarayanan G 	(1 << (D40_DREG_GCC_EVTGRP_POS + 2 * x + y))
1347fb3e75eSNarayanan G 
1358d318a50SLinus Walleij #define D40_DREG_PRTYP		0x004
1368d318a50SLinus Walleij #define D40_DREG_PRSME		0x008
1378d318a50SLinus Walleij #define D40_DREG_PRSMO		0x00C
1388d318a50SLinus Walleij #define D40_DREG_PRMSE		0x010
1398d318a50SLinus Walleij #define D40_DREG_PRMSO		0x014
1408d318a50SLinus Walleij #define D40_DREG_PRMOE		0x018
1418d318a50SLinus Walleij #define D40_DREG_PRMOO		0x01C
14220a5b6d0SRabin Vincent #define D40_DREG_PRMO_PCHAN_BASIC		0x1
14320a5b6d0SRabin Vincent #define D40_DREG_PRMO_PCHAN_MODULO		0x2
14420a5b6d0SRabin Vincent #define D40_DREG_PRMO_PCHAN_DOUBLE_DST		0x3
14520a5b6d0SRabin Vincent #define D40_DREG_PRMO_LCHAN_SRC_PHY_DST_LOG	0x1
14620a5b6d0SRabin Vincent #define D40_DREG_PRMO_LCHAN_SRC_LOG_DST_PHY	0x2
14720a5b6d0SRabin Vincent #define D40_DREG_PRMO_LCHAN_SRC_LOG_DST_LOG	0x3
14820a5b6d0SRabin Vincent 
1498d318a50SLinus Walleij #define D40_DREG_LCPA		0x020
1508d318a50SLinus Walleij #define D40_DREG_LCLA		0x024
151*3cb645dcSTong Liu 
152*3cb645dcSTong Liu #define D40_DREG_SSEG1		0x030
153*3cb645dcSTong Liu #define D40_DREG_SSEG2		0x034
154*3cb645dcSTong Liu #define D40_DREG_SSEG3		0x038
155*3cb645dcSTong Liu #define D40_DREG_SSEG4		0x03C
156*3cb645dcSTong Liu 
157*3cb645dcSTong Liu #define D40_DREG_SCEG1		0x040
158*3cb645dcSTong Liu #define D40_DREG_SCEG2		0x044
159*3cb645dcSTong Liu #define D40_DREG_SCEG3		0x048
160*3cb645dcSTong Liu #define D40_DREG_SCEG4		0x04C
161*3cb645dcSTong Liu 
1628d318a50SLinus Walleij #define D40_DREG_ACTIVE		0x050
1638d318a50SLinus Walleij #define D40_DREG_ACTIVO		0x054
164*3cb645dcSTong Liu #define D40_DREG_CIDMOD		0x058
165*3cb645dcSTong Liu #define D40_DREG_TCIDV		0x05C
1668d318a50SLinus Walleij #define D40_DREG_PCMIS		0x060
1678d318a50SLinus Walleij #define D40_DREG_PCICR		0x064
1688d318a50SLinus Walleij #define D40_DREG_PCTIS		0x068
1698d318a50SLinus Walleij #define D40_DREG_PCEIS		0x06C
170*3cb645dcSTong Liu 
171*3cb645dcSTong Liu #define D40_DREG_SPCMIS		0x070
172*3cb645dcSTong Liu #define D40_DREG_SPCICR		0x074
173*3cb645dcSTong Liu #define D40_DREG_SPCTIS		0x078
174*3cb645dcSTong Liu #define D40_DREG_SPCEIS		0x07C
175*3cb645dcSTong Liu 
1768d318a50SLinus Walleij #define D40_DREG_LCMIS0		0x080
1778d318a50SLinus Walleij #define D40_DREG_LCMIS1		0x084
1788d318a50SLinus Walleij #define D40_DREG_LCMIS2		0x088
1798d318a50SLinus Walleij #define D40_DREG_LCMIS3		0x08C
1808d318a50SLinus Walleij #define D40_DREG_LCICR0		0x090
1818d318a50SLinus Walleij #define D40_DREG_LCICR1		0x094
1828d318a50SLinus Walleij #define D40_DREG_LCICR2		0x098
1838d318a50SLinus Walleij #define D40_DREG_LCICR3		0x09C
1848d318a50SLinus Walleij #define D40_DREG_LCTIS0		0x0A0
1858d318a50SLinus Walleij #define D40_DREG_LCTIS1		0x0A4
1868d318a50SLinus Walleij #define D40_DREG_LCTIS2		0x0A8
1878d318a50SLinus Walleij #define D40_DREG_LCTIS3		0x0AC
1888d318a50SLinus Walleij #define D40_DREG_LCEIS0		0x0B0
1898d318a50SLinus Walleij #define D40_DREG_LCEIS1		0x0B4
1908d318a50SLinus Walleij #define D40_DREG_LCEIS2		0x0B8
1918d318a50SLinus Walleij #define D40_DREG_LCEIS3		0x0BC
192*3cb645dcSTong Liu 
193*3cb645dcSTong Liu #define D40_DREG_SLCMIS1	0x0C0
194*3cb645dcSTong Liu #define D40_DREG_SLCMIS2	0x0C4
195*3cb645dcSTong Liu #define D40_DREG_SLCMIS3	0x0C8
196*3cb645dcSTong Liu #define D40_DREG_SLCMIS4	0x0CC
197*3cb645dcSTong Liu 
198*3cb645dcSTong Liu #define D40_DREG_SLCICR1	0x0D0
199*3cb645dcSTong Liu #define D40_DREG_SLCICR2	0x0D4
200*3cb645dcSTong Liu #define D40_DREG_SLCICR3	0x0D8
201*3cb645dcSTong Liu #define D40_DREG_SLCICR4	0x0DC
202*3cb645dcSTong Liu 
203*3cb645dcSTong Liu #define D40_DREG_SLCTIS1	0x0E0
204*3cb645dcSTong Liu #define D40_DREG_SLCTIS2	0x0E4
205*3cb645dcSTong Liu #define D40_DREG_SLCTIS3	0x0E8
206*3cb645dcSTong Liu #define D40_DREG_SLCTIS4	0x0EC
207*3cb645dcSTong Liu 
208*3cb645dcSTong Liu #define D40_DREG_SLCEIS1	0x0F0
209*3cb645dcSTong Liu #define D40_DREG_SLCEIS2	0x0F4
210*3cb645dcSTong Liu #define D40_DREG_SLCEIS3	0x0F8
211*3cb645dcSTong Liu #define D40_DREG_SLCEIS4	0x0FC
212*3cb645dcSTong Liu 
213*3cb645dcSTong Liu #define D40_DREG_FSESS1		0x100
214*3cb645dcSTong Liu #define D40_DREG_FSESS2		0x104
215*3cb645dcSTong Liu 
216*3cb645dcSTong Liu #define D40_DREG_FSEBS1		0x108
217*3cb645dcSTong Liu #define D40_DREG_FSEBS2		0x10C
218*3cb645dcSTong Liu 
219ac2c0a38SRabin Vincent #define D40_DREG_PSEG1		0x110
220ac2c0a38SRabin Vincent #define D40_DREG_PSEG2		0x114
221ac2c0a38SRabin Vincent #define D40_DREG_PSEG3		0x118
222ac2c0a38SRabin Vincent #define D40_DREG_PSEG4		0x11C
223ac2c0a38SRabin Vincent #define D40_DREG_PCEG1		0x120
224ac2c0a38SRabin Vincent #define D40_DREG_PCEG2		0x124
225ac2c0a38SRabin Vincent #define D40_DREG_PCEG3		0x128
226ac2c0a38SRabin Vincent #define D40_DREG_PCEG4		0x12C
227ac2c0a38SRabin Vincent #define D40_DREG_RSEG1		0x130
228ac2c0a38SRabin Vincent #define D40_DREG_RSEG2		0x134
229ac2c0a38SRabin Vincent #define D40_DREG_RSEG3		0x138
230ac2c0a38SRabin Vincent #define D40_DREG_RSEG4		0x13C
231ac2c0a38SRabin Vincent #define D40_DREG_RCEG1		0x140
232ac2c0a38SRabin Vincent #define D40_DREG_RCEG2		0x144
233ac2c0a38SRabin Vincent #define D40_DREG_RCEG3		0x148
234ac2c0a38SRabin Vincent #define D40_DREG_RCEG4		0x14C
235*3cb645dcSTong Liu 
236*3cb645dcSTong Liu #define D40_DREG_PREFOT		0x15C
237*3cb645dcSTong Liu #define D40_DREG_EXTCFG		0x160
238*3cb645dcSTong Liu 
239*3cb645dcSTong Liu #define D40_DREG_CPSEG1		0x200
240*3cb645dcSTong Liu #define D40_DREG_CPSEG2		0x204
241*3cb645dcSTong Liu #define D40_DREG_CPSEG3		0x208
242*3cb645dcSTong Liu #define D40_DREG_CPSEG4		0x20C
243*3cb645dcSTong Liu #define D40_DREG_CPSEG5		0x210
244*3cb645dcSTong Liu 
245*3cb645dcSTong Liu #define D40_DREG_CPCEG1		0x220
246*3cb645dcSTong Liu #define D40_DREG_CPCEG2		0x224
247*3cb645dcSTong Liu #define D40_DREG_CPCEG3		0x228
248*3cb645dcSTong Liu #define D40_DREG_CPCEG4		0x22C
249*3cb645dcSTong Liu #define D40_DREG_CPCEG5		0x230
250*3cb645dcSTong Liu 
251*3cb645dcSTong Liu #define D40_DREG_CRSEG1		0x240
252*3cb645dcSTong Liu #define D40_DREG_CRSEG2		0x244
253*3cb645dcSTong Liu #define D40_DREG_CRSEG3		0x248
254*3cb645dcSTong Liu #define D40_DREG_CRSEG4		0x24C
255*3cb645dcSTong Liu #define D40_DREG_CRSEG5		0x250
256*3cb645dcSTong Liu 
257*3cb645dcSTong Liu #define D40_DREG_CRCEG1		0x260
258*3cb645dcSTong Liu #define D40_DREG_CRCEG2		0x264
259*3cb645dcSTong Liu #define D40_DREG_CRCEG3		0x268
260*3cb645dcSTong Liu #define D40_DREG_CRCEG4		0x26C
261*3cb645dcSTong Liu #define D40_DREG_CRCEG5		0x270
262*3cb645dcSTong Liu 
263*3cb645dcSTong Liu #define D40_DREG_CFSESS1	0x280
264*3cb645dcSTong Liu #define D40_DREG_CFSESS2	0x284
265*3cb645dcSTong Liu #define D40_DREG_CFSESS3	0x288
266*3cb645dcSTong Liu 
267*3cb645dcSTong Liu #define D40_DREG_CFSEBS1	0x290
268*3cb645dcSTong Liu #define D40_DREG_CFSEBS2	0x294
269*3cb645dcSTong Liu #define D40_DREG_CFSEBS3	0x298
270*3cb645dcSTong Liu 
271*3cb645dcSTong Liu #define D40_DREG_CLCMIS1	0x300
272*3cb645dcSTong Liu #define D40_DREG_CLCMIS2	0x304
273*3cb645dcSTong Liu #define D40_DREG_CLCMIS3	0x308
274*3cb645dcSTong Liu #define D40_DREG_CLCMIS4	0x30C
275*3cb645dcSTong Liu #define D40_DREG_CLCMIS5	0x310
276*3cb645dcSTong Liu 
277*3cb645dcSTong Liu #define D40_DREG_CLCICR1	0x320
278*3cb645dcSTong Liu #define D40_DREG_CLCICR2	0x324
279*3cb645dcSTong Liu #define D40_DREG_CLCICR3	0x328
280*3cb645dcSTong Liu #define D40_DREG_CLCICR4	0x32C
281*3cb645dcSTong Liu #define D40_DREG_CLCICR5	0x330
282*3cb645dcSTong Liu 
283*3cb645dcSTong Liu #define D40_DREG_CLCTIS1	0x340
284*3cb645dcSTong Liu #define D40_DREG_CLCTIS2	0x344
285*3cb645dcSTong Liu #define D40_DREG_CLCTIS3	0x348
286*3cb645dcSTong Liu #define D40_DREG_CLCTIS4	0x34C
287*3cb645dcSTong Liu #define D40_DREG_CLCTIS5	0x350
288*3cb645dcSTong Liu 
289*3cb645dcSTong Liu #define D40_DREG_CLCEIS1	0x360
290*3cb645dcSTong Liu #define D40_DREG_CLCEIS2	0x364
291*3cb645dcSTong Liu #define D40_DREG_CLCEIS3	0x368
292*3cb645dcSTong Liu #define D40_DREG_CLCEIS4	0x36C
293*3cb645dcSTong Liu #define D40_DREG_CLCEIS5	0x370
294*3cb645dcSTong Liu 
295*3cb645dcSTong Liu #define D40_DREG_CPCMIS		0x380
296*3cb645dcSTong Liu #define D40_DREG_CPCICR		0x384
297*3cb645dcSTong Liu #define D40_DREG_CPCTIS		0x388
298*3cb645dcSTong Liu #define D40_DREG_CPCEIS		0x38C
299*3cb645dcSTong Liu 
300*3cb645dcSTong Liu #define D40_DREG_SCCIDA1	0xE80
301*3cb645dcSTong Liu #define D40_DREG_SCCIDA2	0xE90
302*3cb645dcSTong Liu #define D40_DREG_SCCIDA3	0xEA0
303*3cb645dcSTong Liu #define D40_DREG_SCCIDA4	0xEB0
304*3cb645dcSTong Liu #define D40_DREG_SCCIDA5	0xEC0
305*3cb645dcSTong Liu 
306*3cb645dcSTong Liu #define D40_DREG_SCCIDB1	0xE84
307*3cb645dcSTong Liu #define D40_DREG_SCCIDB2	0xE94
308*3cb645dcSTong Liu #define D40_DREG_SCCIDB3	0xEA4
309*3cb645dcSTong Liu #define D40_DREG_SCCIDB4	0xEB4
310*3cb645dcSTong Liu #define D40_DREG_SCCIDB5	0xEC4
311*3cb645dcSTong Liu 
312*3cb645dcSTong Liu #define D40_DREG_PRSCCIDA	0xF80
313*3cb645dcSTong Liu #define D40_DREG_PRSCCIDB	0xF84
314*3cb645dcSTong Liu 
3158d318a50SLinus Walleij #define D40_DREG_STFU		0xFC8
3168d318a50SLinus Walleij #define D40_DREG_ICFG		0xFCC
3178d318a50SLinus Walleij #define D40_DREG_PERIPHID0	0xFE0
3188d318a50SLinus Walleij #define D40_DREG_PERIPHID1	0xFE4
3198d318a50SLinus Walleij #define D40_DREG_PERIPHID2	0xFE8
3208d318a50SLinus Walleij #define D40_DREG_PERIPHID3	0xFEC
3218d318a50SLinus Walleij #define D40_DREG_CELLID0	0xFF0
3228d318a50SLinus Walleij #define D40_DREG_CELLID1	0xFF4
3238d318a50SLinus Walleij #define D40_DREG_CELLID2	0xFF8
3248d318a50SLinus Walleij #define D40_DREG_CELLID3	0xFFC
3258d318a50SLinus Walleij 
3268d318a50SLinus Walleij /* LLI related structures */
3278d318a50SLinus Walleij 
3288d318a50SLinus Walleij /**
329d73111c6SMasanari Iida  * struct d40_phy_lli - The basic configuration register for each physical
3308d318a50SLinus Walleij  * channel.
3318d318a50SLinus Walleij  *
3328d318a50SLinus Walleij  * @reg_cfg: The configuration register.
3338d318a50SLinus Walleij  * @reg_elt: The element register.
3348d318a50SLinus Walleij  * @reg_ptr: The pointer register.
3358d318a50SLinus Walleij  * @reg_lnk: The link register.
3368d318a50SLinus Walleij  *
3378d318a50SLinus Walleij  * These registers are set up for both physical and logical transfers
3388d318a50SLinus Walleij  * Note that the bit in each register means differently in logical and
3398d318a50SLinus Walleij  * physical(standard) mode.
3408d318a50SLinus Walleij  *
3418d318a50SLinus Walleij  * This struct must be 16 bytes aligned, and only contain physical registers
3428d318a50SLinus Walleij  * since it will be directly accessed by the DMA.
3438d318a50SLinus Walleij  */
3448d318a50SLinus Walleij struct d40_phy_lli {
3458d318a50SLinus Walleij 	u32 reg_cfg;
3468d318a50SLinus Walleij 	u32 reg_elt;
3478d318a50SLinus Walleij 	u32 reg_ptr;
3488d318a50SLinus Walleij 	u32 reg_lnk;
3498d318a50SLinus Walleij };
3508d318a50SLinus Walleij 
3518d318a50SLinus Walleij /**
3528d318a50SLinus Walleij  * struct d40_phy_lli_bidir - struct for a transfer.
3538d318a50SLinus Walleij  *
3548d318a50SLinus Walleij  * @src: Register settings for src channel.
3558d318a50SLinus Walleij  * @dst: Register settings for dst channel.
3568d318a50SLinus Walleij  *
3578d318a50SLinus Walleij  * All DMA transfers have a source and a destination.
3588d318a50SLinus Walleij  */
3598d318a50SLinus Walleij 
3608d318a50SLinus Walleij struct d40_phy_lli_bidir {
3618d318a50SLinus Walleij 	struct d40_phy_lli	*src;
3628d318a50SLinus Walleij 	struct d40_phy_lli	*dst;
3638d318a50SLinus Walleij };
3648d318a50SLinus Walleij 
3658d318a50SLinus Walleij 
3668d318a50SLinus Walleij /**
3678d318a50SLinus Walleij  * struct d40_log_lli - logical lli configuration
3688d318a50SLinus Walleij  *
3698d318a50SLinus Walleij  * @lcsp02: Either maps to register lcsp0 if src or lcsp2 if dst.
3708d318a50SLinus Walleij  * @lcsp13: Either maps to register lcsp1 if src or lcsp3 if dst.
3718d318a50SLinus Walleij  *
3728d318a50SLinus Walleij  * This struct must be 8 bytes aligned since it will be accessed directy by
3738d318a50SLinus Walleij  * the DMA. Never add any none hw mapped registers to this struct.
3748d318a50SLinus Walleij  */
3758d318a50SLinus Walleij 
3768d318a50SLinus Walleij struct d40_log_lli {
3778d318a50SLinus Walleij 	u32 lcsp02;
3788d318a50SLinus Walleij 	u32 lcsp13;
3798d318a50SLinus Walleij };
3808d318a50SLinus Walleij 
3818d318a50SLinus Walleij /**
3828d318a50SLinus Walleij  * struct d40_log_lli_bidir - For both src and dst
3838d318a50SLinus Walleij  *
3848d318a50SLinus Walleij  * @src: pointer to src lli configuration.
3858d318a50SLinus Walleij  * @dst: pointer to dst lli configuration.
3868d318a50SLinus Walleij  *
3878d318a50SLinus Walleij  * You always have a src and a dst when doing DMA transfers.
3888d318a50SLinus Walleij  */
3898d318a50SLinus Walleij 
3908d318a50SLinus Walleij struct d40_log_lli_bidir {
3918d318a50SLinus Walleij 	struct d40_log_lli *src;
3928d318a50SLinus Walleij 	struct d40_log_lli *dst;
3938d318a50SLinus Walleij };
3948d318a50SLinus Walleij 
3958d318a50SLinus Walleij /**
3968d318a50SLinus Walleij  * struct d40_log_lli_full - LCPA layout
3978d318a50SLinus Walleij  *
3988d318a50SLinus Walleij  * @lcsp0: Logical Channel Standard Param 0 - Src.
3998d318a50SLinus Walleij  * @lcsp1: Logical Channel Standard Param 1 - Src.
4008d318a50SLinus Walleij  * @lcsp2: Logical Channel Standard Param 2 - Dst.
4018d318a50SLinus Walleij  * @lcsp3: Logical Channel Standard Param 3 - Dst.
4028d318a50SLinus Walleij  *
4038d318a50SLinus Walleij  * This struct maps to LCPA physical memory layout. Must map to
4048d318a50SLinus Walleij  * the hw.
4058d318a50SLinus Walleij  */
4068d318a50SLinus Walleij struct d40_log_lli_full {
4078d318a50SLinus Walleij 	u32 lcsp0;
4088d318a50SLinus Walleij 	u32 lcsp1;
4098d318a50SLinus Walleij 	u32 lcsp2;
4108d318a50SLinus Walleij 	u32 lcsp3;
4118d318a50SLinus Walleij };
4128d318a50SLinus Walleij 
4138d318a50SLinus Walleij /**
4148d318a50SLinus Walleij  * struct d40_def_lcsp - Default LCSP1 and LCSP3 settings
4158d318a50SLinus Walleij  *
4168d318a50SLinus Walleij  * @lcsp3: The default configuration for dst.
4178d318a50SLinus Walleij  * @lcsp1: The default configuration for src.
4188d318a50SLinus Walleij  */
4198d318a50SLinus Walleij struct d40_def_lcsp {
4208d318a50SLinus Walleij 	u32 lcsp3;
4218d318a50SLinus Walleij 	u32 lcsp1;
4228d318a50SLinus Walleij };
4238d318a50SLinus Walleij 
4248d318a50SLinus Walleij /* Physical channels */
4258d318a50SLinus Walleij 
4267f933bedSRabin Vincent enum d40_lli_flags {
4277f933bedSRabin Vincent 	LLI_ADDR_INC	= 1 << 0,
4287f933bedSRabin Vincent 	LLI_TERM_INT	= 1 << 1,
4290c842b55SRabin Vincent 	LLI_CYCLIC	= 1 << 2,
4300c842b55SRabin Vincent 	LLI_LAST_LINK	= 1 << 3,
4317f933bedSRabin Vincent };
4327f933bedSRabin Vincent 
4338d318a50SLinus Walleij void d40_phy_cfg(struct stedma40_chan_cfg *cfg,
434767a9675SJonas Aaberg 		 u32 *src_cfg,
435767a9675SJonas Aaberg 		 u32 *dst_cfg,
436767a9675SJonas Aaberg 		 bool is_log);
4378d318a50SLinus Walleij 
4388d318a50SLinus Walleij void d40_log_cfg(struct stedma40_chan_cfg *cfg,
439767a9675SJonas Aaberg 		 u32 *lcsp1,
440767a9675SJonas Aaberg 		 u32 *lcsp2);
4418d318a50SLinus Walleij 
4428d318a50SLinus Walleij int d40_phy_sg_to_lli(struct scatterlist *sg,
4438d318a50SLinus Walleij 		      int sg_len,
4448d318a50SLinus Walleij 		      dma_addr_t target,
4458d318a50SLinus Walleij 		      struct d40_phy_lli *lli,
4468d318a50SLinus Walleij 		      dma_addr_t lli_phys,
4478d318a50SLinus Walleij 		      u32 reg_cfg,
448cc31b6f7SRabin Vincent 		      struct stedma40_half_channel_info *info,
4490c842b55SRabin Vincent 		      struct stedma40_half_channel_info *otherinfo,
4500c842b55SRabin Vincent 		      unsigned long flags);
4518d318a50SLinus Walleij 
4528d318a50SLinus Walleij /* Logical channels */
4538d318a50SLinus Walleij 
454698e4732SJonas Aaberg int d40_log_sg_to_lli(struct scatterlist *sg,
4558d318a50SLinus Walleij 		      int sg_len,
4565ed04b85SRabin Vincent 		      dma_addr_t dev_addr,
4578d318a50SLinus Walleij 		      struct d40_log_lli *lli_sg,
4588d318a50SLinus Walleij 		      u32 lcsp13, /* src or dst*/
459d49278e3SPer Forlin 		      u32 data_width1, u32 data_width2);
460698e4732SJonas Aaberg 
461698e4732SJonas Aaberg void d40_log_lli_lcpa_write(struct d40_log_lli_full *lcpa,
462698e4732SJonas Aaberg 			    struct d40_log_lli *lli_dst,
463698e4732SJonas Aaberg 			    struct d40_log_lli *lli_src,
4640c842b55SRabin Vincent 			    int next, unsigned int flags);
465698e4732SJonas Aaberg 
466698e4732SJonas Aaberg void d40_log_lli_lcla_write(struct d40_log_lli *lcla,
467698e4732SJonas Aaberg 			    struct d40_log_lli *lli_dst,
468698e4732SJonas Aaberg 			    struct d40_log_lli *lli_src,
4690c842b55SRabin Vincent 			    int next, unsigned int flags);
4708d318a50SLinus Walleij 
4718d318a50SLinus Walleij #endif /* STE_DMA40_LLI_H */
472