1*af873fceSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 28d318a50SLinus Walleij /* 3767a9675SJonas Aaberg * Copyright (C) ST-Ericsson SA 2007-2010 4767a9675SJonas Aaberg * Author: Per Friden <per.friden@stericsson.com> for ST-Ericsson SA 5767a9675SJonas Aaberg * Author: Jonas Aaberg <jonas.aberg@stericsson.com> for ST-Ericsson SA 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 */ 1283cb645dcSTong 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 1513cb645dcSTong Liu 1523cb645dcSTong Liu #define D40_DREG_SSEG1 0x030 1533cb645dcSTong Liu #define D40_DREG_SSEG2 0x034 1543cb645dcSTong Liu #define D40_DREG_SSEG3 0x038 1553cb645dcSTong Liu #define D40_DREG_SSEG4 0x03C 1563cb645dcSTong Liu 1573cb645dcSTong Liu #define D40_DREG_SCEG1 0x040 1583cb645dcSTong Liu #define D40_DREG_SCEG2 0x044 1593cb645dcSTong Liu #define D40_DREG_SCEG3 0x048 1603cb645dcSTong Liu #define D40_DREG_SCEG4 0x04C 1613cb645dcSTong Liu 1628d318a50SLinus Walleij #define D40_DREG_ACTIVE 0x050 1638d318a50SLinus Walleij #define D40_DREG_ACTIVO 0x054 1643cb645dcSTong Liu #define D40_DREG_CIDMOD 0x058 1653cb645dcSTong 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 1703cb645dcSTong Liu 1713cb645dcSTong Liu #define D40_DREG_SPCMIS 0x070 1723cb645dcSTong Liu #define D40_DREG_SPCICR 0x074 1733cb645dcSTong Liu #define D40_DREG_SPCTIS 0x078 1743cb645dcSTong Liu #define D40_DREG_SPCEIS 0x07C 1753cb645dcSTong 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 1923cb645dcSTong Liu 1933cb645dcSTong Liu #define D40_DREG_SLCMIS1 0x0C0 1943cb645dcSTong Liu #define D40_DREG_SLCMIS2 0x0C4 1953cb645dcSTong Liu #define D40_DREG_SLCMIS3 0x0C8 1963cb645dcSTong Liu #define D40_DREG_SLCMIS4 0x0CC 1973cb645dcSTong Liu 1983cb645dcSTong Liu #define D40_DREG_SLCICR1 0x0D0 1993cb645dcSTong Liu #define D40_DREG_SLCICR2 0x0D4 2003cb645dcSTong Liu #define D40_DREG_SLCICR3 0x0D8 2013cb645dcSTong Liu #define D40_DREG_SLCICR4 0x0DC 2023cb645dcSTong Liu 2033cb645dcSTong Liu #define D40_DREG_SLCTIS1 0x0E0 2043cb645dcSTong Liu #define D40_DREG_SLCTIS2 0x0E4 2053cb645dcSTong Liu #define D40_DREG_SLCTIS3 0x0E8 2063cb645dcSTong Liu #define D40_DREG_SLCTIS4 0x0EC 2073cb645dcSTong Liu 2083cb645dcSTong Liu #define D40_DREG_SLCEIS1 0x0F0 2093cb645dcSTong Liu #define D40_DREG_SLCEIS2 0x0F4 2103cb645dcSTong Liu #define D40_DREG_SLCEIS3 0x0F8 2113cb645dcSTong Liu #define D40_DREG_SLCEIS4 0x0FC 2123cb645dcSTong Liu 2133cb645dcSTong Liu #define D40_DREG_FSESS1 0x100 2143cb645dcSTong Liu #define D40_DREG_FSESS2 0x104 2153cb645dcSTong Liu 2163cb645dcSTong Liu #define D40_DREG_FSEBS1 0x108 2173cb645dcSTong Liu #define D40_DREG_FSEBS2 0x10C 2183cb645dcSTong 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 2353cb645dcSTong Liu 2363cb645dcSTong Liu #define D40_DREG_PREFOT 0x15C 2373cb645dcSTong Liu #define D40_DREG_EXTCFG 0x160 2383cb645dcSTong Liu 2393cb645dcSTong Liu #define D40_DREG_CPSEG1 0x200 2403cb645dcSTong Liu #define D40_DREG_CPSEG2 0x204 2413cb645dcSTong Liu #define D40_DREG_CPSEG3 0x208 2423cb645dcSTong Liu #define D40_DREG_CPSEG4 0x20C 2433cb645dcSTong Liu #define D40_DREG_CPSEG5 0x210 2443cb645dcSTong Liu 2453cb645dcSTong Liu #define D40_DREG_CPCEG1 0x220 2463cb645dcSTong Liu #define D40_DREG_CPCEG2 0x224 2473cb645dcSTong Liu #define D40_DREG_CPCEG3 0x228 2483cb645dcSTong Liu #define D40_DREG_CPCEG4 0x22C 2493cb645dcSTong Liu #define D40_DREG_CPCEG5 0x230 2503cb645dcSTong Liu 2513cb645dcSTong Liu #define D40_DREG_CRSEG1 0x240 2523cb645dcSTong Liu #define D40_DREG_CRSEG2 0x244 2533cb645dcSTong Liu #define D40_DREG_CRSEG3 0x248 2543cb645dcSTong Liu #define D40_DREG_CRSEG4 0x24C 2553cb645dcSTong Liu #define D40_DREG_CRSEG5 0x250 2563cb645dcSTong Liu 2573cb645dcSTong Liu #define D40_DREG_CRCEG1 0x260 2583cb645dcSTong Liu #define D40_DREG_CRCEG2 0x264 2593cb645dcSTong Liu #define D40_DREG_CRCEG3 0x268 2603cb645dcSTong Liu #define D40_DREG_CRCEG4 0x26C 2613cb645dcSTong Liu #define D40_DREG_CRCEG5 0x270 2623cb645dcSTong Liu 2633cb645dcSTong Liu #define D40_DREG_CFSESS1 0x280 2643cb645dcSTong Liu #define D40_DREG_CFSESS2 0x284 2653cb645dcSTong Liu #define D40_DREG_CFSESS3 0x288 2663cb645dcSTong Liu 2673cb645dcSTong Liu #define D40_DREG_CFSEBS1 0x290 2683cb645dcSTong Liu #define D40_DREG_CFSEBS2 0x294 2693cb645dcSTong Liu #define D40_DREG_CFSEBS3 0x298 2703cb645dcSTong Liu 2713cb645dcSTong Liu #define D40_DREG_CLCMIS1 0x300 2723cb645dcSTong Liu #define D40_DREG_CLCMIS2 0x304 2733cb645dcSTong Liu #define D40_DREG_CLCMIS3 0x308 2743cb645dcSTong Liu #define D40_DREG_CLCMIS4 0x30C 2753cb645dcSTong Liu #define D40_DREG_CLCMIS5 0x310 2763cb645dcSTong Liu 2773cb645dcSTong Liu #define D40_DREG_CLCICR1 0x320 2783cb645dcSTong Liu #define D40_DREG_CLCICR2 0x324 2793cb645dcSTong Liu #define D40_DREG_CLCICR3 0x328 2803cb645dcSTong Liu #define D40_DREG_CLCICR4 0x32C 2813cb645dcSTong Liu #define D40_DREG_CLCICR5 0x330 2823cb645dcSTong Liu 2833cb645dcSTong Liu #define D40_DREG_CLCTIS1 0x340 2843cb645dcSTong Liu #define D40_DREG_CLCTIS2 0x344 2853cb645dcSTong Liu #define D40_DREG_CLCTIS3 0x348 2863cb645dcSTong Liu #define D40_DREG_CLCTIS4 0x34C 2873cb645dcSTong Liu #define D40_DREG_CLCTIS5 0x350 2883cb645dcSTong Liu 2893cb645dcSTong Liu #define D40_DREG_CLCEIS1 0x360 2903cb645dcSTong Liu #define D40_DREG_CLCEIS2 0x364 2913cb645dcSTong Liu #define D40_DREG_CLCEIS3 0x368 2923cb645dcSTong Liu #define D40_DREG_CLCEIS4 0x36C 2933cb645dcSTong Liu #define D40_DREG_CLCEIS5 0x370 2943cb645dcSTong Liu 2953cb645dcSTong Liu #define D40_DREG_CPCMIS 0x380 2963cb645dcSTong Liu #define D40_DREG_CPCICR 0x384 2973cb645dcSTong Liu #define D40_DREG_CPCTIS 0x388 2983cb645dcSTong Liu #define D40_DREG_CPCEIS 0x38C 2993cb645dcSTong Liu 3003cb645dcSTong Liu #define D40_DREG_SCCIDA1 0xE80 3013cb645dcSTong Liu #define D40_DREG_SCCIDA2 0xE90 3023cb645dcSTong Liu #define D40_DREG_SCCIDA3 0xEA0 3033cb645dcSTong Liu #define D40_DREG_SCCIDA4 0xEB0 3043cb645dcSTong Liu #define D40_DREG_SCCIDA5 0xEC0 3053cb645dcSTong Liu 3063cb645dcSTong Liu #define D40_DREG_SCCIDB1 0xE84 3073cb645dcSTong Liu #define D40_DREG_SCCIDB2 0xE94 3083cb645dcSTong Liu #define D40_DREG_SCCIDB3 0xEA4 3093cb645dcSTong Liu #define D40_DREG_SCCIDB4 0xEB4 3103cb645dcSTong Liu #define D40_DREG_SCCIDB5 0xEC4 3113cb645dcSTong Liu 3123cb645dcSTong Liu #define D40_DREG_PRSCCIDA 0xF80 3133cb645dcSTong Liu #define D40_DREG_PRSCCIDB 0xF84 3143cb645dcSTong 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, 43557e65ad7SLee Jones u32 *dst_cfg); 4368d318a50SLinus Walleij 4378d318a50SLinus Walleij void d40_log_cfg(struct stedma40_chan_cfg *cfg, 438767a9675SJonas Aaberg u32 *lcsp1, 439767a9675SJonas Aaberg u32 *lcsp2); 4408d318a50SLinus Walleij 4418d318a50SLinus Walleij int d40_phy_sg_to_lli(struct scatterlist *sg, 4428d318a50SLinus Walleij int sg_len, 4438d318a50SLinus Walleij dma_addr_t target, 4448d318a50SLinus Walleij struct d40_phy_lli *lli, 4458d318a50SLinus Walleij dma_addr_t lli_phys, 4468d318a50SLinus Walleij u32 reg_cfg, 447cc31b6f7SRabin Vincent struct stedma40_half_channel_info *info, 4480c842b55SRabin Vincent struct stedma40_half_channel_info *otherinfo, 4490c842b55SRabin Vincent unsigned long flags); 4508d318a50SLinus Walleij 4518d318a50SLinus Walleij /* Logical channels */ 4528d318a50SLinus Walleij 453698e4732SJonas Aaberg int d40_log_sg_to_lli(struct scatterlist *sg, 4548d318a50SLinus Walleij int sg_len, 4555ed04b85SRabin Vincent dma_addr_t dev_addr, 4568d318a50SLinus Walleij struct d40_log_lli *lli_sg, 4578d318a50SLinus Walleij u32 lcsp13, /* src or dst*/ 458d49278e3SPer Forlin u32 data_width1, u32 data_width2); 459698e4732SJonas Aaberg 460698e4732SJonas Aaberg void d40_log_lli_lcpa_write(struct d40_log_lli_full *lcpa, 461698e4732SJonas Aaberg struct d40_log_lli *lli_dst, 462698e4732SJonas Aaberg struct d40_log_lli *lli_src, 4630c842b55SRabin Vincent int next, unsigned int flags); 464698e4732SJonas Aaberg 465698e4732SJonas Aaberg void d40_log_lli_lcla_write(struct d40_log_lli *lcla, 466698e4732SJonas Aaberg struct d40_log_lli *lli_dst, 467698e4732SJonas Aaberg struct d40_log_lli *lli_src, 4680c842b55SRabin Vincent int next, unsigned int flags); 4698d318a50SLinus Walleij 4708d318a50SLinus Walleij #endif /* STE_DMA40_LLI_H */ 471