18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Tsi721 PCIExpress-to-SRIO bridge definitions 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2011, Integrated Device Technology, Inc. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef __TSI721_H 98c2ecf20Sopenharmony_ci#define __TSI721_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* Debug output filtering masks */ 128c2ecf20Sopenharmony_cienum { 138c2ecf20Sopenharmony_ci DBG_NONE = 0, 148c2ecf20Sopenharmony_ci DBG_INIT = BIT(0), /* driver init */ 158c2ecf20Sopenharmony_ci DBG_EXIT = BIT(1), /* driver exit */ 168c2ecf20Sopenharmony_ci DBG_MPORT = BIT(2), /* mport add/remove */ 178c2ecf20Sopenharmony_ci DBG_MAINT = BIT(3), /* maintenance ops messages */ 188c2ecf20Sopenharmony_ci DBG_DMA = BIT(4), /* DMA transfer messages */ 198c2ecf20Sopenharmony_ci DBG_DMAV = BIT(5), /* verbose DMA transfer messages */ 208c2ecf20Sopenharmony_ci DBG_IBW = BIT(6), /* inbound window */ 218c2ecf20Sopenharmony_ci DBG_EVENT = BIT(7), /* event handling messages */ 228c2ecf20Sopenharmony_ci DBG_OBW = BIT(8), /* outbound window messages */ 238c2ecf20Sopenharmony_ci DBG_DBELL = BIT(9), /* doorbell messages */ 248c2ecf20Sopenharmony_ci DBG_OMSG = BIT(10), /* doorbell messages */ 258c2ecf20Sopenharmony_ci DBG_IMSG = BIT(11), /* doorbell messages */ 268c2ecf20Sopenharmony_ci DBG_ALL = ~0, 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#ifdef DEBUG 308c2ecf20Sopenharmony_ciextern u32 tsi_dbg_level; 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define tsi_debug(level, dev, fmt, arg...) \ 338c2ecf20Sopenharmony_ci do { \ 348c2ecf20Sopenharmony_ci if (DBG_##level & tsi_dbg_level) \ 358c2ecf20Sopenharmony_ci dev_dbg(dev, "%s: " fmt "\n", __func__, ##arg); \ 368c2ecf20Sopenharmony_ci } while (0) 378c2ecf20Sopenharmony_ci#else 388c2ecf20Sopenharmony_ci#define tsi_debug(level, dev, fmt, arg...) \ 398c2ecf20Sopenharmony_ci no_printk(KERN_DEBUG "%s: " fmt "\n", __func__, ##arg) 408c2ecf20Sopenharmony_ci#endif 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define tsi_info(dev, fmt, arg...) \ 438c2ecf20Sopenharmony_ci dev_info(dev, "%s: " fmt "\n", __func__, ##arg) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define tsi_warn(dev, fmt, arg...) \ 468c2ecf20Sopenharmony_ci dev_warn(dev, "%s: WARNING " fmt "\n", __func__, ##arg) 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define tsi_err(dev, fmt, arg...) \ 498c2ecf20Sopenharmony_ci dev_err(dev, "%s: ERROR " fmt "\n", __func__, ##arg) 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define DRV_NAME "tsi721" 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define DEFAULT_HOPCOUNT 0xff 548c2ecf20Sopenharmony_ci#define DEFAULT_DESTID 0xff 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* PCI device ID */ 578c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_TSI721 0x80ab 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define BAR_0 0 608c2ecf20Sopenharmony_ci#define BAR_1 1 618c2ecf20Sopenharmony_ci#define BAR_2 2 628c2ecf20Sopenharmony_ci#define BAR_4 4 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define TSI721_PC2SR_BARS 2 658c2ecf20Sopenharmony_ci#define TSI721_PC2SR_WINS 8 668c2ecf20Sopenharmony_ci#define TSI721_PC2SR_ZONES 8 678c2ecf20Sopenharmony_ci#define TSI721_MAINT_WIN 0 /* Window for outbound maintenance requests */ 688c2ecf20Sopenharmony_ci#define IDB_QUEUE 0 /* Inbound Doorbell Queue to use */ 698c2ecf20Sopenharmony_ci#define IDB_QSIZE 512 /* Inbound Doorbell Queue size */ 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci/* Memory space sizes */ 728c2ecf20Sopenharmony_ci#define TSI721_REG_SPACE_SIZE (512 * 1024) /* 512K */ 738c2ecf20Sopenharmony_ci#define TSI721_DB_WIN_SIZE (16 * 1024 * 1024) /* 16MB */ 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define RIO_TT_CODE_8 0x00000000 768c2ecf20Sopenharmony_ci#define RIO_TT_CODE_16 0x00000001 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define TSI721_DMA_MAXCH 8 798c2ecf20Sopenharmony_ci#define TSI721_DMA_MINSTSSZ 32 808c2ecf20Sopenharmony_ci#define TSI721_DMA_STSBLKSZ 8 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#define TSI721_SRIO_MAXCH 8 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define DBELL_SID(buf) (((u8)buf[2] << 8) | (u8)buf[3]) 858c2ecf20Sopenharmony_ci#define DBELL_TID(buf) (((u8)buf[4] << 8) | (u8)buf[5]) 868c2ecf20Sopenharmony_ci#define DBELL_INF(buf) (((u8)buf[0] << 8) | (u8)buf[1]) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_MSG_SIZE 16 /* Tsi721 saves only 16 bytes of PW msg */ 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/* Register definitions */ 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci/* 938c2ecf20Sopenharmony_ci * Registers in PCIe configuration space 948c2ecf20Sopenharmony_ci */ 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define TSI721_PCIECFG_MSIXTBL 0x0a4 978c2ecf20Sopenharmony_ci#define TSI721_MSIXTBL_OFFSET 0x2c000 988c2ecf20Sopenharmony_ci#define TSI721_PCIECFG_MSIXPBA 0x0a8 998c2ecf20Sopenharmony_ci#define TSI721_MSIXPBA_OFFSET 0x2a000 1008c2ecf20Sopenharmony_ci#define TSI721_PCIECFG_EPCTL 0x400 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/* 1038c2ecf20Sopenharmony_ci * Event Management Registers 1048c2ecf20Sopenharmony_ci */ 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci#define TSI721_RIO_EM_INT_STAT 0x10910 1078c2ecf20Sopenharmony_ci#define TSI721_RIO_EM_INT_STAT_PW_RX 0x00010000 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define TSI721_RIO_EM_INT_ENABLE 0x10914 1108c2ecf20Sopenharmony_ci#define TSI721_RIO_EM_INT_ENABLE_PW_RX 0x00010000 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ci#define TSI721_RIO_EM_DEV_INT_EN 0x10930 1138c2ecf20Sopenharmony_ci#define TSI721_RIO_EM_DEV_INT_EN_INT 0x00000001 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* 1168c2ecf20Sopenharmony_ci * Port-Write Block Registers 1178c2ecf20Sopenharmony_ci */ 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL 0x10a04 1208c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PW_TIMER 0xf0000000 1218c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWT_DIS (0 << 28) 1228c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWT_103 (1 << 28) 1238c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWT_205 (1 << 29) 1248c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWT_410 (1 << 30) 1258c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWT_820 (1 << 31) 1268c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWC_MODE 0x01000000 1278c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWC_CONT 0x00000000 1288c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_CTL_PWC_REL 0x01000000 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_STAT 0x10a10 1318c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_STAT_WR_SIZE 0x0000f000 1328c2ecf20Sopenharmony_ci#define TSI_RIO_PW_RX_STAT_WDPTR 0x00000100 1338c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_STAT_PW_SHORT 0x00000008 1348c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_STAT_PW_TRUNC 0x00000004 1358c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_STAT_PW_DISC 0x00000002 1368c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_STAT_PW_VAL 0x00000001 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci#define TSI721_RIO_PW_RX_CAPT(x) (0x10a20 + (x)*4) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci/* 1418c2ecf20Sopenharmony_ci * Inbound Doorbells 1428c2ecf20Sopenharmony_ci */ 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci#define TSI721_IDB_ENTRY_SIZE 64 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#define TSI721_IDQ_CTL(x) (0x20000 + (x) * 0x1000) 1478c2ecf20Sopenharmony_ci#define TSI721_IDQ_SUSPEND 0x00000002 1488c2ecf20Sopenharmony_ci#define TSI721_IDQ_INIT 0x00000001 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define TSI721_IDQ_STS(x) (0x20004 + (x) * 0x1000) 1518c2ecf20Sopenharmony_ci#define TSI721_IDQ_RUN 0x00200000 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define TSI721_IDQ_MASK(x) (0x20008 + (x) * 0x1000) 1548c2ecf20Sopenharmony_ci#define TSI721_IDQ_MASK_MASK 0xffff0000 1558c2ecf20Sopenharmony_ci#define TSI721_IDQ_MASK_PATT 0x0000ffff 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci#define TSI721_IDQ_RP(x) (0x2000c + (x) * 0x1000) 1588c2ecf20Sopenharmony_ci#define TSI721_IDQ_RP_PTR 0x0007ffff 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define TSI721_IDQ_WP(x) (0x20010 + (x) * 0x1000) 1618c2ecf20Sopenharmony_ci#define TSI721_IDQ_WP_PTR 0x0007ffff 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#define TSI721_IDQ_BASEL(x) (0x20014 + (x) * 0x1000) 1648c2ecf20Sopenharmony_ci#define TSI721_IDQ_BASEL_ADDR 0xffffffc0 1658c2ecf20Sopenharmony_ci#define TSI721_IDQ_BASEU(x) (0x20018 + (x) * 0x1000) 1668c2ecf20Sopenharmony_ci#define TSI721_IDQ_SIZE(x) (0x2001c + (x) * 0x1000) 1678c2ecf20Sopenharmony_ci#define TSI721_IDQ_SIZE_VAL(size) (__fls(size) - 4) 1688c2ecf20Sopenharmony_ci#define TSI721_IDQ_SIZE_MIN 512 1698c2ecf20Sopenharmony_ci#define TSI721_IDQ_SIZE_MAX (512 * 1024) 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT(x) (0x20040 + (x) * 0x1000) 1728c2ecf20Sopenharmony_ci#define TSI721_SR_CHINTE(x) (0x20044 + (x) * 0x1000) 1738c2ecf20Sopenharmony_ci#define TSI721_SR_CHINTSET(x) (0x20048 + (x) * 0x1000) 1748c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_ODBOK 0x00000020 1758c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_IDBQRCV 0x00000010 1768c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_SUSP 0x00000008 1778c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_ODBTO 0x00000004 1788c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_ODBRTRY 0x00000002 1798c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_ODBERR 0x00000001 1808c2ecf20Sopenharmony_ci#define TSI721_SR_CHINT_ALL 0x0000003f 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci#define TSI721_IBWIN_NUM 8 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci#define TSI721_IBWIN_LB(x) (0x29000 + (x) * 0x20) 1858c2ecf20Sopenharmony_ci#define TSI721_IBWIN_LB_BA 0xfffff000 1868c2ecf20Sopenharmony_ci#define TSI721_IBWIN_LB_WEN 0x00000001 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#define TSI721_IBWIN_UB(x) (0x29004 + (x) * 0x20) 1898c2ecf20Sopenharmony_ci#define TSI721_IBWIN_SZ(x) (0x29008 + (x) * 0x20) 1908c2ecf20Sopenharmony_ci#define TSI721_IBWIN_SZ_SIZE 0x00001f00 1918c2ecf20Sopenharmony_ci#define TSI721_IBWIN_SIZE(size) (__fls(size) - 12) 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci#define TSI721_IBWIN_TLA(x) (0x2900c + (x) * 0x20) 1948c2ecf20Sopenharmony_ci#define TSI721_IBWIN_TLA_ADD 0xfffff000 1958c2ecf20Sopenharmony_ci#define TSI721_IBWIN_TUA(x) (0x29010 + (x) * 0x20) 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci#define TSI721_SR2PC_GEN_INTE 0x29800 1988c2ecf20Sopenharmony_ci#define TSI721_SR2PC_PWE 0x29804 1998c2ecf20Sopenharmony_ci#define TSI721_SR2PC_GEN_INT 0x29808 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci#define TSI721_DEV_INTE 0x29840 2028c2ecf20Sopenharmony_ci#define TSI721_DEV_INT 0x29844 2038c2ecf20Sopenharmony_ci#define TSI721_DEV_INTSET 0x29848 2048c2ecf20Sopenharmony_ci#define TSI721_DEV_INT_BDMA_CH 0x00002000 2058c2ecf20Sopenharmony_ci#define TSI721_DEV_INT_BDMA_NCH 0x00001000 2068c2ecf20Sopenharmony_ci#define TSI721_DEV_INT_SMSG_CH 0x00000800 2078c2ecf20Sopenharmony_ci#define TSI721_DEV_INT_SMSG_NCH 0x00000400 2088c2ecf20Sopenharmony_ci#define TSI721_DEV_INT_SR2PC_CH 0x00000200 2098c2ecf20Sopenharmony_ci#define TSI721_DEV_INT_SRIO 0x00000020 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci#define TSI721_DEV_CHAN_INTE 0x2984c 2128c2ecf20Sopenharmony_ci#define TSI721_DEV_CHAN_INT 0x29850 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci#define TSI721_INT_SR2PC_CHAN_M 0xff000000 2158c2ecf20Sopenharmony_ci#define TSI721_INT_SR2PC_CHAN(x) (1 << (24 + (x))) 2168c2ecf20Sopenharmony_ci#define TSI721_INT_IMSG_CHAN_M 0x00ff0000 2178c2ecf20Sopenharmony_ci#define TSI721_INT_IMSG_CHAN(x) (1 << (16 + (x))) 2188c2ecf20Sopenharmony_ci#define TSI721_INT_OMSG_CHAN_M 0x0000ff00 2198c2ecf20Sopenharmony_ci#define TSI721_INT_OMSG_CHAN(x) (1 << (8 + (x))) 2208c2ecf20Sopenharmony_ci#define TSI721_INT_BDMA_CHAN_M 0x000000ff 2218c2ecf20Sopenharmony_ci#define TSI721_INT_BDMA_CHAN(x) (1 << (x)) 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci/* 2248c2ecf20Sopenharmony_ci * PC2SR block registers 2258c2ecf20Sopenharmony_ci */ 2268c2ecf20Sopenharmony_ci#define TSI721_OBWIN_NUM TSI721_PC2SR_WINS 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci#define TSI721_OBWINLB(x) (0x40000 + (x) * 0x20) 2298c2ecf20Sopenharmony_ci#define TSI721_OBWINLB_BA 0xffff8000 2308c2ecf20Sopenharmony_ci#define TSI721_OBWINLB_WEN 0x00000001 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci#define TSI721_OBWINUB(x) (0x40004 + (x) * 0x20) 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci#define TSI721_OBWINSZ(x) (0x40008 + (x) * 0x20) 2358c2ecf20Sopenharmony_ci#define TSI721_OBWINSZ_SIZE 0x00001f00 2368c2ecf20Sopenharmony_ci#define TSI721_OBWIN_SIZE(size) (__fls(size) - 15) 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci#define TSI721_ZONE_SEL 0x41300 2398c2ecf20Sopenharmony_ci#define TSI721_ZONE_SEL_RD_WRB 0x00020000 2408c2ecf20Sopenharmony_ci#define TSI721_ZONE_SEL_GO 0x00010000 2418c2ecf20Sopenharmony_ci#define TSI721_ZONE_SEL_WIN 0x00000038 2428c2ecf20Sopenharmony_ci#define TSI721_ZONE_SEL_ZONE 0x00000007 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0 0x41304 2458c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_ADD 0xfffff000 2468c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_RDTYPE 0x00000f00 2478c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_NREAD 0x00000100 2488c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_MNTRD 0x00000200 2498c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_RDCRF 0x00000020 2508c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_WRCRF 0x00000010 2518c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_WRTYPE 0x0000000f 2528c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_NWR 0x00000001 2538c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_MNTWR 0x00000002 2548c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA0_NWR_R 0x00000004 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA1 0x41308 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA2 0x4130c 2598c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA2_HC 0xff000000 2608c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA2_ADD65 0x000c0000 2618c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA2_TT 0x00030000 2628c2ecf20Sopenharmony_ci#define TSI721_LUT_DATA2_DSTID 0x0000ffff 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci#define TSI721_PC2SR_INTE 0x41310 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci#define TSI721_DEVCTL 0x48004 2678c2ecf20Sopenharmony_ci#define TSI721_DEVCTL_SRBOOT_CMPL 0x00000004 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci#define TSI721_I2C_INT_ENABLE 0x49120 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci/* 2728c2ecf20Sopenharmony_ci * Block DMA Engine Registers 2738c2ecf20Sopenharmony_ci * x = 0..7 2748c2ecf20Sopenharmony_ci */ 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci#define TSI721_DMAC_BASE(x) (0x51000 + (x) * 0x1000) 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci#define TSI721_DMAC_DWRCNT 0x000 2798c2ecf20Sopenharmony_ci#define TSI721_DMAC_DRDCNT 0x004 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci#define TSI721_DMAC_CTL 0x008 2828c2ecf20Sopenharmony_ci#define TSI721_DMAC_CTL_SUSP 0x00000002 2838c2ecf20Sopenharmony_ci#define TSI721_DMAC_CTL_INIT 0x00000001 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT 0x00c 2868c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT_STFULL 0x00000010 2878c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT_DONE 0x00000008 2888c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT_SUSP 0x00000004 2898c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT_ERR 0x00000002 2908c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT_IOFDONE 0x00000001 2918c2ecf20Sopenharmony_ci#define TSI721_DMAC_INT_ALL 0x0000001f 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ci#define TSI721_DMAC_INTSET 0x010 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#define TSI721_DMAC_STS 0x014 2968c2ecf20Sopenharmony_ci#define TSI721_DMAC_STS_ABORT 0x00400000 2978c2ecf20Sopenharmony_ci#define TSI721_DMAC_STS_RUN 0x00200000 2988c2ecf20Sopenharmony_ci#define TSI721_DMAC_STS_CS 0x001f0000 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci#define TSI721_DMAC_INTE 0x018 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci#define TSI721_DMAC_DPTRL 0x024 3038c2ecf20Sopenharmony_ci#define TSI721_DMAC_DPTRL_MASK 0xffffffe0 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci#define TSI721_DMAC_DPTRH 0x028 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSBL 0x02c 3088c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSBL_MASK 0xffffffc0 3098c2ecf20Sopenharmony_ci 3108c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSBH 0x030 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSSZ 0x034 3138c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSSZ_SIZE_M 0x0000000f 3148c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSSZ_SIZE(size) (__fls(size) - 4) 3158c2ecf20Sopenharmony_ci 3168c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSRP 0x038 3178c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSRP_MASK 0x0007ffff 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSWP 0x03c 3208c2ecf20Sopenharmony_ci#define TSI721_DMAC_DSWP_MASK 0x0007ffff 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci#define TSI721_BDMA_INTE 0x5f000 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci/* 3258c2ecf20Sopenharmony_ci * Messaging definitions 3268c2ecf20Sopenharmony_ci */ 3278c2ecf20Sopenharmony_ci#define TSI721_MSG_BUFFER_SIZE RIO_MAX_MSG_SIZE 3288c2ecf20Sopenharmony_ci#define TSI721_MSG_MAX_SIZE RIO_MAX_MSG_SIZE 3298c2ecf20Sopenharmony_ci#define TSI721_IMSG_MAXCH 8 3308c2ecf20Sopenharmony_ci#define TSI721_IMSG_CHNUM TSI721_IMSG_MAXCH 3318c2ecf20Sopenharmony_ci#define TSI721_IMSGD_MIN_RING_SIZE 32 3328c2ecf20Sopenharmony_ci#define TSI721_IMSGD_RING_SIZE 512 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci#define TSI721_OMSG_CHNUM 4 /* One channel per MBOX */ 3358c2ecf20Sopenharmony_ci#define TSI721_OMSGD_MIN_RING_SIZE 32 3368c2ecf20Sopenharmony_ci#define TSI721_OMSGD_RING_SIZE 512 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci/* 3398c2ecf20Sopenharmony_ci * Outbound Messaging Engine Registers 3408c2ecf20Sopenharmony_ci * x = 0..7 3418c2ecf20Sopenharmony_ci */ 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DWRCNT(x) (0x61000 + (x) * 0x1000) 3448c2ecf20Sopenharmony_ci 3458c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DRDCNT(x) (0x61004 + (x) * 0x1000) 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_CTL(x) (0x61008 + (x) * 0x1000) 3488c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_CTL_MASK 0x00000007 3498c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_CTL_RETRY_THR 0x00000004 3508c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_CTL_SUSPEND 0x00000002 3518c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_CTL_INIT 0x00000001 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT(x) (0x6100c + (x) * 0x1000) 3548c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INTSET(x) (0x61010 + (x) * 0x1000) 3558c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INTE(x) (0x61018 + (x) * 0x1000) 3568c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_MASK 0x0000001F 3578c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_ST_FULL 0x00000010 3588c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_DONE 0x00000008 3598c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_SUSPENDED 0x00000004 3608c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_ERROR 0x00000002 3618c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_IOF_DONE 0x00000001 3628c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_INT_ALL TSI721_OBDMAC_INT_MASK 3638c2ecf20Sopenharmony_ci 3648c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_STS(x) (0x61014 + (x) * 0x1000) 3658c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_STS_MASK 0x007f0000 3668c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_STS_ABORT 0x00400000 3678c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_STS_RUN 0x00200000 3688c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_STS_CS 0x001f0000 3698c2ecf20Sopenharmony_ci 3708c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_PWE(x) (0x6101c + (x) * 0x1000) 3718c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_PWE_MASK 0x00000002 3728c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_PWE_ERROR_EN 0x00000002 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DPTRL(x) (0x61020 + (x) * 0x1000) 3758c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DPTRL_MASK 0xfffffff0 3768c2ecf20Sopenharmony_ci 3778c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DPTRH(x) (0x61024 + (x) * 0x1000) 3788c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DPTRH_MASK 0xffffffff 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSBL(x) (0x61040 + (x) * 0x1000) 3818c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSBL_MASK 0xffffffc0 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSBH(x) (0x61044 + (x) * 0x1000) 3848c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSBH_MASK 0xffffffff 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSSZ(x) (0x61048 + (x) * 0x1000) 3878c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSSZ_MASK 0x0000000f 3888c2ecf20Sopenharmony_ci 3898c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSRP(x) (0x6104c + (x) * 0x1000) 3908c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSRP_MASK 0x0007ffff 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSWP(x) (0x61050 + (x) * 0x1000) 3938c2ecf20Sopenharmony_ci#define TSI721_OBDMAC_DSWP_MASK 0x0007ffff 3948c2ecf20Sopenharmony_ci 3958c2ecf20Sopenharmony_ci#define TSI721_RQRPTO 0x60010 3968c2ecf20Sopenharmony_ci#define TSI721_RQRPTO_MASK 0x00ffffff 3978c2ecf20Sopenharmony_ci#define TSI721_RQRPTO_VAL 400 /* Response TO value */ 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci/* 4008c2ecf20Sopenharmony_ci * Inbound Messaging Engine Registers 4018c2ecf20Sopenharmony_ci * x = 0..7 4028c2ecf20Sopenharmony_ci */ 4038c2ecf20Sopenharmony_ci 4048c2ecf20Sopenharmony_ci#define TSI721_IB_DEVID_GLOBAL 0xffff 4058c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQBL(x) (0x61200 + (x) * 0x1000) 4068c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQBL_MASK 0xffffffc0 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQBH(x) (0x61204 + (x) * 0x1000) 4098c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQBH_MASK 0xffffffff 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQSZ_ENTRY_INX TSI721_IMSGD_RING_SIZE 4128c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQSZ(x) (0x61208 + (x) * 0x1000) 4138c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQSZ_MASK 0x0000000f 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQRP(x) (0x6120c + (x) * 0x1000) 4168c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQRP_MASK 0x0007ffff 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQWP(x) (0x61210 + (x) * 0x1000) 4198c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQWP_MASK 0x0007ffff 4208c2ecf20Sopenharmony_ci 4218c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQTH(x) (0x61214 + (x) * 0x1000) 4228c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_FQTH_MASK 0x0007ffff 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci#define TSI721_IB_DEVID 0x60020 4258c2ecf20Sopenharmony_ci#define TSI721_IB_DEVID_MASK 0x0000ffff 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_CTL(x) (0x61240 + (x) * 0x1000) 4288c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_CTL_MASK 0x00000003 4298c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_CTL_SUSPEND 0x00000002 4308c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_CTL_INIT 0x00000001 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_STS(x) (0x61244 + (x) * 0x1000) 4338c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_STS_MASK 0x007f0000 4348c2ecf20Sopenharmony_ci#define TSI721_IBSMAC_STS_ABORT 0x00400000 4358c2ecf20Sopenharmony_ci#define TSI721_IBSMAC_STS_RUN 0x00200000 4368c2ecf20Sopenharmony_ci#define TSI721_IBSMAC_STS_CS 0x001f0000 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT(x) (0x61248 + (x) * 0x1000) 4398c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INTSET(x) (0x6124c + (x) * 0x1000) 4408c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INTE(x) (0x61250 + (x) * 0x1000) 4418c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_MASK 0x0000100f 4428c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_SRTO 0x00001000 4438c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_SUSPENDED 0x00000008 4448c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_PC_ERROR 0x00000004 4458c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_FQ_LOW 0x00000002 4468c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_DQ_RCV 0x00000001 4478c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_INT_ALL TSI721_IBDMAC_INT_MASK 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_PWE(x) (0x61254 + (x) * 0x1000) 4508c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_PWE_MASK 0x00001700 4518c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_PWE_SRTO 0x00001000 4528c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_PWE_ILL_FMT 0x00000400 4538c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_PWE_ILL_DEC 0x00000200 4548c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_PWE_IMP_SP 0x00000100 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQBL(x) (0x61300 + (x) * 0x1000) 4578c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQBL_MASK 0xffffffc0 4588c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQBL_ADDR 0xffffffc0 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQBH(x) (0x61304 + (x) * 0x1000) 4618c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQBH_MASK 0xffffffff 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQRP(x) (0x61308 + (x) * 0x1000) 4648c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQRP_MASK 0x0007ffff 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQWR(x) (0x6130c + (x) * 0x1000) 4678c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQWR_MASK 0x0007ffff 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQSZ(x) (0x61314 + (x) * 0x1000) 4708c2ecf20Sopenharmony_ci#define TSI721_IBDMAC_DQSZ_MASK 0x0000000f 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci/* 4738c2ecf20Sopenharmony_ci * Messaging Engine Interrupts 4748c2ecf20Sopenharmony_ci */ 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci#define TSI721_SMSG_PWE 0x6a004 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci#define TSI721_SMSG_INTE 0x6a000 4798c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT 0x6a008 4808c2ecf20Sopenharmony_ci#define TSI721_SMSG_INTSET 0x6a010 4818c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT_MASK 0x0086ffff 4828c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT_UNS_RSP 0x00800000 4838c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT_ECC_NCOR 0x00040000 4848c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT_ECC_COR 0x00020000 4858c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT_ECC_NCOR_CH 0x0000ff00 4868c2ecf20Sopenharmony_ci#define TSI721_SMSG_INT_ECC_COR_CH 0x000000ff 4878c2ecf20Sopenharmony_ci 4888c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_LOG 0x6a014 4898c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_LOG_MASK 0x00070007 4908c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_LOG_ECC_NCOR_M 0x00070000 4918c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_LOG_ECC_COR_M 0x00000007 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ci#define TSI721_RETRY_GEN_CNT 0x6a100 4948c2ecf20Sopenharmony_ci#define TSI721_RETRY_GEN_CNT_MASK 0xffffffff 4958c2ecf20Sopenharmony_ci 4968c2ecf20Sopenharmony_ci#define TSI721_RETRY_RX_CNT 0x6a104 4978c2ecf20Sopenharmony_ci#define TSI721_RETRY_RX_CNT_MASK 0xffffffff 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_COR_LOG(x) (0x6a300 + (x) * 4) 5008c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_COR_LOG_MASK 0x000000ff 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_NCOR(x) (0x6a340 + (x) * 4) 5038c2ecf20Sopenharmony_ci#define TSI721_SMSG_ECC_NCOR_MASK 0x000000ff 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci/* 5068c2ecf20Sopenharmony_ci * Block DMA Descriptors 5078c2ecf20Sopenharmony_ci */ 5088c2ecf20Sopenharmony_ci 5098c2ecf20Sopenharmony_cistruct tsi721_dma_desc { 5108c2ecf20Sopenharmony_ci __le32 type_id; 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci#define TSI721_DMAD_DEVID 0x0000ffff 5138c2ecf20Sopenharmony_ci#define TSI721_DMAD_CRF 0x00010000 5148c2ecf20Sopenharmony_ci#define TSI721_DMAD_PRIO 0x00060000 5158c2ecf20Sopenharmony_ci#define TSI721_DMAD_RTYPE 0x00780000 5168c2ecf20Sopenharmony_ci#define TSI721_DMAD_IOF 0x08000000 5178c2ecf20Sopenharmony_ci#define TSI721_DMAD_DTYPE 0xe0000000 5188c2ecf20Sopenharmony_ci 5198c2ecf20Sopenharmony_ci __le32 bcount; 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci#define TSI721_DMAD_BCOUNT1 0x03ffffff /* if DTYPE == 1 */ 5228c2ecf20Sopenharmony_ci#define TSI721_DMAD_BCOUNT2 0x0000000f /* if DTYPE == 2 */ 5238c2ecf20Sopenharmony_ci#define TSI721_DMAD_TT 0x0c000000 5248c2ecf20Sopenharmony_ci#define TSI721_DMAD_RADDR0 0xc0000000 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci union { 5278c2ecf20Sopenharmony_ci __le32 raddr_lo; /* if DTYPE == (1 || 2) */ 5288c2ecf20Sopenharmony_ci __le32 next_lo; /* if DTYPE == 3 */ 5298c2ecf20Sopenharmony_ci }; 5308c2ecf20Sopenharmony_ci 5318c2ecf20Sopenharmony_ci#define TSI721_DMAD_CFGOFF 0x00ffffff 5328c2ecf20Sopenharmony_ci#define TSI721_DMAD_HOPCNT 0xff000000 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci union { 5358c2ecf20Sopenharmony_ci __le32 raddr_hi; /* if DTYPE == (1 || 2) */ 5368c2ecf20Sopenharmony_ci __le32 next_hi; /* if DTYPE == 3 */ 5378c2ecf20Sopenharmony_ci }; 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci union { 5408c2ecf20Sopenharmony_ci struct { /* if DTYPE == 1 */ 5418c2ecf20Sopenharmony_ci __le32 bufptr_lo; 5428c2ecf20Sopenharmony_ci __le32 bufptr_hi; 5438c2ecf20Sopenharmony_ci __le32 s_dist; 5448c2ecf20Sopenharmony_ci __le32 s_size; 5458c2ecf20Sopenharmony_ci } t1; 5468c2ecf20Sopenharmony_ci __le32 data[4]; /* if DTYPE == 2 */ 5478c2ecf20Sopenharmony_ci u32 reserved[4]; /* if DTYPE == 3 */ 5488c2ecf20Sopenharmony_ci }; 5498c2ecf20Sopenharmony_ci} __aligned(32); 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci/* 5528c2ecf20Sopenharmony_ci * Inbound Messaging Descriptor 5538c2ecf20Sopenharmony_ci */ 5548c2ecf20Sopenharmony_cistruct tsi721_imsg_desc { 5558c2ecf20Sopenharmony_ci __le32 type_id; 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci#define TSI721_IMD_DEVID 0x0000ffff 5588c2ecf20Sopenharmony_ci#define TSI721_IMD_CRF 0x00010000 5598c2ecf20Sopenharmony_ci#define TSI721_IMD_PRIO 0x00060000 5608c2ecf20Sopenharmony_ci#define TSI721_IMD_TT 0x00180000 5618c2ecf20Sopenharmony_ci#define TSI721_IMD_DTYPE 0xe0000000 5628c2ecf20Sopenharmony_ci 5638c2ecf20Sopenharmony_ci __le32 msg_info; 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_ci#define TSI721_IMD_BCOUNT 0x00000ff8 5668c2ecf20Sopenharmony_ci#define TSI721_IMD_SSIZE 0x0000f000 5678c2ecf20Sopenharmony_ci#define TSI721_IMD_LETER 0x00030000 5688c2ecf20Sopenharmony_ci#define TSI721_IMD_XMBOX 0x003c0000 5698c2ecf20Sopenharmony_ci#define TSI721_IMD_MBOX 0x00c00000 5708c2ecf20Sopenharmony_ci#define TSI721_IMD_CS 0x78000000 5718c2ecf20Sopenharmony_ci#define TSI721_IMD_HO 0x80000000 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci __le32 bufptr_lo; 5748c2ecf20Sopenharmony_ci __le32 bufptr_hi; 5758c2ecf20Sopenharmony_ci u32 reserved[12]; 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci} __aligned(64); 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci/* 5808c2ecf20Sopenharmony_ci * Outbound Messaging Descriptor 5818c2ecf20Sopenharmony_ci */ 5828c2ecf20Sopenharmony_cistruct tsi721_omsg_desc { 5838c2ecf20Sopenharmony_ci __le32 type_id; 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_ci#define TSI721_OMD_DEVID 0x0000ffff 5868c2ecf20Sopenharmony_ci#define TSI721_OMD_CRF 0x00010000 5878c2ecf20Sopenharmony_ci#define TSI721_OMD_PRIO 0x00060000 5888c2ecf20Sopenharmony_ci#define TSI721_OMD_IOF 0x08000000 5898c2ecf20Sopenharmony_ci#define TSI721_OMD_DTYPE 0xe0000000 5908c2ecf20Sopenharmony_ci#define TSI721_OMD_RSRVD 0x17f80000 5918c2ecf20Sopenharmony_ci 5928c2ecf20Sopenharmony_ci __le32 msg_info; 5938c2ecf20Sopenharmony_ci 5948c2ecf20Sopenharmony_ci#define TSI721_OMD_BCOUNT 0x00000ff8 5958c2ecf20Sopenharmony_ci#define TSI721_OMD_SSIZE 0x0000f000 5968c2ecf20Sopenharmony_ci#define TSI721_OMD_LETER 0x00030000 5978c2ecf20Sopenharmony_ci#define TSI721_OMD_XMBOX 0x003c0000 5988c2ecf20Sopenharmony_ci#define TSI721_OMD_MBOX 0x00c00000 5998c2ecf20Sopenharmony_ci#define TSI721_OMD_TT 0x0c000000 6008c2ecf20Sopenharmony_ci 6018c2ecf20Sopenharmony_ci union { 6028c2ecf20Sopenharmony_ci __le32 bufptr_lo; /* if DTYPE == 4 */ 6038c2ecf20Sopenharmony_ci __le32 next_lo; /* if DTYPE == 5 */ 6048c2ecf20Sopenharmony_ci }; 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_ci union { 6078c2ecf20Sopenharmony_ci __le32 bufptr_hi; /* if DTYPE == 4 */ 6088c2ecf20Sopenharmony_ci __le32 next_hi; /* if DTYPE == 5 */ 6098c2ecf20Sopenharmony_ci }; 6108c2ecf20Sopenharmony_ci 6118c2ecf20Sopenharmony_ci} __aligned(16); 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_cistruct tsi721_dma_sts { 6148c2ecf20Sopenharmony_ci __le64 desc_sts[8]; 6158c2ecf20Sopenharmony_ci} __aligned(64); 6168c2ecf20Sopenharmony_ci 6178c2ecf20Sopenharmony_cistruct tsi721_desc_sts_fifo { 6188c2ecf20Sopenharmony_ci union { 6198c2ecf20Sopenharmony_ci __le64 da64; 6208c2ecf20Sopenharmony_ci struct { 6218c2ecf20Sopenharmony_ci __le32 lo; 6228c2ecf20Sopenharmony_ci __le32 hi; 6238c2ecf20Sopenharmony_ci } da32; 6248c2ecf20Sopenharmony_ci } stat[8]; 6258c2ecf20Sopenharmony_ci} __aligned(64); 6268c2ecf20Sopenharmony_ci 6278c2ecf20Sopenharmony_ci/* Descriptor types for BDMA and Messaging blocks */ 6288c2ecf20Sopenharmony_cienum dma_dtype { 6298c2ecf20Sopenharmony_ci DTYPE1 = 1, /* Data Transfer DMA Descriptor */ 6308c2ecf20Sopenharmony_ci DTYPE2 = 2, /* Immediate Data Transfer DMA Descriptor */ 6318c2ecf20Sopenharmony_ci DTYPE3 = 3, /* Block Pointer DMA Descriptor */ 6328c2ecf20Sopenharmony_ci DTYPE4 = 4, /* Outbound Msg DMA Descriptor */ 6338c2ecf20Sopenharmony_ci DTYPE5 = 5, /* OB Messaging Block Pointer Descriptor */ 6348c2ecf20Sopenharmony_ci DTYPE6 = 6 /* Inbound Messaging Descriptor */ 6358c2ecf20Sopenharmony_ci}; 6368c2ecf20Sopenharmony_ci 6378c2ecf20Sopenharmony_cienum dma_rtype { 6388c2ecf20Sopenharmony_ci NREAD = 0, 6398c2ecf20Sopenharmony_ci LAST_NWRITE_R = 1, 6408c2ecf20Sopenharmony_ci ALL_NWRITE = 2, 6418c2ecf20Sopenharmony_ci ALL_NWRITE_R = 3, 6428c2ecf20Sopenharmony_ci MAINT_RD = 4, 6438c2ecf20Sopenharmony_ci MAINT_WR = 5 6448c2ecf20Sopenharmony_ci}; 6458c2ecf20Sopenharmony_ci 6468c2ecf20Sopenharmony_ci/* 6478c2ecf20Sopenharmony_ci * mport Driver Definitions 6488c2ecf20Sopenharmony_ci */ 6498c2ecf20Sopenharmony_ci#define TSI721_DMA_CHNUM TSI721_DMA_MAXCH 6508c2ecf20Sopenharmony_ci 6518c2ecf20Sopenharmony_ci#define TSI721_DMACH_MAINT 7 /* DMA channel for maint requests */ 6528c2ecf20Sopenharmony_ci#define TSI721_DMACH_MAINT_NBD 32 /* Number of BDs for maint requests */ 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_ci#define TSI721_DMACH_DMA 1 /* DMA channel for data transfers */ 6558c2ecf20Sopenharmony_ci 6568c2ecf20Sopenharmony_ci#define MSG_DMA_ENTRY_INX_TO_SIZE(x) ((0x10 << (x)) & 0xFFFF0) 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_cienum tsi721_smsg_int_flag { 6598c2ecf20Sopenharmony_ci SMSG_INT_NONE = 0x00000000, 6608c2ecf20Sopenharmony_ci SMSG_INT_ECC_COR_CH = 0x000000ff, 6618c2ecf20Sopenharmony_ci SMSG_INT_ECC_NCOR_CH = 0x0000ff00, 6628c2ecf20Sopenharmony_ci SMSG_INT_ECC_COR = 0x00020000, 6638c2ecf20Sopenharmony_ci SMSG_INT_ECC_NCOR = 0x00040000, 6648c2ecf20Sopenharmony_ci SMSG_INT_UNS_RSP = 0x00800000, 6658c2ecf20Sopenharmony_ci SMSG_INT_ALL = 0x0006ffff 6668c2ecf20Sopenharmony_ci}; 6678c2ecf20Sopenharmony_ci 6688c2ecf20Sopenharmony_ci/* Structures */ 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_ci#ifdef CONFIG_RAPIDIO_DMA_ENGINE 6718c2ecf20Sopenharmony_ci 6728c2ecf20Sopenharmony_ci#define TSI721_BDMA_MAX_BCOUNT (TSI721_DMAD_BCOUNT1 + 1) 6738c2ecf20Sopenharmony_ci 6748c2ecf20Sopenharmony_cistruct tsi721_tx_desc { 6758c2ecf20Sopenharmony_ci struct dma_async_tx_descriptor txd; 6768c2ecf20Sopenharmony_ci u16 destid; 6778c2ecf20Sopenharmony_ci /* low 64-bits of 66-bit RIO address */ 6788c2ecf20Sopenharmony_ci u64 rio_addr; 6798c2ecf20Sopenharmony_ci /* upper 2-bits of 66-bit RIO address */ 6808c2ecf20Sopenharmony_ci u8 rio_addr_u; 6818c2ecf20Sopenharmony_ci enum dma_rtype rtype; 6828c2ecf20Sopenharmony_ci struct list_head desc_node; 6838c2ecf20Sopenharmony_ci struct scatterlist *sg; 6848c2ecf20Sopenharmony_ci unsigned int sg_len; 6858c2ecf20Sopenharmony_ci enum dma_status status; 6868c2ecf20Sopenharmony_ci}; 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_cistruct tsi721_bdma_chan { 6898c2ecf20Sopenharmony_ci int id; 6908c2ecf20Sopenharmony_ci void __iomem *regs; 6918c2ecf20Sopenharmony_ci int bd_num; /* number of HW buffer descriptors */ 6928c2ecf20Sopenharmony_ci void *bd_base; /* start of DMA descriptors */ 6938c2ecf20Sopenharmony_ci dma_addr_t bd_phys; 6948c2ecf20Sopenharmony_ci void *sts_base; /* start of DMA BD status FIFO */ 6958c2ecf20Sopenharmony_ci dma_addr_t sts_phys; 6968c2ecf20Sopenharmony_ci int sts_size; 6978c2ecf20Sopenharmony_ci u32 sts_rdptr; 6988c2ecf20Sopenharmony_ci u32 wr_count; 6998c2ecf20Sopenharmony_ci u32 wr_count_next; 7008c2ecf20Sopenharmony_ci 7018c2ecf20Sopenharmony_ci struct dma_chan dchan; 7028c2ecf20Sopenharmony_ci struct tsi721_tx_desc *tx_desc; 7038c2ecf20Sopenharmony_ci spinlock_t lock; 7048c2ecf20Sopenharmony_ci struct tsi721_tx_desc *active_tx; 7058c2ecf20Sopenharmony_ci struct list_head queue; 7068c2ecf20Sopenharmony_ci struct list_head free_list; 7078c2ecf20Sopenharmony_ci struct tasklet_struct tasklet; 7088c2ecf20Sopenharmony_ci bool active; 7098c2ecf20Sopenharmony_ci}; 7108c2ecf20Sopenharmony_ci 7118c2ecf20Sopenharmony_ci#endif /* CONFIG_RAPIDIO_DMA_ENGINE */ 7128c2ecf20Sopenharmony_ci 7138c2ecf20Sopenharmony_cistruct tsi721_bdma_maint { 7148c2ecf20Sopenharmony_ci int ch_id; /* BDMA channel number */ 7158c2ecf20Sopenharmony_ci int bd_num; /* number of buffer descriptors */ 7168c2ecf20Sopenharmony_ci void *bd_base; /* start of DMA descriptors */ 7178c2ecf20Sopenharmony_ci dma_addr_t bd_phys; 7188c2ecf20Sopenharmony_ci void *sts_base; /* start of DMA BD status FIFO */ 7198c2ecf20Sopenharmony_ci dma_addr_t sts_phys; 7208c2ecf20Sopenharmony_ci int sts_size; 7218c2ecf20Sopenharmony_ci}; 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_cistruct tsi721_imsg_ring { 7248c2ecf20Sopenharmony_ci u32 size; 7258c2ecf20Sopenharmony_ci /* VA/PA of data buffers for incoming messages */ 7268c2ecf20Sopenharmony_ci void *buf_base; 7278c2ecf20Sopenharmony_ci dma_addr_t buf_phys; 7288c2ecf20Sopenharmony_ci /* VA/PA of circular free buffer list */ 7298c2ecf20Sopenharmony_ci void *imfq_base; 7308c2ecf20Sopenharmony_ci dma_addr_t imfq_phys; 7318c2ecf20Sopenharmony_ci /* VA/PA of Inbound message descriptors */ 7328c2ecf20Sopenharmony_ci void *imd_base; 7338c2ecf20Sopenharmony_ci dma_addr_t imd_phys; 7348c2ecf20Sopenharmony_ci /* Inbound Queue buffer pointers */ 7358c2ecf20Sopenharmony_ci void *imq_base[TSI721_IMSGD_RING_SIZE]; 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_ci u32 rx_slot; 7388c2ecf20Sopenharmony_ci void *dev_id; 7398c2ecf20Sopenharmony_ci u32 fq_wrptr; 7408c2ecf20Sopenharmony_ci u32 desc_rdptr; 7418c2ecf20Sopenharmony_ci spinlock_t lock; 7428c2ecf20Sopenharmony_ci}; 7438c2ecf20Sopenharmony_ci 7448c2ecf20Sopenharmony_cistruct tsi721_omsg_ring { 7458c2ecf20Sopenharmony_ci u32 size; 7468c2ecf20Sopenharmony_ci /* VA/PA of OB Msg descriptors */ 7478c2ecf20Sopenharmony_ci void *omd_base; 7488c2ecf20Sopenharmony_ci dma_addr_t omd_phys; 7498c2ecf20Sopenharmony_ci /* VA/PA of OB Msg data buffers */ 7508c2ecf20Sopenharmony_ci void *omq_base[TSI721_OMSGD_RING_SIZE]; 7518c2ecf20Sopenharmony_ci dma_addr_t omq_phys[TSI721_OMSGD_RING_SIZE]; 7528c2ecf20Sopenharmony_ci /* VA/PA of OB Msg descriptor status FIFO */ 7538c2ecf20Sopenharmony_ci void *sts_base; 7548c2ecf20Sopenharmony_ci dma_addr_t sts_phys; 7558c2ecf20Sopenharmony_ci u32 sts_size; /* # of allocated status entries */ 7568c2ecf20Sopenharmony_ci u32 sts_rdptr; 7578c2ecf20Sopenharmony_ci 7588c2ecf20Sopenharmony_ci u32 tx_slot; 7598c2ecf20Sopenharmony_ci void *dev_id; 7608c2ecf20Sopenharmony_ci u32 wr_count; 7618c2ecf20Sopenharmony_ci spinlock_t lock; 7628c2ecf20Sopenharmony_ci}; 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_cienum tsi721_flags { 7658c2ecf20Sopenharmony_ci TSI721_USING_MSI = (1 << 0), 7668c2ecf20Sopenharmony_ci TSI721_USING_MSIX = (1 << 1), 7678c2ecf20Sopenharmony_ci TSI721_IMSGID_SET = (1 << 2), 7688c2ecf20Sopenharmony_ci}; 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_MSI 7718c2ecf20Sopenharmony_ci/* 7728c2ecf20Sopenharmony_ci * MSI-X Table Entries (0 ... 69) 7738c2ecf20Sopenharmony_ci */ 7748c2ecf20Sopenharmony_ci#define TSI721_MSIX_DMACH_DONE(x) (0 + (x)) 7758c2ecf20Sopenharmony_ci#define TSI721_MSIX_DMACH_INT(x) (8 + (x)) 7768c2ecf20Sopenharmony_ci#define TSI721_MSIX_BDMA_INT 16 7778c2ecf20Sopenharmony_ci#define TSI721_MSIX_OMSG_DONE(x) (17 + (x)) 7788c2ecf20Sopenharmony_ci#define TSI721_MSIX_OMSG_INT(x) (25 + (x)) 7798c2ecf20Sopenharmony_ci#define TSI721_MSIX_IMSG_DQ_RCV(x) (33 + (x)) 7808c2ecf20Sopenharmony_ci#define TSI721_MSIX_IMSG_INT(x) (41 + (x)) 7818c2ecf20Sopenharmony_ci#define TSI721_MSIX_MSG_INT 49 7828c2ecf20Sopenharmony_ci#define TSI721_MSIX_SR2PC_IDBQ_RCV(x) (50 + (x)) 7838c2ecf20Sopenharmony_ci#define TSI721_MSIX_SR2PC_CH_INT(x) (58 + (x)) 7848c2ecf20Sopenharmony_ci#define TSI721_MSIX_SR2PC_INT 66 7858c2ecf20Sopenharmony_ci#define TSI721_MSIX_PC2SR_INT 67 7868c2ecf20Sopenharmony_ci#define TSI721_MSIX_SRIO_MAC_INT 68 7878c2ecf20Sopenharmony_ci#define TSI721_MSIX_I2C_INT 69 7888c2ecf20Sopenharmony_ci 7898c2ecf20Sopenharmony_ci/* MSI-X vector and init table entry indexes */ 7908c2ecf20Sopenharmony_cienum tsi721_msix_vect { 7918c2ecf20Sopenharmony_ci TSI721_VECT_IDB, 7928c2ecf20Sopenharmony_ci TSI721_VECT_PWRX, /* PW_RX is part of SRIO MAC Interrupt reporting */ 7938c2ecf20Sopenharmony_ci TSI721_VECT_OMB0_DONE, 7948c2ecf20Sopenharmony_ci TSI721_VECT_OMB1_DONE, 7958c2ecf20Sopenharmony_ci TSI721_VECT_OMB2_DONE, 7968c2ecf20Sopenharmony_ci TSI721_VECT_OMB3_DONE, 7978c2ecf20Sopenharmony_ci TSI721_VECT_OMB0_INT, 7988c2ecf20Sopenharmony_ci TSI721_VECT_OMB1_INT, 7998c2ecf20Sopenharmony_ci TSI721_VECT_OMB2_INT, 8008c2ecf20Sopenharmony_ci TSI721_VECT_OMB3_INT, 8018c2ecf20Sopenharmony_ci TSI721_VECT_IMB0_RCV, 8028c2ecf20Sopenharmony_ci TSI721_VECT_IMB1_RCV, 8038c2ecf20Sopenharmony_ci TSI721_VECT_IMB2_RCV, 8048c2ecf20Sopenharmony_ci TSI721_VECT_IMB3_RCV, 8058c2ecf20Sopenharmony_ci TSI721_VECT_IMB0_INT, 8068c2ecf20Sopenharmony_ci TSI721_VECT_IMB1_INT, 8078c2ecf20Sopenharmony_ci TSI721_VECT_IMB2_INT, 8088c2ecf20Sopenharmony_ci TSI721_VECT_IMB3_INT, 8098c2ecf20Sopenharmony_ci#ifdef CONFIG_RAPIDIO_DMA_ENGINE 8108c2ecf20Sopenharmony_ci TSI721_VECT_DMA0_DONE, 8118c2ecf20Sopenharmony_ci TSI721_VECT_DMA1_DONE, 8128c2ecf20Sopenharmony_ci TSI721_VECT_DMA2_DONE, 8138c2ecf20Sopenharmony_ci TSI721_VECT_DMA3_DONE, 8148c2ecf20Sopenharmony_ci TSI721_VECT_DMA4_DONE, 8158c2ecf20Sopenharmony_ci TSI721_VECT_DMA5_DONE, 8168c2ecf20Sopenharmony_ci TSI721_VECT_DMA6_DONE, 8178c2ecf20Sopenharmony_ci TSI721_VECT_DMA7_DONE, 8188c2ecf20Sopenharmony_ci TSI721_VECT_DMA0_INT, 8198c2ecf20Sopenharmony_ci TSI721_VECT_DMA1_INT, 8208c2ecf20Sopenharmony_ci TSI721_VECT_DMA2_INT, 8218c2ecf20Sopenharmony_ci TSI721_VECT_DMA3_INT, 8228c2ecf20Sopenharmony_ci TSI721_VECT_DMA4_INT, 8238c2ecf20Sopenharmony_ci TSI721_VECT_DMA5_INT, 8248c2ecf20Sopenharmony_ci TSI721_VECT_DMA6_INT, 8258c2ecf20Sopenharmony_ci TSI721_VECT_DMA7_INT, 8268c2ecf20Sopenharmony_ci#endif /* CONFIG_RAPIDIO_DMA_ENGINE */ 8278c2ecf20Sopenharmony_ci TSI721_VECT_MAX 8288c2ecf20Sopenharmony_ci}; 8298c2ecf20Sopenharmony_ci 8308c2ecf20Sopenharmony_ci#define IRQ_DEVICE_NAME_MAX 64 8318c2ecf20Sopenharmony_ci 8328c2ecf20Sopenharmony_cistruct msix_irq { 8338c2ecf20Sopenharmony_ci u16 vector; 8348c2ecf20Sopenharmony_ci char irq_name[IRQ_DEVICE_NAME_MAX]; 8358c2ecf20Sopenharmony_ci}; 8368c2ecf20Sopenharmony_ci#endif /* CONFIG_PCI_MSI */ 8378c2ecf20Sopenharmony_ci 8388c2ecf20Sopenharmony_cistruct tsi721_ib_win_mapping { 8398c2ecf20Sopenharmony_ci struct list_head node; 8408c2ecf20Sopenharmony_ci dma_addr_t lstart; 8418c2ecf20Sopenharmony_ci}; 8428c2ecf20Sopenharmony_ci 8438c2ecf20Sopenharmony_cistruct tsi721_ib_win { 8448c2ecf20Sopenharmony_ci u64 rstart; 8458c2ecf20Sopenharmony_ci u32 size; 8468c2ecf20Sopenharmony_ci dma_addr_t lstart; 8478c2ecf20Sopenharmony_ci bool active; 8488c2ecf20Sopenharmony_ci bool xlat; 8498c2ecf20Sopenharmony_ci struct list_head mappings; 8508c2ecf20Sopenharmony_ci}; 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_cistruct tsi721_obw_bar { 8538c2ecf20Sopenharmony_ci u64 base; 8548c2ecf20Sopenharmony_ci u64 size; 8558c2ecf20Sopenharmony_ci u64 free; 8568c2ecf20Sopenharmony_ci}; 8578c2ecf20Sopenharmony_ci 8588c2ecf20Sopenharmony_cistruct tsi721_ob_win { 8598c2ecf20Sopenharmony_ci u64 base; 8608c2ecf20Sopenharmony_ci u32 size; 8618c2ecf20Sopenharmony_ci u16 destid; 8628c2ecf20Sopenharmony_ci u64 rstart; 8638c2ecf20Sopenharmony_ci bool active; 8648c2ecf20Sopenharmony_ci struct tsi721_obw_bar *pbar; 8658c2ecf20Sopenharmony_ci}; 8668c2ecf20Sopenharmony_ci 8678c2ecf20Sopenharmony_cistruct tsi721_device { 8688c2ecf20Sopenharmony_ci struct pci_dev *pdev; 8698c2ecf20Sopenharmony_ci struct rio_mport mport; 8708c2ecf20Sopenharmony_ci u32 flags; 8718c2ecf20Sopenharmony_ci void __iomem *regs; 8728c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI_MSI 8738c2ecf20Sopenharmony_ci struct msix_irq msix[TSI721_VECT_MAX]; 8748c2ecf20Sopenharmony_ci#endif 8758c2ecf20Sopenharmony_ci /* Doorbells */ 8768c2ecf20Sopenharmony_ci void __iomem *odb_base; 8778c2ecf20Sopenharmony_ci void *idb_base; 8788c2ecf20Sopenharmony_ci dma_addr_t idb_dma; 8798c2ecf20Sopenharmony_ci struct work_struct idb_work; 8808c2ecf20Sopenharmony_ci u32 db_discard_count; 8818c2ecf20Sopenharmony_ci 8828c2ecf20Sopenharmony_ci /* Inbound Port-Write */ 8838c2ecf20Sopenharmony_ci struct work_struct pw_work; 8848c2ecf20Sopenharmony_ci struct kfifo pw_fifo; 8858c2ecf20Sopenharmony_ci spinlock_t pw_fifo_lock; 8868c2ecf20Sopenharmony_ci u32 pw_discard_count; 8878c2ecf20Sopenharmony_ci 8888c2ecf20Sopenharmony_ci /* BDMA Engine */ 8898c2ecf20Sopenharmony_ci struct tsi721_bdma_maint mdma; /* Maintenance rd/wr request channel */ 8908c2ecf20Sopenharmony_ci 8918c2ecf20Sopenharmony_ci#ifdef CONFIG_RAPIDIO_DMA_ENGINE 8928c2ecf20Sopenharmony_ci struct tsi721_bdma_chan bdma[TSI721_DMA_CHNUM]; 8938c2ecf20Sopenharmony_ci#endif 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ci /* Inbound Messaging */ 8968c2ecf20Sopenharmony_ci int imsg_init[TSI721_IMSG_CHNUM]; 8978c2ecf20Sopenharmony_ci struct tsi721_imsg_ring imsg_ring[TSI721_IMSG_CHNUM]; 8988c2ecf20Sopenharmony_ci 8998c2ecf20Sopenharmony_ci /* Outbound Messaging */ 9008c2ecf20Sopenharmony_ci int omsg_init[TSI721_OMSG_CHNUM]; 9018c2ecf20Sopenharmony_ci struct tsi721_omsg_ring omsg_ring[TSI721_OMSG_CHNUM]; 9028c2ecf20Sopenharmony_ci 9038c2ecf20Sopenharmony_ci /* Inbound Mapping Windows */ 9048c2ecf20Sopenharmony_ci struct tsi721_ib_win ib_win[TSI721_IBWIN_NUM]; 9058c2ecf20Sopenharmony_ci int ibwin_cnt; 9068c2ecf20Sopenharmony_ci 9078c2ecf20Sopenharmony_ci /* Outbound Mapping Windows */ 9088c2ecf20Sopenharmony_ci struct tsi721_obw_bar p2r_bar[2]; 9098c2ecf20Sopenharmony_ci struct tsi721_ob_win ob_win[TSI721_OBWIN_NUM]; 9108c2ecf20Sopenharmony_ci int obwin_cnt; 9118c2ecf20Sopenharmony_ci}; 9128c2ecf20Sopenharmony_ci 9138c2ecf20Sopenharmony_ci#ifdef CONFIG_RAPIDIO_DMA_ENGINE 9148c2ecf20Sopenharmony_ciextern void tsi721_bdma_handler(struct tsi721_bdma_chan *bdma_chan); 9158c2ecf20Sopenharmony_ciextern int tsi721_register_dma(struct tsi721_device *priv); 9168c2ecf20Sopenharmony_ciextern void tsi721_unregister_dma(struct tsi721_device *priv); 9178c2ecf20Sopenharmony_ciextern void tsi721_dma_stop_all(struct tsi721_device *priv); 9188c2ecf20Sopenharmony_ci#else 9198c2ecf20Sopenharmony_ci#define tsi721_dma_stop_all(priv) do {} while (0) 9208c2ecf20Sopenharmony_ci#define tsi721_unregister_dma(priv) do {} while (0) 9218c2ecf20Sopenharmony_ci#endif 9228c2ecf20Sopenharmony_ci 9238c2ecf20Sopenharmony_ci#endif 924