18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * (C) Copyright 2005 Tundra Semiconductor Corp. 48c2ecf20Sopenharmony_ci * Kong Lai, <kong.lai@tundra.com). 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * See file CREDITS for list of people who contributed to this 78c2ecf20Sopenharmony_ci * project. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* 118c2ecf20Sopenharmony_ci * net/tsi108_eth.h - definitions for Tsi108 GIGE network controller. 128c2ecf20Sopenharmony_ci */ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#ifndef __TSI108_ETH_H 158c2ecf20Sopenharmony_ci#define __TSI108_ETH_H 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <linux/types.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define TSI_WRITE(offset, val) \ 208c2ecf20Sopenharmony_ci out_be32((data->regs + (offset)), val) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define TSI_READ(offset) \ 238c2ecf20Sopenharmony_ci in_be32((data->regs + (offset))) 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define TSI_WRITE_PHY(offset, val) \ 268c2ecf20Sopenharmony_ci out_be32((data->phyregs + (offset)), val) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define TSI_READ_PHY(offset) \ 298c2ecf20Sopenharmony_ci in_be32((data->phyregs + (offset))) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/* 328c2ecf20Sopenharmony_ci * TSI108 GIGE port registers 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define TSI108_ETH_PORT_NUM 2 368c2ecf20Sopenharmony_ci#define TSI108_PBM_PORT 2 378c2ecf20Sopenharmony_ci#define TSI108_SDRAM_PORT 4 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG1 (0x000) 408c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG1_SOFTRST (1 << 31) 418c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG1_LOOPBACK (1 << 8) 428c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG1_RXEN (1 << 2) 438c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG1_TXEN (1 << 0) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2 (0x004) 468c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2_DFLT_PREAMBLE (7 << 12) 478c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2_IFACE_MASK (3 << 8) 488c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2_NOGIG (1 << 8) 498c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2_GIG (2 << 8) 508c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2_PADCRC (1 << 2) 518c2ecf20Sopenharmony_ci#define TSI108_MAC_CFG2_FULLDUPLEX (1 << 0) 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_MGMT_CFG (0x020) 548c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_MGMT_CLK (7 << 0) 558c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_MGMT_RST (1 << 31) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_CMD (0x024) 588c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_CMD_READ (1 << 0) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_ADDR (0x028) 618c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_ADDR_REG 0 628c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_ADDR_PHY 8 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_DATAOUT (0x02c) 658c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_DATAIN (0x030) 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_IND (0x034) 688c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_IND_NOTVALID (1 << 2) 698c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_IND_SCANNING (1 << 1) 708c2ecf20Sopenharmony_ci#define TSI108_MAC_MII_IND_BUSY (1 << 0) 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define TSI108_MAC_IFCTRL (0x038) 738c2ecf20Sopenharmony_ci#define TSI108_MAC_IFCTRL_PHYMODE (1 << 24) 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define TSI108_MAC_ADDR1 (0x040) 768c2ecf20Sopenharmony_ci#define TSI108_MAC_ADDR2 (0x044) 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define TSI108_STAT_RXBYTES (0x06c) 798c2ecf20Sopenharmony_ci#define TSI108_STAT_RXBYTES_CARRY (1 << 24) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci#define TSI108_STAT_RXPKTS (0x070) 828c2ecf20Sopenharmony_ci#define TSI108_STAT_RXPKTS_CARRY (1 << 18) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define TSI108_STAT_RXFCS (0x074) 858c2ecf20Sopenharmony_ci#define TSI108_STAT_RXFCS_CARRY (1 << 12) 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define TSI108_STAT_RXMCAST (0x078) 888c2ecf20Sopenharmony_ci#define TSI108_STAT_RXMCAST_CARRY (1 << 18) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define TSI108_STAT_RXALIGN (0x08c) 918c2ecf20Sopenharmony_ci#define TSI108_STAT_RXALIGN_CARRY (1 << 12) 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define TSI108_STAT_RXLENGTH (0x090) 948c2ecf20Sopenharmony_ci#define TSI108_STAT_RXLENGTH_CARRY (1 << 12) 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define TSI108_STAT_RXRUNT (0x09c) 978c2ecf20Sopenharmony_ci#define TSI108_STAT_RXRUNT_CARRY (1 << 12) 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define TSI108_STAT_RXJUMBO (0x0a0) 1008c2ecf20Sopenharmony_ci#define TSI108_STAT_RXJUMBO_CARRY (1 << 12) 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci#define TSI108_STAT_RXFRAG (0x0a4) 1038c2ecf20Sopenharmony_ci#define TSI108_STAT_RXFRAG_CARRY (1 << 12) 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define TSI108_STAT_RXJABBER (0x0a8) 1068c2ecf20Sopenharmony_ci#define TSI108_STAT_RXJABBER_CARRY (1 << 12) 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define TSI108_STAT_RXDROP (0x0ac) 1098c2ecf20Sopenharmony_ci#define TSI108_STAT_RXDROP_CARRY (1 << 12) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define TSI108_STAT_TXBYTES (0x0b0) 1128c2ecf20Sopenharmony_ci#define TSI108_STAT_TXBYTES_CARRY (1 << 24) 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci#define TSI108_STAT_TXPKTS (0x0b4) 1158c2ecf20Sopenharmony_ci#define TSI108_STAT_TXPKTS_CARRY (1 << 18) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci#define TSI108_STAT_TXEXDEF (0x0c8) 1188c2ecf20Sopenharmony_ci#define TSI108_STAT_TXEXDEF_CARRY (1 << 12) 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#define TSI108_STAT_TXEXCOL (0x0d8) 1218c2ecf20Sopenharmony_ci#define TSI108_STAT_TXEXCOL_CARRY (1 << 12) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define TSI108_STAT_TXTCOL (0x0dc) 1248c2ecf20Sopenharmony_ci#define TSI108_STAT_TXTCOL_CARRY (1 << 13) 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define TSI108_STAT_TXPAUSEDROP (0x0e4) 1278c2ecf20Sopenharmony_ci#define TSI108_STAT_TXPAUSEDROP_CARRY (1 << 12) 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1 (0x100) 1308c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXBYTES (1 << 16) 1318c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXPKTS (1 << 15) 1328c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXFCS (1 << 14) 1338c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXMCAST (1 << 13) 1348c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXALIGN (1 << 8) 1358c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXLENGTH (1 << 7) 1368c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXRUNT (1 << 4) 1378c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXJUMBO (1 << 3) 1388c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXFRAG (1 << 2) 1398c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXJABBER (1 << 1) 1408c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY1_RXDROP (1 << 0) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2 (0x104) 1438c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2_TXBYTES (1 << 13) 1448c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2_TXPKTS (1 << 12) 1458c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2_TXEXDEF (1 << 7) 1468c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2_TXEXCOL (1 << 3) 1478c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2_TXTCOL (1 << 2) 1488c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRY2_TXPAUSE (1 << 0) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRYMASK1 (0x108) 1518c2ecf20Sopenharmony_ci#define TSI108_STAT_CARRYMASK2 (0x10c) 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define TSI108_EC_PORTCTRL (0x200) 1548c2ecf20Sopenharmony_ci#define TSI108_EC_PORTCTRL_STATRST (1 << 31) 1558c2ecf20Sopenharmony_ci#define TSI108_EC_PORTCTRL_STATEN (1 << 28) 1568c2ecf20Sopenharmony_ci#define TSI108_EC_PORTCTRL_NOGIG (1 << 18) 1578c2ecf20Sopenharmony_ci#define TSI108_EC_PORTCTRL_HALFDUPLEX (1 << 16) 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define TSI108_EC_INTSTAT (0x204) 1608c2ecf20Sopenharmony_ci#define TSI108_EC_INTMASK (0x208) 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci#define TSI108_INT_ANY (1 << 31) 1638c2ecf20Sopenharmony_ci#define TSI108_INT_SFN (1 << 30) 1648c2ecf20Sopenharmony_ci#define TSI108_INT_RXIDLE (1 << 29) 1658c2ecf20Sopenharmony_ci#define TSI108_INT_RXABORT (1 << 28) 1668c2ecf20Sopenharmony_ci#define TSI108_INT_RXERROR (1 << 27) 1678c2ecf20Sopenharmony_ci#define TSI108_INT_RXOVERRUN (1 << 26) 1688c2ecf20Sopenharmony_ci#define TSI108_INT_RXTHRESH (1 << 25) 1698c2ecf20Sopenharmony_ci#define TSI108_INT_RXWAIT (1 << 24) 1708c2ecf20Sopenharmony_ci#define TSI108_INT_RXQUEUE0 (1 << 16) 1718c2ecf20Sopenharmony_ci#define TSI108_INT_STATCARRY (1 << 15) 1728c2ecf20Sopenharmony_ci#define TSI108_INT_TXIDLE (1 << 13) 1738c2ecf20Sopenharmony_ci#define TSI108_INT_TXABORT (1 << 12) 1748c2ecf20Sopenharmony_ci#define TSI108_INT_TXERROR (1 << 11) 1758c2ecf20Sopenharmony_ci#define TSI108_INT_TXUNDERRUN (1 << 10) 1768c2ecf20Sopenharmony_ci#define TSI108_INT_TXTHRESH (1 << 9) 1778c2ecf20Sopenharmony_ci#define TSI108_INT_TXWAIT (1 << 8) 1788c2ecf20Sopenharmony_ci#define TSI108_INT_TXQUEUE0 (1 << 0) 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci#define TSI108_EC_TXCFG (0x220) 1818c2ecf20Sopenharmony_ci#define TSI108_EC_TXCFG_RST (1 << 31) 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define TSI108_EC_TXCTRL (0x224) 1848c2ecf20Sopenharmony_ci#define TSI108_EC_TXCTRL_IDLEINT (1 << 31) 1858c2ecf20Sopenharmony_ci#define TSI108_EC_TXCTRL_ABORT (1 << 30) 1868c2ecf20Sopenharmony_ci#define TSI108_EC_TXCTRL_GO (1 << 15) 1878c2ecf20Sopenharmony_ci#define TSI108_EC_TXCTRL_QUEUE0 (1 << 0) 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#define TSI108_EC_TXSTAT (0x228) 1908c2ecf20Sopenharmony_ci#define TSI108_EC_TXSTAT_ACTIVE (1 << 15) 1918c2ecf20Sopenharmony_ci#define TSI108_EC_TXSTAT_QUEUE0 (1 << 0) 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci#define TSI108_EC_TXESTAT (0x22c) 1948c2ecf20Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_ERR (1 << 24) 1958c2ecf20Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_DESCINT (1 << 16) 1968c2ecf20Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_EOF (1 << 8) 1978c2ecf20Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_EOQ (1 << 0) 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci#define TSI108_EC_TXERR (0x278) 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_CFG (0x280) 2028c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_CFG_DESC_INT (1 << 20) 2038c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_CFG_EOQ_OWN_INT (1 << 19) 2048c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_CFG_WSWP (1 << 11) 2058c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_CFG_BSWP (1 << 10) 2068c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_CFG_SFNPORT 0 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG (0x284) 2098c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST8 (0 << 8) 2108c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST32 (1 << 8) 2118c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST128 (2 << 8) 2128c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST256 (3 << 8) 2138c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_WSWP (1 << 11) 2148c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BSWP (1 << 10) 2158c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_SFNPORT 0 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_PTRLOW (0x288) 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_PTRHIGH (0x28c) 2208c2ecf20Sopenharmony_ci#define TSI108_EC_TXQ_PTRHIGH_VALID (1 << 31) 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci#define TSI108_EC_TXTHRESH (0x230) 2238c2ecf20Sopenharmony_ci#define TSI108_EC_TXTHRESH_STARTFILL 0 2248c2ecf20Sopenharmony_ci#define TSI108_EC_TXTHRESH_STOPFILL 16 2258c2ecf20Sopenharmony_ci 2268c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG (0x320) 2278c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_RST (1 << 31) 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci#define TSI108_EC_RXSTAT (0x328) 2308c2ecf20Sopenharmony_ci#define TSI108_EC_RXSTAT_ACTIVE (1 << 15) 2318c2ecf20Sopenharmony_ci#define TSI108_EC_RXSTAT_QUEUE0 (1 << 0) 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci#define TSI108_EC_RXESTAT (0x32c) 2348c2ecf20Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_ERR (1 << 24) 2358c2ecf20Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_DESCINT (1 << 16) 2368c2ecf20Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_EOF (1 << 8) 2378c2ecf20Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_EOQ (1 << 0) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#define TSI108_EC_HASHADDR (0x360) 2408c2ecf20Sopenharmony_ci#define TSI108_EC_HASHADDR_AUTOINC (1 << 31) 2418c2ecf20Sopenharmony_ci#define TSI108_EC_HASHADDR_DO1STREAD (1 << 30) 2428c2ecf20Sopenharmony_ci#define TSI108_EC_HASHADDR_UNICAST (0 << 4) 2438c2ecf20Sopenharmony_ci#define TSI108_EC_HASHADDR_MCAST (1 << 4) 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci#define TSI108_EC_HASHDATA (0x364) 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_PTRLOW (0x388) 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_PTRHIGH (0x38c) 2508c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_PTRHIGH_VALID (1 << 31) 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci/* Station Enable -- accept packets destined for us */ 2538c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_SE (1 << 13) 2548c2ecf20Sopenharmony_ci/* Unicast Frame Enable -- for packets not destined for us */ 2558c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_UFE (1 << 12) 2568c2ecf20Sopenharmony_ci/* Multicast Frame Enable */ 2578c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_MFE (1 << 11) 2588c2ecf20Sopenharmony_ci/* Broadcast Frame Enable */ 2598c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_BFE (1 << 10) 2608c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_UC_HASH (1 << 9) 2618c2ecf20Sopenharmony_ci#define TSI108_EC_RXCFG_MC_HASH (1 << 8) 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_CFG (0x380) 2648c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_CFG_DESC_INT (1 << 20) 2658c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_CFG_EOQ_OWN_INT (1 << 19) 2668c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_CFG_WSWP (1 << 11) 2678c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_CFG_BSWP (1 << 10) 2688c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_CFG_SFNPORT 0 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG (0x384) 2718c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST8 (0 << 8) 2728c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST32 (1 << 8) 2738c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST128 (2 << 8) 2748c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST256 (3 << 8) 2758c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_WSWP (1 << 11) 2768c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BSWP (1 << 10) 2778c2ecf20Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_SFNPORT 0 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci#define TSI108_EC_RXCTRL (0x324) 2808c2ecf20Sopenharmony_ci#define TSI108_EC_RXCTRL_ABORT (1 << 30) 2818c2ecf20Sopenharmony_ci#define TSI108_EC_RXCTRL_GO (1 << 15) 2828c2ecf20Sopenharmony_ci#define TSI108_EC_RXCTRL_QUEUE0 (1 << 0) 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_ci#define TSI108_EC_RXERR (0x378) 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci#define TSI108_TX_EOF (1 << 0) /* End of frame; last fragment of packet */ 2878c2ecf20Sopenharmony_ci#define TSI108_TX_SOF (1 << 1) /* Start of frame; first frag. of packet */ 2888c2ecf20Sopenharmony_ci#define TSI108_TX_VLAN (1 << 2) /* Per-frame VLAN: enables VLAN override */ 2898c2ecf20Sopenharmony_ci#define TSI108_TX_HUGE (1 << 3) /* Huge frame enable */ 2908c2ecf20Sopenharmony_ci#define TSI108_TX_PAD (1 << 4) /* Pad the packet if too short */ 2918c2ecf20Sopenharmony_ci#define TSI108_TX_CRC (1 << 5) /* Generate CRC for this packet */ 2928c2ecf20Sopenharmony_ci#define TSI108_TX_INT (1 << 14) /* Generate an IRQ after frag. processed */ 2938c2ecf20Sopenharmony_ci#define TSI108_TX_RETRY (0xf << 16) /* 4 bit field indicating num. of retries */ 2948c2ecf20Sopenharmony_ci#define TSI108_TX_COL (1 << 20) /* Set if a collision occurred */ 2958c2ecf20Sopenharmony_ci#define TSI108_TX_LCOL (1 << 24) /* Set if a late collision occurred */ 2968c2ecf20Sopenharmony_ci#define TSI108_TX_UNDER (1 << 25) /* Set if a FIFO underrun occurred */ 2978c2ecf20Sopenharmony_ci#define TSI108_TX_RLIM (1 << 26) /* Set if the retry limit was reached */ 2988c2ecf20Sopenharmony_ci#define TSI108_TX_OK (1 << 30) /* Set if the frame TX was successful */ 2998c2ecf20Sopenharmony_ci#define TSI108_TX_OWN (1 << 31) /* Set if the device owns the descriptor */ 3008c2ecf20Sopenharmony_ci 3018c2ecf20Sopenharmony_ci/* Note: the descriptor layouts assume big-endian byte order. */ 3028c2ecf20Sopenharmony_citypedef struct { 3038c2ecf20Sopenharmony_ci u32 buf0; 3048c2ecf20Sopenharmony_ci u32 buf1; /* Base address of buffer */ 3058c2ecf20Sopenharmony_ci u32 next0; /* Address of next descriptor, if any */ 3068c2ecf20Sopenharmony_ci u32 next1; 3078c2ecf20Sopenharmony_ci u16 vlan; /* VLAN, if override enabled for this packet */ 3088c2ecf20Sopenharmony_ci u16 len; /* Length of buffer in bytes */ 3098c2ecf20Sopenharmony_ci u32 misc; /* See TSI108_TX_* above */ 3108c2ecf20Sopenharmony_ci u32 reserved0; /*reserved0 and reserved1 are added to make the desc */ 3118c2ecf20Sopenharmony_ci u32 reserved1; /* 32-byte aligned */ 3128c2ecf20Sopenharmony_ci} __attribute__ ((aligned(32))) tx_desc; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci#define TSI108_RX_EOF (1 << 0) /* End of frame; last fragment of packet */ 3158c2ecf20Sopenharmony_ci#define TSI108_RX_SOF (1 << 1) /* Start of frame; first frag. of packet */ 3168c2ecf20Sopenharmony_ci#define TSI108_RX_VLAN (1 << 2) /* Set on SOF if packet has a VLAN */ 3178c2ecf20Sopenharmony_ci#define TSI108_RX_FTYPE (1 << 3) /* Length/Type field is type, not length */ 3188c2ecf20Sopenharmony_ci#define TSI108_RX_RUNT (1 << 4)/* Packet is less than minimum size */ 3198c2ecf20Sopenharmony_ci#define TSI108_RX_HASH (1 << 7)/* Hash table match */ 3208c2ecf20Sopenharmony_ci#define TSI108_RX_BAD (1 << 8) /* Bad frame */ 3218c2ecf20Sopenharmony_ci#define TSI108_RX_OVER (1 << 9) /* FIFO overrun occurred */ 3228c2ecf20Sopenharmony_ci#define TSI108_RX_TRUNC (1 << 11) /* Packet truncated due to excess length */ 3238c2ecf20Sopenharmony_ci#define TSI108_RX_CRC (1 << 12) /* Packet had a CRC error */ 3248c2ecf20Sopenharmony_ci#define TSI108_RX_INT (1 << 13) /* Generate an IRQ after frag. processed */ 3258c2ecf20Sopenharmony_ci#define TSI108_RX_OWN (1 << 15) /* Set if the device owns the descriptor */ 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci#define TSI108_RX_SKB_SIZE 1536 /* The RX skb length */ 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_citypedef struct { 3308c2ecf20Sopenharmony_ci u32 buf0; /* Base address of buffer */ 3318c2ecf20Sopenharmony_ci u32 buf1; /* Base address of buffer */ 3328c2ecf20Sopenharmony_ci u32 next0; /* Address of next descriptor, if any */ 3338c2ecf20Sopenharmony_ci u32 next1; /* Address of next descriptor, if any */ 3348c2ecf20Sopenharmony_ci u16 vlan; /* VLAN of received packet, first frag only */ 3358c2ecf20Sopenharmony_ci u16 len; /* Length of received fragment in bytes */ 3368c2ecf20Sopenharmony_ci u16 blen; /* Length of buffer in bytes */ 3378c2ecf20Sopenharmony_ci u16 misc; /* See TSI108_RX_* above */ 3388c2ecf20Sopenharmony_ci u32 reserved0; /* reserved0 and reserved1 are added to make the desc */ 3398c2ecf20Sopenharmony_ci u32 reserved1; /* 32-byte aligned */ 3408c2ecf20Sopenharmony_ci} __attribute__ ((aligned(32))) rx_desc; 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci#endif /* __TSI108_ETH_H */ 343