162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * (C) Copyright 2005 Tundra Semiconductor Corp. 462306a36Sopenharmony_ci * Kong Lai, <kong.lai@tundra.com). 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * See file CREDITS for list of people who contributed to this 762306a36Sopenharmony_ci * project. 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* 1162306a36Sopenharmony_ci * net/tsi108_eth.h - definitions for Tsi108 GIGE network controller. 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#ifndef __TSI108_ETH_H 1562306a36Sopenharmony_ci#define __TSI108_ETH_H 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#include <linux/types.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define TSI_WRITE(offset, val) \ 2062306a36Sopenharmony_ci out_be32((data->regs + (offset)), val) 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define TSI_READ(offset) \ 2362306a36Sopenharmony_ci in_be32((data->regs + (offset))) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#define TSI_WRITE_PHY(offset, val) \ 2662306a36Sopenharmony_ci out_be32((data->phyregs + (offset)), val) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#define TSI_READ_PHY(offset) \ 2962306a36Sopenharmony_ci in_be32((data->phyregs + (offset))) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci/* 3262306a36Sopenharmony_ci * TSI108 GIGE port registers 3362306a36Sopenharmony_ci */ 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define TSI108_ETH_PORT_NUM 2 3662306a36Sopenharmony_ci#define TSI108_PBM_PORT 2 3762306a36Sopenharmony_ci#define TSI108_SDRAM_PORT 4 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define TSI108_MAC_CFG1 (0x000) 4062306a36Sopenharmony_ci#define TSI108_MAC_CFG1_SOFTRST (1 << 31) 4162306a36Sopenharmony_ci#define TSI108_MAC_CFG1_LOOPBACK (1 << 8) 4262306a36Sopenharmony_ci#define TSI108_MAC_CFG1_RXEN (1 << 2) 4362306a36Sopenharmony_ci#define TSI108_MAC_CFG1_TXEN (1 << 0) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define TSI108_MAC_CFG2 (0x004) 4662306a36Sopenharmony_ci#define TSI108_MAC_CFG2_DFLT_PREAMBLE (7 << 12) 4762306a36Sopenharmony_ci#define TSI108_MAC_CFG2_IFACE_MASK (3 << 8) 4862306a36Sopenharmony_ci#define TSI108_MAC_CFG2_NOGIG (1 << 8) 4962306a36Sopenharmony_ci#define TSI108_MAC_CFG2_GIG (2 << 8) 5062306a36Sopenharmony_ci#define TSI108_MAC_CFG2_PADCRC (1 << 2) 5162306a36Sopenharmony_ci#define TSI108_MAC_CFG2_FULLDUPLEX (1 << 0) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define TSI108_MAC_MII_MGMT_CFG (0x020) 5462306a36Sopenharmony_ci#define TSI108_MAC_MII_MGMT_CLK (7 << 0) 5562306a36Sopenharmony_ci#define TSI108_MAC_MII_MGMT_RST (1 << 31) 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#define TSI108_MAC_MII_CMD (0x024) 5862306a36Sopenharmony_ci#define TSI108_MAC_MII_CMD_READ (1 << 0) 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#define TSI108_MAC_MII_ADDR (0x028) 6162306a36Sopenharmony_ci#define TSI108_MAC_MII_ADDR_REG 0 6262306a36Sopenharmony_ci#define TSI108_MAC_MII_ADDR_PHY 8 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define TSI108_MAC_MII_DATAOUT (0x02c) 6562306a36Sopenharmony_ci#define TSI108_MAC_MII_DATAIN (0x030) 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#define TSI108_MAC_MII_IND (0x034) 6862306a36Sopenharmony_ci#define TSI108_MAC_MII_IND_NOTVALID (1 << 2) 6962306a36Sopenharmony_ci#define TSI108_MAC_MII_IND_SCANNING (1 << 1) 7062306a36Sopenharmony_ci#define TSI108_MAC_MII_IND_BUSY (1 << 0) 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define TSI108_MAC_IFCTRL (0x038) 7362306a36Sopenharmony_ci#define TSI108_MAC_IFCTRL_PHYMODE (1 << 24) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#define TSI108_MAC_ADDR1 (0x040) 7662306a36Sopenharmony_ci#define TSI108_MAC_ADDR2 (0x044) 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#define TSI108_STAT_RXBYTES (0x06c) 7962306a36Sopenharmony_ci#define TSI108_STAT_RXBYTES_CARRY (1 << 24) 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci#define TSI108_STAT_RXPKTS (0x070) 8262306a36Sopenharmony_ci#define TSI108_STAT_RXPKTS_CARRY (1 << 18) 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define TSI108_STAT_RXFCS (0x074) 8562306a36Sopenharmony_ci#define TSI108_STAT_RXFCS_CARRY (1 << 12) 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci#define TSI108_STAT_RXMCAST (0x078) 8862306a36Sopenharmony_ci#define TSI108_STAT_RXMCAST_CARRY (1 << 18) 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define TSI108_STAT_RXALIGN (0x08c) 9162306a36Sopenharmony_ci#define TSI108_STAT_RXALIGN_CARRY (1 << 12) 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define TSI108_STAT_RXLENGTH (0x090) 9462306a36Sopenharmony_ci#define TSI108_STAT_RXLENGTH_CARRY (1 << 12) 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define TSI108_STAT_RXRUNT (0x09c) 9762306a36Sopenharmony_ci#define TSI108_STAT_RXRUNT_CARRY (1 << 12) 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci#define TSI108_STAT_RXJUMBO (0x0a0) 10062306a36Sopenharmony_ci#define TSI108_STAT_RXJUMBO_CARRY (1 << 12) 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci#define TSI108_STAT_RXFRAG (0x0a4) 10362306a36Sopenharmony_ci#define TSI108_STAT_RXFRAG_CARRY (1 << 12) 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define TSI108_STAT_RXJABBER (0x0a8) 10662306a36Sopenharmony_ci#define TSI108_STAT_RXJABBER_CARRY (1 << 12) 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci#define TSI108_STAT_RXDROP (0x0ac) 10962306a36Sopenharmony_ci#define TSI108_STAT_RXDROP_CARRY (1 << 12) 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci#define TSI108_STAT_TXBYTES (0x0b0) 11262306a36Sopenharmony_ci#define TSI108_STAT_TXBYTES_CARRY (1 << 24) 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci#define TSI108_STAT_TXPKTS (0x0b4) 11562306a36Sopenharmony_ci#define TSI108_STAT_TXPKTS_CARRY (1 << 18) 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define TSI108_STAT_TXEXDEF (0x0c8) 11862306a36Sopenharmony_ci#define TSI108_STAT_TXEXDEF_CARRY (1 << 12) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define TSI108_STAT_TXEXCOL (0x0d8) 12162306a36Sopenharmony_ci#define TSI108_STAT_TXEXCOL_CARRY (1 << 12) 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci#define TSI108_STAT_TXTCOL (0x0dc) 12462306a36Sopenharmony_ci#define TSI108_STAT_TXTCOL_CARRY (1 << 13) 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci#define TSI108_STAT_TXPAUSEDROP (0x0e4) 12762306a36Sopenharmony_ci#define TSI108_STAT_TXPAUSEDROP_CARRY (1 << 12) 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci#define TSI108_STAT_CARRY1 (0x100) 13062306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXBYTES (1 << 16) 13162306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXPKTS (1 << 15) 13262306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXFCS (1 << 14) 13362306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXMCAST (1 << 13) 13462306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXALIGN (1 << 8) 13562306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXLENGTH (1 << 7) 13662306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXRUNT (1 << 4) 13762306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXJUMBO (1 << 3) 13862306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXFRAG (1 << 2) 13962306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXJABBER (1 << 1) 14062306a36Sopenharmony_ci#define TSI108_STAT_CARRY1_RXDROP (1 << 0) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci#define TSI108_STAT_CARRY2 (0x104) 14362306a36Sopenharmony_ci#define TSI108_STAT_CARRY2_TXBYTES (1 << 13) 14462306a36Sopenharmony_ci#define TSI108_STAT_CARRY2_TXPKTS (1 << 12) 14562306a36Sopenharmony_ci#define TSI108_STAT_CARRY2_TXEXDEF (1 << 7) 14662306a36Sopenharmony_ci#define TSI108_STAT_CARRY2_TXEXCOL (1 << 3) 14762306a36Sopenharmony_ci#define TSI108_STAT_CARRY2_TXTCOL (1 << 2) 14862306a36Sopenharmony_ci#define TSI108_STAT_CARRY2_TXPAUSE (1 << 0) 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#define TSI108_STAT_CARRYMASK1 (0x108) 15162306a36Sopenharmony_ci#define TSI108_STAT_CARRYMASK2 (0x10c) 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ci#define TSI108_EC_PORTCTRL (0x200) 15462306a36Sopenharmony_ci#define TSI108_EC_PORTCTRL_STATRST (1 << 31) 15562306a36Sopenharmony_ci#define TSI108_EC_PORTCTRL_STATEN (1 << 28) 15662306a36Sopenharmony_ci#define TSI108_EC_PORTCTRL_NOGIG (1 << 18) 15762306a36Sopenharmony_ci#define TSI108_EC_PORTCTRL_HALFDUPLEX (1 << 16) 15862306a36Sopenharmony_ci 15962306a36Sopenharmony_ci#define TSI108_EC_INTSTAT (0x204) 16062306a36Sopenharmony_ci#define TSI108_EC_INTMASK (0x208) 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci#define TSI108_INT_ANY (1 << 31) 16362306a36Sopenharmony_ci#define TSI108_INT_SFN (1 << 30) 16462306a36Sopenharmony_ci#define TSI108_INT_RXIDLE (1 << 29) 16562306a36Sopenharmony_ci#define TSI108_INT_RXABORT (1 << 28) 16662306a36Sopenharmony_ci#define TSI108_INT_RXERROR (1 << 27) 16762306a36Sopenharmony_ci#define TSI108_INT_RXOVERRUN (1 << 26) 16862306a36Sopenharmony_ci#define TSI108_INT_RXTHRESH (1 << 25) 16962306a36Sopenharmony_ci#define TSI108_INT_RXWAIT (1 << 24) 17062306a36Sopenharmony_ci#define TSI108_INT_RXQUEUE0 (1 << 16) 17162306a36Sopenharmony_ci#define TSI108_INT_STATCARRY (1 << 15) 17262306a36Sopenharmony_ci#define TSI108_INT_TXIDLE (1 << 13) 17362306a36Sopenharmony_ci#define TSI108_INT_TXABORT (1 << 12) 17462306a36Sopenharmony_ci#define TSI108_INT_TXERROR (1 << 11) 17562306a36Sopenharmony_ci#define TSI108_INT_TXUNDERRUN (1 << 10) 17662306a36Sopenharmony_ci#define TSI108_INT_TXTHRESH (1 << 9) 17762306a36Sopenharmony_ci#define TSI108_INT_TXWAIT (1 << 8) 17862306a36Sopenharmony_ci#define TSI108_INT_TXQUEUE0 (1 << 0) 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci#define TSI108_EC_TXCFG (0x220) 18162306a36Sopenharmony_ci#define TSI108_EC_TXCFG_RST (1 << 31) 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci#define TSI108_EC_TXCTRL (0x224) 18462306a36Sopenharmony_ci#define TSI108_EC_TXCTRL_IDLEINT (1 << 31) 18562306a36Sopenharmony_ci#define TSI108_EC_TXCTRL_ABORT (1 << 30) 18662306a36Sopenharmony_ci#define TSI108_EC_TXCTRL_GO (1 << 15) 18762306a36Sopenharmony_ci#define TSI108_EC_TXCTRL_QUEUE0 (1 << 0) 18862306a36Sopenharmony_ci 18962306a36Sopenharmony_ci#define TSI108_EC_TXSTAT (0x228) 19062306a36Sopenharmony_ci#define TSI108_EC_TXSTAT_ACTIVE (1 << 15) 19162306a36Sopenharmony_ci#define TSI108_EC_TXSTAT_QUEUE0 (1 << 0) 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci#define TSI108_EC_TXESTAT (0x22c) 19462306a36Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_ERR (1 << 24) 19562306a36Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_DESCINT (1 << 16) 19662306a36Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_EOF (1 << 8) 19762306a36Sopenharmony_ci#define TSI108_EC_TXESTAT_Q0_EOQ (1 << 0) 19862306a36Sopenharmony_ci 19962306a36Sopenharmony_ci#define TSI108_EC_TXERR (0x278) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci#define TSI108_EC_TXQ_CFG (0x280) 20262306a36Sopenharmony_ci#define TSI108_EC_TXQ_CFG_DESC_INT (1 << 20) 20362306a36Sopenharmony_ci#define TSI108_EC_TXQ_CFG_EOQ_OWN_INT (1 << 19) 20462306a36Sopenharmony_ci#define TSI108_EC_TXQ_CFG_WSWP (1 << 11) 20562306a36Sopenharmony_ci#define TSI108_EC_TXQ_CFG_BSWP (1 << 10) 20662306a36Sopenharmony_ci#define TSI108_EC_TXQ_CFG_SFNPORT 0 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG (0x284) 20962306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST8 (0 << 8) 21062306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST32 (1 << 8) 21162306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST128 (2 << 8) 21262306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BURST256 (3 << 8) 21362306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_WSWP (1 << 11) 21462306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_BSWP (1 << 10) 21562306a36Sopenharmony_ci#define TSI108_EC_TXQ_BUFCFG_SFNPORT 0 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_ci#define TSI108_EC_TXQ_PTRLOW (0x288) 21862306a36Sopenharmony_ci 21962306a36Sopenharmony_ci#define TSI108_EC_TXQ_PTRHIGH (0x28c) 22062306a36Sopenharmony_ci#define TSI108_EC_TXQ_PTRHIGH_VALID (1 << 31) 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci#define TSI108_EC_TXTHRESH (0x230) 22362306a36Sopenharmony_ci#define TSI108_EC_TXTHRESH_STARTFILL 0 22462306a36Sopenharmony_ci#define TSI108_EC_TXTHRESH_STOPFILL 16 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci#define TSI108_EC_RXCFG (0x320) 22762306a36Sopenharmony_ci#define TSI108_EC_RXCFG_RST (1 << 31) 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci#define TSI108_EC_RXSTAT (0x328) 23062306a36Sopenharmony_ci#define TSI108_EC_RXSTAT_ACTIVE (1 << 15) 23162306a36Sopenharmony_ci#define TSI108_EC_RXSTAT_QUEUE0 (1 << 0) 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci#define TSI108_EC_RXESTAT (0x32c) 23462306a36Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_ERR (1 << 24) 23562306a36Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_DESCINT (1 << 16) 23662306a36Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_EOF (1 << 8) 23762306a36Sopenharmony_ci#define TSI108_EC_RXESTAT_Q0_EOQ (1 << 0) 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci#define TSI108_EC_HASHADDR (0x360) 24062306a36Sopenharmony_ci#define TSI108_EC_HASHADDR_AUTOINC (1 << 31) 24162306a36Sopenharmony_ci#define TSI108_EC_HASHADDR_DO1STREAD (1 << 30) 24262306a36Sopenharmony_ci#define TSI108_EC_HASHADDR_UNICAST (0 << 4) 24362306a36Sopenharmony_ci#define TSI108_EC_HASHADDR_MCAST (1 << 4) 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ci#define TSI108_EC_HASHDATA (0x364) 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci#define TSI108_EC_RXQ_PTRLOW (0x388) 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci#define TSI108_EC_RXQ_PTRHIGH (0x38c) 25062306a36Sopenharmony_ci#define TSI108_EC_RXQ_PTRHIGH_VALID (1 << 31) 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci/* Station Enable -- accept packets destined for us */ 25362306a36Sopenharmony_ci#define TSI108_EC_RXCFG_SE (1 << 13) 25462306a36Sopenharmony_ci/* Unicast Frame Enable -- for packets not destined for us */ 25562306a36Sopenharmony_ci#define TSI108_EC_RXCFG_UFE (1 << 12) 25662306a36Sopenharmony_ci/* Multicast Frame Enable */ 25762306a36Sopenharmony_ci#define TSI108_EC_RXCFG_MFE (1 << 11) 25862306a36Sopenharmony_ci/* Broadcast Frame Enable */ 25962306a36Sopenharmony_ci#define TSI108_EC_RXCFG_BFE (1 << 10) 26062306a36Sopenharmony_ci#define TSI108_EC_RXCFG_UC_HASH (1 << 9) 26162306a36Sopenharmony_ci#define TSI108_EC_RXCFG_MC_HASH (1 << 8) 26262306a36Sopenharmony_ci 26362306a36Sopenharmony_ci#define TSI108_EC_RXQ_CFG (0x380) 26462306a36Sopenharmony_ci#define TSI108_EC_RXQ_CFG_DESC_INT (1 << 20) 26562306a36Sopenharmony_ci#define TSI108_EC_RXQ_CFG_EOQ_OWN_INT (1 << 19) 26662306a36Sopenharmony_ci#define TSI108_EC_RXQ_CFG_WSWP (1 << 11) 26762306a36Sopenharmony_ci#define TSI108_EC_RXQ_CFG_BSWP (1 << 10) 26862306a36Sopenharmony_ci#define TSI108_EC_RXQ_CFG_SFNPORT 0 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG (0x384) 27162306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST8 (0 << 8) 27262306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST32 (1 << 8) 27362306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST128 (2 << 8) 27462306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BURST256 (3 << 8) 27562306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_WSWP (1 << 11) 27662306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_BSWP (1 << 10) 27762306a36Sopenharmony_ci#define TSI108_EC_RXQ_BUFCFG_SFNPORT 0 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci#define TSI108_EC_RXCTRL (0x324) 28062306a36Sopenharmony_ci#define TSI108_EC_RXCTRL_ABORT (1 << 30) 28162306a36Sopenharmony_ci#define TSI108_EC_RXCTRL_GO (1 << 15) 28262306a36Sopenharmony_ci#define TSI108_EC_RXCTRL_QUEUE0 (1 << 0) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci#define TSI108_EC_RXERR (0x378) 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci#define TSI108_TX_EOF (1 << 0) /* End of frame; last fragment of packet */ 28762306a36Sopenharmony_ci#define TSI108_TX_SOF (1 << 1) /* Start of frame; first frag. of packet */ 28862306a36Sopenharmony_ci#define TSI108_TX_VLAN (1 << 2) /* Per-frame VLAN: enables VLAN override */ 28962306a36Sopenharmony_ci#define TSI108_TX_HUGE (1 << 3) /* Huge frame enable */ 29062306a36Sopenharmony_ci#define TSI108_TX_PAD (1 << 4) /* Pad the packet if too short */ 29162306a36Sopenharmony_ci#define TSI108_TX_CRC (1 << 5) /* Generate CRC for this packet */ 29262306a36Sopenharmony_ci#define TSI108_TX_INT (1 << 14) /* Generate an IRQ after frag. processed */ 29362306a36Sopenharmony_ci#define TSI108_TX_RETRY (0xf << 16) /* 4 bit field indicating num. of retries */ 29462306a36Sopenharmony_ci#define TSI108_TX_COL (1 << 20) /* Set if a collision occurred */ 29562306a36Sopenharmony_ci#define TSI108_TX_LCOL (1 << 24) /* Set if a late collision occurred */ 29662306a36Sopenharmony_ci#define TSI108_TX_UNDER (1 << 25) /* Set if a FIFO underrun occurred */ 29762306a36Sopenharmony_ci#define TSI108_TX_RLIM (1 << 26) /* Set if the retry limit was reached */ 29862306a36Sopenharmony_ci#define TSI108_TX_OK (1 << 30) /* Set if the frame TX was successful */ 29962306a36Sopenharmony_ci#define TSI108_TX_OWN (1 << 31) /* Set if the device owns the descriptor */ 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci/* Note: the descriptor layouts assume big-endian byte order. */ 30262306a36Sopenharmony_citypedef struct { 30362306a36Sopenharmony_ci u32 buf0; 30462306a36Sopenharmony_ci u32 buf1; /* Base address of buffer */ 30562306a36Sopenharmony_ci u32 next0; /* Address of next descriptor, if any */ 30662306a36Sopenharmony_ci u32 next1; 30762306a36Sopenharmony_ci u16 vlan; /* VLAN, if override enabled for this packet */ 30862306a36Sopenharmony_ci u16 len; /* Length of buffer in bytes */ 30962306a36Sopenharmony_ci u32 misc; /* See TSI108_TX_* above */ 31062306a36Sopenharmony_ci u32 reserved0; /*reserved0 and reserved1 are added to make the desc */ 31162306a36Sopenharmony_ci u32 reserved1; /* 32-byte aligned */ 31262306a36Sopenharmony_ci} __attribute__ ((aligned(32))) tx_desc; 31362306a36Sopenharmony_ci 31462306a36Sopenharmony_ci#define TSI108_RX_EOF (1 << 0) /* End of frame; last fragment of packet */ 31562306a36Sopenharmony_ci#define TSI108_RX_SOF (1 << 1) /* Start of frame; first frag. of packet */ 31662306a36Sopenharmony_ci#define TSI108_RX_VLAN (1 << 2) /* Set on SOF if packet has a VLAN */ 31762306a36Sopenharmony_ci#define TSI108_RX_FTYPE (1 << 3) /* Length/Type field is type, not length */ 31862306a36Sopenharmony_ci#define TSI108_RX_RUNT (1 << 4)/* Packet is less than minimum size */ 31962306a36Sopenharmony_ci#define TSI108_RX_HASH (1 << 7)/* Hash table match */ 32062306a36Sopenharmony_ci#define TSI108_RX_BAD (1 << 8) /* Bad frame */ 32162306a36Sopenharmony_ci#define TSI108_RX_OVER (1 << 9) /* FIFO overrun occurred */ 32262306a36Sopenharmony_ci#define TSI108_RX_TRUNC (1 << 11) /* Packet truncated due to excess length */ 32362306a36Sopenharmony_ci#define TSI108_RX_CRC (1 << 12) /* Packet had a CRC error */ 32462306a36Sopenharmony_ci#define TSI108_RX_INT (1 << 13) /* Generate an IRQ after frag. processed */ 32562306a36Sopenharmony_ci#define TSI108_RX_OWN (1 << 15) /* Set if the device owns the descriptor */ 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ci#define TSI108_RX_SKB_SIZE 1536 /* The RX skb length */ 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_citypedef struct { 33062306a36Sopenharmony_ci u32 buf0; /* Base address of buffer */ 33162306a36Sopenharmony_ci u32 buf1; /* Base address of buffer */ 33262306a36Sopenharmony_ci u32 next0; /* Address of next descriptor, if any */ 33362306a36Sopenharmony_ci u32 next1; /* Address of next descriptor, if any */ 33462306a36Sopenharmony_ci u16 vlan; /* VLAN of received packet, first frag only */ 33562306a36Sopenharmony_ci u16 len; /* Length of received fragment in bytes */ 33662306a36Sopenharmony_ci u16 blen; /* Length of buffer in bytes */ 33762306a36Sopenharmony_ci u16 misc; /* See TSI108_RX_* above */ 33862306a36Sopenharmony_ci u32 reserved0; /* reserved0 and reserved1 are added to make the desc */ 33962306a36Sopenharmony_ci u32 reserved1; /* 32-byte aligned */ 34062306a36Sopenharmony_ci} __attribute__ ((aligned(32))) rx_desc; 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci#endif /* __TSI108_ETH_H */ 343