18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2006-2008 PA Semi, Inc 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Hardware register layout and descriptor formats for the on-board 68c2ecf20Sopenharmony_ci * DMA engine on PA Semi PWRficient. Used by ethernet, function and security 78c2ecf20Sopenharmony_ci * drivers. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef ASM_PASEMI_DMA_H 118c2ecf20Sopenharmony_ci#define ASM_PASEMI_DMA_H 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* status register layout in IOB region, at 0xfb800000 */ 148c2ecf20Sopenharmony_cistruct pasdma_status { 158c2ecf20Sopenharmony_ci u64 rx_sta[64]; /* RX channel status */ 168c2ecf20Sopenharmony_ci u64 tx_sta[20]; /* TX channel status */ 178c2ecf20Sopenharmony_ci}; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* All these registers live in the PCI configuration space for the DMA PCI 218c2ecf20Sopenharmony_ci * device. Use the normal PCI config access functions for them. 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_cienum { 248c2ecf20Sopenharmony_ci PAS_DMA_CAP_TXCH = 0x44, /* Transmit Channel Info */ 258c2ecf20Sopenharmony_ci PAS_DMA_CAP_RXCH = 0x48, /* Transmit Channel Info */ 268c2ecf20Sopenharmony_ci PAS_DMA_CAP_IFI = 0x4c, /* Interface Info */ 278c2ecf20Sopenharmony_ci PAS_DMA_COM_TXCMD = 0x100, /* Transmit Command Register */ 288c2ecf20Sopenharmony_ci PAS_DMA_COM_TXSTA = 0x104, /* Transmit Status Register */ 298c2ecf20Sopenharmony_ci PAS_DMA_COM_RXCMD = 0x108, /* Receive Command Register */ 308c2ecf20Sopenharmony_ci PAS_DMA_COM_RXSTA = 0x10c, /* Receive Status Register */ 318c2ecf20Sopenharmony_ci PAS_DMA_COM_CFG = 0x114, /* Common config reg */ 328c2ecf20Sopenharmony_ci PAS_DMA_TXF_SFLG0 = 0x140, /* Set flags */ 338c2ecf20Sopenharmony_ci PAS_DMA_TXF_SFLG1 = 0x144, /* Set flags */ 348c2ecf20Sopenharmony_ci PAS_DMA_TXF_CFLG0 = 0x148, /* Set flags */ 358c2ecf20Sopenharmony_ci PAS_DMA_TXF_CFLG1 = 0x14c, /* Set flags */ 368c2ecf20Sopenharmony_ci}; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_TXCH_TCHN_M 0x00ff0000 /* # of TX channels */ 408c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_TXCH_TCHN_S 16 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_RXCH_RCHN_M 0x00ff0000 /* # of RX channels */ 438c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_RXCH_RCHN_S 16 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_IFI_IOFF_M 0xff000000 /* Cfg reg for intf pointers */ 468c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_IFI_IOFF_S 24 478c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_IFI_NIN_M 0x00ff0000 /* # of interfaces */ 488c2ecf20Sopenharmony_ci#define PAS_DMA_CAP_IFI_NIN_S 16 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define PAS_DMA_COM_TXCMD_EN 0x00000001 /* enable */ 518c2ecf20Sopenharmony_ci#define PAS_DMA_COM_TXSTA_ACT 0x00000001 /* active */ 528c2ecf20Sopenharmony_ci#define PAS_DMA_COM_RXCMD_EN 0x00000001 /* enable */ 538c2ecf20Sopenharmony_ci#define PAS_DMA_COM_RXSTA_ACT 0x00000001 /* active */ 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* Per-interface and per-channel registers */ 578c2ecf20Sopenharmony_ci#define _PAS_DMA_RXINT_STRIDE 0x20 588c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA(i) (0x200+(i)*_PAS_DMA_RXINT_STRIDE) 598c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_EN 0x00000001 608c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_ST 0x00000002 618c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_MBT 0x00000008 628c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_MDR 0x00000010 638c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_MOO 0x00000020 648c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_MBP 0x00000040 658c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_BT 0x00000800 668c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_DR 0x00001000 678c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_OO 0x00002000 688c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_BP 0x00004000 698c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_TB 0x00008000 708c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_ACT 0x00010000 718c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_DROPS_M 0xfffe0000 728c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_RCMDSTA_DROPS_S 17 738c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG(i) (0x204+(i)*_PAS_DMA_RXINT_STRIDE) 748c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_RBP 0x80000000 758c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_ITRR 0x40000000 768c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_DHL_M 0x07000000 778c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_DHL_S 24 788c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_DHL(x) (((x) << PAS_DMA_RXINT_CFG_DHL_S) & \ 798c2ecf20Sopenharmony_ci PAS_DMA_RXINT_CFG_DHL_M) 808c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_ITR 0x00400000 818c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_LW 0x00200000 828c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_L2 0x00100000 838c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_HEN 0x00080000 848c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_WIF 0x00000002 858c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_CFG_WIL 0x00000001 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_INCR(i) (0x210+(i)*_PAS_DMA_RXINT_STRIDE) 888c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_INCR_INCR_M 0x0000ffff 898c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_INCR_INCR_S 0 908c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_INCR_INCR(x) ((x) & 0x0000ffff) 918c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEL(i) (0x218+(i)*_PAS_DMA_RXINT_STRIDE) 928c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEL_BRBL(x) ((x) & ~0x3f) 938c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEU(i) (0x21c+(i)*_PAS_DMA_RXINT_STRIDE) 948c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEU_BRBH(x) ((x) & 0xfff) 958c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEU_SIZ_M 0x3fff0000 /* # of cache lines worth of buffer ring */ 968c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEU_SIZ_S 16 /* 0 = 16K */ 978c2ecf20Sopenharmony_ci#define PAS_DMA_RXINT_BASEU_SIZ(x) (((x) << PAS_DMA_RXINT_BASEU_SIZ_S) & \ 988c2ecf20Sopenharmony_ci PAS_DMA_RXINT_BASEU_SIZ_M) 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_STRIDE 0x20 /* Size per channel */ 1028c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_TCMDSTA 0x300 /* Command / Status */ 1038c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_CFG 0x304 /* Configuration */ 1048c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_DSCRBU 0x308 /* Descriptor BU Allocation */ 1058c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_INCR 0x310 /* Descriptor increment */ 1068c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_CNT 0x314 /* Descriptor count/offset */ 1078c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_BASEL 0x318 /* Descriptor ring base (low) */ 1088c2ecf20Sopenharmony_ci#define _PAS_DMA_TXCHAN_BASEU 0x31c /* (high) */ 1098c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA(c) (0x300+(c)*_PAS_DMA_TXCHAN_STRIDE) 1108c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_EN 0x00000001 /* Enabled */ 1118c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_ST 0x00000002 /* Stop interface */ 1128c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_ACT 0x00010000 /* Active */ 1138c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_SZ 0x00000800 1148c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_DB 0x00000400 1158c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_DE 0x00000200 1168c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_TCMDSTA_DA 0x00000100 1178c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG(c) (0x304+(c)*_PAS_DMA_TXCHAN_STRIDE) 1188c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TY_IFACE 0x00000000 /* Type = interface */ 1198c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TY_COPY 0x00000001 /* Type = copy only */ 1208c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TY_FUNC 0x00000002 /* Type = function */ 1218c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TY_XOR 0x00000003 /* Type = xor only */ 1228c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TATTR_M 0x0000003c 1238c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TATTR_S 2 1248c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TATTR(x) (((x) << PAS_DMA_TXCHAN_CFG_TATTR_S) & \ 1258c2ecf20Sopenharmony_ci PAS_DMA_TXCHAN_CFG_TATTR_M) 1268c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_LPDQ 0x00000800 1278c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_LPSQ 0x00000400 1288c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_WT_M 0x000003c0 1298c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_WT_S 6 1308c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_WT(x) (((x) << PAS_DMA_TXCHAN_CFG_WT_S) & \ 1318c2ecf20Sopenharmony_ci PAS_DMA_TXCHAN_CFG_WT_M) 1328c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TRD 0x00010000 /* translate data */ 1338c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_TRR 0x00008000 /* translate rings */ 1348c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_UP 0x00004000 /* update tx descr when sent */ 1358c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_CL 0x00002000 /* Clean last line */ 1368c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_CFG_CF 0x00001000 /* Clean first line */ 1378c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_INCR(c) (0x310+(c)*_PAS_DMA_TXCHAN_STRIDE) 1388c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEL(c) (0x318+(c)*_PAS_DMA_TXCHAN_STRIDE) 1398c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEL_BRBL_M 0xffffffc0 1408c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEL_BRBL_S 0 1418c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEL_BRBL(x) (((x) << PAS_DMA_TXCHAN_BASEL_BRBL_S) & \ 1428c2ecf20Sopenharmony_ci PAS_DMA_TXCHAN_BASEL_BRBL_M) 1438c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU(c) (0x31c+(c)*_PAS_DMA_TXCHAN_STRIDE) 1448c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU_BRBH_M 0x00000fff 1458c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU_BRBH_S 0 1468c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU_BRBH(x) (((x) << PAS_DMA_TXCHAN_BASEU_BRBH_S) & \ 1478c2ecf20Sopenharmony_ci PAS_DMA_TXCHAN_BASEU_BRBH_M) 1488c2ecf20Sopenharmony_ci/* # of cache lines worth of buffer ring */ 1498c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU_SIZ_M 0x3fff0000 1508c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU_SIZ_S 16 /* 0 = 16K */ 1518c2ecf20Sopenharmony_ci#define PAS_DMA_TXCHAN_BASEU_SIZ(x) (((x) << PAS_DMA_TXCHAN_BASEU_SIZ_S) & \ 1528c2ecf20Sopenharmony_ci PAS_DMA_TXCHAN_BASEU_SIZ_M) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_STRIDE 0x20 /* Size per channel */ 1558c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_CCMDSTA 0x800 /* Command / Status */ 1568c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_CFG 0x804 /* Configuration */ 1578c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_INCR 0x810 /* Descriptor increment */ 1588c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_CNT 0x814 /* Descriptor count/offset */ 1598c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_BASEL 0x818 /* Descriptor ring base (low) */ 1608c2ecf20Sopenharmony_ci#define _PAS_DMA_RXCHAN_BASEU 0x81c /* (high) */ 1618c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA(c) (0x800+(c)*_PAS_DMA_RXCHAN_STRIDE) 1628c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_EN 0x00000001 /* Enabled */ 1638c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_ST 0x00000002 /* Stop interface */ 1648c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_ACT 0x00010000 /* Active */ 1658c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_DU 0x00020000 1668c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_OD 0x00002000 1678c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_FD 0x00001000 1688c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CCMDSTA_DT 0x00000800 1698c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CFG(c) (0x804+(c)*_PAS_DMA_RXCHAN_STRIDE) 1708c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CFG_CTR 0x00000400 1718c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CFG_HBU_M 0x00000380 1728c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CFG_HBU_S 7 1738c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_CFG_HBU(x) (((x) << PAS_DMA_RXCHAN_CFG_HBU_S) & \ 1748c2ecf20Sopenharmony_ci PAS_DMA_RXCHAN_CFG_HBU_M) 1758c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_INCR(c) (0x810+(c)*_PAS_DMA_RXCHAN_STRIDE) 1768c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEL(c) (0x818+(c)*_PAS_DMA_RXCHAN_STRIDE) 1778c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEL_BRBL_M 0xffffffc0 1788c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEL_BRBL_S 0 1798c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEL_BRBL(x) (((x) << PAS_DMA_RXCHAN_BASEL_BRBL_S) & \ 1808c2ecf20Sopenharmony_ci PAS_DMA_RXCHAN_BASEL_BRBL_M) 1818c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU(c) (0x81c+(c)*_PAS_DMA_RXCHAN_STRIDE) 1828c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU_BRBH_M 0x00000fff 1838c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU_BRBH_S 0 1848c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU_BRBH(x) (((x) << PAS_DMA_RXCHAN_BASEU_BRBH_S) & \ 1858c2ecf20Sopenharmony_ci PAS_DMA_RXCHAN_BASEU_BRBH_M) 1868c2ecf20Sopenharmony_ci/* # of cache lines worth of buffer ring */ 1878c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU_SIZ_M 0x3fff0000 1888c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU_SIZ_S 16 /* 0 = 16K */ 1898c2ecf20Sopenharmony_ci#define PAS_DMA_RXCHAN_BASEU_SIZ(x) (((x) << PAS_DMA_RXCHAN_BASEU_SIZ_S) & \ 1908c2ecf20Sopenharmony_ci PAS_DMA_RXCHAN_BASEU_SIZ_M) 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci#define PAS_STATUS_PCNT_M 0x000000000000ffffull 1938c2ecf20Sopenharmony_ci#define PAS_STATUS_PCNT_S 0 1948c2ecf20Sopenharmony_ci#define PAS_STATUS_DCNT_M 0x00000000ffff0000ull 1958c2ecf20Sopenharmony_ci#define PAS_STATUS_DCNT_S 16 1968c2ecf20Sopenharmony_ci#define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull 1978c2ecf20Sopenharmony_ci#define PAS_STATUS_BPCNT_S 32 1988c2ecf20Sopenharmony_ci#define PAS_STATUS_CAUSE_M 0xf000000000000000ull 1998c2ecf20Sopenharmony_ci#define PAS_STATUS_TIMER 0x1000000000000000ull 2008c2ecf20Sopenharmony_ci#define PAS_STATUS_ERROR 0x2000000000000000ull 2018c2ecf20Sopenharmony_ci#define PAS_STATUS_SOFT 0x4000000000000000ull 2028c2ecf20Sopenharmony_ci#define PAS_STATUS_INT 0x8000000000000000ull 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci#define PAS_IOB_COM_PKTHDRCNT 0x120 2058c2ecf20Sopenharmony_ci#define PAS_IOB_COM_PKTHDRCNT_PKTHDR1_M 0x0fff0000 2068c2ecf20Sopenharmony_ci#define PAS_IOB_COM_PKTHDRCNT_PKTHDR1_S 16 2078c2ecf20Sopenharmony_ci#define PAS_IOB_COM_PKTHDRCNT_PKTHDR0_M 0x00000fff 2088c2ecf20Sopenharmony_ci#define PAS_IOB_COM_PKTHDRCNT_PKTHDR0_S 0 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_CFG(i) (0x1100 + (i)*4) 2118c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_CFG_CNTTH_M 0x00000fff 2128c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_CFG_CNTTH_S 0 2138c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_CFG_CNTTH(x) (((x) << PAS_IOB_DMA_RXCH_CFG_CNTTH_S) & \ 2148c2ecf20Sopenharmony_ci PAS_IOB_DMA_RXCH_CFG_CNTTH_M) 2158c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_CFG(i) (0x1200 + (i)*4) 2168c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_CFG_CNTTH_M 0x00000fff 2178c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_CFG_CNTTH_S 0 2188c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_CFG_CNTTH(x) (((x) << PAS_IOB_DMA_TXCH_CFG_CNTTH_S) & \ 2198c2ecf20Sopenharmony_ci PAS_IOB_DMA_TXCH_CFG_CNTTH_M) 2208c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_STAT(i) (0x1300 + (i)*4) 2218c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_STAT_INTGEN 0x00001000 2228c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_STAT_CNTDEL_M 0x00000fff 2238c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_STAT_CNTDEL_S 0 2248c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_STAT_CNTDEL(x) (((x) << PAS_IOB_DMA_RXCH_STAT_CNTDEL_S) &\ 2258c2ecf20Sopenharmony_ci PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) 2268c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_STAT(i) (0x1400 + (i)*4) 2278c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_STAT_INTGEN 0x00001000 2288c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_STAT_CNTDEL_M 0x00000fff 2298c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_STAT_CNTDEL_S 0 2308c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_STAT_CNTDEL(x) (((x) << PAS_IOB_DMA_TXCH_STAT_CNTDEL_S) &\ 2318c2ecf20Sopenharmony_ci PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) 2328c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4) 2338c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000 2348c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_PCNT_S 16 2358c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \ 2368c2ecf20Sopenharmony_ci PAS_IOB_DMA_RXCH_RESET_PCNT_M) 2378c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020 2388c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_DCNTRST 0x00000010 2398c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_TINTC 0x00000008 2408c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_DINTC 0x00000004 2418c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_SINTC 0x00000002 2428c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001 2438c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4) 2448c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000 2458c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_PCNT_S 16 2468c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \ 2478c2ecf20Sopenharmony_ci PAS_IOB_DMA_TXCH_RESET_PCNT_M) 2488c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020 2498c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_DCNTRST 0x00000010 2508c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_TINTC 0x00000008 2518c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_DINTC 0x00000004 2528c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_SINTC 0x00000002 2538c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_TXCH_RESET_PINTC 0x00000001 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_COM_TIMEOUTCFG 0x1700 2568c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_M 0x00ffffff 2578c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_S 0 2588c2ecf20Sopenharmony_ci#define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(x) (((x) << PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_S) & \ 2598c2ecf20Sopenharmony_ci PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_M) 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci/* Transmit descriptor fields */ 2628c2ecf20Sopenharmony_ci#define XCT_MACTX_T 0x8000000000000000ull 2638c2ecf20Sopenharmony_ci#define XCT_MACTX_ST 0x4000000000000000ull 2648c2ecf20Sopenharmony_ci#define XCT_MACTX_NORES 0x0000000000000000ull 2658c2ecf20Sopenharmony_ci#define XCT_MACTX_8BRES 0x1000000000000000ull 2668c2ecf20Sopenharmony_ci#define XCT_MACTX_24BRES 0x2000000000000000ull 2678c2ecf20Sopenharmony_ci#define XCT_MACTX_40BRES 0x3000000000000000ull 2688c2ecf20Sopenharmony_ci#define XCT_MACTX_I 0x0800000000000000ull 2698c2ecf20Sopenharmony_ci#define XCT_MACTX_O 0x0400000000000000ull 2708c2ecf20Sopenharmony_ci#define XCT_MACTX_E 0x0200000000000000ull 2718c2ecf20Sopenharmony_ci#define XCT_MACTX_VLAN_M 0x0180000000000000ull 2728c2ecf20Sopenharmony_ci#define XCT_MACTX_VLAN_NOP 0x0000000000000000ull 2738c2ecf20Sopenharmony_ci#define XCT_MACTX_VLAN_REMOVE 0x0080000000000000ull 2748c2ecf20Sopenharmony_ci#define XCT_MACTX_VLAN_INSERT 0x0100000000000000ull 2758c2ecf20Sopenharmony_ci#define XCT_MACTX_VLAN_REPLACE 0x0180000000000000ull 2768c2ecf20Sopenharmony_ci#define XCT_MACTX_CRC_M 0x0060000000000000ull 2778c2ecf20Sopenharmony_ci#define XCT_MACTX_CRC_NOP 0x0000000000000000ull 2788c2ecf20Sopenharmony_ci#define XCT_MACTX_CRC_INSERT 0x0020000000000000ull 2798c2ecf20Sopenharmony_ci#define XCT_MACTX_CRC_PAD 0x0040000000000000ull 2808c2ecf20Sopenharmony_ci#define XCT_MACTX_CRC_REPLACE 0x0060000000000000ull 2818c2ecf20Sopenharmony_ci#define XCT_MACTX_SS 0x0010000000000000ull 2828c2ecf20Sopenharmony_ci#define XCT_MACTX_LLEN_M 0x00007fff00000000ull 2838c2ecf20Sopenharmony_ci#define XCT_MACTX_LLEN_S 32ull 2848c2ecf20Sopenharmony_ci#define XCT_MACTX_LLEN(x) ((((long)(x)) << XCT_MACTX_LLEN_S) & \ 2858c2ecf20Sopenharmony_ci XCT_MACTX_LLEN_M) 2868c2ecf20Sopenharmony_ci#define XCT_MACTX_IPH_M 0x00000000f8000000ull 2878c2ecf20Sopenharmony_ci#define XCT_MACTX_IPH_S 27ull 2888c2ecf20Sopenharmony_ci#define XCT_MACTX_IPH(x) ((((long)(x)) << XCT_MACTX_IPH_S) & \ 2898c2ecf20Sopenharmony_ci XCT_MACTX_IPH_M) 2908c2ecf20Sopenharmony_ci#define XCT_MACTX_IPO_M 0x0000000007c00000ull 2918c2ecf20Sopenharmony_ci#define XCT_MACTX_IPO_S 22ull 2928c2ecf20Sopenharmony_ci#define XCT_MACTX_IPO(x) ((((long)(x)) << XCT_MACTX_IPO_S) & \ 2938c2ecf20Sopenharmony_ci XCT_MACTX_IPO_M) 2948c2ecf20Sopenharmony_ci#define XCT_MACTX_CSUM_M 0x0000000000000060ull 2958c2ecf20Sopenharmony_ci#define XCT_MACTX_CSUM_NOP 0x0000000000000000ull 2968c2ecf20Sopenharmony_ci#define XCT_MACTX_CSUM_TCP 0x0000000000000040ull 2978c2ecf20Sopenharmony_ci#define XCT_MACTX_CSUM_UDP 0x0000000000000060ull 2988c2ecf20Sopenharmony_ci#define XCT_MACTX_V6 0x0000000000000010ull 2998c2ecf20Sopenharmony_ci#define XCT_MACTX_C 0x0000000000000004ull 3008c2ecf20Sopenharmony_ci#define XCT_MACTX_AL2 0x0000000000000002ull 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci/* Receive descriptor fields */ 3038c2ecf20Sopenharmony_ci#define XCT_MACRX_T 0x8000000000000000ull 3048c2ecf20Sopenharmony_ci#define XCT_MACRX_ST 0x4000000000000000ull 3058c2ecf20Sopenharmony_ci#define XCT_MACRX_RR_M 0x3000000000000000ull 3068c2ecf20Sopenharmony_ci#define XCT_MACRX_RR_NORES 0x0000000000000000ull 3078c2ecf20Sopenharmony_ci#define XCT_MACRX_RR_8BRES 0x1000000000000000ull 3088c2ecf20Sopenharmony_ci#define XCT_MACRX_O 0x0400000000000000ull 3098c2ecf20Sopenharmony_ci#define XCT_MACRX_E 0x0200000000000000ull 3108c2ecf20Sopenharmony_ci#define XCT_MACRX_FF 0x0100000000000000ull 3118c2ecf20Sopenharmony_ci#define XCT_MACRX_PF 0x0080000000000000ull 3128c2ecf20Sopenharmony_ci#define XCT_MACRX_OB 0x0040000000000000ull 3138c2ecf20Sopenharmony_ci#define XCT_MACRX_OD 0x0020000000000000ull 3148c2ecf20Sopenharmony_ci#define XCT_MACRX_FS 0x0010000000000000ull 3158c2ecf20Sopenharmony_ci#define XCT_MACRX_NB_M 0x000fc00000000000ull 3168c2ecf20Sopenharmony_ci#define XCT_MACRX_NB_S 46ULL 3178c2ecf20Sopenharmony_ci#define XCT_MACRX_NB(x) ((((long)(x)) << XCT_MACRX_NB_S) & \ 3188c2ecf20Sopenharmony_ci XCT_MACRX_NB_M) 3198c2ecf20Sopenharmony_ci#define XCT_MACRX_LLEN_M 0x00003fff00000000ull 3208c2ecf20Sopenharmony_ci#define XCT_MACRX_LLEN_S 32ULL 3218c2ecf20Sopenharmony_ci#define XCT_MACRX_LLEN(x) ((((long)(x)) << XCT_MACRX_LLEN_S) & \ 3228c2ecf20Sopenharmony_ci XCT_MACRX_LLEN_M) 3238c2ecf20Sopenharmony_ci#define XCT_MACRX_CRC 0x0000000080000000ull 3248c2ecf20Sopenharmony_ci#define XCT_MACRX_LEN_M 0x0000000060000000ull 3258c2ecf20Sopenharmony_ci#define XCT_MACRX_LEN_TOOSHORT 0x0000000020000000ull 3268c2ecf20Sopenharmony_ci#define XCT_MACRX_LEN_BELOWMIN 0x0000000040000000ull 3278c2ecf20Sopenharmony_ci#define XCT_MACRX_LEN_TRUNC 0x0000000060000000ull 3288c2ecf20Sopenharmony_ci#define XCT_MACRX_CAST_M 0x0000000018000000ull 3298c2ecf20Sopenharmony_ci#define XCT_MACRX_CAST_UNI 0x0000000000000000ull 3308c2ecf20Sopenharmony_ci#define XCT_MACRX_CAST_MULTI 0x0000000008000000ull 3318c2ecf20Sopenharmony_ci#define XCT_MACRX_CAST_BROAD 0x0000000010000000ull 3328c2ecf20Sopenharmony_ci#define XCT_MACRX_CAST_PAUSE 0x0000000018000000ull 3338c2ecf20Sopenharmony_ci#define XCT_MACRX_VLC_M 0x0000000006000000ull 3348c2ecf20Sopenharmony_ci#define XCT_MACRX_FM 0x0000000001000000ull 3358c2ecf20Sopenharmony_ci#define XCT_MACRX_HTY_M 0x0000000000c00000ull 3368c2ecf20Sopenharmony_ci#define XCT_MACRX_HTY_IPV4_OK 0x0000000000000000ull 3378c2ecf20Sopenharmony_ci#define XCT_MACRX_HTY_IPV6 0x0000000000400000ull 3388c2ecf20Sopenharmony_ci#define XCT_MACRX_HTY_IPV4_BAD 0x0000000000800000ull 3398c2ecf20Sopenharmony_ci#define XCT_MACRX_HTY_NONIP 0x0000000000c00000ull 3408c2ecf20Sopenharmony_ci#define XCT_MACRX_IPP_M 0x00000000003f0000ull 3418c2ecf20Sopenharmony_ci#define XCT_MACRX_IPP_S 16 3428c2ecf20Sopenharmony_ci#define XCT_MACRX_CSUM_M 0x000000000000ffffull 3438c2ecf20Sopenharmony_ci#define XCT_MACRX_CSUM_S 0 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define XCT_PTR_T 0x8000000000000000ull 3468c2ecf20Sopenharmony_ci#define XCT_PTR_LEN_M 0x7ffff00000000000ull 3478c2ecf20Sopenharmony_ci#define XCT_PTR_LEN_S 44 3488c2ecf20Sopenharmony_ci#define XCT_PTR_LEN(x) ((((long)(x)) << XCT_PTR_LEN_S) & \ 3498c2ecf20Sopenharmony_ci XCT_PTR_LEN_M) 3508c2ecf20Sopenharmony_ci#define XCT_PTR_ADDR_M 0x00000fffffffffffull 3518c2ecf20Sopenharmony_ci#define XCT_PTR_ADDR_S 0 3528c2ecf20Sopenharmony_ci#define XCT_PTR_ADDR(x) ((((long)(x)) << XCT_PTR_ADDR_S) & \ 3538c2ecf20Sopenharmony_ci XCT_PTR_ADDR_M) 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_ci/* Receive interface 8byte result fields */ 3568c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_L4O_M 0xff00000000000000ull 3578c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_L4O_S 56 3588c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_RULE_M 0x00ffff0000000000ull 3598c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_RULE_S 40 3608c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_EVAL_M 0x000000ffff000000ull 3618c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_EVAL_S 24 3628c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_HTYPE_M 0x0000000000f00000ull 3638c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_HASH_M 0x00000000000fffffull 3648c2ecf20Sopenharmony_ci#define XCT_RXRES_8B_HASH_S 0 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci/* Receive interface buffer fields */ 3678c2ecf20Sopenharmony_ci#define XCT_RXB_LEN_M 0x0ffff00000000000ull 3688c2ecf20Sopenharmony_ci#define XCT_RXB_LEN_S 44 3698c2ecf20Sopenharmony_ci#define XCT_RXB_LEN(x) ((((long)(x)) << XCT_RXB_LEN_S) & \ 3708c2ecf20Sopenharmony_ci XCT_RXB_LEN_M) 3718c2ecf20Sopenharmony_ci#define XCT_RXB_ADDR_M 0x00000fffffffffffull 3728c2ecf20Sopenharmony_ci#define XCT_RXB_ADDR_S 0 3738c2ecf20Sopenharmony_ci#define XCT_RXB_ADDR(x) ((((long)(x)) << XCT_RXB_ADDR_S) & \ 3748c2ecf20Sopenharmony_ci XCT_RXB_ADDR_M) 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci/* Copy descriptor fields */ 3778c2ecf20Sopenharmony_ci#define XCT_COPY_T 0x8000000000000000ull 3788c2ecf20Sopenharmony_ci#define XCT_COPY_ST 0x4000000000000000ull 3798c2ecf20Sopenharmony_ci#define XCT_COPY_RR_M 0x3000000000000000ull 3808c2ecf20Sopenharmony_ci#define XCT_COPY_RR_NORES 0x0000000000000000ull 3818c2ecf20Sopenharmony_ci#define XCT_COPY_RR_8BRES 0x1000000000000000ull 3828c2ecf20Sopenharmony_ci#define XCT_COPY_RR_24BRES 0x2000000000000000ull 3838c2ecf20Sopenharmony_ci#define XCT_COPY_RR_40BRES 0x3000000000000000ull 3848c2ecf20Sopenharmony_ci#define XCT_COPY_I 0x0800000000000000ull 3858c2ecf20Sopenharmony_ci#define XCT_COPY_O 0x0400000000000000ull 3868c2ecf20Sopenharmony_ci#define XCT_COPY_E 0x0200000000000000ull 3878c2ecf20Sopenharmony_ci#define XCT_COPY_STY_ZERO 0x01c0000000000000ull 3888c2ecf20Sopenharmony_ci#define XCT_COPY_DTY_PREF 0x0038000000000000ull 3898c2ecf20Sopenharmony_ci#define XCT_COPY_LLEN_M 0x0007ffff00000000ull 3908c2ecf20Sopenharmony_ci#define XCT_COPY_LLEN_S 32 3918c2ecf20Sopenharmony_ci#define XCT_COPY_LLEN(x) ((((long)(x)) << XCT_COPY_LLEN_S) & \ 3928c2ecf20Sopenharmony_ci XCT_COPY_LLEN_M) 3938c2ecf20Sopenharmony_ci#define XCT_COPY_SE 0x0000000000000001ull 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci/* Function descriptor fields */ 3968c2ecf20Sopenharmony_ci#define XCT_FUN_T 0x8000000000000000ull 3978c2ecf20Sopenharmony_ci#define XCT_FUN_ST 0x4000000000000000ull 3988c2ecf20Sopenharmony_ci#define XCT_FUN_RR_M 0x3000000000000000ull 3998c2ecf20Sopenharmony_ci#define XCT_FUN_RR_NORES 0x0000000000000000ull 4008c2ecf20Sopenharmony_ci#define XCT_FUN_RR_8BRES 0x1000000000000000ull 4018c2ecf20Sopenharmony_ci#define XCT_FUN_RR_24BRES 0x2000000000000000ull 4028c2ecf20Sopenharmony_ci#define XCT_FUN_RR_40BRES 0x3000000000000000ull 4038c2ecf20Sopenharmony_ci#define XCT_FUN_I 0x0800000000000000ull 4048c2ecf20Sopenharmony_ci#define XCT_FUN_O 0x0400000000000000ull 4058c2ecf20Sopenharmony_ci#define XCT_FUN_E 0x0200000000000000ull 4068c2ecf20Sopenharmony_ci#define XCT_FUN_FUN_M 0x01c0000000000000ull 4078c2ecf20Sopenharmony_ci#define XCT_FUN_FUN_S 54 4088c2ecf20Sopenharmony_ci#define XCT_FUN_FUN(x) ((((long)(x)) << XCT_FUN_FUN_S) & XCT_FUN_FUN_M) 4098c2ecf20Sopenharmony_ci#define XCT_FUN_CRM_M 0x0038000000000000ull 4108c2ecf20Sopenharmony_ci#define XCT_FUN_CRM_NOP 0x0000000000000000ull 4118c2ecf20Sopenharmony_ci#define XCT_FUN_CRM_SIG 0x0008000000000000ull 4128c2ecf20Sopenharmony_ci#define XCT_FUN_LLEN_M 0x0007ffff00000000ull 4138c2ecf20Sopenharmony_ci#define XCT_FUN_LLEN_S 32 4148c2ecf20Sopenharmony_ci#define XCT_FUN_LLEN(x) ((((long)(x)) << XCT_FUN_LLEN_S) & XCT_FUN_LLEN_M) 4158c2ecf20Sopenharmony_ci#define XCT_FUN_SHL_M 0x00000000f8000000ull 4168c2ecf20Sopenharmony_ci#define XCT_FUN_SHL_S 27 4178c2ecf20Sopenharmony_ci#define XCT_FUN_SHL(x) ((((long)(x)) << XCT_FUN_SHL_S) & XCT_FUN_SHL_M) 4188c2ecf20Sopenharmony_ci#define XCT_FUN_CHL_M 0x0000000007c00000ull 4198c2ecf20Sopenharmony_ci#define XCT_FUN_HSZ_M 0x00000000003c0000ull 4208c2ecf20Sopenharmony_ci#define XCT_FUN_ALG_M 0x0000000000038000ull 4218c2ecf20Sopenharmony_ci#define XCT_FUN_HP 0x0000000000004000ull 4228c2ecf20Sopenharmony_ci#define XCT_FUN_BCM_M 0x0000000000003800ull 4238c2ecf20Sopenharmony_ci#define XCT_FUN_BCP_M 0x0000000000000600ull 4248c2ecf20Sopenharmony_ci#define XCT_FUN_SIG_M 0x00000000000001f0ull 4258c2ecf20Sopenharmony_ci#define XCT_FUN_SIG_TCP4 0x0000000000000140ull 4268c2ecf20Sopenharmony_ci#define XCT_FUN_SIG_TCP6 0x0000000000000150ull 4278c2ecf20Sopenharmony_ci#define XCT_FUN_SIG_UDP4 0x0000000000000160ull 4288c2ecf20Sopenharmony_ci#define XCT_FUN_SIG_UDP6 0x0000000000000170ull 4298c2ecf20Sopenharmony_ci#define XCT_FUN_A 0x0000000000000008ull 4308c2ecf20Sopenharmony_ci#define XCT_FUN_C 0x0000000000000004ull 4318c2ecf20Sopenharmony_ci#define XCT_FUN_AL2 0x0000000000000002ull 4328c2ecf20Sopenharmony_ci#define XCT_FUN_SE 0x0000000000000001ull 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci/* Function descriptor 8byte result fields */ 4358c2ecf20Sopenharmony_ci#define XCT_FUNRES_8B_CS_M 0x0000ffff00000000ull 4368c2ecf20Sopenharmony_ci#define XCT_FUNRES_8B_CS_S 32 4378c2ecf20Sopenharmony_ci#define XCT_FUNRES_8B_CRC_M 0x00000000ffffffffull 4388c2ecf20Sopenharmony_ci#define XCT_FUNRES_8B_CRC_S 0 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci/* Control descriptor fields */ 4418c2ecf20Sopenharmony_ci#define CTRL_CMD_T 0x8000000000000000ull 4428c2ecf20Sopenharmony_ci#define CTRL_CMD_META_EVT 0x2000000000000000ull 4438c2ecf20Sopenharmony_ci#define CTRL_CMD_O 0x0400000000000000ull 4448c2ecf20Sopenharmony_ci#define CTRL_CMD_ETYPE_M 0x0038000000000000ull 4458c2ecf20Sopenharmony_ci#define CTRL_CMD_ETYPE_EXT 0x0000000000000000ull 4468c2ecf20Sopenharmony_ci#define CTRL_CMD_ETYPE_WSET 0x0020000000000000ull 4478c2ecf20Sopenharmony_ci#define CTRL_CMD_ETYPE_WCLR 0x0028000000000000ull 4488c2ecf20Sopenharmony_ci#define CTRL_CMD_ETYPE_SET 0x0030000000000000ull 4498c2ecf20Sopenharmony_ci#define CTRL_CMD_ETYPE_CLR 0x0038000000000000ull 4508c2ecf20Sopenharmony_ci#define CTRL_CMD_REG_M 0x000000000000007full 4518c2ecf20Sopenharmony_ci#define CTRL_CMD_REG_S 0 4528c2ecf20Sopenharmony_ci#define CTRL_CMD_REG(x) ((((long)(x)) << CTRL_CMD_REG_S) & \ 4538c2ecf20Sopenharmony_ci CTRL_CMD_REG_M) 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci/* Prototypes for the shared DMA functions in the platform code. */ 4588c2ecf20Sopenharmony_ci 4598c2ecf20Sopenharmony_ci/* DMA TX Channel type. Right now only limitations used are event types 0/1, 4608c2ecf20Sopenharmony_ci * for event-triggered DMA transactions. 4618c2ecf20Sopenharmony_ci */ 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cienum pasemi_dmachan_type { 4648c2ecf20Sopenharmony_ci RXCHAN = 0, /* Any RX chan */ 4658c2ecf20Sopenharmony_ci TXCHAN = 1, /* Any TX chan */ 4668c2ecf20Sopenharmony_ci TXCHAN_EVT0 = 0x1001, /* TX chan in event class 0 (chan 0-9) */ 4678c2ecf20Sopenharmony_ci TXCHAN_EVT1 = 0x2001, /* TX chan in event class 1 (chan 10-19) */ 4688c2ecf20Sopenharmony_ci}; 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_cistruct pasemi_dmachan { 4718c2ecf20Sopenharmony_ci int chno; /* Channel number */ 4728c2ecf20Sopenharmony_ci enum pasemi_dmachan_type chan_type; /* TX / RX */ 4738c2ecf20Sopenharmony_ci u64 *status; /* Ptr to cacheable status */ 4748c2ecf20Sopenharmony_ci int irq; /* IRQ used by channel */ 4758c2ecf20Sopenharmony_ci unsigned int ring_size; /* size of allocated ring */ 4768c2ecf20Sopenharmony_ci dma_addr_t ring_dma; /* DMA address for ring */ 4778c2ecf20Sopenharmony_ci u64 *ring_virt; /* Virt address for ring */ 4788c2ecf20Sopenharmony_ci void *priv; /* Ptr to start of client struct */ 4798c2ecf20Sopenharmony_ci}; 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_ci/* Read/write the different registers in the I/O Bridge, Ethernet 4828c2ecf20Sopenharmony_ci * and DMA Controller 4838c2ecf20Sopenharmony_ci */ 4848c2ecf20Sopenharmony_ciextern unsigned int pasemi_read_iob_reg(unsigned int reg); 4858c2ecf20Sopenharmony_ciextern void pasemi_write_iob_reg(unsigned int reg, unsigned int val); 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ciextern unsigned int pasemi_read_mac_reg(int intf, unsigned int reg); 4888c2ecf20Sopenharmony_ciextern void pasemi_write_mac_reg(int intf, unsigned int reg, unsigned int val); 4898c2ecf20Sopenharmony_ci 4908c2ecf20Sopenharmony_ciextern unsigned int pasemi_read_dma_reg(unsigned int reg); 4918c2ecf20Sopenharmony_ciextern void pasemi_write_dma_reg(unsigned int reg, unsigned int val); 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ci/* Channel management routines */ 4948c2ecf20Sopenharmony_ci 4958c2ecf20Sopenharmony_ciextern void *pasemi_dma_alloc_chan(enum pasemi_dmachan_type type, 4968c2ecf20Sopenharmony_ci int total_size, int offset); 4978c2ecf20Sopenharmony_ciextern void pasemi_dma_free_chan(struct pasemi_dmachan *chan); 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ciextern void pasemi_dma_start_chan(const struct pasemi_dmachan *chan, 5008c2ecf20Sopenharmony_ci const u32 cmdsta); 5018c2ecf20Sopenharmony_ciextern int pasemi_dma_stop_chan(const struct pasemi_dmachan *chan); 5028c2ecf20Sopenharmony_ci 5038c2ecf20Sopenharmony_ci/* Common routines to allocate rings and buffers */ 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ciextern int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size); 5068c2ecf20Sopenharmony_ciextern void pasemi_dma_free_ring(struct pasemi_dmachan *chan); 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ciextern void *pasemi_dma_alloc_buf(struct pasemi_dmachan *chan, int size, 5098c2ecf20Sopenharmony_ci dma_addr_t *handle); 5108c2ecf20Sopenharmony_ciextern void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size, 5118c2ecf20Sopenharmony_ci dma_addr_t *handle); 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_ci/* Routines to allocate flags (events) for channel synchronization */ 5148c2ecf20Sopenharmony_ciextern int pasemi_dma_alloc_flag(void); 5158c2ecf20Sopenharmony_ciextern void pasemi_dma_free_flag(int flag); 5168c2ecf20Sopenharmony_ciextern void pasemi_dma_set_flag(int flag); 5178c2ecf20Sopenharmony_ciextern void pasemi_dma_clear_flag(int flag); 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci/* Routines to allocate function engines */ 5208c2ecf20Sopenharmony_ciextern int pasemi_dma_alloc_fun(void); 5218c2ecf20Sopenharmony_ciextern void pasemi_dma_free_fun(int fun); 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci/* Initialize the library, must be called before any other functions */ 5248c2ecf20Sopenharmony_ciextern int pasemi_dma_init(void); 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci#endif /* ASM_PASEMI_DMA_H */ 527