18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Chip register definitions for PCILynx chipset. Based on pcilynx.h 48c2ecf20Sopenharmony_ci * from the Linux 1394 drivers, but modified a bit so the names here 58c2ecf20Sopenharmony_ci * match the specification exactly (even though they have weird names, 68c2ecf20Sopenharmony_ci * like xxx_OVER_FLOW, or arbitrary abbreviations like SNTRJ for "sent 78c2ecf20Sopenharmony_ci * reject" etc.) 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#define PCILYNX_MAX_REGISTER 0xfff 118c2ecf20Sopenharmony_ci#define PCILYNX_MAX_MEMORY 0xffff 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define PCI_LATENCY_CACHELINE 0x0c 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define MISC_CONTROL 0x40 168c2ecf20Sopenharmony_ci#define MISC_CONTROL_SWRESET (1<<0) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define SERIAL_EEPROM_CONTROL 0x44 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define PCI_INT_STATUS 0x48 218c2ecf20Sopenharmony_ci#define PCI_INT_ENABLE 0x4c 228c2ecf20Sopenharmony_ci/* status and enable have identical bit numbers */ 238c2ecf20Sopenharmony_ci#define PCI_INT_INT_PEND (1<<31) 248c2ecf20Sopenharmony_ci#define PCI_INT_FRC_INT (1<<30) 258c2ecf20Sopenharmony_ci#define PCI_INT_SLV_ADR_PERR (1<<28) 268c2ecf20Sopenharmony_ci#define PCI_INT_SLV_DAT_PERR (1<<27) 278c2ecf20Sopenharmony_ci#define PCI_INT_MST_DAT_PERR (1<<26) 288c2ecf20Sopenharmony_ci#define PCI_INT_MST_DEV_TO (1<<25) 298c2ecf20Sopenharmony_ci#define PCI_INT_INT_SLV_TO (1<<23) 308c2ecf20Sopenharmony_ci#define PCI_INT_AUX_TO (1<<18) 318c2ecf20Sopenharmony_ci#define PCI_INT_AUX_INT (1<<17) 328c2ecf20Sopenharmony_ci#define PCI_INT_P1394_INT (1<<16) 338c2ecf20Sopenharmony_ci#define PCI_INT_DMA4_PCL (1<<9) 348c2ecf20Sopenharmony_ci#define PCI_INT_DMA4_HLT (1<<8) 358c2ecf20Sopenharmony_ci#define PCI_INT_DMA3_PCL (1<<7) 368c2ecf20Sopenharmony_ci#define PCI_INT_DMA3_HLT (1<<6) 378c2ecf20Sopenharmony_ci#define PCI_INT_DMA2_PCL (1<<5) 388c2ecf20Sopenharmony_ci#define PCI_INT_DMA2_HLT (1<<4) 398c2ecf20Sopenharmony_ci#define PCI_INT_DMA1_PCL (1<<3) 408c2ecf20Sopenharmony_ci#define PCI_INT_DMA1_HLT (1<<2) 418c2ecf20Sopenharmony_ci#define PCI_INT_DMA0_PCL (1<<1) 428c2ecf20Sopenharmony_ci#define PCI_INT_DMA0_HLT (1<<0) 438c2ecf20Sopenharmony_ci/* all DMA interrupts combined: */ 448c2ecf20Sopenharmony_ci#define PCI_INT_DMA_ALL 0x3ff 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define PCI_INT_DMA_HLT(chan) (1 << (chan * 2)) 478c2ecf20Sopenharmony_ci#define PCI_INT_DMA_PCL(chan) (1 << (chan * 2 + 1)) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define LBUS_ADDR 0xb4 508c2ecf20Sopenharmony_ci#define LBUS_ADDR_SEL_RAM (0x0<<16) 518c2ecf20Sopenharmony_ci#define LBUS_ADDR_SEL_ROM (0x1<<16) 528c2ecf20Sopenharmony_ci#define LBUS_ADDR_SEL_AUX (0x2<<16) 538c2ecf20Sopenharmony_ci#define LBUS_ADDR_SEL_ZV (0x3<<16) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define GPIO_CTRL_A 0xb8 568c2ecf20Sopenharmony_ci#define GPIO_CTRL_B 0xbc 578c2ecf20Sopenharmony_ci#define GPIO_DATA_BASE 0xc0 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define DMA_BREG(base, chan) (base + chan * 0x20) 608c2ecf20Sopenharmony_ci#define DMA_SREG(base, chan) (base + chan * 0x10) 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define PCL_NEXT_INVALID (1<<0) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* transfer commands */ 658c2ecf20Sopenharmony_ci#define PCL_CMD_RCV (0x1<<24) 668c2ecf20Sopenharmony_ci#define PCL_CMD_RCV_AND_UPDATE (0xa<<24) 678c2ecf20Sopenharmony_ci#define PCL_CMD_XMT (0x2<<24) 688c2ecf20Sopenharmony_ci#define PCL_CMD_UNFXMT (0xc<<24) 698c2ecf20Sopenharmony_ci#define PCL_CMD_PCI_TO_LBUS (0x8<<24) 708c2ecf20Sopenharmony_ci#define PCL_CMD_LBUS_TO_PCI (0x9<<24) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* aux commands */ 738c2ecf20Sopenharmony_ci#define PCL_CMD_NOP (0x0<<24) 748c2ecf20Sopenharmony_ci#define PCL_CMD_LOAD (0x3<<24) 758c2ecf20Sopenharmony_ci#define PCL_CMD_STOREQ (0x4<<24) 768c2ecf20Sopenharmony_ci#define PCL_CMD_STORED (0xb<<24) 778c2ecf20Sopenharmony_ci#define PCL_CMD_STORE0 (0x5<<24) 788c2ecf20Sopenharmony_ci#define PCL_CMD_STORE1 (0x6<<24) 798c2ecf20Sopenharmony_ci#define PCL_CMD_COMPARE (0xe<<24) 808c2ecf20Sopenharmony_ci#define PCL_CMD_SWAP_COMPARE (0xf<<24) 818c2ecf20Sopenharmony_ci#define PCL_CMD_ADD (0xd<<24) 828c2ecf20Sopenharmony_ci#define PCL_CMD_BRANCH (0x7<<24) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/* BRANCH condition codes */ 858c2ecf20Sopenharmony_ci#define PCL_COND_DMARDY_SET (0x1<<20) 868c2ecf20Sopenharmony_ci#define PCL_COND_DMARDY_CLEAR (0x2<<20) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define PCL_GEN_INTR (1<<19) 898c2ecf20Sopenharmony_ci#define PCL_LAST_BUFF (1<<18) 908c2ecf20Sopenharmony_ci#define PCL_LAST_CMD (PCL_LAST_BUFF) 918c2ecf20Sopenharmony_ci#define PCL_WAITSTAT (1<<17) 928c2ecf20Sopenharmony_ci#define PCL_BIGENDIAN (1<<16) 938c2ecf20Sopenharmony_ci#define PCL_ISOMODE (1<<12) 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci#define DMA0_PREV_PCL 0x100 968c2ecf20Sopenharmony_ci#define DMA1_PREV_PCL 0x120 978c2ecf20Sopenharmony_ci#define DMA2_PREV_PCL 0x140 988c2ecf20Sopenharmony_ci#define DMA3_PREV_PCL 0x160 998c2ecf20Sopenharmony_ci#define DMA4_PREV_PCL 0x180 1008c2ecf20Sopenharmony_ci#define DMA_PREV_PCL(chan) (DMA_BREG(DMA0_PREV_PCL, chan)) 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci#define DMA0_CURRENT_PCL 0x104 1038c2ecf20Sopenharmony_ci#define DMA1_CURRENT_PCL 0x124 1048c2ecf20Sopenharmony_ci#define DMA2_CURRENT_PCL 0x144 1058c2ecf20Sopenharmony_ci#define DMA3_CURRENT_PCL 0x164 1068c2ecf20Sopenharmony_ci#define DMA4_CURRENT_PCL 0x184 1078c2ecf20Sopenharmony_ci#define DMA_CURRENT_PCL(chan) (DMA_BREG(DMA0_CURRENT_PCL, chan)) 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define DMA0_CHAN_STAT 0x10c 1108c2ecf20Sopenharmony_ci#define DMA1_CHAN_STAT 0x12c 1118c2ecf20Sopenharmony_ci#define DMA2_CHAN_STAT 0x14c 1128c2ecf20Sopenharmony_ci#define DMA3_CHAN_STAT 0x16c 1138c2ecf20Sopenharmony_ci#define DMA4_CHAN_STAT 0x18c 1148c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT(chan) (DMA_BREG(DMA0_CHAN_STAT, chan)) 1158c2ecf20Sopenharmony_ci/* CHAN_STATUS registers share bits */ 1168c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT_SELFID (1<<31) 1178c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT_ISOPKT (1<<30) 1188c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT_PCIERR (1<<29) 1198c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT_PKTERR (1<<28) 1208c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT_PKTCMPL (1<<27) 1218c2ecf20Sopenharmony_ci#define DMA_CHAN_STAT_SPECIALACK (1<<14) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define DMA0_CHAN_CTRL 0x110 1248c2ecf20Sopenharmony_ci#define DMA1_CHAN_CTRL 0x130 1258c2ecf20Sopenharmony_ci#define DMA2_CHAN_CTRL 0x150 1268c2ecf20Sopenharmony_ci#define DMA3_CHAN_CTRL 0x170 1278c2ecf20Sopenharmony_ci#define DMA4_CHAN_CTRL 0x190 1288c2ecf20Sopenharmony_ci#define DMA_CHAN_CTRL(chan) (DMA_BREG(DMA0_CHAN_CTRL, chan)) 1298c2ecf20Sopenharmony_ci/* CHAN_CTRL registers share bits */ 1308c2ecf20Sopenharmony_ci#define DMA_CHAN_CTRL_ENABLE (1<<31) 1318c2ecf20Sopenharmony_ci#define DMA_CHAN_CTRL_BUSY (1<<30) 1328c2ecf20Sopenharmony_ci#define DMA_CHAN_CTRL_LINK (1<<29) 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci#define DMA0_READY 0x114 1358c2ecf20Sopenharmony_ci#define DMA1_READY 0x134 1368c2ecf20Sopenharmony_ci#define DMA2_READY 0x154 1378c2ecf20Sopenharmony_ci#define DMA3_READY 0x174 1388c2ecf20Sopenharmony_ci#define DMA4_READY 0x194 1398c2ecf20Sopenharmony_ci#define DMA_READY(chan) (DMA_BREG(DMA0_READY, chan)) 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci#define DMA_GLOBAL_REGISTER 0x908 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#define FIFO_SIZES 0xa00 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define FIFO_CONTROL 0xa10 1468c2ecf20Sopenharmony_ci#define FIFO_CONTROL_GRF_FLUSH (1<<4) 1478c2ecf20Sopenharmony_ci#define FIFO_CONTROL_ITF_FLUSH (1<<3) 1488c2ecf20Sopenharmony_ci#define FIFO_CONTROL_ATF_FLUSH (1<<2) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define FIFO_XMIT_THRESHOLD 0xa14 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci#define DMA0_WORD0_CMP_VALUE 0xb00 1538c2ecf20Sopenharmony_ci#define DMA1_WORD0_CMP_VALUE 0xb10 1548c2ecf20Sopenharmony_ci#define DMA2_WORD0_CMP_VALUE 0xb20 1558c2ecf20Sopenharmony_ci#define DMA3_WORD0_CMP_VALUE 0xb30 1568c2ecf20Sopenharmony_ci#define DMA4_WORD0_CMP_VALUE 0xb40 1578c2ecf20Sopenharmony_ci#define DMA_WORD0_CMP_VALUE(chan) (DMA_SREG(DMA0_WORD0_CMP_VALUE, chan)) 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define DMA0_WORD0_CMP_ENABLE 0xb04 1608c2ecf20Sopenharmony_ci#define DMA1_WORD0_CMP_ENABLE 0xb14 1618c2ecf20Sopenharmony_ci#define DMA2_WORD0_CMP_ENABLE 0xb24 1628c2ecf20Sopenharmony_ci#define DMA3_WORD0_CMP_ENABLE 0xb34 1638c2ecf20Sopenharmony_ci#define DMA4_WORD0_CMP_ENABLE 0xb44 1648c2ecf20Sopenharmony_ci#define DMA_WORD0_CMP_ENABLE(chan) (DMA_SREG(DMA0_WORD0_CMP_ENABLE, chan)) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci#define DMA0_WORD1_CMP_VALUE 0xb08 1678c2ecf20Sopenharmony_ci#define DMA1_WORD1_CMP_VALUE 0xb18 1688c2ecf20Sopenharmony_ci#define DMA2_WORD1_CMP_VALUE 0xb28 1698c2ecf20Sopenharmony_ci#define DMA3_WORD1_CMP_VALUE 0xb38 1708c2ecf20Sopenharmony_ci#define DMA4_WORD1_CMP_VALUE 0xb48 1718c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_VALUE(chan) (DMA_SREG(DMA0_WORD1_CMP_VALUE, chan)) 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci#define DMA0_WORD1_CMP_ENABLE 0xb0c 1748c2ecf20Sopenharmony_ci#define DMA1_WORD1_CMP_ENABLE 0xb1c 1758c2ecf20Sopenharmony_ci#define DMA2_WORD1_CMP_ENABLE 0xb2c 1768c2ecf20Sopenharmony_ci#define DMA3_WORD1_CMP_ENABLE 0xb3c 1778c2ecf20Sopenharmony_ci#define DMA4_WORD1_CMP_ENABLE 0xb4c 1788c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_ENABLE(chan) (DMA_SREG(DMA0_WORD1_CMP_ENABLE, chan)) 1798c2ecf20Sopenharmony_ci/* word 1 compare enable flags */ 1808c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_MATCH_OTHERBUS (1<<15) 1818c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_MATCH_BROADCAST (1<<14) 1828c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_MATCH_BUS_BCAST (1<<13) 1838c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_MATCH_LOCAL_NODE (1<<12) 1848c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_MATCH_EXACT (1<<11) 1858c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_ENABLE_SELF_ID (1<<10) 1868c2ecf20Sopenharmony_ci#define DMA_WORD1_CMP_ENABLE_MASTER (1<<8) 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define LINK_ID 0xf00 1898c2ecf20Sopenharmony_ci#define LINK_ID_BUS(id) (id<<22) 1908c2ecf20Sopenharmony_ci#define LINK_ID_NODE(id) (id<<16) 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci#define LINK_CONTROL 0xf04 1938c2ecf20Sopenharmony_ci#define LINK_CONTROL_BUSY (1<<29) 1948c2ecf20Sopenharmony_ci#define LINK_CONTROL_TX_ISO_EN (1<<26) 1958c2ecf20Sopenharmony_ci#define LINK_CONTROL_RX_ISO_EN (1<<25) 1968c2ecf20Sopenharmony_ci#define LINK_CONTROL_TX_ASYNC_EN (1<<24) 1978c2ecf20Sopenharmony_ci#define LINK_CONTROL_RX_ASYNC_EN (1<<23) 1988c2ecf20Sopenharmony_ci#define LINK_CONTROL_RESET_TX (1<<21) 1998c2ecf20Sopenharmony_ci#define LINK_CONTROL_RESET_RX (1<<20) 2008c2ecf20Sopenharmony_ci#define LINK_CONTROL_CYCMASTER (1<<11) 2018c2ecf20Sopenharmony_ci#define LINK_CONTROL_CYCSOURCE (1<<10) 2028c2ecf20Sopenharmony_ci#define LINK_CONTROL_CYCTIMEREN (1<<9) 2038c2ecf20Sopenharmony_ci#define LINK_CONTROL_RCV_CMP_VALID (1<<7) 2048c2ecf20Sopenharmony_ci#define LINK_CONTROL_SNOOP_ENABLE (1<<6) 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci#define CYCLE_TIMER 0xf08 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define LINK_PHY 0xf0c 2098c2ecf20Sopenharmony_ci#define LINK_PHY_READ (1<<31) 2108c2ecf20Sopenharmony_ci#define LINK_PHY_WRITE (1<<30) 2118c2ecf20Sopenharmony_ci#define LINK_PHY_ADDR(addr) (addr<<24) 2128c2ecf20Sopenharmony_ci#define LINK_PHY_WDATA(data) (data<<16) 2138c2ecf20Sopenharmony_ci#define LINK_PHY_RADDR(addr) (addr<<8) 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci#define LINK_INT_STATUS 0xf14 2168c2ecf20Sopenharmony_ci#define LINK_INT_ENABLE 0xf18 2178c2ecf20Sopenharmony_ci/* status and enable have identical bit numbers */ 2188c2ecf20Sopenharmony_ci#define LINK_INT_LINK_INT (1<<31) 2198c2ecf20Sopenharmony_ci#define LINK_INT_PHY_TIME_OUT (1<<30) 2208c2ecf20Sopenharmony_ci#define LINK_INT_PHY_REG_RCVD (1<<29) 2218c2ecf20Sopenharmony_ci#define LINK_INT_PHY_BUSRESET (1<<28) 2228c2ecf20Sopenharmony_ci#define LINK_INT_TX_RDY (1<<26) 2238c2ecf20Sopenharmony_ci#define LINK_INT_RX_DATA_RDY (1<<25) 2248c2ecf20Sopenharmony_ci#define LINK_INT_IT_STUCK (1<<20) 2258c2ecf20Sopenharmony_ci#define LINK_INT_AT_STUCK (1<<19) 2268c2ecf20Sopenharmony_ci#define LINK_INT_SNTRJ (1<<17) 2278c2ecf20Sopenharmony_ci#define LINK_INT_HDR_ERR (1<<16) 2288c2ecf20Sopenharmony_ci#define LINK_INT_TC_ERR (1<<15) 2298c2ecf20Sopenharmony_ci#define LINK_INT_CYC_SEC (1<<11) 2308c2ecf20Sopenharmony_ci#define LINK_INT_CYC_STRT (1<<10) 2318c2ecf20Sopenharmony_ci#define LINK_INT_CYC_DONE (1<<9) 2328c2ecf20Sopenharmony_ci#define LINK_INT_CYC_PEND (1<<8) 2338c2ecf20Sopenharmony_ci#define LINK_INT_CYC_LOST (1<<7) 2348c2ecf20Sopenharmony_ci#define LINK_INT_CYC_ARB_FAILED (1<<6) 2358c2ecf20Sopenharmony_ci#define LINK_INT_GRF_OVER_FLOW (1<<5) 2368c2ecf20Sopenharmony_ci#define LINK_INT_ITF_UNDER_FLOW (1<<4) 2378c2ecf20Sopenharmony_ci#define LINK_INT_ATF_UNDER_FLOW (1<<3) 2388c2ecf20Sopenharmony_ci#define LINK_INT_IARB_FAILED (1<<0) 239