162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 262306a36Sopenharmony_ci/* $Id: cassini.h,v 1.16 2004/08/17 21:15:16 zaumen Exp $ 362306a36Sopenharmony_ci * cassini.h: Definitions for Sun Microsystems Cassini(+) ethernet driver. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2004 Sun Microsystems Inc. 662306a36Sopenharmony_ci * Copyright (c) 2003 Adrian Sun (asun@darksunrising.com) 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * vendor id: 0x108E (Sun Microsystems, Inc.) 962306a36Sopenharmony_ci * device id: 0xabba (Cassini) 1062306a36Sopenharmony_ci * revision ids: 0x01 = Cassini 1162306a36Sopenharmony_ci * 0x02 = Cassini rev 2 1262306a36Sopenharmony_ci * 0x10 = Cassini+ 1362306a36Sopenharmony_ci * 0x11 = Cassini+ 0.2u 1462306a36Sopenharmony_ci * 1562306a36Sopenharmony_ci * vendor id: 0x100b (National Semiconductor) 1662306a36Sopenharmony_ci * device id: 0x0035 (DP83065/Saturn) 1762306a36Sopenharmony_ci * revision ids: 0x30 = Saturn B2 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * rings are all offset from 0. 2062306a36Sopenharmony_ci * 2162306a36Sopenharmony_ci * there are two clock domains: 2262306a36Sopenharmony_ci * PCI: 33/66MHz clock 2362306a36Sopenharmony_ci * chip: 125MHz clock 2462306a36Sopenharmony_ci */ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#ifndef _CASSINI_H 2762306a36Sopenharmony_ci#define _CASSINI_H 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci/* cassini register map: 2M memory mapped in 32-bit memory space accessible as 3062306a36Sopenharmony_ci * 32-bit words. there is no i/o port access. REG_ addresses are 3162306a36Sopenharmony_ci * shared between cassini and cassini+. REG_PLUS_ addresses only 3262306a36Sopenharmony_ci * appear in cassini+. REG_MINUS_ addresses only appear in cassini. 3362306a36Sopenharmony_ci */ 3462306a36Sopenharmony_ci#define CAS_ID_REV2 0x02 3562306a36Sopenharmony_ci#define CAS_ID_REVPLUS 0x10 3662306a36Sopenharmony_ci#define CAS_ID_REVPLUS02u 0x11 3762306a36Sopenharmony_ci#define CAS_ID_REVSATURNB2 0x30 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/** global resources **/ 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci/* this register sets the weights for the weighted round robin arbiter. e.g., 4262306a36Sopenharmony_ci * if rx weight == 1 and tx weight == 0, rx == 2x tx transfer credit 4362306a36Sopenharmony_ci * for its next turn to access the pci bus. 4462306a36Sopenharmony_ci * map: 0x0 = x1, 0x1 = x2, 0x2 = x4, 0x3 = x8 4562306a36Sopenharmony_ci * DEFAULT: 0x0, SIZE: 5 bits 4662306a36Sopenharmony_ci */ 4762306a36Sopenharmony_ci#define REG_CAWR 0x0004 /* core arbitration weight */ 4862306a36Sopenharmony_ci#define CAWR_RX_DMA_WEIGHT_SHIFT 0 4962306a36Sopenharmony_ci#define CAWR_RX_DMA_WEIGHT_MASK 0x03 /* [0:1] */ 5062306a36Sopenharmony_ci#define CAWR_TX_DMA_WEIGHT_SHIFT 2 5162306a36Sopenharmony_ci#define CAWR_TX_DMA_WEIGHT_MASK 0x0C /* [3:2] */ 5262306a36Sopenharmony_ci#define CAWR_RR_DIS 0x10 /* [4] */ 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* if enabled, BIM can send bursts across PCI bus > cacheline size. burst 5562306a36Sopenharmony_ci * sizes determined by length of packet or descriptor transfer and the 5662306a36Sopenharmony_ci * max length allowed by the target. 5762306a36Sopenharmony_ci * DEFAULT: 0x0, SIZE: 1 bit 5862306a36Sopenharmony_ci */ 5962306a36Sopenharmony_ci#define REG_INF_BURST 0x0008 /* infinite burst enable reg */ 6062306a36Sopenharmony_ci#define INF_BURST_EN 0x1 /* enable */ 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* top level interrupts [0-9] are auto-cleared to 0 when the status 6362306a36Sopenharmony_ci * register is read. second level interrupts [13 - 18] are cleared at 6462306a36Sopenharmony_ci * the source. tx completion register 3 is replicated in [19 - 31] 6562306a36Sopenharmony_ci * DEFAULT: 0x00000000, SIZE: 29 bits 6662306a36Sopenharmony_ci */ 6762306a36Sopenharmony_ci#define REG_INTR_STATUS 0x000C /* interrupt status register */ 6862306a36Sopenharmony_ci#define INTR_TX_INTME 0x00000001 /* frame w/ INT ME desc bit set 6962306a36Sopenharmony_ci xferred from host queue to 7062306a36Sopenharmony_ci TX FIFO */ 7162306a36Sopenharmony_ci#define INTR_TX_ALL 0x00000002 /* all xmit frames xferred into 7262306a36Sopenharmony_ci TX FIFO. i.e., 7362306a36Sopenharmony_ci TX Kick == TX complete. if 7462306a36Sopenharmony_ci PACED_MODE set, then TX FIFO 7562306a36Sopenharmony_ci also empty */ 7662306a36Sopenharmony_ci#define INTR_TX_DONE 0x00000004 /* any frame xferred into tx 7762306a36Sopenharmony_ci FIFO */ 7862306a36Sopenharmony_ci#define INTR_TX_TAG_ERROR 0x00000008 /* TX FIFO tag framing 7962306a36Sopenharmony_ci corrupted. FATAL ERROR */ 8062306a36Sopenharmony_ci#define INTR_RX_DONE 0x00000010 /* at least 1 frame xferred 8162306a36Sopenharmony_ci from RX FIFO to host mem. 8262306a36Sopenharmony_ci RX completion reg updated. 8362306a36Sopenharmony_ci may be delayed by recv 8462306a36Sopenharmony_ci intr blanking. */ 8562306a36Sopenharmony_ci#define INTR_RX_BUF_UNAVAIL 0x00000020 /* no more receive buffers. 8662306a36Sopenharmony_ci RX Kick == RX complete */ 8762306a36Sopenharmony_ci#define INTR_RX_TAG_ERROR 0x00000040 /* RX FIFO tag framing 8862306a36Sopenharmony_ci corrupted. FATAL ERROR */ 8962306a36Sopenharmony_ci#define INTR_RX_COMP_FULL 0x00000080 /* no more room in completion 9062306a36Sopenharmony_ci ring to post descriptors. 9162306a36Sopenharmony_ci RX complete head incr to 9262306a36Sopenharmony_ci almost reach RX complete 9362306a36Sopenharmony_ci tail */ 9462306a36Sopenharmony_ci#define INTR_RX_BUF_AE 0x00000100 /* less than the 9562306a36Sopenharmony_ci programmable threshold # 9662306a36Sopenharmony_ci of free descr avail for 9762306a36Sopenharmony_ci hw use */ 9862306a36Sopenharmony_ci#define INTR_RX_COMP_AF 0x00000200 /* less than the 9962306a36Sopenharmony_ci programmable threshold # 10062306a36Sopenharmony_ci of descr spaces for hw 10162306a36Sopenharmony_ci use in completion descr 10262306a36Sopenharmony_ci ring */ 10362306a36Sopenharmony_ci#define INTR_RX_LEN_MISMATCH 0x00000400 /* len field from MAC != 10462306a36Sopenharmony_ci len of non-reassembly pkt 10562306a36Sopenharmony_ci from fifo during DMA or 10662306a36Sopenharmony_ci header parser provides TCP 10762306a36Sopenharmony_ci header and payload size > 10862306a36Sopenharmony_ci MAC packet size. 10962306a36Sopenharmony_ci FATAL ERROR */ 11062306a36Sopenharmony_ci#define INTR_SUMMARY 0x00001000 /* summary interrupt bit. this 11162306a36Sopenharmony_ci bit will be set if an interrupt 11262306a36Sopenharmony_ci generated on the pci bus. useful 11362306a36Sopenharmony_ci when driver is polling for 11462306a36Sopenharmony_ci interrupts */ 11562306a36Sopenharmony_ci#define INTR_PCS_STATUS 0x00002000 /* PCS interrupt status register */ 11662306a36Sopenharmony_ci#define INTR_TX_MAC_STATUS 0x00004000 /* TX MAC status register has at 11762306a36Sopenharmony_ci least 1 unmasked interrupt set */ 11862306a36Sopenharmony_ci#define INTR_RX_MAC_STATUS 0x00008000 /* RX MAC status register has at 11962306a36Sopenharmony_ci least 1 unmasked interrupt set */ 12062306a36Sopenharmony_ci#define INTR_MAC_CTRL_STATUS 0x00010000 /* MAC control status register has 12162306a36Sopenharmony_ci at least 1 unmasked interrupt 12262306a36Sopenharmony_ci set */ 12362306a36Sopenharmony_ci#define INTR_MIF_STATUS 0x00020000 /* MIF status register has at least 12462306a36Sopenharmony_ci 1 unmasked interrupt set */ 12562306a36Sopenharmony_ci#define INTR_PCI_ERROR_STATUS 0x00040000 /* PCI error status register in the 12662306a36Sopenharmony_ci BIF has at least 1 unmasked 12762306a36Sopenharmony_ci interrupt set */ 12862306a36Sopenharmony_ci#define INTR_TX_COMP_3_MASK 0xFFF80000 /* mask for TX completion 12962306a36Sopenharmony_ci 3 reg data */ 13062306a36Sopenharmony_ci#define INTR_TX_COMP_3_SHIFT 19 13162306a36Sopenharmony_ci#define INTR_ERROR_MASK (INTR_MIF_STATUS | INTR_PCI_ERROR_STATUS | \ 13262306a36Sopenharmony_ci INTR_PCS_STATUS | INTR_RX_LEN_MISMATCH | \ 13362306a36Sopenharmony_ci INTR_TX_MAC_STATUS | INTR_RX_MAC_STATUS | \ 13462306a36Sopenharmony_ci INTR_TX_TAG_ERROR | INTR_RX_TAG_ERROR | \ 13562306a36Sopenharmony_ci INTR_MAC_CTRL_STATUS) 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci/* determines which status events will cause an interrupt. layout same 13862306a36Sopenharmony_ci * as REG_INTR_STATUS. 13962306a36Sopenharmony_ci * DEFAULT: 0xFFFFFFFF, SIZE: 16 bits 14062306a36Sopenharmony_ci */ 14162306a36Sopenharmony_ci#define REG_INTR_MASK 0x0010 /* Interrupt mask */ 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci/* top level interrupt bits that are cleared during read of REG_INTR_STATUS_ALIAS. 14462306a36Sopenharmony_ci * useful when driver is polling for interrupts. layout same as REG_INTR_MASK. 14562306a36Sopenharmony_ci * DEFAULT: 0x00000000, SIZE: 12 bits 14662306a36Sopenharmony_ci */ 14762306a36Sopenharmony_ci#define REG_ALIAS_CLEAR 0x0014 /* alias clear mask 14862306a36Sopenharmony_ci (used w/ status alias) */ 14962306a36Sopenharmony_ci/* same as REG_INTR_STATUS except that only bits cleared are those selected by 15062306a36Sopenharmony_ci * REG_ALIAS_CLEAR 15162306a36Sopenharmony_ci * DEFAULT: 0x00000000, SIZE: 29 bits 15262306a36Sopenharmony_ci */ 15362306a36Sopenharmony_ci#define REG_INTR_STATUS_ALIAS 0x001C /* interrupt status alias 15462306a36Sopenharmony_ci (selective clear) */ 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci/* DEFAULT: 0x0, SIZE: 3 bits */ 15762306a36Sopenharmony_ci#define REG_PCI_ERR_STATUS 0x1000 /* PCI error status */ 15862306a36Sopenharmony_ci#define PCI_ERR_BADACK 0x01 /* reserved in Cassini+. 15962306a36Sopenharmony_ci set if no ACK64# during ABS64 cycle 16062306a36Sopenharmony_ci in Cassini. */ 16162306a36Sopenharmony_ci#define PCI_ERR_DTRTO 0x02 /* delayed xaction timeout. set if 16262306a36Sopenharmony_ci no read retry after 2^15 clocks */ 16362306a36Sopenharmony_ci#define PCI_ERR_OTHER 0x04 /* other PCI errors */ 16462306a36Sopenharmony_ci#define PCI_ERR_BIM_DMA_WRITE 0x08 /* BIM received 0 count DMA write req. 16562306a36Sopenharmony_ci unused in Cassini. */ 16662306a36Sopenharmony_ci#define PCI_ERR_BIM_DMA_READ 0x10 /* BIM received 0 count DMA read req. 16762306a36Sopenharmony_ci unused in Cassini. */ 16862306a36Sopenharmony_ci#define PCI_ERR_BIM_DMA_TIMEOUT 0x20 /* BIM received 255 retries during 16962306a36Sopenharmony_ci DMA. unused in cassini. */ 17062306a36Sopenharmony_ci 17162306a36Sopenharmony_ci/* mask for PCI status events that will set PCI_ERR_STATUS. if cleared, event 17262306a36Sopenharmony_ci * causes an interrupt to be generated. 17362306a36Sopenharmony_ci * DEFAULT: 0x7, SIZE: 3 bits 17462306a36Sopenharmony_ci */ 17562306a36Sopenharmony_ci#define REG_PCI_ERR_STATUS_MASK 0x1004 /* PCI Error status mask */ 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* used to configure PCI related parameters that are not in PCI config space. 17862306a36Sopenharmony_ci * DEFAULT: 0bxx000, SIZE: 5 bits 17962306a36Sopenharmony_ci */ 18062306a36Sopenharmony_ci#define REG_BIM_CFG 0x1008 /* BIM Configuration */ 18162306a36Sopenharmony_ci#define BIM_CFG_RESERVED0 0x001 /* reserved */ 18262306a36Sopenharmony_ci#define BIM_CFG_RESERVED1 0x002 /* reserved */ 18362306a36Sopenharmony_ci#define BIM_CFG_64BIT_DISABLE 0x004 /* disable 64-bit mode */ 18462306a36Sopenharmony_ci#define BIM_CFG_66MHZ 0x008 /* (ro) 1 = 66MHz, 0 = < 66MHz */ 18562306a36Sopenharmony_ci#define BIM_CFG_32BIT 0x010 /* (ro) 1 = 32-bit slot, 0 = 64-bit */ 18662306a36Sopenharmony_ci#define BIM_CFG_DPAR_INTR_ENABLE 0x020 /* detected parity err enable */ 18762306a36Sopenharmony_ci#define BIM_CFG_RMA_INTR_ENABLE 0x040 /* master abort intr enable */ 18862306a36Sopenharmony_ci#define BIM_CFG_RTA_INTR_ENABLE 0x080 /* target abort intr enable */ 18962306a36Sopenharmony_ci#define BIM_CFG_RESERVED2 0x100 /* reserved */ 19062306a36Sopenharmony_ci#define BIM_CFG_BIM_DISABLE 0x200 /* stop BIM DMA. use before global 19162306a36Sopenharmony_ci reset. reserved in Cassini. */ 19262306a36Sopenharmony_ci#define BIM_CFG_BIM_STATUS 0x400 /* (ro) 1 = BIM DMA suspended. 19362306a36Sopenharmony_ci reserved in Cassini. */ 19462306a36Sopenharmony_ci#define BIM_CFG_PERROR_BLOCK 0x800 /* block PERR# to pci bus. def: 0. 19562306a36Sopenharmony_ci reserved in Cassini. */ 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci/* DEFAULT: 0x00000000, SIZE: 32 bits */ 19862306a36Sopenharmony_ci#define REG_BIM_DIAG 0x100C /* BIM Diagnostic */ 19962306a36Sopenharmony_ci#define BIM_DIAG_MSTR_SM_MASK 0x3FFFFF00 /* PCI master controller state 20062306a36Sopenharmony_ci machine bits [21:0] */ 20162306a36Sopenharmony_ci#define BIM_DIAG_BRST_SM_MASK 0x7F /* PCI burst controller state 20262306a36Sopenharmony_ci machine bits [6:0] */ 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* writing to SW_RESET_TX and SW_RESET_RX will issue a global 20562306a36Sopenharmony_ci * reset. poll until TX and RX read back as 0's for completion. 20662306a36Sopenharmony_ci */ 20762306a36Sopenharmony_ci#define REG_SW_RESET 0x1010 /* Software reset */ 20862306a36Sopenharmony_ci#define SW_RESET_TX 0x00000001 /* reset TX DMA engine. poll until 20962306a36Sopenharmony_ci cleared to 0. */ 21062306a36Sopenharmony_ci#define SW_RESET_RX 0x00000002 /* reset RX DMA engine. poll until 21162306a36Sopenharmony_ci cleared to 0. */ 21262306a36Sopenharmony_ci#define SW_RESET_RSTOUT 0x00000004 /* force RSTOUT# pin active (low). 21362306a36Sopenharmony_ci resets PHY and anything else 21462306a36Sopenharmony_ci connected to RSTOUT#. RSTOUT# 21562306a36Sopenharmony_ci is also activated by local PCI 21662306a36Sopenharmony_ci reset when hot-swap is being 21762306a36Sopenharmony_ci done. */ 21862306a36Sopenharmony_ci#define SW_RESET_BLOCK_PCS_SLINK 0x00000008 /* if a global reset is done with 21962306a36Sopenharmony_ci this bit set, PCS and SLINK 22062306a36Sopenharmony_ci modules won't be reset. 22162306a36Sopenharmony_ci i.e., link won't drop. */ 22262306a36Sopenharmony_ci#define SW_RESET_BREQ_SM_MASK 0x00007F00 /* breq state machine [6:0] */ 22362306a36Sopenharmony_ci#define SW_RESET_PCIARB_SM_MASK 0x00070000 /* pci arbitration state bits: 22462306a36Sopenharmony_ci 0b000: ARB_IDLE1 22562306a36Sopenharmony_ci 0b001: ARB_IDLE2 22662306a36Sopenharmony_ci 0b010: ARB_WB_ACK 22762306a36Sopenharmony_ci 0b011: ARB_WB_WAT 22862306a36Sopenharmony_ci 0b100: ARB_RB_ACK 22962306a36Sopenharmony_ci 0b101: ARB_RB_WAT 23062306a36Sopenharmony_ci 0b110: ARB_RB_END 23162306a36Sopenharmony_ci 0b111: ARB_WB_END */ 23262306a36Sopenharmony_ci#define SW_RESET_RDPCI_SM_MASK 0x00300000 /* read pci state bits: 23362306a36Sopenharmony_ci 0b00: RD_PCI_WAT 23462306a36Sopenharmony_ci 0b01: RD_PCI_RDY 23562306a36Sopenharmony_ci 0b11: RD_PCI_ACK */ 23662306a36Sopenharmony_ci#define SW_RESET_RDARB_SM_MASK 0x00C00000 /* read arbitration state bits: 23762306a36Sopenharmony_ci 0b00: AD_IDL_RX 23862306a36Sopenharmony_ci 0b01: AD_ACK_RX 23962306a36Sopenharmony_ci 0b10: AD_ACK_TX 24062306a36Sopenharmony_ci 0b11: AD_IDL_TX */ 24162306a36Sopenharmony_ci#define SW_RESET_WRPCI_SM_MASK 0x06000000 /* write pci state bits 24262306a36Sopenharmony_ci 0b00: WR_PCI_WAT 24362306a36Sopenharmony_ci 0b01: WR_PCI_RDY 24462306a36Sopenharmony_ci 0b11: WR_PCI_ACK */ 24562306a36Sopenharmony_ci#define SW_RESET_WRARB_SM_MASK 0x38000000 /* write arbitration state bits: 24662306a36Sopenharmony_ci 0b000: ARB_IDLE1 24762306a36Sopenharmony_ci 0b001: ARB_IDLE2 24862306a36Sopenharmony_ci 0b010: ARB_TX_ACK 24962306a36Sopenharmony_ci 0b011: ARB_TX_WAT 25062306a36Sopenharmony_ci 0b100: ARB_RX_ACK 25162306a36Sopenharmony_ci 0b110: ARB_RX_WAT */ 25262306a36Sopenharmony_ci 25362306a36Sopenharmony_ci/* Cassini only. 64-bit register used to check PCI datapath. when read, 25462306a36Sopenharmony_ci * value written has both lower and upper 32-bit halves rotated to the right 25562306a36Sopenharmony_ci * one bit position. e.g., FFFFFFFF FFFFFFFF -> 7FFFFFFF 7FFFFFFF 25662306a36Sopenharmony_ci */ 25762306a36Sopenharmony_ci#define REG_MINUS_BIM_DATAPATH_TEST 0x1018 /* Cassini: BIM datapath test 25862306a36Sopenharmony_ci Cassini+: reserved */ 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci/* output enables are provided for each device's chip select and for the rest 26162306a36Sopenharmony_ci * of the outputs from cassini to its local bus devices. two sw programmable 26262306a36Sopenharmony_ci * bits are connected to general purpus control/status bits. 26362306a36Sopenharmony_ci * DEFAULT: 0x7 26462306a36Sopenharmony_ci */ 26562306a36Sopenharmony_ci#define REG_BIM_LOCAL_DEV_EN 0x1020 /* BIM local device 26662306a36Sopenharmony_ci output EN. default: 0x7 */ 26762306a36Sopenharmony_ci#define BIM_LOCAL_DEV_PAD 0x01 /* address bus, RW signal, and 26862306a36Sopenharmony_ci OE signal output enable on the 26962306a36Sopenharmony_ci local bus interface. these 27062306a36Sopenharmony_ci are shared between both local 27162306a36Sopenharmony_ci bus devices. tristate when 0. */ 27262306a36Sopenharmony_ci#define BIM_LOCAL_DEV_PROM 0x02 /* PROM chip select */ 27362306a36Sopenharmony_ci#define BIM_LOCAL_DEV_EXT 0x04 /* secondary local bus device chip 27462306a36Sopenharmony_ci select output enable */ 27562306a36Sopenharmony_ci#define BIM_LOCAL_DEV_SOFT_0 0x08 /* sw programmable ctrl bit 0 */ 27662306a36Sopenharmony_ci#define BIM_LOCAL_DEV_SOFT_1 0x10 /* sw programmable ctrl bit 1 */ 27762306a36Sopenharmony_ci#define BIM_LOCAL_DEV_HW_RESET 0x20 /* internal hw reset. Cassini+ only. */ 27862306a36Sopenharmony_ci 27962306a36Sopenharmony_ci/* access 24 entry BIM read and write buffers. put address in REG_BIM_BUFFER_ADDR 28062306a36Sopenharmony_ci * and read/write from/to it REG_BIM_BUFFER_DATA_LOW and _DATA_HI. 28162306a36Sopenharmony_ci * _DATA_HI should be the last access of the sequence. 28262306a36Sopenharmony_ci * DEFAULT: undefined 28362306a36Sopenharmony_ci */ 28462306a36Sopenharmony_ci#define REG_BIM_BUFFER_ADDR 0x1024 /* BIM buffer address. for 28562306a36Sopenharmony_ci purposes. */ 28662306a36Sopenharmony_ci#define BIM_BUFFER_ADDR_MASK 0x3F /* index (0 - 23) of buffer */ 28762306a36Sopenharmony_ci#define BIM_BUFFER_WR_SELECT 0x40 /* write buffer access = 1 28862306a36Sopenharmony_ci read buffer access = 0 */ 28962306a36Sopenharmony_ci/* DEFAULT: undefined */ 29062306a36Sopenharmony_ci#define REG_BIM_BUFFER_DATA_LOW 0x1028 /* BIM buffer data low */ 29162306a36Sopenharmony_ci#define REG_BIM_BUFFER_DATA_HI 0x102C /* BIM buffer data high */ 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci/* set BIM_RAM_BIST_START to start built-in self test for BIM read buffer. 29462306a36Sopenharmony_ci * bit auto-clears when done with status read from _SUMMARY and _PASS bits. 29562306a36Sopenharmony_ci */ 29662306a36Sopenharmony_ci#define REG_BIM_RAM_BIST 0x102C /* BIM RAM (read buffer) BIST 29762306a36Sopenharmony_ci control/status */ 29862306a36Sopenharmony_ci#define BIM_RAM_BIST_RD_START 0x01 /* start BIST for BIM read buffer */ 29962306a36Sopenharmony_ci#define BIM_RAM_BIST_WR_START 0x02 /* start BIST for BIM write buffer. 30062306a36Sopenharmony_ci Cassini only. reserved in 30162306a36Sopenharmony_ci Cassini+. */ 30262306a36Sopenharmony_ci#define BIM_RAM_BIST_RD_PASS 0x04 /* summary BIST pass status for read 30362306a36Sopenharmony_ci buffer. */ 30462306a36Sopenharmony_ci#define BIM_RAM_BIST_WR_PASS 0x08 /* summary BIST pass status for write 30562306a36Sopenharmony_ci buffer. Cassini only. reserved 30662306a36Sopenharmony_ci in Cassini+. */ 30762306a36Sopenharmony_ci#define BIM_RAM_BIST_RD_LOW_PASS 0x10 /* read low bank passes BIST */ 30862306a36Sopenharmony_ci#define BIM_RAM_BIST_RD_HI_PASS 0x20 /* read high bank passes BIST */ 30962306a36Sopenharmony_ci#define BIM_RAM_BIST_WR_LOW_PASS 0x40 /* write low bank passes BIST. 31062306a36Sopenharmony_ci Cassini only. reserved in 31162306a36Sopenharmony_ci Cassini+. */ 31262306a36Sopenharmony_ci#define BIM_RAM_BIST_WR_HI_PASS 0x80 /* write high bank passes BIST. 31362306a36Sopenharmony_ci Cassini only. reserved in 31462306a36Sopenharmony_ci Cassini+. */ 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci/* ASUN: i'm not sure what this does as it's not in the spec. 31762306a36Sopenharmony_ci * DEFAULT: 0xFC 31862306a36Sopenharmony_ci */ 31962306a36Sopenharmony_ci#define REG_BIM_DIAG_MUX 0x1030 /* BIM diagnostic probe mux 32062306a36Sopenharmony_ci select register */ 32162306a36Sopenharmony_ci 32262306a36Sopenharmony_ci/* enable probe monitoring mode and select data appearing on the P_A* bus. bit 32362306a36Sopenharmony_ci * values for _SEL_HI_MASK and _SEL_LOW_MASK: 32462306a36Sopenharmony_ci * 0x0: internal probe[7:0] (pci arb state, wtc empty w, wtc full w, wtc empty w, 32562306a36Sopenharmony_ci * wtc empty r, post pci) 32662306a36Sopenharmony_ci * 0x1: internal probe[15:8] (pci wbuf comp, pci wpkt comp, pci rbuf comp, 32762306a36Sopenharmony_ci * pci rpkt comp, txdma wr req, txdma wr ack, 32862306a36Sopenharmony_ci * txdma wr rdy, txdma wr xfr done) 32962306a36Sopenharmony_ci * 0x2: internal probe[23:16] (txdma rd req, txdma rd ack, txdma rd rdy, rxdma rd, 33062306a36Sopenharmony_ci * rd arb state, rd pci state) 33162306a36Sopenharmony_ci * 0x3: internal probe[31:24] (rxdma req, rxdma ack, rxdma rdy, wrarb state, 33262306a36Sopenharmony_ci * wrpci state) 33362306a36Sopenharmony_ci * 0x4: pci io probe[7:0] 0x5: pci io probe[15:8] 33462306a36Sopenharmony_ci * 0x6: pci io probe[23:16] 0x7: pci io probe[31:24] 33562306a36Sopenharmony_ci * 0x8: pci io probe[39:32] 0x9: pci io probe[47:40] 33662306a36Sopenharmony_ci * 0xa: pci io probe[55:48] 0xb: pci io probe[63:56] 33762306a36Sopenharmony_ci * the following are not available in Cassini: 33862306a36Sopenharmony_ci * 0xc: rx probe[7:0] 0xd: tx probe[7:0] 33962306a36Sopenharmony_ci * 0xe: hp probe[7:0] 0xf: mac probe[7:0] 34062306a36Sopenharmony_ci */ 34162306a36Sopenharmony_ci#define REG_PLUS_PROBE_MUX_SELECT 0x1034 /* Cassini+: PROBE MUX SELECT */ 34262306a36Sopenharmony_ci#define PROBE_MUX_EN 0x80000000 /* allow probe signals to be 34362306a36Sopenharmony_ci driven on local bus P_A[15:0] 34462306a36Sopenharmony_ci for debugging */ 34562306a36Sopenharmony_ci#define PROBE_MUX_SUB_MUX_MASK 0x0000FF00 /* select sub module probe signals: 34662306a36Sopenharmony_ci 0x03 = mac[1:0] 34762306a36Sopenharmony_ci 0x0C = rx[1:0] 34862306a36Sopenharmony_ci 0x30 = tx[1:0] 34962306a36Sopenharmony_ci 0xC0 = hp[1:0] */ 35062306a36Sopenharmony_ci#define PROBE_MUX_SEL_HI_MASK 0x000000F0 /* select which module to appear 35162306a36Sopenharmony_ci on P_A[15:8]. see above for 35262306a36Sopenharmony_ci values. */ 35362306a36Sopenharmony_ci#define PROBE_MUX_SEL_LOW_MASK 0x0000000F /* select which module to appear 35462306a36Sopenharmony_ci on P_A[7:0]. see above for 35562306a36Sopenharmony_ci values. */ 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci/* values mean the same thing as REG_INTR_MASK excep that it's for INTB. 35862306a36Sopenharmony_ci DEFAULT: 0x1F */ 35962306a36Sopenharmony_ci#define REG_PLUS_INTR_MASK_1 0x1038 /* Cassini+: interrupt mask 36062306a36Sopenharmony_ci register 2 for INTB */ 36162306a36Sopenharmony_ci#define REG_PLUS_INTRN_MASK(x) (REG_PLUS_INTR_MASK_1 + ((x) - 1)*16) 36262306a36Sopenharmony_ci/* bits correspond to both _MASK and _STATUS registers. _ALT corresponds to 36362306a36Sopenharmony_ci * all of the alternate (2-4) INTR registers while _1 corresponds to only 36462306a36Sopenharmony_ci * _MASK_1 and _STATUS_1 registers. 36562306a36Sopenharmony_ci * DEFAULT: 0x7 for MASK registers, 0x0 for ALIAS_CLEAR registers 36662306a36Sopenharmony_ci */ 36762306a36Sopenharmony_ci#define INTR_RX_DONE_ALT 0x01 36862306a36Sopenharmony_ci#define INTR_RX_COMP_FULL_ALT 0x02 36962306a36Sopenharmony_ci#define INTR_RX_COMP_AF_ALT 0x04 37062306a36Sopenharmony_ci#define INTR_RX_BUF_UNAVAIL_1 0x08 37162306a36Sopenharmony_ci#define INTR_RX_BUF_AE_1 0x10 /* almost empty */ 37262306a36Sopenharmony_ci#define INTRN_MASK_RX_EN 0x80 37362306a36Sopenharmony_ci#define INTRN_MASK_CLEAR_ALL (INTR_RX_DONE_ALT | \ 37462306a36Sopenharmony_ci INTR_RX_COMP_FULL_ALT | \ 37562306a36Sopenharmony_ci INTR_RX_COMP_AF_ALT | \ 37662306a36Sopenharmony_ci INTR_RX_BUF_UNAVAIL_1 | \ 37762306a36Sopenharmony_ci INTR_RX_BUF_AE_1) 37862306a36Sopenharmony_ci#define REG_PLUS_INTR_STATUS_1 0x103C /* Cassini+: interrupt status 37962306a36Sopenharmony_ci register 2 for INTB. default: 0x1F */ 38062306a36Sopenharmony_ci#define REG_PLUS_INTRN_STATUS(x) (REG_PLUS_INTR_STATUS_1 + ((x) - 1)*16) 38162306a36Sopenharmony_ci#define INTR_STATUS_ALT_INTX_EN 0x80 /* generate INTX when one of the 38262306a36Sopenharmony_ci flags are set. enables desc ring. */ 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci#define REG_PLUS_ALIAS_CLEAR_1 0x1040 /* Cassini+: alias clear mask 38562306a36Sopenharmony_ci register 2 for INTB */ 38662306a36Sopenharmony_ci#define REG_PLUS_ALIASN_CLEAR(x) (REG_PLUS_ALIAS_CLEAR_1 + ((x) - 1)*16) 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci#define REG_PLUS_INTR_STATUS_ALIAS_1 0x1044 /* Cassini+: interrupt status 38962306a36Sopenharmony_ci register alias 2 for INTB */ 39062306a36Sopenharmony_ci#define REG_PLUS_INTRN_STATUS_ALIAS(x) (REG_PLUS_INTR_STATUS_ALIAS_1 + ((x) - 1)*16) 39162306a36Sopenharmony_ci 39262306a36Sopenharmony_ci#define REG_SATURN_PCFG 0x106c /* pin configuration register for 39362306a36Sopenharmony_ci integrated macphy */ 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_ci#define SATURN_PCFG_TLA 0x00000001 /* 1 = phy actled */ 39662306a36Sopenharmony_ci#define SATURN_PCFG_FLA 0x00000002 /* 1 = phy link10led */ 39762306a36Sopenharmony_ci#define SATURN_PCFG_CLA 0x00000004 /* 1 = phy link100led */ 39862306a36Sopenharmony_ci#define SATURN_PCFG_LLA 0x00000008 /* 1 = phy link1000led */ 39962306a36Sopenharmony_ci#define SATURN_PCFG_RLA 0x00000010 /* 1 = phy duplexled */ 40062306a36Sopenharmony_ci#define SATURN_PCFG_PDS 0x00000020 /* phy debug mode. 40162306a36Sopenharmony_ci 0 = normal */ 40262306a36Sopenharmony_ci#define SATURN_PCFG_MTP 0x00000080 /* test point select */ 40362306a36Sopenharmony_ci#define SATURN_PCFG_GMO 0x00000100 /* GMII observe. 1 = 40462306a36Sopenharmony_ci GMII on SERDES pins for 40562306a36Sopenharmony_ci monitoring. */ 40662306a36Sopenharmony_ci#define SATURN_PCFG_FSI 0x00000200 /* 1 = freeze serdes/gmii. all 40762306a36Sopenharmony_ci pins configed as outputs. 40862306a36Sopenharmony_ci for power saving when using 40962306a36Sopenharmony_ci internal phy. */ 41062306a36Sopenharmony_ci#define SATURN_PCFG_LAD 0x00000800 /* 0 = mac core led ctrl 41162306a36Sopenharmony_ci polarity from strapping 41262306a36Sopenharmony_ci value. 41362306a36Sopenharmony_ci 1 = mac core led ctrl 41462306a36Sopenharmony_ci polarity active low. */ 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_ci/** transmit dma registers **/ 41862306a36Sopenharmony_ci#define MAX_TX_RINGS_SHIFT 2 41962306a36Sopenharmony_ci#define MAX_TX_RINGS (1 << MAX_TX_RINGS_SHIFT) 42062306a36Sopenharmony_ci#define MAX_TX_RINGS_MASK (MAX_TX_RINGS - 1) 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ci/* TX configuration. 42362306a36Sopenharmony_ci * descr ring sizes size = 32 * (1 << n), n < 9. e.g., 0x8 = 8k. default: 0x8 42462306a36Sopenharmony_ci * DEFAULT: 0x3F000001 42562306a36Sopenharmony_ci */ 42662306a36Sopenharmony_ci#define REG_TX_CFG 0x2004 /* TX config */ 42762306a36Sopenharmony_ci#define TX_CFG_DMA_EN 0x00000001 /* enable TX DMA. if cleared, DMA 42862306a36Sopenharmony_ci will stop after xfer of current 42962306a36Sopenharmony_ci buffer has been completed. */ 43062306a36Sopenharmony_ci#define TX_CFG_FIFO_PIO_SEL 0x00000002 /* TX DMA FIFO can be 43162306a36Sopenharmony_ci accessed w/ FIFO addr 43262306a36Sopenharmony_ci and data registers. 43362306a36Sopenharmony_ci TX DMA should be 43462306a36Sopenharmony_ci disabled. */ 43562306a36Sopenharmony_ci#define TX_CFG_DESC_RING0_MASK 0x0000003C /* # desc entries in 43662306a36Sopenharmony_ci ring 1. */ 43762306a36Sopenharmony_ci#define TX_CFG_DESC_RING0_SHIFT 2 43862306a36Sopenharmony_ci#define TX_CFG_DESC_RINGN_MASK(a) (TX_CFG_DESC_RING0_MASK << (a)*4) 43962306a36Sopenharmony_ci#define TX_CFG_DESC_RINGN_SHIFT(a) (TX_CFG_DESC_RING0_SHIFT + (a)*4) 44062306a36Sopenharmony_ci#define TX_CFG_PACED_MODE 0x00100000 /* TX_ALL only set after 44162306a36Sopenharmony_ci TX FIFO becomes empty. 44262306a36Sopenharmony_ci if 0, TX_ALL set 44362306a36Sopenharmony_ci if descr queue empty. */ 44462306a36Sopenharmony_ci#define TX_CFG_DMA_RDPIPE_DIS 0x01000000 /* always set to 1 */ 44562306a36Sopenharmony_ci#define TX_CFG_COMPWB_Q1 0x02000000 /* completion writeback happens at 44662306a36Sopenharmony_ci the end of every packet kicked 44762306a36Sopenharmony_ci through Q1. */ 44862306a36Sopenharmony_ci#define TX_CFG_COMPWB_Q2 0x04000000 /* completion writeback happens at 44962306a36Sopenharmony_ci the end of every packet kicked 45062306a36Sopenharmony_ci through Q2. */ 45162306a36Sopenharmony_ci#define TX_CFG_COMPWB_Q3 0x08000000 /* completion writeback happens at 45262306a36Sopenharmony_ci the end of every packet kicked 45362306a36Sopenharmony_ci through Q3 */ 45462306a36Sopenharmony_ci#define TX_CFG_COMPWB_Q4 0x10000000 /* completion writeback happens at 45562306a36Sopenharmony_ci the end of every packet kicked 45662306a36Sopenharmony_ci through Q4 */ 45762306a36Sopenharmony_ci#define TX_CFG_INTR_COMPWB_DIS 0x20000000 /* disable pre-interrupt completion 45862306a36Sopenharmony_ci writeback */ 45962306a36Sopenharmony_ci#define TX_CFG_CTX_SEL_MASK 0xC0000000 /* selects tx test port 46062306a36Sopenharmony_ci connection 46162306a36Sopenharmony_ci 0b00: tx mac req, 46262306a36Sopenharmony_ci tx mac retry req, 46362306a36Sopenharmony_ci tx ack and tx tag. 46462306a36Sopenharmony_ci 0b01: txdma rd req, 46562306a36Sopenharmony_ci txdma rd ack, 46662306a36Sopenharmony_ci txdma rd rdy, 46762306a36Sopenharmony_ci txdma rd type0 46862306a36Sopenharmony_ci 0b11: txdma wr req, 46962306a36Sopenharmony_ci txdma wr ack, 47062306a36Sopenharmony_ci txdma wr rdy, 47162306a36Sopenharmony_ci txdma wr xfr done. */ 47262306a36Sopenharmony_ci#define TX_CFG_CTX_SEL_SHIFT 30 47362306a36Sopenharmony_ci 47462306a36Sopenharmony_ci/* 11-bit counters that point to next location in FIFO to be loaded/retrieved. 47562306a36Sopenharmony_ci * used for diagnostics only. 47662306a36Sopenharmony_ci */ 47762306a36Sopenharmony_ci#define REG_TX_FIFO_WRITE_PTR 0x2014 /* TX FIFO write pointer */ 47862306a36Sopenharmony_ci#define REG_TX_FIFO_SHADOW_WRITE_PTR 0x2018 /* TX FIFO shadow write 47962306a36Sopenharmony_ci pointer. temp hold reg. 48062306a36Sopenharmony_ci diagnostics only. */ 48162306a36Sopenharmony_ci#define REG_TX_FIFO_READ_PTR 0x201C /* TX FIFO read pointer */ 48262306a36Sopenharmony_ci#define REG_TX_FIFO_SHADOW_READ_PTR 0x2020 /* TX FIFO shadow read 48362306a36Sopenharmony_ci pointer */ 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ci/* (ro) 11-bit up/down counter w/ # of frames currently in TX FIFO */ 48662306a36Sopenharmony_ci#define REG_TX_FIFO_PKT_CNT 0x2024 /* TX FIFO packet counter */ 48762306a36Sopenharmony_ci 48862306a36Sopenharmony_ci/* current state of all state machines in TX */ 48962306a36Sopenharmony_ci#define REG_TX_SM_1 0x2028 /* TX state machine reg #1 */ 49062306a36Sopenharmony_ci#define TX_SM_1_CHAIN_MASK 0x000003FF /* chaining state machine */ 49162306a36Sopenharmony_ci#define TX_SM_1_CSUM_MASK 0x00000C00 /* checksum state machine */ 49262306a36Sopenharmony_ci#define TX_SM_1_FIFO_LOAD_MASK 0x0003F000 /* FIFO load state machine. 49362306a36Sopenharmony_ci = 0x01 when TX disabled. */ 49462306a36Sopenharmony_ci#define TX_SM_1_FIFO_UNLOAD_MASK 0x003C0000 /* FIFO unload state machine */ 49562306a36Sopenharmony_ci#define TX_SM_1_CACHE_MASK 0x03C00000 /* desc. prefetch cache controller 49662306a36Sopenharmony_ci state machine */ 49762306a36Sopenharmony_ci#define TX_SM_1_CBQ_ARB_MASK 0xF8000000 /* CBQ arbiter state machine */ 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci#define REG_TX_SM_2 0x202C /* TX state machine reg #2 */ 50062306a36Sopenharmony_ci#define TX_SM_2_COMP_WB_MASK 0x07 /* completion writeback sm */ 50162306a36Sopenharmony_ci#define TX_SM_2_SUB_LOAD_MASK 0x38 /* sub load state machine */ 50262306a36Sopenharmony_ci#define TX_SM_2_KICK_MASK 0xC0 /* kick state machine */ 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ci/* 64-bit pointer to the transmit data buffer. only the 50 LSB are incremented 50562306a36Sopenharmony_ci * while the upper 23 bits are taken from the TX descriptor 50662306a36Sopenharmony_ci */ 50762306a36Sopenharmony_ci#define REG_TX_DATA_PTR_LOW 0x2030 /* TX data pointer low */ 50862306a36Sopenharmony_ci#define REG_TX_DATA_PTR_HI 0x2034 /* TX data pointer high */ 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ci/* 13 bit registers written by driver w/ descriptor value that follows 51162306a36Sopenharmony_ci * last valid xmit descriptor. kick # and complete # values are used by 51262306a36Sopenharmony_ci * the xmit dma engine to control tx descr fetching. if > 1 valid 51362306a36Sopenharmony_ci * tx descr is available within the cache line being read, cassini will 51462306a36Sopenharmony_ci * internally cache up to 4 of them. 0 on reset. _KICK = rw, _COMP = ro. 51562306a36Sopenharmony_ci */ 51662306a36Sopenharmony_ci#define REG_TX_KICK0 0x2038 /* TX kick reg #1 */ 51762306a36Sopenharmony_ci#define REG_TX_KICKN(x) (REG_TX_KICK0 + (x)*4) 51862306a36Sopenharmony_ci#define REG_TX_COMP0 0x2048 /* TX completion reg #1 */ 51962306a36Sopenharmony_ci#define REG_TX_COMPN(x) (REG_TX_COMP0 + (x)*4) 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ci/* values of TX_COMPLETE_1-4 are written. each completion register 52262306a36Sopenharmony_ci * is 2bytes in size and contiguous. 8B allocation w/ 8B alignment. 52362306a36Sopenharmony_ci * NOTE: completion reg values are only written back prior to TX_INTME and 52462306a36Sopenharmony_ci * TX_ALL interrupts. at all other times, the most up-to-date index values 52562306a36Sopenharmony_ci * should be obtained from the REG_TX_COMPLETE_# registers. 52662306a36Sopenharmony_ci * here's the layout: 52762306a36Sopenharmony_ci * offset from base addr completion # byte 52862306a36Sopenharmony_ci * 0 TX_COMPLETE_1_MSB 52962306a36Sopenharmony_ci * 1 TX_COMPLETE_1_LSB 53062306a36Sopenharmony_ci * 2 TX_COMPLETE_2_MSB 53162306a36Sopenharmony_ci * 3 TX_COMPLETE_2_LSB 53262306a36Sopenharmony_ci * 4 TX_COMPLETE_3_MSB 53362306a36Sopenharmony_ci * 5 TX_COMPLETE_3_LSB 53462306a36Sopenharmony_ci * 6 TX_COMPLETE_4_MSB 53562306a36Sopenharmony_ci * 7 TX_COMPLETE_4_LSB 53662306a36Sopenharmony_ci */ 53762306a36Sopenharmony_ci#define TX_COMPWB_SIZE 8 53862306a36Sopenharmony_ci#define REG_TX_COMPWB_DB_LOW 0x2058 /* TX completion write back 53962306a36Sopenharmony_ci base low */ 54062306a36Sopenharmony_ci#define REG_TX_COMPWB_DB_HI 0x205C /* TX completion write back 54162306a36Sopenharmony_ci base high */ 54262306a36Sopenharmony_ci#define TX_COMPWB_MSB_MASK 0x00000000000000FFULL 54362306a36Sopenharmony_ci#define TX_COMPWB_MSB_SHIFT 0 54462306a36Sopenharmony_ci#define TX_COMPWB_LSB_MASK 0x000000000000FF00ULL 54562306a36Sopenharmony_ci#define TX_COMPWB_LSB_SHIFT 8 54662306a36Sopenharmony_ci#define TX_COMPWB_NEXT(x) ((x) >> 16) 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ci/* 53 MSB used as base address. 11 LSB assumed to be 0. TX desc pointer must 54962306a36Sopenharmony_ci * be 2KB-aligned. */ 55062306a36Sopenharmony_ci#define REG_TX_DB0_LOW 0x2060 /* TX descriptor base low #1 */ 55162306a36Sopenharmony_ci#define REG_TX_DB0_HI 0x2064 /* TX descriptor base hi #1 */ 55262306a36Sopenharmony_ci#define REG_TX_DBN_LOW(x) (REG_TX_DB0_LOW + (x)*8) 55362306a36Sopenharmony_ci#define REG_TX_DBN_HI(x) (REG_TX_DB0_HI + (x)*8) 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_ci/* 16-bit registers hold weights for the weighted round-robin of the 55662306a36Sopenharmony_ci * four CBQ TX descr rings. weights correspond to # bytes xferred from 55762306a36Sopenharmony_ci * host to TXFIFO in a round of WRR arbitration. can be set 55862306a36Sopenharmony_ci * dynamically with new weights set upon completion of the current 55962306a36Sopenharmony_ci * packet transfer from host memory to TXFIFO. a dummy write to any of 56062306a36Sopenharmony_ci * these registers causes a queue1 pre-emption with all historical bw 56162306a36Sopenharmony_ci * deficit data reset to 0 (useful when congestion requires a 56262306a36Sopenharmony_ci * pre-emption/re-allocation of network bandwidth 56362306a36Sopenharmony_ci */ 56462306a36Sopenharmony_ci#define REG_TX_MAXBURST_0 0x2080 /* TX MaxBurst #1 */ 56562306a36Sopenharmony_ci#define REG_TX_MAXBURST_1 0x2084 /* TX MaxBurst #2 */ 56662306a36Sopenharmony_ci#define REG_TX_MAXBURST_2 0x2088 /* TX MaxBurst #3 */ 56762306a36Sopenharmony_ci#define REG_TX_MAXBURST_3 0x208C /* TX MaxBurst #4 */ 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci/* diagnostics access to any TX FIFO location. every access is 65 57062306a36Sopenharmony_ci * bits. _DATA_LOW = 32 LSB, _DATA_HI_T1/T0 = 32 MSB. _TAG = tag bit. 57162306a36Sopenharmony_ci * writing _DATA_HI_T0 sets tag bit low, writing _DATA_HI_T1 sets tag 57262306a36Sopenharmony_ci * bit high. TX_FIFO_PIO_SEL must be set for TX FIFO PIO access. if 57362306a36Sopenharmony_ci * TX FIFO data integrity is desired, TX DMA should be 57462306a36Sopenharmony_ci * disabled. _DATA_HI_Tx should be the last access of the sequence. 57562306a36Sopenharmony_ci */ 57662306a36Sopenharmony_ci#define REG_TX_FIFO_ADDR 0x2104 /* TX FIFO address */ 57762306a36Sopenharmony_ci#define REG_TX_FIFO_TAG 0x2108 /* TX FIFO tag */ 57862306a36Sopenharmony_ci#define REG_TX_FIFO_DATA_LOW 0x210C /* TX FIFO data low */ 57962306a36Sopenharmony_ci#define REG_TX_FIFO_DATA_HI_T1 0x2110 /* TX FIFO data high t1 */ 58062306a36Sopenharmony_ci#define REG_TX_FIFO_DATA_HI_T0 0x2114 /* TX FIFO data high t0 */ 58162306a36Sopenharmony_ci#define REG_TX_FIFO_SIZE 0x2118 /* (ro) TX FIFO size = 0x090 = 9KB */ 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_ci/* 9-bit register controls BIST of TX FIFO. bit set indicates that the BIST 58462306a36Sopenharmony_ci * passed for the specified memory 58562306a36Sopenharmony_ci */ 58662306a36Sopenharmony_ci#define REG_TX_RAMBIST 0x211C /* TX RAMBIST control/status */ 58762306a36Sopenharmony_ci#define TX_RAMBIST_STATE 0x01C0 /* progress state of RAMBIST 58862306a36Sopenharmony_ci controller state machine */ 58962306a36Sopenharmony_ci#define TX_RAMBIST_RAM33A_PASS 0x0020 /* RAM33A passed */ 59062306a36Sopenharmony_ci#define TX_RAMBIST_RAM32A_PASS 0x0010 /* RAM32A passed */ 59162306a36Sopenharmony_ci#define TX_RAMBIST_RAM33B_PASS 0x0008 /* RAM33B passed */ 59262306a36Sopenharmony_ci#define TX_RAMBIST_RAM32B_PASS 0x0004 /* RAM32B passed */ 59362306a36Sopenharmony_ci#define TX_RAMBIST_SUMMARY 0x0002 /* all RAM passed */ 59462306a36Sopenharmony_ci#define TX_RAMBIST_START 0x0001 /* write 1 to start BIST. self 59562306a36Sopenharmony_ci clears on completion. */ 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci/** receive dma registers **/ 59862306a36Sopenharmony_ci#define MAX_RX_DESC_RINGS 2 59962306a36Sopenharmony_ci#define MAX_RX_COMP_RINGS 4 60062306a36Sopenharmony_ci 60162306a36Sopenharmony_ci/* receive DMA channel configuration. default: 0x80910 60262306a36Sopenharmony_ci * free ring size = (1 << n)*32 -> [32 - 8k] 60362306a36Sopenharmony_ci * completion ring size = (1 << n)*128 -> [128 - 32k], n < 9 60462306a36Sopenharmony_ci * DEFAULT: 0x80910 60562306a36Sopenharmony_ci */ 60662306a36Sopenharmony_ci#define REG_RX_CFG 0x4000 /* RX config */ 60762306a36Sopenharmony_ci#define RX_CFG_DMA_EN 0x00000001 /* enable RX DMA. 0 stops 60862306a36Sopenharmony_ci channel as soon as current 60962306a36Sopenharmony_ci frame xfer has completed. 61062306a36Sopenharmony_ci driver should disable MAC 61162306a36Sopenharmony_ci for 200ms before disabling 61262306a36Sopenharmony_ci RX */ 61362306a36Sopenharmony_ci#define RX_CFG_DESC_RING_MASK 0x0000001E /* # desc entries in RX 61462306a36Sopenharmony_ci free desc ring. 61562306a36Sopenharmony_ci def: 0x8 = 8k */ 61662306a36Sopenharmony_ci#define RX_CFG_DESC_RING_SHIFT 1 61762306a36Sopenharmony_ci#define RX_CFG_COMP_RING_MASK 0x000001E0 /* # desc entries in RX complete 61862306a36Sopenharmony_ci ring. def: 0x8 = 32k */ 61962306a36Sopenharmony_ci#define RX_CFG_COMP_RING_SHIFT 5 62062306a36Sopenharmony_ci#define RX_CFG_BATCH_DIS 0x00000200 /* disable receive desc 62162306a36Sopenharmony_ci batching. def: 0x0 = 62262306a36Sopenharmony_ci enabled */ 62362306a36Sopenharmony_ci#define RX_CFG_SWIVEL_MASK 0x00001C00 /* byte offset of the 1st 62462306a36Sopenharmony_ci data byte of the packet 62562306a36Sopenharmony_ci w/in 8 byte boundares. 62662306a36Sopenharmony_ci this swivels the data 62762306a36Sopenharmony_ci DMA'ed to header 62862306a36Sopenharmony_ci buffers, jumbo buffers 62962306a36Sopenharmony_ci when header split is not 63062306a36Sopenharmony_ci requested and MTU sized 63162306a36Sopenharmony_ci buffers. def: 0x2 */ 63262306a36Sopenharmony_ci#define RX_CFG_SWIVEL_SHIFT 10 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci/* cassini+ only */ 63562306a36Sopenharmony_ci#define RX_CFG_DESC_RING1_MASK 0x000F0000 /* # of desc entries in 63662306a36Sopenharmony_ci RX free desc ring 2. 63762306a36Sopenharmony_ci def: 0x8 = 8k */ 63862306a36Sopenharmony_ci#define RX_CFG_DESC_RING1_SHIFT 16 63962306a36Sopenharmony_ci 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci/* the page size register allows cassini chips to do the following with 64262306a36Sopenharmony_ci * received data: 64362306a36Sopenharmony_ci * [--------------------------------------------------------------] page 64462306a36Sopenharmony_ci * [off][buf1][pad][off][buf2][pad][off][buf3][pad][off][buf4][pad] 64562306a36Sopenharmony_ci * |--------------| = PAGE_SIZE_BUFFER_STRIDE 64662306a36Sopenharmony_ci * page = PAGE_SIZE 64762306a36Sopenharmony_ci * offset = PAGE_SIZE_MTU_OFF 64862306a36Sopenharmony_ci * for the above example, MTU_BUFFER_COUNT = 4. 64962306a36Sopenharmony_ci * NOTE: as is apparent, you need to ensure that the following holds: 65062306a36Sopenharmony_ci * MTU_BUFFER_COUNT <= PAGE_SIZE/PAGE_SIZE_BUFFER_STRIDE 65162306a36Sopenharmony_ci * DEFAULT: 0x48002002 (8k pages) 65262306a36Sopenharmony_ci */ 65362306a36Sopenharmony_ci#define REG_RX_PAGE_SIZE 0x4004 /* RX page size */ 65462306a36Sopenharmony_ci#define RX_PAGE_SIZE_MASK 0x00000003 /* size of pages pointed to 65562306a36Sopenharmony_ci by receive descriptors. 65662306a36Sopenharmony_ci if jumbo buffers are 65762306a36Sopenharmony_ci supported the page size 65862306a36Sopenharmony_ci should not be < 8k. 65962306a36Sopenharmony_ci 0b00 = 2k, 0b01 = 4k 66062306a36Sopenharmony_ci 0b10 = 8k, 0b11 = 16k 66162306a36Sopenharmony_ci DEFAULT: 8k */ 66262306a36Sopenharmony_ci#define RX_PAGE_SIZE_SHIFT 0 66362306a36Sopenharmony_ci#define RX_PAGE_SIZE_MTU_COUNT_MASK 0x00007800 /* # of MTU buffers the hw 66462306a36Sopenharmony_ci packs into a page. 66562306a36Sopenharmony_ci DEFAULT: 4 */ 66662306a36Sopenharmony_ci#define RX_PAGE_SIZE_MTU_COUNT_SHIFT 11 66762306a36Sopenharmony_ci#define RX_PAGE_SIZE_MTU_STRIDE_MASK 0x18000000 /* # of bytes that separate 66862306a36Sopenharmony_ci each MTU buffer + 66962306a36Sopenharmony_ci offset from each 67062306a36Sopenharmony_ci other. 67162306a36Sopenharmony_ci 0b00 = 1k, 0b01 = 2k 67262306a36Sopenharmony_ci 0b10 = 4k, 0b11 = 8k 67362306a36Sopenharmony_ci DEFAULT: 0x1 */ 67462306a36Sopenharmony_ci#define RX_PAGE_SIZE_MTU_STRIDE_SHIFT 27 67562306a36Sopenharmony_ci#define RX_PAGE_SIZE_MTU_OFF_MASK 0xC0000000 /* offset in each page that 67662306a36Sopenharmony_ci hw writes the MTU buffer 67762306a36Sopenharmony_ci into. 67862306a36Sopenharmony_ci 0b00 = 0, 67962306a36Sopenharmony_ci 0b01 = 64 bytes 68062306a36Sopenharmony_ci 0b10 = 96, 0b11 = 128 68162306a36Sopenharmony_ci DEFAULT: 0x1 */ 68262306a36Sopenharmony_ci#define RX_PAGE_SIZE_MTU_OFF_SHIFT 30 68362306a36Sopenharmony_ci 68462306a36Sopenharmony_ci/* 11-bit counter points to next location in RX FIFO to be loaded/read. 68562306a36Sopenharmony_ci * shadow write pointers enable retries in case of early receive aborts. 68662306a36Sopenharmony_ci * DEFAULT: 0x0. generated on 64-bit boundaries. 68762306a36Sopenharmony_ci */ 68862306a36Sopenharmony_ci#define REG_RX_FIFO_WRITE_PTR 0x4008 /* RX FIFO write pointer */ 68962306a36Sopenharmony_ci#define REG_RX_FIFO_READ_PTR 0x400C /* RX FIFO read pointer */ 69062306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_SHADOW_WRITE_PTR 0x4010 /* RX IPP FIFO shadow write 69162306a36Sopenharmony_ci pointer */ 69262306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_SHADOW_READ_PTR 0x4014 /* RX IPP FIFO shadow read 69362306a36Sopenharmony_ci pointer */ 69462306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_READ_PTR 0x400C /* RX IPP FIFO read 69562306a36Sopenharmony_ci pointer. (8-bit counter) */ 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ci/* current state of RX DMA state engines + other info 69862306a36Sopenharmony_ci * DEFAULT: 0x0 69962306a36Sopenharmony_ci */ 70062306a36Sopenharmony_ci#define REG_RX_DEBUG 0x401C /* RX debug */ 70162306a36Sopenharmony_ci#define RX_DEBUG_LOAD_STATE_MASK 0x0000000F /* load state machine w/ MAC: 70262306a36Sopenharmony_ci 0x0 = idle, 0x1 = load_bop 70362306a36Sopenharmony_ci 0x2 = load 1, 0x3 = load 2 70462306a36Sopenharmony_ci 0x4 = load 3, 0x5 = load 4 70562306a36Sopenharmony_ci 0x6 = last detect 70662306a36Sopenharmony_ci 0x7 = wait req 70762306a36Sopenharmony_ci 0x8 = wait req statuss 1st 70862306a36Sopenharmony_ci 0x9 = load st 70962306a36Sopenharmony_ci 0xa = bubble mac 71062306a36Sopenharmony_ci 0xb = error */ 71162306a36Sopenharmony_ci#define RX_DEBUG_LM_STATE_MASK 0x00000070 /* load state machine w/ HP and 71262306a36Sopenharmony_ci RX FIFO: 71362306a36Sopenharmony_ci 0x0 = idle, 0x1 = hp xfr 71462306a36Sopenharmony_ci 0x2 = wait hp ready 71562306a36Sopenharmony_ci 0x3 = wait flow code 71662306a36Sopenharmony_ci 0x4 = fifo xfer 71762306a36Sopenharmony_ci 0x5 = make status 71862306a36Sopenharmony_ci 0x6 = csum ready 71962306a36Sopenharmony_ci 0x7 = error */ 72062306a36Sopenharmony_ci#define RX_DEBUG_FC_STATE_MASK 0x000000180 /* flow control state machine 72162306a36Sopenharmony_ci w/ MAC: 72262306a36Sopenharmony_ci 0x0 = idle 72362306a36Sopenharmony_ci 0x1 = wait xoff ack 72462306a36Sopenharmony_ci 0x2 = wait xon 72562306a36Sopenharmony_ci 0x3 = wait xon ack */ 72662306a36Sopenharmony_ci#define RX_DEBUG_DATA_STATE_MASK 0x000001E00 /* unload data state machine 72762306a36Sopenharmony_ci states: 72862306a36Sopenharmony_ci 0x0 = idle data 72962306a36Sopenharmony_ci 0x1 = header begin 73062306a36Sopenharmony_ci 0x2 = xfer header 73162306a36Sopenharmony_ci 0x3 = xfer header ld 73262306a36Sopenharmony_ci 0x4 = mtu begin 73362306a36Sopenharmony_ci 0x5 = xfer mtu 73462306a36Sopenharmony_ci 0x6 = xfer mtu ld 73562306a36Sopenharmony_ci 0x7 = jumbo begin 73662306a36Sopenharmony_ci 0x8 = xfer jumbo 73762306a36Sopenharmony_ci 0x9 = xfer jumbo ld 73862306a36Sopenharmony_ci 0xa = reas begin 73962306a36Sopenharmony_ci 0xb = xfer reas 74062306a36Sopenharmony_ci 0xc = flush tag 74162306a36Sopenharmony_ci 0xd = xfer reas ld 74262306a36Sopenharmony_ci 0xe = error 74362306a36Sopenharmony_ci 0xf = bubble idle */ 74462306a36Sopenharmony_ci#define RX_DEBUG_DESC_STATE_MASK 0x0001E000 /* unload desc state machine 74562306a36Sopenharmony_ci states: 74662306a36Sopenharmony_ci 0x0 = idle desc 74762306a36Sopenharmony_ci 0x1 = wait ack 74862306a36Sopenharmony_ci 0x9 = wait ack 2 74962306a36Sopenharmony_ci 0x2 = fetch desc 1 75062306a36Sopenharmony_ci 0xa = fetch desc 2 75162306a36Sopenharmony_ci 0x3 = load ptrs 75262306a36Sopenharmony_ci 0x4 = wait dma 75362306a36Sopenharmony_ci 0x5 = wait ack batch 75462306a36Sopenharmony_ci 0x6 = post batch 75562306a36Sopenharmony_ci 0x7 = xfr done */ 75662306a36Sopenharmony_ci#define RX_DEBUG_INTR_READ_PTR_MASK 0x30000000 /* interrupt read ptr of the 75762306a36Sopenharmony_ci interrupt queue */ 75862306a36Sopenharmony_ci#define RX_DEBUG_INTR_WRITE_PTR_MASK 0xC0000000 /* interrupt write pointer 75962306a36Sopenharmony_ci of the interrupt queue */ 76062306a36Sopenharmony_ci 76162306a36Sopenharmony_ci/* flow control frames are emitted using two PAUSE thresholds: 76262306a36Sopenharmony_ci * XOFF PAUSE uses pause time value pre-programmed in the Send PAUSE MAC reg 76362306a36Sopenharmony_ci * XON PAUSE uses a pause time of 0. granularity of threshold is 64bytes. 76462306a36Sopenharmony_ci * PAUSE thresholds defined in terms of FIFO occupancy and may be translated 76562306a36Sopenharmony_ci * into FIFO vacancy using RX_FIFO_SIZE. setting ON will trigger XON frames 76662306a36Sopenharmony_ci * when FIFO reaches 0. OFF threshold should not be > size of RX FIFO. max 76762306a36Sopenharmony_ci * value is 0x6F. 76862306a36Sopenharmony_ci * DEFAULT: 0x00078 76962306a36Sopenharmony_ci */ 77062306a36Sopenharmony_ci#define REG_RX_PAUSE_THRESH 0x4020 /* RX pause thresholds */ 77162306a36Sopenharmony_ci#define RX_PAUSE_THRESH_QUANTUM 64 77262306a36Sopenharmony_ci#define RX_PAUSE_THRESH_OFF_MASK 0x000001FF /* XOFF PAUSE emitted when 77362306a36Sopenharmony_ci RX FIFO occupancy > 77462306a36Sopenharmony_ci value*64B */ 77562306a36Sopenharmony_ci#define RX_PAUSE_THRESH_OFF_SHIFT 0 77662306a36Sopenharmony_ci#define RX_PAUSE_THRESH_ON_MASK 0x001FF000 /* XON PAUSE emitted after 77762306a36Sopenharmony_ci emitting XOFF PAUSE when RX 77862306a36Sopenharmony_ci FIFO occupancy falls below 77962306a36Sopenharmony_ci this value*64B. must be 78062306a36Sopenharmony_ci < XOFF threshold. if = 78162306a36Sopenharmony_ci RX_FIFO_SIZE< XON frames are 78262306a36Sopenharmony_ci never emitted. */ 78362306a36Sopenharmony_ci#define RX_PAUSE_THRESH_ON_SHIFT 12 78462306a36Sopenharmony_ci 78562306a36Sopenharmony_ci/* 13-bit register used to control RX desc fetching and intr generation. if 4+ 78662306a36Sopenharmony_ci * valid RX descriptors are available, Cassini will read 4 at a time. 78762306a36Sopenharmony_ci * writing N means that all desc up to *but* excluding N are available. N must 78862306a36Sopenharmony_ci * be a multiple of 4 (N % 4 = 0). first desc should be cache-line aligned. 78962306a36Sopenharmony_ci * DEFAULT: 0 on reset 79062306a36Sopenharmony_ci */ 79162306a36Sopenharmony_ci#define REG_RX_KICK 0x4024 /* RX kick reg */ 79262306a36Sopenharmony_ci 79362306a36Sopenharmony_ci/* 8KB aligned 64-bit pointer to the base of the RX free/completion rings. 79462306a36Sopenharmony_ci * lower 13 bits of the low register are hard-wired to 0. 79562306a36Sopenharmony_ci */ 79662306a36Sopenharmony_ci#define REG_RX_DB_LOW 0x4028 /* RX descriptor ring 79762306a36Sopenharmony_ci base low */ 79862306a36Sopenharmony_ci#define REG_RX_DB_HI 0x402C /* RX descriptor ring 79962306a36Sopenharmony_ci base hi */ 80062306a36Sopenharmony_ci#define REG_RX_CB_LOW 0x4030 /* RX completion ring 80162306a36Sopenharmony_ci base low */ 80262306a36Sopenharmony_ci#define REG_RX_CB_HI 0x4034 /* RX completion ring 80362306a36Sopenharmony_ci base hi */ 80462306a36Sopenharmony_ci/* 13-bit register indicate desc used by cassini for receive frames. used 80562306a36Sopenharmony_ci * for diagnostic purposes. 80662306a36Sopenharmony_ci * DEFAULT: 0 on reset 80762306a36Sopenharmony_ci */ 80862306a36Sopenharmony_ci#define REG_RX_COMP 0x4038 /* (ro) RX completion */ 80962306a36Sopenharmony_ci 81062306a36Sopenharmony_ci/* HEAD and TAIL are used to control RX desc posting and interrupt 81162306a36Sopenharmony_ci * generation. hw moves the head register to pass ownership to sw. sw 81262306a36Sopenharmony_ci * moves the tail register to pass ownership back to hw. to give all 81362306a36Sopenharmony_ci * entries to hw, set TAIL = HEAD. if HEAD and TAIL indicate that no 81462306a36Sopenharmony_ci * more entries are available, DMA will pause and an interrupt will be 81562306a36Sopenharmony_ci * generated to indicate no more entries are available. sw can use 81662306a36Sopenharmony_ci * this interrupt to reduce the # of times it must update the 81762306a36Sopenharmony_ci * completion tail register. 81862306a36Sopenharmony_ci * DEFAULT: 0 on reset 81962306a36Sopenharmony_ci */ 82062306a36Sopenharmony_ci#define REG_RX_COMP_HEAD 0x403C /* RX completion head */ 82162306a36Sopenharmony_ci#define REG_RX_COMP_TAIL 0x4040 /* RX completion tail */ 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci/* values used for receive interrupt blanking. loaded each time the ISR is read 82462306a36Sopenharmony_ci * DEFAULT: 0x00000000 82562306a36Sopenharmony_ci */ 82662306a36Sopenharmony_ci#define REG_RX_BLANK 0x4044 /* RX blanking register 82762306a36Sopenharmony_ci for ISR read */ 82862306a36Sopenharmony_ci#define RX_BLANK_INTR_PKT_MASK 0x000001FF /* RX_DONE intr asserted if 82962306a36Sopenharmony_ci this many sets of completion 83062306a36Sopenharmony_ci writebacks (up to 2 packets) 83162306a36Sopenharmony_ci occur since the last time 83262306a36Sopenharmony_ci the ISR was read. 0 = no 83362306a36Sopenharmony_ci packet blanking */ 83462306a36Sopenharmony_ci#define RX_BLANK_INTR_PKT_SHIFT 0 83562306a36Sopenharmony_ci#define RX_BLANK_INTR_TIME_MASK 0x3FFFF000 /* RX_DONE interrupt asserted 83662306a36Sopenharmony_ci if that many clocks were 83762306a36Sopenharmony_ci counted since last time the 83862306a36Sopenharmony_ci ISR was read. 83962306a36Sopenharmony_ci each count is 512 core 84062306a36Sopenharmony_ci clocks (125MHz). 0 = no 84162306a36Sopenharmony_ci time blanking */ 84262306a36Sopenharmony_ci#define RX_BLANK_INTR_TIME_SHIFT 12 84362306a36Sopenharmony_ci 84462306a36Sopenharmony_ci/* values used for interrupt generation based on threshold values of how 84562306a36Sopenharmony_ci * many free desc and completion entries are available for hw use. 84662306a36Sopenharmony_ci * DEFAULT: 0x00000000 84762306a36Sopenharmony_ci */ 84862306a36Sopenharmony_ci#define REG_RX_AE_THRESH 0x4048 /* RX almost empty 84962306a36Sopenharmony_ci thresholds */ 85062306a36Sopenharmony_ci#define RX_AE_THRESH_FREE_MASK 0x00001FFF /* RX_BUF_AE will be 85162306a36Sopenharmony_ci generated if # desc 85262306a36Sopenharmony_ci avail for hw use <= 85362306a36Sopenharmony_ci # */ 85462306a36Sopenharmony_ci#define RX_AE_THRESH_FREE_SHIFT 0 85562306a36Sopenharmony_ci#define RX_AE_THRESH_COMP_MASK 0x0FFFE000 /* RX_COMP_AE will be 85662306a36Sopenharmony_ci generated if # of 85762306a36Sopenharmony_ci completion entries 85862306a36Sopenharmony_ci avail for hw use <= 85962306a36Sopenharmony_ci # */ 86062306a36Sopenharmony_ci#define RX_AE_THRESH_COMP_SHIFT 13 86162306a36Sopenharmony_ci 86262306a36Sopenharmony_ci/* probabilities for random early drop (RED) thresholds on a FIFO threshold 86362306a36Sopenharmony_ci * basis. probability should increase when the FIFO level increases. control 86462306a36Sopenharmony_ci * packets are never dropped and not counted in stats. probability programmed 86562306a36Sopenharmony_ci * on a 12.5% granularity. e.g., 0x1 = 1/8 packets dropped. 86662306a36Sopenharmony_ci * DEFAULT: 0x00000000 86762306a36Sopenharmony_ci */ 86862306a36Sopenharmony_ci#define REG_RX_RED 0x404C /* RX random early detect enable */ 86962306a36Sopenharmony_ci#define RX_RED_4K_6K_FIFO_MASK 0x000000FF /* 4KB < FIFO thresh < 6KB */ 87062306a36Sopenharmony_ci#define RX_RED_6K_8K_FIFO_MASK 0x0000FF00 /* 6KB < FIFO thresh < 8KB */ 87162306a36Sopenharmony_ci#define RX_RED_8K_10K_FIFO_MASK 0x00FF0000 /* 8KB < FIFO thresh < 10KB */ 87262306a36Sopenharmony_ci#define RX_RED_10K_12K_FIFO_MASK 0xFF000000 /* 10KB < FIFO thresh < 12KB */ 87362306a36Sopenharmony_ci 87462306a36Sopenharmony_ci/* FIFO fullness levels for RX FIFO, RX control FIFO, and RX IPP FIFO. 87562306a36Sopenharmony_ci * RX control FIFO = # of packets in RX FIFO. 87662306a36Sopenharmony_ci * DEFAULT: 0x0 87762306a36Sopenharmony_ci */ 87862306a36Sopenharmony_ci#define REG_RX_FIFO_FULLNESS 0x4050 /* (ro) RX FIFO fullness */ 87962306a36Sopenharmony_ci#define RX_FIFO_FULLNESS_RX_FIFO_MASK 0x3FF80000 /* level w/ 8B granularity */ 88062306a36Sopenharmony_ci#define RX_FIFO_FULLNESS_IPP_FIFO_MASK 0x0007FF00 /* level w/ 8B granularity */ 88162306a36Sopenharmony_ci#define RX_FIFO_FULLNESS_RX_PKT_MASK 0x000000FF /* # packets in RX FIFO */ 88262306a36Sopenharmony_ci#define REG_RX_IPP_PACKET_COUNT 0x4054 /* RX IPP packet counter */ 88362306a36Sopenharmony_ci#define REG_RX_WORK_DMA_PTR_LOW 0x4058 /* RX working DMA ptr low */ 88462306a36Sopenharmony_ci#define REG_RX_WORK_DMA_PTR_HI 0x405C /* RX working DMA ptr 88562306a36Sopenharmony_ci high */ 88662306a36Sopenharmony_ci 88762306a36Sopenharmony_ci/* BIST testing ro RX FIFO, RX control FIFO, and RX IPP FIFO. only RX BIST 88862306a36Sopenharmony_ci * START/COMPLETE is writeable. START will clear when the BIST has completed 88962306a36Sopenharmony_ci * checking all 17 RAMS. 89062306a36Sopenharmony_ci * DEFAULT: 0bxxxx xxxxx xxxx xxxx xxxx x000 0000 0000 00x0 89162306a36Sopenharmony_ci */ 89262306a36Sopenharmony_ci#define REG_RX_BIST 0x4060 /* (ro) RX BIST */ 89362306a36Sopenharmony_ci#define RX_BIST_32A_PASS 0x80000000 /* RX FIFO 32A passed */ 89462306a36Sopenharmony_ci#define RX_BIST_33A_PASS 0x40000000 /* RX FIFO 33A passed */ 89562306a36Sopenharmony_ci#define RX_BIST_32B_PASS 0x20000000 /* RX FIFO 32B passed */ 89662306a36Sopenharmony_ci#define RX_BIST_33B_PASS 0x10000000 /* RX FIFO 33B passed */ 89762306a36Sopenharmony_ci#define RX_BIST_32C_PASS 0x08000000 /* RX FIFO 32C passed */ 89862306a36Sopenharmony_ci#define RX_BIST_33C_PASS 0x04000000 /* RX FIFO 33C passed */ 89962306a36Sopenharmony_ci#define RX_BIST_IPP_32A_PASS 0x02000000 /* RX IPP FIFO 33B passed */ 90062306a36Sopenharmony_ci#define RX_BIST_IPP_33A_PASS 0x01000000 /* RX IPP FIFO 33A passed */ 90162306a36Sopenharmony_ci#define RX_BIST_IPP_32B_PASS 0x00800000 /* RX IPP FIFO 32B passed */ 90262306a36Sopenharmony_ci#define RX_BIST_IPP_33B_PASS 0x00400000 /* RX IPP FIFO 33B passed */ 90362306a36Sopenharmony_ci#define RX_BIST_IPP_32C_PASS 0x00200000 /* RX IPP FIFO 32C passed */ 90462306a36Sopenharmony_ci#define RX_BIST_IPP_33C_PASS 0x00100000 /* RX IPP FIFO 33C passed */ 90562306a36Sopenharmony_ci#define RX_BIST_CTRL_32_PASS 0x00800000 /* RX CTRL FIFO 32 passed */ 90662306a36Sopenharmony_ci#define RX_BIST_CTRL_33_PASS 0x00400000 /* RX CTRL FIFO 33 passed */ 90762306a36Sopenharmony_ci#define RX_BIST_REAS_26A_PASS 0x00200000 /* RX Reas 26A passed */ 90862306a36Sopenharmony_ci#define RX_BIST_REAS_26B_PASS 0x00100000 /* RX Reas 26B passed */ 90962306a36Sopenharmony_ci#define RX_BIST_REAS_27_PASS 0x00080000 /* RX Reas 27 passed */ 91062306a36Sopenharmony_ci#define RX_BIST_STATE_MASK 0x00078000 /* BIST state machine */ 91162306a36Sopenharmony_ci#define RX_BIST_SUMMARY 0x00000002 /* when BIST complete, 91262306a36Sopenharmony_ci summary pass bit 91362306a36Sopenharmony_ci contains AND of BIST 91462306a36Sopenharmony_ci results of all 16 91562306a36Sopenharmony_ci RAMS */ 91662306a36Sopenharmony_ci#define RX_BIST_START 0x00000001 /* write 1 to start 91762306a36Sopenharmony_ci BIST. self clears 91862306a36Sopenharmony_ci on completion. */ 91962306a36Sopenharmony_ci 92062306a36Sopenharmony_ci/* next location in RX CTRL FIFO that will be loaded w/ data from RX IPP/read 92162306a36Sopenharmony_ci * from to retrieve packet control info. 92262306a36Sopenharmony_ci * DEFAULT: 0 92362306a36Sopenharmony_ci */ 92462306a36Sopenharmony_ci#define REG_RX_CTRL_FIFO_WRITE_PTR 0x4064 /* (ro) RX control FIFO 92562306a36Sopenharmony_ci write ptr */ 92662306a36Sopenharmony_ci#define REG_RX_CTRL_FIFO_READ_PTR 0x4068 /* (ro) RX control FIFO read 92762306a36Sopenharmony_ci ptr */ 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ci/* receive interrupt blanking. loaded each time interrupt alias register is 93062306a36Sopenharmony_ci * read. 93162306a36Sopenharmony_ci * DEFAULT: 0x0 93262306a36Sopenharmony_ci */ 93362306a36Sopenharmony_ci#define REG_RX_BLANK_ALIAS_READ 0x406C /* RX blanking register for 93462306a36Sopenharmony_ci alias read */ 93562306a36Sopenharmony_ci#define RX_BAR_INTR_PACKET_MASK 0x000001FF /* assert RX_DONE if # 93662306a36Sopenharmony_ci completion writebacks 93762306a36Sopenharmony_ci > # since last ISR 93862306a36Sopenharmony_ci read. 0 = no 93962306a36Sopenharmony_ci blanking. up to 2 94062306a36Sopenharmony_ci packets per 94162306a36Sopenharmony_ci completion wb. */ 94262306a36Sopenharmony_ci#define RX_BAR_INTR_TIME_MASK 0x3FFFF000 /* assert RX_DONE if # 94362306a36Sopenharmony_ci clocks > # since last 94462306a36Sopenharmony_ci ISR read. each count 94562306a36Sopenharmony_ci is 512 core clocks 94662306a36Sopenharmony_ci (125MHz). 0 = no 94762306a36Sopenharmony_ci blanking. */ 94862306a36Sopenharmony_ci 94962306a36Sopenharmony_ci/* diagnostic access to RX FIFO. 32 LSB accessed via DATA_LOW. 32 MSB accessed 95062306a36Sopenharmony_ci * via DATA_HI_T0 or DATA_HI_T1. TAG reads the tag bit. writing HI_T0 95162306a36Sopenharmony_ci * will unset the tag bit while writing HI_T1 will set the tag bit. to reset 95262306a36Sopenharmony_ci * to normal operation after diagnostics, write to address location 0x0. 95362306a36Sopenharmony_ci * RX_DMA_EN bit must be set to 0x0 for RX FIFO PIO access. DATA_HI should 95462306a36Sopenharmony_ci * be the last write access of a write sequence. 95562306a36Sopenharmony_ci * DEFAULT: undefined 95662306a36Sopenharmony_ci */ 95762306a36Sopenharmony_ci#define REG_RX_FIFO_ADDR 0x4080 /* RX FIFO address */ 95862306a36Sopenharmony_ci#define REG_RX_FIFO_TAG 0x4084 /* RX FIFO tag */ 95962306a36Sopenharmony_ci#define REG_RX_FIFO_DATA_LOW 0x4088 /* RX FIFO data low */ 96062306a36Sopenharmony_ci#define REG_RX_FIFO_DATA_HI_T0 0x408C /* RX FIFO data high T0 */ 96162306a36Sopenharmony_ci#define REG_RX_FIFO_DATA_HI_T1 0x4090 /* RX FIFO data high T1 */ 96262306a36Sopenharmony_ci 96362306a36Sopenharmony_ci/* diagnostic assess to RX CTRL FIFO. 8-bit FIFO_ADDR holds address of 96462306a36Sopenharmony_ci * 81 bit control entry and 6 bit flow id. LOW and MID are both 32-bit 96562306a36Sopenharmony_ci * accesses. HI is 7-bits with 6-bit flow id and 1 bit control 96662306a36Sopenharmony_ci * word. RX_DMA_EN must be 0 for RX CTRL FIFO PIO access. DATA_HI 96762306a36Sopenharmony_ci * should be last write access of the write sequence. 96862306a36Sopenharmony_ci * DEFAULT: undefined 96962306a36Sopenharmony_ci */ 97062306a36Sopenharmony_ci#define REG_RX_CTRL_FIFO_ADDR 0x4094 /* RX Control FIFO and 97162306a36Sopenharmony_ci Batching FIFO addr */ 97262306a36Sopenharmony_ci#define REG_RX_CTRL_FIFO_DATA_LOW 0x4098 /* RX Control FIFO data 97362306a36Sopenharmony_ci low */ 97462306a36Sopenharmony_ci#define REG_RX_CTRL_FIFO_DATA_MID 0x409C /* RX Control FIFO data 97562306a36Sopenharmony_ci mid */ 97662306a36Sopenharmony_ci#define REG_RX_CTRL_FIFO_DATA_HI 0x4100 /* RX Control FIFO data 97762306a36Sopenharmony_ci hi and flow id */ 97862306a36Sopenharmony_ci#define RX_CTRL_FIFO_DATA_HI_CTRL 0x0001 /* upper bit of ctrl word */ 97962306a36Sopenharmony_ci#define RX_CTRL_FIFO_DATA_HI_FLOW_MASK 0x007E /* flow id */ 98062306a36Sopenharmony_ci 98162306a36Sopenharmony_ci/* diagnostic access to RX IPP FIFO. same semantics as RX_FIFO. 98262306a36Sopenharmony_ci * DEFAULT: undefined 98362306a36Sopenharmony_ci */ 98462306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_ADDR 0x4104 /* RX IPP FIFO address */ 98562306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_TAG 0x4108 /* RX IPP FIFO tag */ 98662306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_DATA_LOW 0x410C /* RX IPP FIFO data low */ 98762306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_DATA_HI_T0 0x4110 /* RX IPP FIFO data high 98862306a36Sopenharmony_ci T0 */ 98962306a36Sopenharmony_ci#define REG_RX_IPP_FIFO_DATA_HI_T1 0x4114 /* RX IPP FIFO data high 99062306a36Sopenharmony_ci T1 */ 99162306a36Sopenharmony_ci 99262306a36Sopenharmony_ci/* 64-bit pointer to receive data buffer in host memory used for headers and 99362306a36Sopenharmony_ci * small packets. MSB in high register. loaded by DMA state machine and 99462306a36Sopenharmony_ci * increments as DMA writes receive data. only 50 LSB are incremented. top 99562306a36Sopenharmony_ci * 13 bits taken from RX descriptor. 99662306a36Sopenharmony_ci * DEFAULT: undefined 99762306a36Sopenharmony_ci */ 99862306a36Sopenharmony_ci#define REG_RX_HEADER_PAGE_PTR_LOW 0x4118 /* (ro) RX header page ptr 99962306a36Sopenharmony_ci low */ 100062306a36Sopenharmony_ci#define REG_RX_HEADER_PAGE_PTR_HI 0x411C /* (ro) RX header page ptr 100162306a36Sopenharmony_ci high */ 100262306a36Sopenharmony_ci#define REG_RX_MTU_PAGE_PTR_LOW 0x4120 /* (ro) RX MTU page pointer 100362306a36Sopenharmony_ci low */ 100462306a36Sopenharmony_ci#define REG_RX_MTU_PAGE_PTR_HI 0x4124 /* (ro) RX MTU page pointer 100562306a36Sopenharmony_ci high */ 100662306a36Sopenharmony_ci 100762306a36Sopenharmony_ci/* PIO diagnostic access to RX reassembly DMA Table RAM. 6-bit register holds 100862306a36Sopenharmony_ci * one of 64 79-bit locations in the RX Reassembly DMA table and the addr of 100962306a36Sopenharmony_ci * one of the 64 byte locations in the Batching table. LOW holds 32 LSB. 101062306a36Sopenharmony_ci * MID holds the next 32 LSB. HIGH holds the 15 MSB. RX_DMA_EN must be set 101162306a36Sopenharmony_ci * to 0 for PIO access. DATA_HIGH should be last write of write sequence. 101262306a36Sopenharmony_ci * layout: 101362306a36Sopenharmony_ci * reassmbl ptr [78:15] | reassmbl index [14:1] | reassmbl entry valid [0] 101462306a36Sopenharmony_ci * DEFAULT: undefined 101562306a36Sopenharmony_ci */ 101662306a36Sopenharmony_ci#define REG_RX_TABLE_ADDR 0x4128 /* RX reassembly DMA table 101762306a36Sopenharmony_ci address */ 101862306a36Sopenharmony_ci#define RX_TABLE_ADDR_MASK 0x0000003F /* address mask */ 101962306a36Sopenharmony_ci 102062306a36Sopenharmony_ci#define REG_RX_TABLE_DATA_LOW 0x412C /* RX reassembly DMA table 102162306a36Sopenharmony_ci data low */ 102262306a36Sopenharmony_ci#define REG_RX_TABLE_DATA_MID 0x4130 /* RX reassembly DMA table 102362306a36Sopenharmony_ci data mid */ 102462306a36Sopenharmony_ci#define REG_RX_TABLE_DATA_HI 0x4134 /* RX reassembly DMA table 102562306a36Sopenharmony_ci data high */ 102662306a36Sopenharmony_ci 102762306a36Sopenharmony_ci/* cassini+ only */ 102862306a36Sopenharmony_ci/* 8KB aligned 64-bit pointer to base of RX rings. lower 13 bits hardwired to 102962306a36Sopenharmony_ci * 0. same semantics as primary desc/complete rings. 103062306a36Sopenharmony_ci */ 103162306a36Sopenharmony_ci#define REG_PLUS_RX_DB1_LOW 0x4200 /* RX descriptor ring 103262306a36Sopenharmony_ci 2 base low */ 103362306a36Sopenharmony_ci#define REG_PLUS_RX_DB1_HI 0x4204 /* RX descriptor ring 103462306a36Sopenharmony_ci 2 base high */ 103562306a36Sopenharmony_ci#define REG_PLUS_RX_CB1_LOW 0x4208 /* RX completion ring 103662306a36Sopenharmony_ci 2 base low. 4 total */ 103762306a36Sopenharmony_ci#define REG_PLUS_RX_CB1_HI 0x420C /* RX completion ring 103862306a36Sopenharmony_ci 2 base high. 4 total */ 103962306a36Sopenharmony_ci#define REG_PLUS_RX_CBN_LOW(x) (REG_PLUS_RX_CB1_LOW + 8*((x) - 1)) 104062306a36Sopenharmony_ci#define REG_PLUS_RX_CBN_HI(x) (REG_PLUS_RX_CB1_HI + 8*((x) - 1)) 104162306a36Sopenharmony_ci#define REG_PLUS_RX_KICK1 0x4220 /* RX Kick 2 register */ 104262306a36Sopenharmony_ci#define REG_PLUS_RX_COMP1 0x4224 /* (ro) RX completion 2 104362306a36Sopenharmony_ci reg */ 104462306a36Sopenharmony_ci#define REG_PLUS_RX_COMP1_HEAD 0x4228 /* (ro) RX completion 2 104562306a36Sopenharmony_ci head reg. 4 total. */ 104662306a36Sopenharmony_ci#define REG_PLUS_RX_COMP1_TAIL 0x422C /* RX completion 2 104762306a36Sopenharmony_ci tail reg. 4 total. */ 104862306a36Sopenharmony_ci#define REG_PLUS_RX_COMPN_HEAD(x) (REG_PLUS_RX_COMP1_HEAD + 8*((x) - 1)) 104962306a36Sopenharmony_ci#define REG_PLUS_RX_COMPN_TAIL(x) (REG_PLUS_RX_COMP1_TAIL + 8*((x) - 1)) 105062306a36Sopenharmony_ci#define REG_PLUS_RX_AE1_THRESH 0x4240 /* RX almost empty 2 105162306a36Sopenharmony_ci thresholds */ 105262306a36Sopenharmony_ci#define RX_AE1_THRESH_FREE_MASK RX_AE_THRESH_FREE_MASK 105362306a36Sopenharmony_ci#define RX_AE1_THRESH_FREE_SHIFT RX_AE_THRESH_FREE_SHIFT 105462306a36Sopenharmony_ci 105562306a36Sopenharmony_ci/** header parser registers **/ 105662306a36Sopenharmony_ci 105762306a36Sopenharmony_ci/* RX parser configuration register. 105862306a36Sopenharmony_ci * DEFAULT: 0x1651004 105962306a36Sopenharmony_ci */ 106062306a36Sopenharmony_ci#define REG_HP_CFG 0x4140 /* header parser 106162306a36Sopenharmony_ci configuration reg */ 106262306a36Sopenharmony_ci#define HP_CFG_PARSE_EN 0x00000001 /* enab header parsing */ 106362306a36Sopenharmony_ci#define HP_CFG_NUM_CPU_MASK 0x000000FC /* # processors 106462306a36Sopenharmony_ci 0 = 64. 0x3f = 63 */ 106562306a36Sopenharmony_ci#define HP_CFG_NUM_CPU_SHIFT 2 106662306a36Sopenharmony_ci#define HP_CFG_SYN_INC_MASK 0x00000100 /* SYN bit won't increment 106762306a36Sopenharmony_ci TCP seq # by one when 106862306a36Sopenharmony_ci stored in FDBM */ 106962306a36Sopenharmony_ci#define HP_CFG_TCP_THRESH_MASK 0x000FFE00 /* # bytes of TCP data 107062306a36Sopenharmony_ci needed to be considered 107162306a36Sopenharmony_ci for reassembly */ 107262306a36Sopenharmony_ci#define HP_CFG_TCP_THRESH_SHIFT 9 107362306a36Sopenharmony_ci 107462306a36Sopenharmony_ci/* access to RX Instruction RAM. 5-bit register/counter holds addr 107562306a36Sopenharmony_ci * of 39 bit entry to be read/written. 32 LSB in _DATA_LOW. 7 MSB in _DATA_HI. 107662306a36Sopenharmony_ci * RX_DMA_EN must be 0 for RX instr PIO access. DATA_HI should be last access 107762306a36Sopenharmony_ci * of sequence. 107862306a36Sopenharmony_ci * DEFAULT: undefined 107962306a36Sopenharmony_ci */ 108062306a36Sopenharmony_ci#define REG_HP_INSTR_RAM_ADDR 0x4144 /* HP instruction RAM 108162306a36Sopenharmony_ci address */ 108262306a36Sopenharmony_ci#define HP_INSTR_RAM_ADDR_MASK 0x01F /* 5-bit mask */ 108362306a36Sopenharmony_ci#define REG_HP_INSTR_RAM_DATA_LOW 0x4148 /* HP instruction RAM 108462306a36Sopenharmony_ci data low */ 108562306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTMASK_MASK 0x0000FFFF 108662306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTMASK_SHIFT 0 108762306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTSHIFT_MASK 0x000F0000 108862306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTSHIFT_SHIFT 16 108962306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTEN_MASK 0x00300000 109062306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTEN_SHIFT 20 109162306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTARG_MASK 0xFFC00000 109262306a36Sopenharmony_ci#define HP_INSTR_RAM_LOW_OUTARG_SHIFT 22 109362306a36Sopenharmony_ci#define REG_HP_INSTR_RAM_DATA_MID 0x414C /* HP instruction RAM 109462306a36Sopenharmony_ci data mid */ 109562306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_OUTARG_MASK 0x00000003 109662306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_OUTARG_SHIFT 0 109762306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_OUTOP_MASK 0x0000003C 109862306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_OUTOP_SHIFT 2 109962306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_FNEXT_MASK 0x000007C0 110062306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_FNEXT_SHIFT 6 110162306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_FOFF_MASK 0x0003F800 110262306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_FOFF_SHIFT 11 110362306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_SNEXT_MASK 0x007C0000 110462306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_SNEXT_SHIFT 18 110562306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_SOFF_MASK 0x3F800000 110662306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_SOFF_SHIFT 23 110762306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_OP_MASK 0xC0000000 110862306a36Sopenharmony_ci#define HP_INSTR_RAM_MID_OP_SHIFT 30 110962306a36Sopenharmony_ci#define REG_HP_INSTR_RAM_DATA_HI 0x4150 /* HP instruction RAM 111062306a36Sopenharmony_ci data high */ 111162306a36Sopenharmony_ci#define HP_INSTR_RAM_HI_VAL_MASK 0x0000FFFF 111262306a36Sopenharmony_ci#define HP_INSTR_RAM_HI_VAL_SHIFT 0 111362306a36Sopenharmony_ci#define HP_INSTR_RAM_HI_MASK_MASK 0xFFFF0000 111462306a36Sopenharmony_ci#define HP_INSTR_RAM_HI_MASK_SHIFT 16 111562306a36Sopenharmony_ci 111662306a36Sopenharmony_ci/* PIO access into RX Header parser data RAM and flow database. 111762306a36Sopenharmony_ci * 11-bit register. Data fills the LSB portion of bus if less than 32 bits. 111862306a36Sopenharmony_ci * DATA_RAM: write RAM_FDB_DATA with index to access DATA_RAM. 111962306a36Sopenharmony_ci * RAM bytes = 4*(x - 1) + [3:0]. e.g., 0 -> [3:0], 31 -> [123:120] 112062306a36Sopenharmony_ci * FLOWDB: write DATA_RAM_FDB register and then read/write FDB1-12 to access 112162306a36Sopenharmony_ci * flow database. 112262306a36Sopenharmony_ci * RX_DMA_EN must be 0 for RX parser RAM PIO access. RX Parser RAM data reg 112362306a36Sopenharmony_ci * should be the last write access of the write sequence. 112462306a36Sopenharmony_ci * DEFAULT: undefined 112562306a36Sopenharmony_ci */ 112662306a36Sopenharmony_ci#define REG_HP_DATA_RAM_FDB_ADDR 0x4154 /* HP data and FDB 112762306a36Sopenharmony_ci RAM address */ 112862306a36Sopenharmony_ci#define HP_DATA_RAM_FDB_DATA_MASK 0x001F /* select 1 of 86 byte 112962306a36Sopenharmony_ci locations in header 113062306a36Sopenharmony_ci parser data ram to 113162306a36Sopenharmony_ci read/write */ 113262306a36Sopenharmony_ci#define HP_DATA_RAM_FDB_FDB_MASK 0x3F00 /* 1 of 64 353-bit locations 113362306a36Sopenharmony_ci in the flow database */ 113462306a36Sopenharmony_ci#define REG_HP_DATA_RAM_DATA 0x4158 /* HP data RAM data */ 113562306a36Sopenharmony_ci 113662306a36Sopenharmony_ci/* HP flow database registers: 1 - 12, 0x415C - 0x4188, 4 8-bit bytes 113762306a36Sopenharmony_ci * FLOW_DB(1) = IP_SA[127:96], FLOW_DB(2) = IP_SA[95:64] 113862306a36Sopenharmony_ci * FLOW_DB(3) = IP_SA[63:32], FLOW_DB(4) = IP_SA[31:0] 113962306a36Sopenharmony_ci * FLOW_DB(5) = IP_DA[127:96], FLOW_DB(6) = IP_DA[95:64] 114062306a36Sopenharmony_ci * FLOW_DB(7) = IP_DA[63:32], FLOW_DB(8) = IP_DA[31:0] 114162306a36Sopenharmony_ci * FLOW_DB(9) = {TCP_SP[15:0],TCP_DP[15:0]} 114262306a36Sopenharmony_ci * FLOW_DB(10) = bit 0 has value for flow valid 114362306a36Sopenharmony_ci * FLOW_DB(11) = TCP_SEQ[63:32], FLOW_DB(12) = TCP_SEQ[31:0] 114462306a36Sopenharmony_ci */ 114562306a36Sopenharmony_ci#define REG_HP_FLOW_DB0 0x415C /* HP flow database 1 reg */ 114662306a36Sopenharmony_ci#define REG_HP_FLOW_DBN(x) (REG_HP_FLOW_DB0 + (x)*4) 114762306a36Sopenharmony_ci 114862306a36Sopenharmony_ci/* diagnostics for RX Header Parser block. 114962306a36Sopenharmony_ci * ASUN: the header parser state machine register is used for diagnostics 115062306a36Sopenharmony_ci * purposes. however, the spec doesn't have any details on it. 115162306a36Sopenharmony_ci */ 115262306a36Sopenharmony_ci#define REG_HP_STATE_MACHINE 0x418C /* (ro) HP state machine */ 115362306a36Sopenharmony_ci#define REG_HP_STATUS0 0x4190 /* (ro) HP status 1 */ 115462306a36Sopenharmony_ci#define HP_STATUS0_SAP_MASK 0xFFFF0000 /* SAP */ 115562306a36Sopenharmony_ci#define HP_STATUS0_L3_OFF_MASK 0x0000FE00 /* L3 offset */ 115662306a36Sopenharmony_ci#define HP_STATUS0_LB_CPUNUM_MASK 0x000001F8 /* load balancing CPU 115762306a36Sopenharmony_ci number */ 115862306a36Sopenharmony_ci#define HP_STATUS0_HRP_OPCODE_MASK 0x00000007 /* HRP opcode */ 115962306a36Sopenharmony_ci 116062306a36Sopenharmony_ci#define REG_HP_STATUS1 0x4194 /* (ro) HP status 2 */ 116162306a36Sopenharmony_ci#define HP_STATUS1_ACCUR2_MASK 0xE0000000 /* accu R2[6:4] */ 116262306a36Sopenharmony_ci#define HP_STATUS1_FLOWID_MASK 0x1F800000 /* flow id */ 116362306a36Sopenharmony_ci#define HP_STATUS1_TCP_OFF_MASK 0x007F0000 /* tcp payload offset */ 116462306a36Sopenharmony_ci#define HP_STATUS1_TCP_SIZE_MASK 0x0000FFFF /* tcp payload size */ 116562306a36Sopenharmony_ci 116662306a36Sopenharmony_ci#define REG_HP_STATUS2 0x4198 /* (ro) HP status 3 */ 116762306a36Sopenharmony_ci#define HP_STATUS2_ACCUR2_MASK 0xF0000000 /* accu R2[3:0] */ 116862306a36Sopenharmony_ci#define HP_STATUS2_CSUM_OFF_MASK 0x07F00000 /* checksum start 116962306a36Sopenharmony_ci start offset */ 117062306a36Sopenharmony_ci#define HP_STATUS2_ACCUR1_MASK 0x000FE000 /* accu R1 */ 117162306a36Sopenharmony_ci#define HP_STATUS2_FORCE_DROP 0x00001000 /* force drop */ 117262306a36Sopenharmony_ci#define HP_STATUS2_BWO_REASSM 0x00000800 /* batching w/o 117362306a36Sopenharmony_ci reassembly */ 117462306a36Sopenharmony_ci#define HP_STATUS2_JH_SPLIT_EN 0x00000400 /* jumbo header split 117562306a36Sopenharmony_ci enable */ 117662306a36Sopenharmony_ci#define HP_STATUS2_FORCE_TCP_NOCHECK 0x00000200 /* force tcp no payload 117762306a36Sopenharmony_ci check */ 117862306a36Sopenharmony_ci#define HP_STATUS2_DATA_MASK_ZERO 0x00000100 /* mask of data length 117962306a36Sopenharmony_ci equal to zero */ 118062306a36Sopenharmony_ci#define HP_STATUS2_FORCE_TCP_CHECK 0x00000080 /* force tcp payload 118162306a36Sopenharmony_ci chk */ 118262306a36Sopenharmony_ci#define HP_STATUS2_MASK_TCP_THRESH 0x00000040 /* mask of payload 118362306a36Sopenharmony_ci threshold */ 118462306a36Sopenharmony_ci#define HP_STATUS2_NO_ASSIST 0x00000020 /* no assist */ 118562306a36Sopenharmony_ci#define HP_STATUS2_CTRL_PACKET_FLAG 0x00000010 /* control packet flag */ 118662306a36Sopenharmony_ci#define HP_STATUS2_TCP_FLAG_CHECK 0x00000008 /* tcp flag check */ 118762306a36Sopenharmony_ci#define HP_STATUS2_SYN_FLAG 0x00000004 /* syn flag */ 118862306a36Sopenharmony_ci#define HP_STATUS2_TCP_CHECK 0x00000002 /* tcp payload chk */ 118962306a36Sopenharmony_ci#define HP_STATUS2_TCP_NOCHECK 0x00000001 /* tcp no payload chk */ 119062306a36Sopenharmony_ci 119162306a36Sopenharmony_ci/* BIST for header parser(HP) and flow database memories (FDBM). set _START 119262306a36Sopenharmony_ci * to start BIST. controller clears _START on completion. _START can also 119362306a36Sopenharmony_ci * be cleared to force termination of BIST. a bit set indicates that that 119462306a36Sopenharmony_ci * memory passed its BIST. 119562306a36Sopenharmony_ci */ 119662306a36Sopenharmony_ci#define REG_HP_RAM_BIST 0x419C /* HP RAM BIST reg */ 119762306a36Sopenharmony_ci#define HP_RAM_BIST_HP_DATA_PASS 0x80000000 /* HP data ram */ 119862306a36Sopenharmony_ci#define HP_RAM_BIST_HP_INSTR0_PASS 0x40000000 /* HP instr ram 0 */ 119962306a36Sopenharmony_ci#define HP_RAM_BIST_HP_INSTR1_PASS 0x20000000 /* HP instr ram 1 */ 120062306a36Sopenharmony_ci#define HP_RAM_BIST_HP_INSTR2_PASS 0x10000000 /* HP instr ram 2 */ 120162306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_AGE0_PASS 0x08000000 /* FDBM aging RAM0 */ 120262306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_AGE1_PASS 0x04000000 /* FDBM aging RAM1 */ 120362306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID00_PASS 0x02000000 /* FDBM flowid RAM0 120462306a36Sopenharmony_ci bank 0 */ 120562306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID10_PASS 0x01000000 /* FDBM flowid RAM1 120662306a36Sopenharmony_ci bank 0 */ 120762306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID20_PASS 0x00800000 /* FDBM flowid RAM2 120862306a36Sopenharmony_ci bank 0 */ 120962306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID30_PASS 0x00400000 /* FDBM flowid RAM3 121062306a36Sopenharmony_ci bank 0 */ 121162306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID01_PASS 0x00200000 /* FDBM flowid RAM0 121262306a36Sopenharmony_ci bank 1 */ 121362306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID11_PASS 0x00100000 /* FDBM flowid RAM1 121462306a36Sopenharmony_ci bank 2 */ 121562306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID21_PASS 0x00080000 /* FDBM flowid RAM2 121662306a36Sopenharmony_ci bank 1 */ 121762306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_FLOWID31_PASS 0x00040000 /* FDBM flowid RAM3 121862306a36Sopenharmony_ci bank 1 */ 121962306a36Sopenharmony_ci#define HP_RAM_BIST_FDBM_TCPSEQ_PASS 0x00020000 /* FDBM tcp sequence 122062306a36Sopenharmony_ci RAM */ 122162306a36Sopenharmony_ci#define HP_RAM_BIST_SUMMARY 0x00000002 /* all BIST tests */ 122262306a36Sopenharmony_ci#define HP_RAM_BIST_START 0x00000001 /* start/stop BIST */ 122362306a36Sopenharmony_ci 122462306a36Sopenharmony_ci 122562306a36Sopenharmony_ci/** MAC registers. **/ 122662306a36Sopenharmony_ci/* reset bits are set using a PIO write and self-cleared after the command 122762306a36Sopenharmony_ci * execution has completed. 122862306a36Sopenharmony_ci */ 122962306a36Sopenharmony_ci#define REG_MAC_TX_RESET 0x6000 /* TX MAC software reset 123062306a36Sopenharmony_ci command (default: 0x0) */ 123162306a36Sopenharmony_ci#define REG_MAC_RX_RESET 0x6004 /* RX MAC software reset 123262306a36Sopenharmony_ci command (default: 0x0) */ 123362306a36Sopenharmony_ci/* execute a pause flow control frame transmission 123462306a36Sopenharmony_ci DEFAULT: 0x0XXXX */ 123562306a36Sopenharmony_ci#define REG_MAC_SEND_PAUSE 0x6008 /* send pause command reg */ 123662306a36Sopenharmony_ci#define MAC_SEND_PAUSE_TIME_MASK 0x0000FFFF /* value of pause time 123762306a36Sopenharmony_ci to be sent on network 123862306a36Sopenharmony_ci in units of slot 123962306a36Sopenharmony_ci times */ 124062306a36Sopenharmony_ci#define MAC_SEND_PAUSE_SEND 0x00010000 /* send pause flow ctrl 124162306a36Sopenharmony_ci frame on network */ 124262306a36Sopenharmony_ci 124362306a36Sopenharmony_ci/* bit set indicates that event occurred. auto-cleared when status register 124462306a36Sopenharmony_ci * is read and have corresponding mask bits in mask register. events will 124562306a36Sopenharmony_ci * trigger an interrupt if the corresponding mask bit is 0. 124662306a36Sopenharmony_ci * status register default: 0x00000000 124762306a36Sopenharmony_ci * mask register default = 0xFFFFFFFF on reset 124862306a36Sopenharmony_ci */ 124962306a36Sopenharmony_ci#define REG_MAC_TX_STATUS 0x6010 /* TX MAC status reg */ 125062306a36Sopenharmony_ci#define MAC_TX_FRAME_XMIT 0x0001 /* successful frame 125162306a36Sopenharmony_ci transmision */ 125262306a36Sopenharmony_ci#define MAC_TX_UNDERRUN 0x0002 /* terminated frame 125362306a36Sopenharmony_ci transmission due to 125462306a36Sopenharmony_ci data starvation in the 125562306a36Sopenharmony_ci xmit data path */ 125662306a36Sopenharmony_ci#define MAC_TX_MAX_PACKET_ERR 0x0004 /* frame exceeds max allowed 125762306a36Sopenharmony_ci length passed to TX MAC 125862306a36Sopenharmony_ci by the DMA engine */ 125962306a36Sopenharmony_ci#define MAC_TX_COLL_NORMAL 0x0008 /* rollover of the normal 126062306a36Sopenharmony_ci collision counter */ 126162306a36Sopenharmony_ci#define MAC_TX_COLL_EXCESS 0x0010 /* rollover of the excessive 126262306a36Sopenharmony_ci collision counter */ 126362306a36Sopenharmony_ci#define MAC_TX_COLL_LATE 0x0020 /* rollover of the late 126462306a36Sopenharmony_ci collision counter */ 126562306a36Sopenharmony_ci#define MAC_TX_COLL_FIRST 0x0040 /* rollover of the first 126662306a36Sopenharmony_ci collision counter */ 126762306a36Sopenharmony_ci#define MAC_TX_DEFER_TIMER 0x0080 /* rollover of the defer 126862306a36Sopenharmony_ci timer */ 126962306a36Sopenharmony_ci#define MAC_TX_PEAK_ATTEMPTS 0x0100 /* rollover of the peak 127062306a36Sopenharmony_ci attempts counter */ 127162306a36Sopenharmony_ci 127262306a36Sopenharmony_ci#define REG_MAC_RX_STATUS 0x6014 /* RX MAC status reg */ 127362306a36Sopenharmony_ci#define MAC_RX_FRAME_RECV 0x0001 /* successful receipt of 127462306a36Sopenharmony_ci a frame */ 127562306a36Sopenharmony_ci#define MAC_RX_OVERFLOW 0x0002 /* dropped frame due to 127662306a36Sopenharmony_ci RX FIFO overflow */ 127762306a36Sopenharmony_ci#define MAC_RX_FRAME_COUNT 0x0004 /* rollover of receive frame 127862306a36Sopenharmony_ci counter */ 127962306a36Sopenharmony_ci#define MAC_RX_ALIGN_ERR 0x0008 /* rollover of alignment 128062306a36Sopenharmony_ci error counter */ 128162306a36Sopenharmony_ci#define MAC_RX_CRC_ERR 0x0010 /* rollover of crc error 128262306a36Sopenharmony_ci counter */ 128362306a36Sopenharmony_ci#define MAC_RX_LEN_ERR 0x0020 /* rollover of length 128462306a36Sopenharmony_ci error counter */ 128562306a36Sopenharmony_ci#define MAC_RX_VIOL_ERR 0x0040 /* rollover of code 128662306a36Sopenharmony_ci violation error */ 128762306a36Sopenharmony_ci 128862306a36Sopenharmony_ci/* DEFAULT: 0xXXXX0000 on reset */ 128962306a36Sopenharmony_ci#define REG_MAC_CTRL_STATUS 0x6018 /* MAC control status reg */ 129062306a36Sopenharmony_ci#define MAC_CTRL_PAUSE_RECEIVED 0x00000001 /* successful 129162306a36Sopenharmony_ci reception of a 129262306a36Sopenharmony_ci pause control 129362306a36Sopenharmony_ci frame */ 129462306a36Sopenharmony_ci#define MAC_CTRL_PAUSE_STATE 0x00000002 /* MAC has made a 129562306a36Sopenharmony_ci transition from 129662306a36Sopenharmony_ci "not paused" to 129762306a36Sopenharmony_ci "paused" */ 129862306a36Sopenharmony_ci#define MAC_CTRL_NOPAUSE_STATE 0x00000004 /* MAC has made a 129962306a36Sopenharmony_ci transition from 130062306a36Sopenharmony_ci "paused" to "not 130162306a36Sopenharmony_ci paused" */ 130262306a36Sopenharmony_ci#define MAC_CTRL_PAUSE_TIME_MASK 0xFFFF0000 /* value of pause time 130362306a36Sopenharmony_ci operand that was 130462306a36Sopenharmony_ci received in the last 130562306a36Sopenharmony_ci pause flow control 130662306a36Sopenharmony_ci frame */ 130762306a36Sopenharmony_ci 130862306a36Sopenharmony_ci/* layout identical to TX MAC[8:0] */ 130962306a36Sopenharmony_ci#define REG_MAC_TX_MASK 0x6020 /* TX MAC mask reg */ 131062306a36Sopenharmony_ci/* layout identical to RX MAC[6:0] */ 131162306a36Sopenharmony_ci#define REG_MAC_RX_MASK 0x6024 /* RX MAC mask reg */ 131262306a36Sopenharmony_ci/* layout identical to CTRL MAC[2:0] */ 131362306a36Sopenharmony_ci#define REG_MAC_CTRL_MASK 0x6028 /* MAC control mask reg */ 131462306a36Sopenharmony_ci 131562306a36Sopenharmony_ci/* to ensure proper operation, CFG_EN must be cleared to 0 and a delay 131662306a36Sopenharmony_ci * imposed before writes to other bits in the TX_MAC_CFG register or any of 131762306a36Sopenharmony_ci * the MAC parameters is performed. delay dependent upon time required to 131862306a36Sopenharmony_ci * transmit a maximum size frame (= MAC_FRAMESIZE_MAX*8/Mbps). e.g., 131962306a36Sopenharmony_ci * the delay for a 1518-byte frame on a 100Mbps network is 125us. 132062306a36Sopenharmony_ci * alternatively, just poll TX_CFG_EN until it reads back as 0. 132162306a36Sopenharmony_ci * NOTE: on half-duplex 1Gbps, TX_CFG_CARRIER_EXTEND and 132262306a36Sopenharmony_ci * RX_CFG_CARRIER_EXTEND should be set and the SLOT_TIME register should 132362306a36Sopenharmony_ci * be 0x200 (slot time of 512 bytes) 132462306a36Sopenharmony_ci */ 132562306a36Sopenharmony_ci#define REG_MAC_TX_CFG 0x6030 /* TX MAC config reg */ 132662306a36Sopenharmony_ci#define MAC_TX_CFG_EN 0x0001 /* enable TX MAC. 0 will 132762306a36Sopenharmony_ci force TXMAC state 132862306a36Sopenharmony_ci machine to remain in 132962306a36Sopenharmony_ci idle state or to 133062306a36Sopenharmony_ci transition to idle state 133162306a36Sopenharmony_ci on completion of an 133262306a36Sopenharmony_ci ongoing packet. */ 133362306a36Sopenharmony_ci#define MAC_TX_CFG_IGNORE_CARRIER 0x0002 /* disable CSMA/CD deferral 133462306a36Sopenharmony_ci process. set to 1 when 133562306a36Sopenharmony_ci full duplex and 0 when 133662306a36Sopenharmony_ci half duplex */ 133762306a36Sopenharmony_ci#define MAC_TX_CFG_IGNORE_COLL 0x0004 /* disable CSMA/CD backoff 133862306a36Sopenharmony_ci algorithm. set to 1 when 133962306a36Sopenharmony_ci full duplex and 0 when 134062306a36Sopenharmony_ci half duplex */ 134162306a36Sopenharmony_ci#define MAC_TX_CFG_IPG_EN 0x0008 /* enable extension of the 134262306a36Sopenharmony_ci Rx-to-TX IPG. after 134362306a36Sopenharmony_ci receiving a frame, TX 134462306a36Sopenharmony_ci MAC will reset its 134562306a36Sopenharmony_ci deferral process to 134662306a36Sopenharmony_ci carrier sense for the 134762306a36Sopenharmony_ci amount of time = IPG0 + 134862306a36Sopenharmony_ci IPG1 and commit to 134962306a36Sopenharmony_ci transmission for time 135062306a36Sopenharmony_ci specified in IPG2. when 135162306a36Sopenharmony_ci 0 or when xmitting frames 135262306a36Sopenharmony_ci back-to-pack (Tx-to-Tx 135362306a36Sopenharmony_ci IPG), TX MAC ignores 135462306a36Sopenharmony_ci IPG0 and will only use 135562306a36Sopenharmony_ci IPG1 for deferral time. 135662306a36Sopenharmony_ci IPG2 still used. */ 135762306a36Sopenharmony_ci#define MAC_TX_CFG_NEVER_GIVE_UP_EN 0x0010 /* TX MAC will not easily 135862306a36Sopenharmony_ci give up on frame 135962306a36Sopenharmony_ci xmission. if backoff 136062306a36Sopenharmony_ci algorithm reaches the 136162306a36Sopenharmony_ci ATTEMPT_LIMIT, it will 136262306a36Sopenharmony_ci clear attempts counter 136362306a36Sopenharmony_ci and continue trying to 136462306a36Sopenharmony_ci send the frame as 136562306a36Sopenharmony_ci specified by 136662306a36Sopenharmony_ci GIVE_UP_LIM. when 0, 136762306a36Sopenharmony_ci TX MAC will execute 136862306a36Sopenharmony_ci standard CSMA/CD prot. */ 136962306a36Sopenharmony_ci#define MAC_TX_CFG_NEVER_GIVE_UP_LIM 0x0020 /* when set, TX MAC will 137062306a36Sopenharmony_ci continue to try to xmit 137162306a36Sopenharmony_ci until successful. when 137262306a36Sopenharmony_ci 0, TX MAC will continue 137362306a36Sopenharmony_ci to try xmitting until 137462306a36Sopenharmony_ci successful or backoff 137562306a36Sopenharmony_ci algorithm reaches 137662306a36Sopenharmony_ci ATTEMPT_LIMIT*16 */ 137762306a36Sopenharmony_ci#define MAC_TX_CFG_NO_BACKOFF 0x0040 /* modify CSMA/CD to disable 137862306a36Sopenharmony_ci backoff algorithm. TX 137962306a36Sopenharmony_ci MAC will not back off 138062306a36Sopenharmony_ci after a xmission attempt 138162306a36Sopenharmony_ci that resulted in a 138262306a36Sopenharmony_ci collision. */ 138362306a36Sopenharmony_ci#define MAC_TX_CFG_SLOW_DOWN 0x0080 /* modify CSMA/CD so that 138462306a36Sopenharmony_ci deferral process is reset 138562306a36Sopenharmony_ci in response to carrier 138662306a36Sopenharmony_ci sense during the entire 138762306a36Sopenharmony_ci duration of IPG. TX MAC 138862306a36Sopenharmony_ci will only commit to frame 138962306a36Sopenharmony_ci xmission after frame 139062306a36Sopenharmony_ci xmission has actually 139162306a36Sopenharmony_ci begun. */ 139262306a36Sopenharmony_ci#define MAC_TX_CFG_NO_FCS 0x0100 /* TX MAC will not generate 139362306a36Sopenharmony_ci CRC for all xmitted 139462306a36Sopenharmony_ci packets. when clear, CRC 139562306a36Sopenharmony_ci generation is dependent 139662306a36Sopenharmony_ci upon NO_CRC bit in the 139762306a36Sopenharmony_ci xmit control word from 139862306a36Sopenharmony_ci TX DMA */ 139962306a36Sopenharmony_ci#define MAC_TX_CFG_CARRIER_EXTEND 0x0200 /* enables xmit part of the 140062306a36Sopenharmony_ci carrier extension 140162306a36Sopenharmony_ci feature. this allows for 140262306a36Sopenharmony_ci longer collision domains 140362306a36Sopenharmony_ci by extending the carrier 140462306a36Sopenharmony_ci and collision window 140562306a36Sopenharmony_ci from the end of FCS until 140662306a36Sopenharmony_ci the end of the slot time 140762306a36Sopenharmony_ci if necessary. Required 140862306a36Sopenharmony_ci for half-duplex at 1Gbps, 140962306a36Sopenharmony_ci clear otherwise. */ 141062306a36Sopenharmony_ci 141162306a36Sopenharmony_ci/* when CRC is not stripped, reassembly packets will not contain the CRC. 141262306a36Sopenharmony_ci * these will be stripped by HRP because it reassembles layer 4 data, and the 141362306a36Sopenharmony_ci * CRC is layer 2. however, non-reassembly packets will still contain the CRC 141462306a36Sopenharmony_ci * when passed to the host. to ensure proper operation, need to wait 3.2ms 141562306a36Sopenharmony_ci * after clearing RX_CFG_EN before writing to any other RX MAC registers 141662306a36Sopenharmony_ci * or other MAC parameters. alternatively, poll RX_CFG_EN until it clears 141762306a36Sopenharmony_ci * to 0. similary, HASH_FILTER_EN and ADDR_FILTER_EN have the same 141862306a36Sopenharmony_ci * restrictions as CFG_EN. 141962306a36Sopenharmony_ci */ 142062306a36Sopenharmony_ci#define REG_MAC_RX_CFG 0x6034 /* RX MAC config reg */ 142162306a36Sopenharmony_ci#define MAC_RX_CFG_EN 0x0001 /* enable RX MAC */ 142262306a36Sopenharmony_ci#define MAC_RX_CFG_STRIP_PAD 0x0002 /* always program to 0. 142362306a36Sopenharmony_ci feature not supported */ 142462306a36Sopenharmony_ci#define MAC_RX_CFG_STRIP_FCS 0x0004 /* RX MAC will strip the 142562306a36Sopenharmony_ci last 4 bytes of a 142662306a36Sopenharmony_ci received frame. */ 142762306a36Sopenharmony_ci#define MAC_RX_CFG_PROMISC_EN 0x0008 /* promiscuous mode */ 142862306a36Sopenharmony_ci#define MAC_RX_CFG_PROMISC_GROUP_EN 0x0010 /* accept all valid 142962306a36Sopenharmony_ci multicast frames (group 143062306a36Sopenharmony_ci bit in DA field set) */ 143162306a36Sopenharmony_ci#define MAC_RX_CFG_HASH_FILTER_EN 0x0020 /* use hash table to filter 143262306a36Sopenharmony_ci multicast addresses */ 143362306a36Sopenharmony_ci#define MAC_RX_CFG_ADDR_FILTER_EN 0x0040 /* cause RX MAC to use 143462306a36Sopenharmony_ci address filtering regs 143562306a36Sopenharmony_ci to filter both unicast 143662306a36Sopenharmony_ci and multicast 143762306a36Sopenharmony_ci addresses */ 143862306a36Sopenharmony_ci#define MAC_RX_CFG_DISABLE_DISCARD 0x0080 /* pass errored frames to 143962306a36Sopenharmony_ci RX DMA by setting BAD 144062306a36Sopenharmony_ci bit but not Abort bit 144162306a36Sopenharmony_ci in the status. CRC, 144262306a36Sopenharmony_ci framing, and length errs 144362306a36Sopenharmony_ci will not increment 144462306a36Sopenharmony_ci error counters. frames 144562306a36Sopenharmony_ci which don't match dest 144662306a36Sopenharmony_ci addr will be passed up 144762306a36Sopenharmony_ci w/ BAD bit set. */ 144862306a36Sopenharmony_ci#define MAC_RX_CFG_CARRIER_EXTEND 0x0100 /* enable reception of 144962306a36Sopenharmony_ci packet bursts generated 145062306a36Sopenharmony_ci by carrier extension 145162306a36Sopenharmony_ci with packet bursting 145262306a36Sopenharmony_ci senders. only applies 145362306a36Sopenharmony_ci to half-duplex 1Gbps */ 145462306a36Sopenharmony_ci 145562306a36Sopenharmony_ci/* DEFAULT: 0x0 */ 145662306a36Sopenharmony_ci#define REG_MAC_CTRL_CFG 0x6038 /* MAC control config reg */ 145762306a36Sopenharmony_ci#define MAC_CTRL_CFG_SEND_PAUSE_EN 0x0001 /* respond to requests for 145862306a36Sopenharmony_ci sending pause flow ctrl 145962306a36Sopenharmony_ci frames */ 146062306a36Sopenharmony_ci#define MAC_CTRL_CFG_RECV_PAUSE_EN 0x0002 /* respond to received 146162306a36Sopenharmony_ci pause flow ctrl frames */ 146262306a36Sopenharmony_ci#define MAC_CTRL_CFG_PASS_CTRL 0x0004 /* pass valid MAC ctrl 146362306a36Sopenharmony_ci packets to RX DMA */ 146462306a36Sopenharmony_ci 146562306a36Sopenharmony_ci/* to ensure proper operation, a global initialization sequence should be 146662306a36Sopenharmony_ci * performed when a loopback config is entered or exited. if programmed after 146762306a36Sopenharmony_ci * a hw or global sw reset, RX/TX MAC software reset and initialization 146862306a36Sopenharmony_ci * should be done to ensure stable clocking. 146962306a36Sopenharmony_ci * DEFAULT: 0x0 147062306a36Sopenharmony_ci */ 147162306a36Sopenharmony_ci#define REG_MAC_XIF_CFG 0x603C /* XIF config reg */ 147262306a36Sopenharmony_ci#define MAC_XIF_TX_MII_OUTPUT_EN 0x0001 /* enable output drivers 147362306a36Sopenharmony_ci on MII xmit bus */ 147462306a36Sopenharmony_ci#define MAC_XIF_MII_INT_LOOPBACK 0x0002 /* loopback GMII xmit data 147562306a36Sopenharmony_ci path to GMII recv data 147662306a36Sopenharmony_ci path. phy mode register 147762306a36Sopenharmony_ci clock selection must be 147862306a36Sopenharmony_ci set to GMII mode and 147962306a36Sopenharmony_ci GMII_MODE should be set 148062306a36Sopenharmony_ci to 1. in loopback mode, 148162306a36Sopenharmony_ci REFCLK will drive the 148262306a36Sopenharmony_ci entire mac core. 0 for 148362306a36Sopenharmony_ci normal operation. */ 148462306a36Sopenharmony_ci#define MAC_XIF_DISABLE_ECHO 0x0004 /* disables receive data 148562306a36Sopenharmony_ci path during packet 148662306a36Sopenharmony_ci xmission. clear to 0 148762306a36Sopenharmony_ci in any full duplex mode, 148862306a36Sopenharmony_ci in any loopback mode, 148962306a36Sopenharmony_ci or in half-duplex SERDES 149062306a36Sopenharmony_ci or SLINK modes. set when 149162306a36Sopenharmony_ci in half-duplex when 149262306a36Sopenharmony_ci using external phy. */ 149362306a36Sopenharmony_ci#define MAC_XIF_GMII_MODE 0x0008 /* MAC operates with GMII 149462306a36Sopenharmony_ci clocks and datapath */ 149562306a36Sopenharmony_ci#define MAC_XIF_MII_BUFFER_OUTPUT_EN 0x0010 /* MII_BUF_EN pin. enable 149662306a36Sopenharmony_ci external tristate buffer 149762306a36Sopenharmony_ci on the MII receive 149862306a36Sopenharmony_ci bus. */ 149962306a36Sopenharmony_ci#define MAC_XIF_LINK_LED 0x0020 /* LINKLED# active (low) */ 150062306a36Sopenharmony_ci#define MAC_XIF_FDPLX_LED 0x0040 /* FDPLXLED# active (low) */ 150162306a36Sopenharmony_ci 150262306a36Sopenharmony_ci#define REG_MAC_IPG0 0x6040 /* inter-packet gap0 reg. 150362306a36Sopenharmony_ci recommended: 0x00 */ 150462306a36Sopenharmony_ci#define REG_MAC_IPG1 0x6044 /* inter-packet gap1 reg 150562306a36Sopenharmony_ci recommended: 0x08 */ 150662306a36Sopenharmony_ci#define REG_MAC_IPG2 0x6048 /* inter-packet gap2 reg 150762306a36Sopenharmony_ci recommended: 0x04 */ 150862306a36Sopenharmony_ci#define REG_MAC_SLOT_TIME 0x604C /* slot time reg 150962306a36Sopenharmony_ci recommended: 0x40 */ 151062306a36Sopenharmony_ci#define REG_MAC_FRAMESIZE_MIN 0x6050 /* min frame size reg 151162306a36Sopenharmony_ci recommended: 0x40 */ 151262306a36Sopenharmony_ci 151362306a36Sopenharmony_ci/* FRAMESIZE_MAX holds both the max frame size as well as the max burst size. 151462306a36Sopenharmony_ci * recommended value: 0x2000.05EE 151562306a36Sopenharmony_ci */ 151662306a36Sopenharmony_ci#define REG_MAC_FRAMESIZE_MAX 0x6054 /* max frame size reg */ 151762306a36Sopenharmony_ci#define MAC_FRAMESIZE_MAX_BURST_MASK 0x3FFF0000 /* max burst size */ 151862306a36Sopenharmony_ci#define MAC_FRAMESIZE_MAX_BURST_SHIFT 16 151962306a36Sopenharmony_ci#define MAC_FRAMESIZE_MAX_FRAME_MASK 0x00007FFF /* max frame size */ 152062306a36Sopenharmony_ci#define MAC_FRAMESIZE_MAX_FRAME_SHIFT 0 152162306a36Sopenharmony_ci#define REG_MAC_PA_SIZE 0x6058 /* PA size reg. number of 152262306a36Sopenharmony_ci preamble bytes that the 152362306a36Sopenharmony_ci TX MAC will xmit at the 152462306a36Sopenharmony_ci beginning of each frame 152562306a36Sopenharmony_ci value should be 2 or 152662306a36Sopenharmony_ci greater. recommended 152762306a36Sopenharmony_ci value: 0x07 */ 152862306a36Sopenharmony_ci#define REG_MAC_JAM_SIZE 0x605C /* jam size reg. duration 152962306a36Sopenharmony_ci of jam in units of media 153062306a36Sopenharmony_ci byte time. recommended 153162306a36Sopenharmony_ci value: 0x04 */ 153262306a36Sopenharmony_ci#define REG_MAC_ATTEMPT_LIMIT 0x6060 /* attempt limit reg. # 153362306a36Sopenharmony_ci of attempts TX MAC will 153462306a36Sopenharmony_ci make to xmit a frame 153562306a36Sopenharmony_ci before it resets its 153662306a36Sopenharmony_ci attempts counter. after 153762306a36Sopenharmony_ci the limit has been 153862306a36Sopenharmony_ci reached, TX MAC may or 153962306a36Sopenharmony_ci may not drop the frame 154062306a36Sopenharmony_ci dependent upon value 154162306a36Sopenharmony_ci in TX_MAC_CFG. 154262306a36Sopenharmony_ci recommended 154362306a36Sopenharmony_ci value: 0x10 */ 154462306a36Sopenharmony_ci#define REG_MAC_CTRL_TYPE 0x6064 /* MAC control type reg. 154562306a36Sopenharmony_ci type field of a MAC 154662306a36Sopenharmony_ci ctrl frame. recommended 154762306a36Sopenharmony_ci value: 0x8808 */ 154862306a36Sopenharmony_ci 154962306a36Sopenharmony_ci/* mac address registers: 0 - 44, 0x6080 - 0x6130, 4 8-bit bytes. 155062306a36Sopenharmony_ci * register contains comparison 155162306a36Sopenharmony_ci * 0 16 MSB of primary MAC addr [47:32] of DA field 155262306a36Sopenharmony_ci * 1 16 middle bits "" [31:16] of DA field 155362306a36Sopenharmony_ci * 2 16 LSB "" [15:0] of DA field 155462306a36Sopenharmony_ci * 3*x 16MSB of alt MAC addr 1-15 [47:32] of DA field 155562306a36Sopenharmony_ci * 4*x 16 middle bits "" [31:16] 155662306a36Sopenharmony_ci * 5*x 16 LSB "" [15:0] 155762306a36Sopenharmony_ci * 42 16 MSB of MAC CTRL addr [47:32] of DA. 155862306a36Sopenharmony_ci * 43 16 middle bits "" [31:16] 155962306a36Sopenharmony_ci * 44 16 LSB "" [15:0] 156062306a36Sopenharmony_ci * MAC CTRL addr must be the reserved multicast addr for MAC CTRL frames. 156162306a36Sopenharmony_ci * if there is a match, MAC will set the bit for alternative address 156262306a36Sopenharmony_ci * filter pass [15] 156362306a36Sopenharmony_ci 156462306a36Sopenharmony_ci * here is the map of registers given MAC address notation: a:b:c:d:e:f 156562306a36Sopenharmony_ci * ab cd ef 156662306a36Sopenharmony_ci * primary addr reg 2 reg 1 reg 0 156762306a36Sopenharmony_ci * alt addr 1 reg 5 reg 4 reg 3 156862306a36Sopenharmony_ci * alt addr x reg 5*x reg 4*x reg 3*x 156962306a36Sopenharmony_ci * ctrl addr reg 44 reg 43 reg 42 157062306a36Sopenharmony_ci */ 157162306a36Sopenharmony_ci#define REG_MAC_ADDR0 0x6080 /* MAC address 0 reg */ 157262306a36Sopenharmony_ci#define REG_MAC_ADDRN(x) (REG_MAC_ADDR0 + (x)*4) 157362306a36Sopenharmony_ci#define REG_MAC_ADDR_FILTER0 0x614C /* address filter 0 reg 157462306a36Sopenharmony_ci [47:32] */ 157562306a36Sopenharmony_ci#define REG_MAC_ADDR_FILTER1 0x6150 /* address filter 1 reg 157662306a36Sopenharmony_ci [31:16] */ 157762306a36Sopenharmony_ci#define REG_MAC_ADDR_FILTER2 0x6154 /* address filter 2 reg 157862306a36Sopenharmony_ci [15:0] */ 157962306a36Sopenharmony_ci#define REG_MAC_ADDR_FILTER2_1_MASK 0x6158 /* address filter 2 and 1 158062306a36Sopenharmony_ci mask reg. 8-bit reg 158162306a36Sopenharmony_ci contains nibble mask for 158262306a36Sopenharmony_ci reg 2 and 1. */ 158362306a36Sopenharmony_ci#define REG_MAC_ADDR_FILTER0_MASK 0x615C /* address filter 0 mask 158462306a36Sopenharmony_ci reg */ 158562306a36Sopenharmony_ci 158662306a36Sopenharmony_ci/* hash table registers: 0 - 15, 0x6160 - 0x619C, 4 8-bit bytes 158762306a36Sopenharmony_ci * 16-bit registers contain bits of the hash table. 158862306a36Sopenharmony_ci * reg x -> [16*(15 - x) + 15 : 16*(15 - x)]. 158962306a36Sopenharmony_ci * e.g., 15 -> [15:0], 0 -> [255:240] 159062306a36Sopenharmony_ci */ 159162306a36Sopenharmony_ci#define REG_MAC_HASH_TABLE0 0x6160 /* hash table 0 reg */ 159262306a36Sopenharmony_ci#define REG_MAC_HASH_TABLEN(x) (REG_MAC_HASH_TABLE0 + (x)*4) 159362306a36Sopenharmony_ci 159462306a36Sopenharmony_ci/* statistics registers. these registers generate an interrupt on 159562306a36Sopenharmony_ci * overflow. recommended initialization: 0x0000. most are 16-bits except 159662306a36Sopenharmony_ci * for PEAK_ATTEMPTS register which is 8 bits. 159762306a36Sopenharmony_ci */ 159862306a36Sopenharmony_ci#define REG_MAC_COLL_NORMAL 0x61A0 /* normal collision 159962306a36Sopenharmony_ci counter. */ 160062306a36Sopenharmony_ci#define REG_MAC_COLL_FIRST 0x61A4 /* first attempt 160162306a36Sopenharmony_ci successful collision 160262306a36Sopenharmony_ci counter */ 160362306a36Sopenharmony_ci#define REG_MAC_COLL_EXCESS 0x61A8 /* excessive collision 160462306a36Sopenharmony_ci counter */ 160562306a36Sopenharmony_ci#define REG_MAC_COLL_LATE 0x61AC /* late collision counter */ 160662306a36Sopenharmony_ci#define REG_MAC_TIMER_DEFER 0x61B0 /* defer timer. time base 160762306a36Sopenharmony_ci is the media byte 160862306a36Sopenharmony_ci clock/256 */ 160962306a36Sopenharmony_ci#define REG_MAC_ATTEMPTS_PEAK 0x61B4 /* peak attempts reg */ 161062306a36Sopenharmony_ci#define REG_MAC_RECV_FRAME 0x61B8 /* receive frame counter */ 161162306a36Sopenharmony_ci#define REG_MAC_LEN_ERR 0x61BC /* length error counter */ 161262306a36Sopenharmony_ci#define REG_MAC_ALIGN_ERR 0x61C0 /* alignment error counter */ 161362306a36Sopenharmony_ci#define REG_MAC_FCS_ERR 0x61C4 /* FCS error counter */ 161462306a36Sopenharmony_ci#define REG_MAC_RX_CODE_ERR 0x61C8 /* RX code violation 161562306a36Sopenharmony_ci error counter */ 161662306a36Sopenharmony_ci 161762306a36Sopenharmony_ci/* misc registers */ 161862306a36Sopenharmony_ci#define REG_MAC_RANDOM_SEED 0x61CC /* random number seed reg. 161962306a36Sopenharmony_ci 10-bit register used as a 162062306a36Sopenharmony_ci seed for the random number 162162306a36Sopenharmony_ci generator for the CSMA/CD 162262306a36Sopenharmony_ci backoff algorithm. only 162362306a36Sopenharmony_ci programmed after power-on 162462306a36Sopenharmony_ci reset and should be a 162562306a36Sopenharmony_ci random value which has a 162662306a36Sopenharmony_ci high likelihood of being 162762306a36Sopenharmony_ci unique for each MAC 162862306a36Sopenharmony_ci attached to a network 162962306a36Sopenharmony_ci segment (e.g., 10 LSB of 163062306a36Sopenharmony_ci MAC address) */ 163162306a36Sopenharmony_ci 163262306a36Sopenharmony_ci/* ASUN: there's a PAUSE_TIMER (ro) described, but it's not in the address 163362306a36Sopenharmony_ci * map 163462306a36Sopenharmony_ci */ 163562306a36Sopenharmony_ci 163662306a36Sopenharmony_ci/* 27-bit register has the current state for key state machines in the MAC */ 163762306a36Sopenharmony_ci#define REG_MAC_STATE_MACHINE 0x61D0 /* (ro) state machine reg */ 163862306a36Sopenharmony_ci#define MAC_SM_RLM_MASK 0x07800000 163962306a36Sopenharmony_ci#define MAC_SM_RLM_SHIFT 23 164062306a36Sopenharmony_ci#define MAC_SM_RX_FC_MASK 0x00700000 164162306a36Sopenharmony_ci#define MAC_SM_RX_FC_SHIFT 20 164262306a36Sopenharmony_ci#define MAC_SM_TLM_MASK 0x000F0000 164362306a36Sopenharmony_ci#define MAC_SM_TLM_SHIFT 16 164462306a36Sopenharmony_ci#define MAC_SM_ENCAP_SM_MASK 0x0000F000 164562306a36Sopenharmony_ci#define MAC_SM_ENCAP_SM_SHIFT 12 164662306a36Sopenharmony_ci#define MAC_SM_TX_REQ_MASK 0x00000C00 164762306a36Sopenharmony_ci#define MAC_SM_TX_REQ_SHIFT 10 164862306a36Sopenharmony_ci#define MAC_SM_TX_FC_MASK 0x000003C0 164962306a36Sopenharmony_ci#define MAC_SM_TX_FC_SHIFT 6 165062306a36Sopenharmony_ci#define MAC_SM_FIFO_WRITE_SEL_MASK 0x00000038 165162306a36Sopenharmony_ci#define MAC_SM_FIFO_WRITE_SEL_SHIFT 3 165262306a36Sopenharmony_ci#define MAC_SM_TX_FIFO_EMPTY_MASK 0x00000007 165362306a36Sopenharmony_ci#define MAC_SM_TX_FIFO_EMPTY_SHIFT 0 165462306a36Sopenharmony_ci 165562306a36Sopenharmony_ci/** MIF registers. the MIF can be programmed in either bit-bang or 165662306a36Sopenharmony_ci * frame mode. 165762306a36Sopenharmony_ci **/ 165862306a36Sopenharmony_ci#define REG_MIF_BIT_BANG_CLOCK 0x6200 /* MIF bit-bang clock. 165962306a36Sopenharmony_ci 1 -> 0 will generate a 166062306a36Sopenharmony_ci rising edge. 0 -> 1 will 166162306a36Sopenharmony_ci generate a falling edge. */ 166262306a36Sopenharmony_ci#define REG_MIF_BIT_BANG_DATA 0x6204 /* MIF bit-bang data. 1-bit 166362306a36Sopenharmony_ci register generates data */ 166462306a36Sopenharmony_ci#define REG_MIF_BIT_BANG_OUTPUT_EN 0x6208 /* MIF bit-bang output 166562306a36Sopenharmony_ci enable. enable when 166662306a36Sopenharmony_ci xmitting data from MIF to 166762306a36Sopenharmony_ci transceiver. */ 166862306a36Sopenharmony_ci 166962306a36Sopenharmony_ci/* 32-bit register serves as an instruction register when the MIF is 167062306a36Sopenharmony_ci * programmed in frame mode. load this register w/ a valid instruction 167162306a36Sopenharmony_ci * (as per IEEE 802.3u MII spec). poll this register to check for instruction 167262306a36Sopenharmony_ci * execution completion. during a read operation, this register will also 167362306a36Sopenharmony_ci * contain the 16-bit data returned by the tranceiver. unless specified 167462306a36Sopenharmony_ci * otherwise, fields are considered "don't care" when polling for 167562306a36Sopenharmony_ci * completion. 167662306a36Sopenharmony_ci */ 167762306a36Sopenharmony_ci#define REG_MIF_FRAME 0x620C /* MIF frame/output reg */ 167862306a36Sopenharmony_ci#define MIF_FRAME_START_MASK 0xC0000000 /* start of frame. 167962306a36Sopenharmony_ci load w/ 01 when 168062306a36Sopenharmony_ci issuing an instr */ 168162306a36Sopenharmony_ci#define MIF_FRAME_ST 0x40000000 /* STart of frame */ 168262306a36Sopenharmony_ci#define MIF_FRAME_OPCODE_MASK 0x30000000 /* opcode. 01 for a 168362306a36Sopenharmony_ci write. 10 for a 168462306a36Sopenharmony_ci read */ 168562306a36Sopenharmony_ci#define MIF_FRAME_OP_READ 0x20000000 /* read OPcode */ 168662306a36Sopenharmony_ci#define MIF_FRAME_OP_WRITE 0x10000000 /* write OPcode */ 168762306a36Sopenharmony_ci#define MIF_FRAME_PHY_ADDR_MASK 0x0F800000 /* phy address. when 168862306a36Sopenharmony_ci issuing an instr, 168962306a36Sopenharmony_ci this field should be 169062306a36Sopenharmony_ci loaded w/ the XCVR 169162306a36Sopenharmony_ci addr */ 169262306a36Sopenharmony_ci#define MIF_FRAME_PHY_ADDR_SHIFT 23 169362306a36Sopenharmony_ci#define MIF_FRAME_REG_ADDR_MASK 0x007C0000 /* register address. 169462306a36Sopenharmony_ci when issuing an instr, 169562306a36Sopenharmony_ci addr of register 169662306a36Sopenharmony_ci to be read/written */ 169762306a36Sopenharmony_ci#define MIF_FRAME_REG_ADDR_SHIFT 18 169862306a36Sopenharmony_ci#define MIF_FRAME_TURN_AROUND_MSB 0x00020000 /* turn around, MSB. 169962306a36Sopenharmony_ci when issuing an instr, 170062306a36Sopenharmony_ci set this bit to 1 */ 170162306a36Sopenharmony_ci#define MIF_FRAME_TURN_AROUND_LSB 0x00010000 /* turn around, LSB. 170262306a36Sopenharmony_ci when issuing an instr, 170362306a36Sopenharmony_ci set this bit to 0. 170462306a36Sopenharmony_ci when polling for 170562306a36Sopenharmony_ci completion, 1 means 170662306a36Sopenharmony_ci that instr execution 170762306a36Sopenharmony_ci has been completed */ 170862306a36Sopenharmony_ci#define MIF_FRAME_DATA_MASK 0x0000FFFF /* instruction payload 170962306a36Sopenharmony_ci load with 16-bit data 171062306a36Sopenharmony_ci to be written in 171162306a36Sopenharmony_ci transceiver reg for a 171262306a36Sopenharmony_ci write. doesn't matter 171362306a36Sopenharmony_ci in a read. when 171462306a36Sopenharmony_ci polling for 171562306a36Sopenharmony_ci completion, field is 171662306a36Sopenharmony_ci "don't care" for write 171762306a36Sopenharmony_ci and 16-bit data 171862306a36Sopenharmony_ci returned by the 171962306a36Sopenharmony_ci transceiver for a 172062306a36Sopenharmony_ci read (if valid bit 172162306a36Sopenharmony_ci is set) */ 172262306a36Sopenharmony_ci#define REG_MIF_CFG 0x6210 /* MIF config reg */ 172362306a36Sopenharmony_ci#define MIF_CFG_PHY_SELECT 0x0001 /* 1 -> select MDIO_1 172462306a36Sopenharmony_ci 0 -> select MDIO_0 */ 172562306a36Sopenharmony_ci#define MIF_CFG_POLL_EN 0x0002 /* enable polling 172662306a36Sopenharmony_ci mechanism. if set, 172762306a36Sopenharmony_ci BB_MODE should be 0 */ 172862306a36Sopenharmony_ci#define MIF_CFG_BB_MODE 0x0004 /* 1 -> bit-bang mode 172962306a36Sopenharmony_ci 0 -> frame mode */ 173062306a36Sopenharmony_ci#define MIF_CFG_POLL_REG_MASK 0x00F8 /* register address to be 173162306a36Sopenharmony_ci used by polling mode. 173262306a36Sopenharmony_ci only meaningful if POLL_EN 173362306a36Sopenharmony_ci is set to 1 */ 173462306a36Sopenharmony_ci#define MIF_CFG_POLL_REG_SHIFT 3 173562306a36Sopenharmony_ci#define MIF_CFG_MDIO_0 0x0100 /* (ro) dual purpose. 173662306a36Sopenharmony_ci when MDIO_0 is idle, 173762306a36Sopenharmony_ci 1 -> tranceiver is 173862306a36Sopenharmony_ci connected to MDIO_0. 173962306a36Sopenharmony_ci when MIF is communicating 174062306a36Sopenharmony_ci w/ MDIO_0 in bit-bang 174162306a36Sopenharmony_ci mode, this bit indicates 174262306a36Sopenharmony_ci the incoming bit stream 174362306a36Sopenharmony_ci during a read op */ 174462306a36Sopenharmony_ci#define MIF_CFG_MDIO_1 0x0200 /* (ro) dual purpose. 174562306a36Sopenharmony_ci when MDIO_1 is idle, 174662306a36Sopenharmony_ci 1 -> transceiver is 174762306a36Sopenharmony_ci connected to MDIO_1. 174862306a36Sopenharmony_ci when MIF is communicating 174962306a36Sopenharmony_ci w/ MDIO_1 in bit-bang 175062306a36Sopenharmony_ci mode, this bit indicates 175162306a36Sopenharmony_ci the incoming bit stream 175262306a36Sopenharmony_ci during a read op */ 175362306a36Sopenharmony_ci#define MIF_CFG_POLL_PHY_MASK 0x7C00 /* tranceiver address to 175462306a36Sopenharmony_ci be polled */ 175562306a36Sopenharmony_ci#define MIF_CFG_POLL_PHY_SHIFT 10 175662306a36Sopenharmony_ci 175762306a36Sopenharmony_ci/* 16-bit register used to determine which bits in the POLL_STATUS portion of 175862306a36Sopenharmony_ci * the MIF_STATUS register will cause an interrupt. if a mask bit is 0, 175962306a36Sopenharmony_ci * corresponding bit of the POLL_STATUS will generate a MIF interrupt when 176062306a36Sopenharmony_ci * set. DEFAULT: 0xFFFF 176162306a36Sopenharmony_ci */ 176262306a36Sopenharmony_ci#define REG_MIF_MASK 0x6214 /* MIF mask reg */ 176362306a36Sopenharmony_ci 176462306a36Sopenharmony_ci/* 32-bit register used when in poll mode. auto-cleared after being read */ 176562306a36Sopenharmony_ci#define REG_MIF_STATUS 0x6218 /* MIF status reg */ 176662306a36Sopenharmony_ci#define MIF_STATUS_POLL_DATA_MASK 0xFFFF0000 /* poll data contains 176762306a36Sopenharmony_ci the "latest image" 176862306a36Sopenharmony_ci update of the XCVR 176962306a36Sopenharmony_ci reg being read */ 177062306a36Sopenharmony_ci#define MIF_STATUS_POLL_DATA_SHIFT 16 177162306a36Sopenharmony_ci#define MIF_STATUS_POLL_STATUS_MASK 0x0000FFFF /* poll status indicates 177262306a36Sopenharmony_ci which bits in the 177362306a36Sopenharmony_ci POLL_DATA field have 177462306a36Sopenharmony_ci changed since the 177562306a36Sopenharmony_ci MIF_STATUS reg was 177662306a36Sopenharmony_ci last read */ 177762306a36Sopenharmony_ci#define MIF_STATUS_POLL_STATUS_SHIFT 0 177862306a36Sopenharmony_ci 177962306a36Sopenharmony_ci/* 7-bit register has current state for all state machines in the MIF */ 178062306a36Sopenharmony_ci#define REG_MIF_STATE_MACHINE 0x621C /* MIF state machine reg */ 178162306a36Sopenharmony_ci#define MIF_SM_CONTROL_MASK 0x07 /* control state machine 178262306a36Sopenharmony_ci state */ 178362306a36Sopenharmony_ci#define MIF_SM_EXECUTION_MASK 0x60 /* execution state machine 178462306a36Sopenharmony_ci state */ 178562306a36Sopenharmony_ci 178662306a36Sopenharmony_ci/** PCS/Serialink. the following registers are equivalent to the standard 178762306a36Sopenharmony_ci * MII management registers except that they're directly mapped in 178862306a36Sopenharmony_ci * Cassini's register space. 178962306a36Sopenharmony_ci **/ 179062306a36Sopenharmony_ci 179162306a36Sopenharmony_ci/* the auto-negotiation enable bit should be programmed the same at 179262306a36Sopenharmony_ci * the link partner as in the local device to enable auto-negotiation to 179362306a36Sopenharmony_ci * complete. when that bit is reprogrammed, auto-neg/manual config is 179462306a36Sopenharmony_ci * restarted automatically. 179562306a36Sopenharmony_ci * DEFAULT: 0x1040 179662306a36Sopenharmony_ci */ 179762306a36Sopenharmony_ci#define REG_PCS_MII_CTRL 0x9000 /* PCS MII control reg */ 179862306a36Sopenharmony_ci#define PCS_MII_CTRL_1000_SEL 0x0040 /* reads 1. ignored on 179962306a36Sopenharmony_ci writes */ 180062306a36Sopenharmony_ci#define PCS_MII_CTRL_COLLISION_TEST 0x0080 /* COL signal at the PCS 180162306a36Sopenharmony_ci to MAC interface is 180262306a36Sopenharmony_ci activated regardless 180362306a36Sopenharmony_ci of activity */ 180462306a36Sopenharmony_ci#define PCS_MII_CTRL_DUPLEX 0x0100 /* forced 0x0. PCS 180562306a36Sopenharmony_ci behaviour same for 180662306a36Sopenharmony_ci half and full dplx */ 180762306a36Sopenharmony_ci#define PCS_MII_RESTART_AUTONEG 0x0200 /* self clearing. 180862306a36Sopenharmony_ci restart auto- 180962306a36Sopenharmony_ci negotiation */ 181062306a36Sopenharmony_ci#define PCS_MII_ISOLATE 0x0400 /* read as 0. ignored 181162306a36Sopenharmony_ci on writes */ 181262306a36Sopenharmony_ci#define PCS_MII_POWER_DOWN 0x0800 /* read as 0. ignored 181362306a36Sopenharmony_ci on writes */ 181462306a36Sopenharmony_ci#define PCS_MII_AUTONEG_EN 0x1000 /* default 1. PCS goes 181562306a36Sopenharmony_ci through automatic 181662306a36Sopenharmony_ci link config before it 181762306a36Sopenharmony_ci can be used. when 0, 181862306a36Sopenharmony_ci link can be used 181962306a36Sopenharmony_ci w/out any link config 182062306a36Sopenharmony_ci phase */ 182162306a36Sopenharmony_ci#define PCS_MII_10_100_SEL 0x2000 /* read as 0. ignored on 182262306a36Sopenharmony_ci writes */ 182362306a36Sopenharmony_ci#define PCS_MII_RESET 0x8000 /* reset PCS. self-clears 182462306a36Sopenharmony_ci when done */ 182562306a36Sopenharmony_ci 182662306a36Sopenharmony_ci/* DEFAULT: 0x0108 */ 182762306a36Sopenharmony_ci#define REG_PCS_MII_STATUS 0x9004 /* PCS MII status reg */ 182862306a36Sopenharmony_ci#define PCS_MII_STATUS_EXTEND_CAP 0x0001 /* reads 0 */ 182962306a36Sopenharmony_ci#define PCS_MII_STATUS_JABBER_DETECT 0x0002 /* reads 0 */ 183062306a36Sopenharmony_ci#define PCS_MII_STATUS_LINK_STATUS 0x0004 /* 1 -> link up. 183162306a36Sopenharmony_ci 0 -> link down. 0 is 183262306a36Sopenharmony_ci latched so that 0 is 183362306a36Sopenharmony_ci kept until read. read 183462306a36Sopenharmony_ci 2x to determine if the 183562306a36Sopenharmony_ci link has gone up again */ 183662306a36Sopenharmony_ci#define PCS_MII_STATUS_AUTONEG_ABLE 0x0008 /* reads 1 (able to perform 183762306a36Sopenharmony_ci auto-neg) */ 183862306a36Sopenharmony_ci#define PCS_MII_STATUS_REMOTE_FAULT 0x0010 /* 1 -> remote fault detected 183962306a36Sopenharmony_ci from received link code 184062306a36Sopenharmony_ci word. only valid after 184162306a36Sopenharmony_ci auto-neg completed */ 184262306a36Sopenharmony_ci#define PCS_MII_STATUS_AUTONEG_COMP 0x0020 /* 1 -> auto-negotiation 184362306a36Sopenharmony_ci completed 184462306a36Sopenharmony_ci 0 -> auto-negotiation not 184562306a36Sopenharmony_ci completed */ 184662306a36Sopenharmony_ci#define PCS_MII_STATUS_EXTEND_STATUS 0x0100 /* reads as 1. used as an 184762306a36Sopenharmony_ci indication that this is 184862306a36Sopenharmony_ci a 1000 Base-X PHY. writes 184962306a36Sopenharmony_ci to it are ignored */ 185062306a36Sopenharmony_ci 185162306a36Sopenharmony_ci/* used during auto-negotiation. 185262306a36Sopenharmony_ci * DEFAULT: 0x00E0 185362306a36Sopenharmony_ci */ 185462306a36Sopenharmony_ci#define REG_PCS_MII_ADVERT 0x9008 /* PCS MII advertisement 185562306a36Sopenharmony_ci reg */ 185662306a36Sopenharmony_ci#define PCS_MII_ADVERT_FD 0x0020 /* advertise full duplex 185762306a36Sopenharmony_ci 1000 Base-X */ 185862306a36Sopenharmony_ci#define PCS_MII_ADVERT_HD 0x0040 /* advertise half-duplex 185962306a36Sopenharmony_ci 1000 Base-X */ 186062306a36Sopenharmony_ci#define PCS_MII_ADVERT_SYM_PAUSE 0x0080 /* advertise PAUSE 186162306a36Sopenharmony_ci symmetric capability */ 186262306a36Sopenharmony_ci#define PCS_MII_ADVERT_ASYM_PAUSE 0x0100 /* advertises PAUSE 186362306a36Sopenharmony_ci asymmetric capability */ 186462306a36Sopenharmony_ci#define PCS_MII_ADVERT_RF_MASK 0x3000 /* remote fault. write bit13 186562306a36Sopenharmony_ci to optionally indicate to 186662306a36Sopenharmony_ci link partner that chip is 186762306a36Sopenharmony_ci going off-line. bit12 will 186862306a36Sopenharmony_ci get set when signal 186962306a36Sopenharmony_ci detect == FAIL and will 187062306a36Sopenharmony_ci remain set until 187162306a36Sopenharmony_ci successful negotiation */ 187262306a36Sopenharmony_ci#define PCS_MII_ADVERT_ACK 0x4000 /* (ro) */ 187362306a36Sopenharmony_ci#define PCS_MII_ADVERT_NEXT_PAGE 0x8000 /* (ro) forced 0x0 */ 187462306a36Sopenharmony_ci 187562306a36Sopenharmony_ci/* contents updated as a result of autonegotiation. layout and definitions 187662306a36Sopenharmony_ci * identical to PCS_MII_ADVERT 187762306a36Sopenharmony_ci */ 187862306a36Sopenharmony_ci#define REG_PCS_MII_LPA 0x900C /* PCS MII link partner 187962306a36Sopenharmony_ci ability reg */ 188062306a36Sopenharmony_ci#define PCS_MII_LPA_FD PCS_MII_ADVERT_FD 188162306a36Sopenharmony_ci#define PCS_MII_LPA_HD PCS_MII_ADVERT_HD 188262306a36Sopenharmony_ci#define PCS_MII_LPA_SYM_PAUSE PCS_MII_ADVERT_SYM_PAUSE 188362306a36Sopenharmony_ci#define PCS_MII_LPA_ASYM_PAUSE PCS_MII_ADVERT_ASYM_PAUSE 188462306a36Sopenharmony_ci#define PCS_MII_LPA_RF_MASK PCS_MII_ADVERT_RF_MASK 188562306a36Sopenharmony_ci#define PCS_MII_LPA_ACK PCS_MII_ADVERT_ACK 188662306a36Sopenharmony_ci#define PCS_MII_LPA_NEXT_PAGE PCS_MII_ADVERT_NEXT_PAGE 188762306a36Sopenharmony_ci 188862306a36Sopenharmony_ci/* DEFAULT: 0x0 */ 188962306a36Sopenharmony_ci#define REG_PCS_CFG 0x9010 /* PCS config reg */ 189062306a36Sopenharmony_ci#define PCS_CFG_EN 0x01 /* enable PCS. must be 189162306a36Sopenharmony_ci 0 when modifying 189262306a36Sopenharmony_ci PCS_MII_ADVERT */ 189362306a36Sopenharmony_ci#define PCS_CFG_SD_OVERRIDE 0x02 /* sets signal detect to 189462306a36Sopenharmony_ci OK. bit is 189562306a36Sopenharmony_ci non-resettable */ 189662306a36Sopenharmony_ci#define PCS_CFG_SD_ACTIVE_LOW 0x04 /* changes interpretation 189762306a36Sopenharmony_ci of optical signal to make 189862306a36Sopenharmony_ci signal detect okay when 189962306a36Sopenharmony_ci signal is low */ 190062306a36Sopenharmony_ci#define PCS_CFG_JITTER_STUDY_MASK 0x18 /* used to make jitter 190162306a36Sopenharmony_ci measurements. a single 190262306a36Sopenharmony_ci code group is xmitted 190362306a36Sopenharmony_ci regularly. 190462306a36Sopenharmony_ci 0x0 = normal operation 190562306a36Sopenharmony_ci 0x1 = high freq test 190662306a36Sopenharmony_ci pattern, D21.5 190762306a36Sopenharmony_ci 0x2 = low freq test 190862306a36Sopenharmony_ci pattern, K28.7 190962306a36Sopenharmony_ci 0x3 = reserved */ 191062306a36Sopenharmony_ci#define PCS_CFG_10MS_TIMER_OVERRIDE 0x20 /* shortens 10-20ms auto- 191162306a36Sopenharmony_ci negotiation timer to 191262306a36Sopenharmony_ci a few cycles for test 191362306a36Sopenharmony_ci purposes */ 191462306a36Sopenharmony_ci 191562306a36Sopenharmony_ci/* used for diagnostic purposes. bits 20-22 autoclear on read */ 191662306a36Sopenharmony_ci#define REG_PCS_STATE_MACHINE 0x9014 /* (ro) PCS state machine 191762306a36Sopenharmony_ci and diagnostic reg */ 191862306a36Sopenharmony_ci#define PCS_SM_TX_STATE_MASK 0x0000000F /* 0 and 1 indicate 191962306a36Sopenharmony_ci xmission of idle. 192062306a36Sopenharmony_ci otherwise, xmission of 192162306a36Sopenharmony_ci a packet */ 192262306a36Sopenharmony_ci#define PCS_SM_RX_STATE_MASK 0x000000F0 /* 0 indicates reception 192362306a36Sopenharmony_ci of idle. otherwise, 192462306a36Sopenharmony_ci reception of packet */ 192562306a36Sopenharmony_ci#define PCS_SM_WORD_SYNC_STATE_MASK 0x00000700 /* 0 indicates loss of 192662306a36Sopenharmony_ci sync */ 192762306a36Sopenharmony_ci#define PCS_SM_SEQ_DETECT_STATE_MASK 0x00001800 /* cycling through 0-3 192862306a36Sopenharmony_ci indicates reception of 192962306a36Sopenharmony_ci Config codes. cycling 193062306a36Sopenharmony_ci through 0-1 indicates 193162306a36Sopenharmony_ci reception of idles */ 193262306a36Sopenharmony_ci#define PCS_SM_LINK_STATE_MASK 0x0001E000 193362306a36Sopenharmony_ci#define SM_LINK_STATE_UP 0x00016000 /* link state is up */ 193462306a36Sopenharmony_ci 193562306a36Sopenharmony_ci#define PCS_SM_LOSS_LINK_C 0x00100000 /* loss of link due to 193662306a36Sopenharmony_ci recept of Config 193762306a36Sopenharmony_ci codes */ 193862306a36Sopenharmony_ci#define PCS_SM_LOSS_LINK_SYNC 0x00200000 /* loss of link due to 193962306a36Sopenharmony_ci loss of sync */ 194062306a36Sopenharmony_ci#define PCS_SM_LOSS_SIGNAL_DETECT 0x00400000 /* signal detect goes 194162306a36Sopenharmony_ci from OK to FAIL. bit29 194262306a36Sopenharmony_ci will also be set if 194362306a36Sopenharmony_ci this is set */ 194462306a36Sopenharmony_ci#define PCS_SM_NO_LINK_BREAKLINK 0x01000000 /* link not up due to 194562306a36Sopenharmony_ci receipt of breaklink 194662306a36Sopenharmony_ci C codes from partner. 194762306a36Sopenharmony_ci C codes w/ 0 content 194862306a36Sopenharmony_ci received triggering 194962306a36Sopenharmony_ci start/restart of 195062306a36Sopenharmony_ci autonegotiation. 195162306a36Sopenharmony_ci should be sent for 195262306a36Sopenharmony_ci no longer than 20ms */ 195362306a36Sopenharmony_ci#define PCS_SM_NO_LINK_SERDES 0x02000000 /* serdes being 195462306a36Sopenharmony_ci initialized. see serdes 195562306a36Sopenharmony_ci state reg */ 195662306a36Sopenharmony_ci#define PCS_SM_NO_LINK_C 0x04000000 /* C codes not stable or 195762306a36Sopenharmony_ci not received */ 195862306a36Sopenharmony_ci#define PCS_SM_NO_LINK_SYNC 0x08000000 /* word sync not 195962306a36Sopenharmony_ci achieved */ 196062306a36Sopenharmony_ci#define PCS_SM_NO_LINK_WAIT_C 0x10000000 /* waiting for C codes 196162306a36Sopenharmony_ci w/ ack bit set */ 196262306a36Sopenharmony_ci#define PCS_SM_NO_LINK_NO_IDLE 0x20000000 /* link partner continues 196362306a36Sopenharmony_ci to send C codes 196462306a36Sopenharmony_ci instead of idle 196562306a36Sopenharmony_ci symbols or pkt data */ 196662306a36Sopenharmony_ci 196762306a36Sopenharmony_ci/* this register indicates interrupt changes in specific PCS MII status bits. 196862306a36Sopenharmony_ci * PCS_INT may be masked at the ISR level. only a single bit is implemented 196962306a36Sopenharmony_ci * for link status change. 197062306a36Sopenharmony_ci */ 197162306a36Sopenharmony_ci#define REG_PCS_INTR_STATUS 0x9018 /* PCS interrupt status */ 197262306a36Sopenharmony_ci#define PCS_INTR_STATUS_LINK_CHANGE 0x04 /* link status has changed 197362306a36Sopenharmony_ci since last read */ 197462306a36Sopenharmony_ci 197562306a36Sopenharmony_ci/* control which network interface is used. no more than one bit should 197662306a36Sopenharmony_ci * be set. 197762306a36Sopenharmony_ci * DEFAULT: none 197862306a36Sopenharmony_ci */ 197962306a36Sopenharmony_ci#define REG_PCS_DATAPATH_MODE 0x9050 /* datapath mode reg */ 198062306a36Sopenharmony_ci#define PCS_DATAPATH_MODE_MII 0x00 /* PCS is not used and 198162306a36Sopenharmony_ci MII/GMII is selected. 198262306a36Sopenharmony_ci selection between MII and 198362306a36Sopenharmony_ci GMII is controlled by 198462306a36Sopenharmony_ci XIF_CFG */ 198562306a36Sopenharmony_ci#define PCS_DATAPATH_MODE_SERDES 0x02 /* PCS is used via the 198662306a36Sopenharmony_ci 10-bit interface */ 198762306a36Sopenharmony_ci 198862306a36Sopenharmony_ci/* input to serdes chip or serialink block */ 198962306a36Sopenharmony_ci#define REG_PCS_SERDES_CTRL 0x9054 /* serdes control reg */ 199062306a36Sopenharmony_ci#define PCS_SERDES_CTRL_LOOPBACK 0x01 /* enable loopback on 199162306a36Sopenharmony_ci serdes interface */ 199262306a36Sopenharmony_ci#define PCS_SERDES_CTRL_SYNCD_EN 0x02 /* enable sync carrier 199362306a36Sopenharmony_ci detection. should be 199462306a36Sopenharmony_ci 0x0 for normal 199562306a36Sopenharmony_ci operation */ 199662306a36Sopenharmony_ci#define PCS_SERDES_CTRL_LOCKREF 0x04 /* frequency-lock RBC[0:1] 199762306a36Sopenharmony_ci to REFCLK when set. 199862306a36Sopenharmony_ci when clear, receiver 199962306a36Sopenharmony_ci clock locks to incoming 200062306a36Sopenharmony_ci serial data */ 200162306a36Sopenharmony_ci 200262306a36Sopenharmony_ci/* multiplex test outputs into the PROM address (PA_3 through PA_0) pins. 200362306a36Sopenharmony_ci * should be 0x0 for normal operations. 200462306a36Sopenharmony_ci * 0b000 normal operation, PROM address[3:0] selected 200562306a36Sopenharmony_ci * 0b001 rxdma req, rxdma ack, rxdma ready, rxdma read 200662306a36Sopenharmony_ci * 0b010 rxmac req, rx ack, rx tag, rx clk shared 200762306a36Sopenharmony_ci * 0b011 txmac req, tx ack, tx tag, tx retry req 200862306a36Sopenharmony_ci * 0b100 tx tp3, tx tp2, tx tp1, tx tp0 200962306a36Sopenharmony_ci * 0b101 R period RX, R period TX, R period HP, R period BIM 201062306a36Sopenharmony_ci * DEFAULT: 0x0 201162306a36Sopenharmony_ci */ 201262306a36Sopenharmony_ci#define REG_PCS_SHARED_OUTPUT_SEL 0x9058 /* shared output select */ 201362306a36Sopenharmony_ci#define PCS_SOS_PROM_ADDR_MASK 0x0007 201462306a36Sopenharmony_ci 201562306a36Sopenharmony_ci/* used for diagnostics. this register indicates progress of the SERDES 201662306a36Sopenharmony_ci * boot up. 201762306a36Sopenharmony_ci * 0b00 undergoing reset 201862306a36Sopenharmony_ci * 0b01 waiting 500us while lockrefn is asserted 201962306a36Sopenharmony_ci * 0b10 waiting for comma detect 202062306a36Sopenharmony_ci * 0b11 receive data is synchronized 202162306a36Sopenharmony_ci * DEFAULT: 0x0 202262306a36Sopenharmony_ci */ 202362306a36Sopenharmony_ci#define REG_PCS_SERDES_STATE 0x905C /* (ro) serdes state */ 202462306a36Sopenharmony_ci#define PCS_SERDES_STATE_MASK 0x03 202562306a36Sopenharmony_ci 202662306a36Sopenharmony_ci/* used for diagnostics. indicates number of packets transmitted or received. 202762306a36Sopenharmony_ci * counters rollover w/out generating an interrupt. 202862306a36Sopenharmony_ci * DEFAULT: 0x0 202962306a36Sopenharmony_ci */ 203062306a36Sopenharmony_ci#define REG_PCS_PACKET_COUNT 0x9060 /* (ro) PCS packet counter */ 203162306a36Sopenharmony_ci#define PCS_PACKET_COUNT_TX 0x000007FF /* pkts xmitted by PCS */ 203262306a36Sopenharmony_ci#define PCS_PACKET_COUNT_RX 0x07FF0000 /* pkts recvd by PCS 203362306a36Sopenharmony_ci whether they 203462306a36Sopenharmony_ci encountered an error 203562306a36Sopenharmony_ci or not */ 203662306a36Sopenharmony_ci 203762306a36Sopenharmony_ci/** LocalBus Devices. the following provides run-time access to the 203862306a36Sopenharmony_ci * Cassini's PROM 203962306a36Sopenharmony_ci ***/ 204062306a36Sopenharmony_ci#define REG_EXPANSION_ROM_RUN_START 0x100000 /* expansion rom run time 204162306a36Sopenharmony_ci access */ 204262306a36Sopenharmony_ci#define REG_EXPANSION_ROM_RUN_END 0x17FFFF 204362306a36Sopenharmony_ci 204462306a36Sopenharmony_ci#define REG_SECOND_LOCALBUS_START 0x180000 /* secondary local bus 204562306a36Sopenharmony_ci device */ 204662306a36Sopenharmony_ci#define REG_SECOND_LOCALBUS_END 0x1FFFFF 204762306a36Sopenharmony_ci 204862306a36Sopenharmony_ci/* entropy device */ 204962306a36Sopenharmony_ci#define REG_ENTROPY_START REG_SECOND_LOCALBUS_START 205062306a36Sopenharmony_ci#define REG_ENTROPY_DATA (REG_ENTROPY_START + 0x00) 205162306a36Sopenharmony_ci#define REG_ENTROPY_STATUS (REG_ENTROPY_START + 0x04) 205262306a36Sopenharmony_ci#define ENTROPY_STATUS_DRDY 0x01 205362306a36Sopenharmony_ci#define ENTROPY_STATUS_BUSY 0x02 205462306a36Sopenharmony_ci#define ENTROPY_STATUS_CIPHER 0x04 205562306a36Sopenharmony_ci#define ENTROPY_STATUS_BYPASS_MASK 0x18 205662306a36Sopenharmony_ci#define REG_ENTROPY_MODE (REG_ENTROPY_START + 0x05) 205762306a36Sopenharmony_ci#define ENTROPY_MODE_KEY_MASK 0x07 205862306a36Sopenharmony_ci#define ENTROPY_MODE_ENCRYPT 0x40 205962306a36Sopenharmony_ci#define REG_ENTROPY_RAND_REG (REG_ENTROPY_START + 0x06) 206062306a36Sopenharmony_ci#define REG_ENTROPY_RESET (REG_ENTROPY_START + 0x07) 206162306a36Sopenharmony_ci#define ENTROPY_RESET_DES_IO 0x01 206262306a36Sopenharmony_ci#define ENTROPY_RESET_STC_MODE 0x02 206362306a36Sopenharmony_ci#define ENTROPY_RESET_KEY_CACHE 0x04 206462306a36Sopenharmony_ci#define ENTROPY_RESET_IV 0x08 206562306a36Sopenharmony_ci#define REG_ENTROPY_IV (REG_ENTROPY_START + 0x08) 206662306a36Sopenharmony_ci#define REG_ENTROPY_KEY0 (REG_ENTROPY_START + 0x10) 206762306a36Sopenharmony_ci#define REG_ENTROPY_KEYN(x) (REG_ENTROPY_KEY0 + 4*(x)) 206862306a36Sopenharmony_ci 206962306a36Sopenharmony_ci/* phys of interest w/ their special mii registers */ 207062306a36Sopenharmony_ci#define PHY_LUCENT_B0 0x00437421 207162306a36Sopenharmony_ci#define LUCENT_MII_REG 0x1F 207262306a36Sopenharmony_ci 207362306a36Sopenharmony_ci#define PHY_NS_DP83065 0x20005c78 207462306a36Sopenharmony_ci#define DP83065_MII_MEM 0x16 207562306a36Sopenharmony_ci#define DP83065_MII_REGD 0x1D 207662306a36Sopenharmony_ci#define DP83065_MII_REGE 0x1E 207762306a36Sopenharmony_ci 207862306a36Sopenharmony_ci#define PHY_BROADCOM_5411 0x00206071 207962306a36Sopenharmony_ci#define PHY_BROADCOM_B0 0x00206050 208062306a36Sopenharmony_ci#define BROADCOM_MII_REG4 0x14 208162306a36Sopenharmony_ci#define BROADCOM_MII_REG5 0x15 208262306a36Sopenharmony_ci#define BROADCOM_MII_REG7 0x17 208362306a36Sopenharmony_ci#define BROADCOM_MII_REG8 0x18 208462306a36Sopenharmony_ci 208562306a36Sopenharmony_ci#define CAS_MII_ANNPTR 0x07 208662306a36Sopenharmony_ci#define CAS_MII_ANNPRR 0x08 208762306a36Sopenharmony_ci#define CAS_MII_1000_CTRL 0x09 208862306a36Sopenharmony_ci#define CAS_MII_1000_STATUS 0x0A 208962306a36Sopenharmony_ci#define CAS_MII_1000_EXTEND 0x0F 209062306a36Sopenharmony_ci 209162306a36Sopenharmony_ci#define CAS_BMSR_1000_EXTEND 0x0100 /* supports 1000Base-T extended status */ 209262306a36Sopenharmony_ci/* 209362306a36Sopenharmony_ci * if autoneg is disabled, here's the table: 209462306a36Sopenharmony_ci * BMCR_SPEED100 = 100Mbps 209562306a36Sopenharmony_ci * BMCR_SPEED1000 = 1000Mbps 209662306a36Sopenharmony_ci * ~(BMCR_SPEED100 | BMCR_SPEED1000) = 10Mbps 209762306a36Sopenharmony_ci */ 209862306a36Sopenharmony_ci#define CAS_BMCR_SPEED1000 0x0040 /* Select 1000Mbps */ 209962306a36Sopenharmony_ci 210062306a36Sopenharmony_ci#define CAS_ADVERTISE_1000HALF 0x0100 210162306a36Sopenharmony_ci#define CAS_ADVERTISE_1000FULL 0x0200 210262306a36Sopenharmony_ci#define CAS_ADVERTISE_PAUSE 0x0400 210362306a36Sopenharmony_ci#define CAS_ADVERTISE_ASYM_PAUSE 0x0800 210462306a36Sopenharmony_ci 210562306a36Sopenharmony_ci/* regular lpa register */ 210662306a36Sopenharmony_ci#define CAS_LPA_PAUSE CAS_ADVERTISE_PAUSE 210762306a36Sopenharmony_ci#define CAS_LPA_ASYM_PAUSE CAS_ADVERTISE_ASYM_PAUSE 210862306a36Sopenharmony_ci 210962306a36Sopenharmony_ci/* 1000_STATUS register */ 211062306a36Sopenharmony_ci#define CAS_LPA_1000HALF 0x0400 211162306a36Sopenharmony_ci#define CAS_LPA_1000FULL 0x0800 211262306a36Sopenharmony_ci 211362306a36Sopenharmony_ci#define CAS_EXTEND_1000XFULL 0x8000 211462306a36Sopenharmony_ci#define CAS_EXTEND_1000XHALF 0x4000 211562306a36Sopenharmony_ci#define CAS_EXTEND_1000TFULL 0x2000 211662306a36Sopenharmony_ci#define CAS_EXTEND_1000THALF 0x1000 211762306a36Sopenharmony_ci 211862306a36Sopenharmony_ci/* cassini header parser firmware */ 211962306a36Sopenharmony_citypedef struct cas_hp_inst { 212062306a36Sopenharmony_ci const char *note; 212162306a36Sopenharmony_ci 212262306a36Sopenharmony_ci u16 mask, val; 212362306a36Sopenharmony_ci 212462306a36Sopenharmony_ci u8 op; 212562306a36Sopenharmony_ci u8 soff, snext; /* if match succeeds, new offset and match */ 212662306a36Sopenharmony_ci u8 foff, fnext; /* if match fails, new offset and match */ 212762306a36Sopenharmony_ci /* output info */ 212862306a36Sopenharmony_ci u8 outop; /* output opcode */ 212962306a36Sopenharmony_ci 213062306a36Sopenharmony_ci u16 outarg; /* output argument */ 213162306a36Sopenharmony_ci u8 outenab; /* output enable: 0 = not, 1 = if match 213262306a36Sopenharmony_ci 2 = if !match, 3 = always */ 213362306a36Sopenharmony_ci u8 outshift; /* barrel shift right, 4 bits */ 213462306a36Sopenharmony_ci u16 outmask; 213562306a36Sopenharmony_ci} cas_hp_inst_t; 213662306a36Sopenharmony_ci 213762306a36Sopenharmony_ci/* comparison */ 213862306a36Sopenharmony_ci#define OP_EQ 0 /* packet == value */ 213962306a36Sopenharmony_ci#define OP_LT 1 /* packet < value */ 214062306a36Sopenharmony_ci#define OP_GT 2 /* packet > value */ 214162306a36Sopenharmony_ci#define OP_NP 3 /* new packet */ 214262306a36Sopenharmony_ci 214362306a36Sopenharmony_ci/* output opcodes */ 214462306a36Sopenharmony_ci#define CL_REG 0 214562306a36Sopenharmony_ci#define LD_FID 1 214662306a36Sopenharmony_ci#define LD_SEQ 2 214762306a36Sopenharmony_ci#define LD_CTL 3 214862306a36Sopenharmony_ci#define LD_SAP 4 214962306a36Sopenharmony_ci#define LD_R1 5 215062306a36Sopenharmony_ci#define LD_L3 6 215162306a36Sopenharmony_ci#define LD_SUM 7 215262306a36Sopenharmony_ci#define LD_HDR 8 215362306a36Sopenharmony_ci#define IM_FID 9 215462306a36Sopenharmony_ci#define IM_SEQ 10 215562306a36Sopenharmony_ci#define IM_SAP 11 215662306a36Sopenharmony_ci#define IM_R1 12 215762306a36Sopenharmony_ci#define IM_CTL 13 215862306a36Sopenharmony_ci#define LD_LEN 14 215962306a36Sopenharmony_ci#define ST_FLG 15 216062306a36Sopenharmony_ci 216162306a36Sopenharmony_ci/* match setp #s for IP4TCP4 */ 216262306a36Sopenharmony_ci#define S1_PCKT 0 216362306a36Sopenharmony_ci#define S1_VLAN 1 216462306a36Sopenharmony_ci#define S1_CFI 2 216562306a36Sopenharmony_ci#define S1_8023 3 216662306a36Sopenharmony_ci#define S1_LLC 4 216762306a36Sopenharmony_ci#define S1_LLCc 5 216862306a36Sopenharmony_ci#define S1_IPV4 6 216962306a36Sopenharmony_ci#define S1_IPV4c 7 217062306a36Sopenharmony_ci#define S1_IPV4F 8 217162306a36Sopenharmony_ci#define S1_TCP44 9 217262306a36Sopenharmony_ci#define S1_IPV6 10 217362306a36Sopenharmony_ci#define S1_IPV6L 11 217462306a36Sopenharmony_ci#define S1_IPV6c 12 217562306a36Sopenharmony_ci#define S1_TCP64 13 217662306a36Sopenharmony_ci#define S1_TCPSQ 14 217762306a36Sopenharmony_ci#define S1_TCPFG 15 217862306a36Sopenharmony_ci#define S1_TCPHL 16 217962306a36Sopenharmony_ci#define S1_TCPHc 17 218062306a36Sopenharmony_ci#define S1_CLNP 18 218162306a36Sopenharmony_ci#define S1_CLNP2 19 218262306a36Sopenharmony_ci#define S1_DROP 20 218362306a36Sopenharmony_ci#define S2_HTTP 21 218462306a36Sopenharmony_ci#define S1_ESP4 22 218562306a36Sopenharmony_ci#define S1_AH4 23 218662306a36Sopenharmony_ci#define S1_ESP6 24 218762306a36Sopenharmony_ci#define S1_AH6 25 218862306a36Sopenharmony_ci 218962306a36Sopenharmony_ci#define CAS_PROG_IP46TCP4_PREAMBLE \ 219062306a36Sopenharmony_ci{ "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, \ 219162306a36Sopenharmony_ci CL_REG, 0x3ff, 1, 0x0, 0x0000}, \ 219262306a36Sopenharmony_ci{ "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, \ 219362306a36Sopenharmony_ci IM_CTL, 0x00a, 3, 0x0, 0xffff}, \ 219462306a36Sopenharmony_ci{ "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, \ 219562306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, \ 219662306a36Sopenharmony_ci{ "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, \ 219762306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, \ 219862306a36Sopenharmony_ci{ "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, \ 219962306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, \ 220062306a36Sopenharmony_ci{ "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, \ 220162306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, \ 220262306a36Sopenharmony_ci{ "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, \ 220362306a36Sopenharmony_ci LD_SAP, 0x100, 3, 0x0, 0xffff}, \ 220462306a36Sopenharmony_ci{ "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, \ 220562306a36Sopenharmony_ci LD_SUM, 0x00a, 1, 0x0, 0x0000}, \ 220662306a36Sopenharmony_ci{ "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, \ 220762306a36Sopenharmony_ci LD_LEN, 0x03e, 1, 0x0, 0xffff}, \ 220862306a36Sopenharmony_ci{ "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, \ 220962306a36Sopenharmony_ci LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ \ 221062306a36Sopenharmony_ci{ "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, \ 221162306a36Sopenharmony_ci LD_SUM, 0x015, 1, 0x0, 0x0000}, \ 221262306a36Sopenharmony_ci{ "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, \ 221362306a36Sopenharmony_ci IM_R1, 0x128, 1, 0x0, 0xffff}, \ 221462306a36Sopenharmony_ci{ "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, \ 221562306a36Sopenharmony_ci LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ \ 221662306a36Sopenharmony_ci{ "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, \ 221762306a36Sopenharmony_ci LD_LEN, 0x03f, 1, 0x0, 0xffff} 221862306a36Sopenharmony_ci 221962306a36Sopenharmony_ci#ifdef USE_HP_IP46TCP4 222062306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_ip46tcp4tab[] = { 222162306a36Sopenharmony_ci CAS_PROG_IP46TCP4_PREAMBLE, 222262306a36Sopenharmony_ci { "TCP seq", /* DADDR should point to dest port */ 222362306a36Sopenharmony_ci 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ, 222462306a36Sopenharmony_ci 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ 222562306a36Sopenharmony_ci { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0, 222662306a36Sopenharmony_ci S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */ 222762306a36Sopenharmony_ci { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, 222862306a36Sopenharmony_ci S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000}, 222962306a36Sopenharmony_ci { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, 223062306a36Sopenharmony_ci S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff}, 223162306a36Sopenharmony_ci { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, 223262306a36Sopenharmony_ci IM_CTL, 0x001, 3, 0x0, 0x0001}, 223362306a36Sopenharmony_ci { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 223462306a36Sopenharmony_ci IM_CTL, 0x000, 0, 0x0, 0x0000}, 223562306a36Sopenharmony_ci { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 223662306a36Sopenharmony_ci IM_CTL, 0x080, 3, 0x0, 0xffff}, 223762306a36Sopenharmony_ci { NULL }, 223862306a36Sopenharmony_ci}; 223962306a36Sopenharmony_ci#ifdef HP_IP46TCP4_DEFAULT 224062306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_ip46tcp4tab 224162306a36Sopenharmony_ci#endif 224262306a36Sopenharmony_ci#endif 224362306a36Sopenharmony_ci 224462306a36Sopenharmony_ci/* 224562306a36Sopenharmony_ci * Alternate table load which excludes HTTP server traffic from reassembly. 224662306a36Sopenharmony_ci * It is substantially similar to the basic table, with one extra state 224762306a36Sopenharmony_ci * and a few extra compares. */ 224862306a36Sopenharmony_ci#ifdef USE_HP_IP46TCP4NOHTTP 224962306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_ip46tcp4nohttptab[] = { 225062306a36Sopenharmony_ci CAS_PROG_IP46TCP4_PREAMBLE, 225162306a36Sopenharmony_ci { "TCP seq", /* DADDR should point to dest port */ 225262306a36Sopenharmony_ci 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ, 225362306a36Sopenharmony_ci 0x081, 3, 0x0, 0xffff} , /* Load TCP seq # */ 225462306a36Sopenharmony_ci { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0, 225562306a36Sopenharmony_ci S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f, }, /* Load TCP flags */ 225662306a36Sopenharmony_ci { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc, 225762306a36Sopenharmony_ci LD_R1, 0x205, 3, 0xB, 0xf000}, 225862306a36Sopenharmony_ci { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 225962306a36Sopenharmony_ci LD_HDR, 0x0ff, 3, 0x0, 0xffff}, 226062306a36Sopenharmony_ci { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, 226162306a36Sopenharmony_ci IM_CTL, 0x001, 3, 0x0, 0x0001}, 226262306a36Sopenharmony_ci { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 226362306a36Sopenharmony_ci CL_REG, 0x002, 3, 0x0, 0x0000}, 226462306a36Sopenharmony_ci { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 226562306a36Sopenharmony_ci IM_CTL, 0x080, 3, 0x0, 0xffff}, 226662306a36Sopenharmony_ci { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 226762306a36Sopenharmony_ci IM_CTL, 0x044, 3, 0x0, 0xffff}, 226862306a36Sopenharmony_ci { NULL }, 226962306a36Sopenharmony_ci}; 227062306a36Sopenharmony_ci#ifdef HP_IP46TCP4NOHTTP_DEFAULT 227162306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_ip46tcp4nohttptab 227262306a36Sopenharmony_ci#endif 227362306a36Sopenharmony_ci#endif 227462306a36Sopenharmony_ci 227562306a36Sopenharmony_ci/* match step #s for IP4FRAG */ 227662306a36Sopenharmony_ci#define S3_IPV6c 11 227762306a36Sopenharmony_ci#define S3_TCP64 12 227862306a36Sopenharmony_ci#define S3_TCPSQ 13 227962306a36Sopenharmony_ci#define S3_TCPFG 14 228062306a36Sopenharmony_ci#define S3_TCPHL 15 228162306a36Sopenharmony_ci#define S3_TCPHc 16 228262306a36Sopenharmony_ci#define S3_FRAG 17 228362306a36Sopenharmony_ci#define S3_FOFF 18 228462306a36Sopenharmony_ci#define S3_CLNP 19 228562306a36Sopenharmony_ci 228662306a36Sopenharmony_ci#ifdef USE_HP_IP4FRAG 228762306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_ip4fragtab[] = { 228862306a36Sopenharmony_ci { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, S1_PCKT, 228962306a36Sopenharmony_ci CL_REG, 0x3ff, 1, 0x0, 0x0000}, 229062306a36Sopenharmony_ci { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, 229162306a36Sopenharmony_ci IM_CTL, 0x00a, 3, 0x0, 0xffff}, 229262306a36Sopenharmony_ci { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S3_CLNP, 1, S1_8023, 229362306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 229462306a36Sopenharmony_ci { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, 229562306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 229662306a36Sopenharmony_ci { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S3_CLNP, 229762306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 229862306a36Sopenharmony_ci { "LLCc?",0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S3_CLNP, 229962306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 230062306a36Sopenharmony_ci { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, 230162306a36Sopenharmony_ci LD_SAP, 0x100, 3, 0x0, 0xffff}, 230262306a36Sopenharmony_ci { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S3_CLNP, 230362306a36Sopenharmony_ci LD_SUM, 0x00a, 1, 0x0, 0x0000}, 230462306a36Sopenharmony_ci { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S3_FRAG, 230562306a36Sopenharmony_ci LD_LEN, 0x03e, 3, 0x0, 0xffff}, 230662306a36Sopenharmony_ci { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S3_TCPSQ, 0, S3_CLNP, 230762306a36Sopenharmony_ci LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ 230862306a36Sopenharmony_ci { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S3_IPV6c, 0, S3_CLNP, 230962306a36Sopenharmony_ci LD_SUM, 0x015, 1, 0x0, 0x0000}, 231062306a36Sopenharmony_ci { "IPV6 cont?", 0xf000, 0x6000, OP_EQ, 3, S3_TCP64, 0, S3_CLNP, 231162306a36Sopenharmony_ci LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ 231262306a36Sopenharmony_ci { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S3_TCPSQ, 0, S3_CLNP, 231362306a36Sopenharmony_ci LD_LEN, 0x03f, 1, 0x0, 0xffff}, 231462306a36Sopenharmony_ci { "TCP seq", /* DADDR should point to dest port */ 231562306a36Sopenharmony_ci 0x0000, 0x0000, OP_EQ, 0, S3_TCPFG, 4, S3_TCPFG, LD_SEQ, 231662306a36Sopenharmony_ci 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ 231762306a36Sopenharmony_ci { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHL, 0, 231862306a36Sopenharmony_ci S3_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */ 231962306a36Sopenharmony_ci { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S3_TCPHc, 0, S3_TCPHc, 232062306a36Sopenharmony_ci LD_R1, 0x205, 3, 0xB, 0xf000}, 232162306a36Sopenharmony_ci { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 232262306a36Sopenharmony_ci LD_HDR, 0x0ff, 3, 0x0, 0xffff}, 232362306a36Sopenharmony_ci { "IP4 Fragment", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF, 232462306a36Sopenharmony_ci LD_FID, 0x103, 3, 0x0, 0xffff}, /* FID IP4 src+dst */ 232562306a36Sopenharmony_ci { "IP4 frag offset", 0x0000, 0x0000, OP_EQ, 0, S3_FOFF, 0, S3_FOFF, 232662306a36Sopenharmony_ci LD_SEQ, 0x040, 1, 0xD, 0xfff8}, 232762306a36Sopenharmony_ci { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 232862306a36Sopenharmony_ci IM_CTL, 0x001, 3, 0x0, 0x0001}, 232962306a36Sopenharmony_ci { NULL }, 233062306a36Sopenharmony_ci}; 233162306a36Sopenharmony_ci#ifdef HP_IP4FRAG_DEFAULT 233262306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_ip4fragtab 233362306a36Sopenharmony_ci#endif 233462306a36Sopenharmony_ci#endif 233562306a36Sopenharmony_ci 233662306a36Sopenharmony_ci/* 233762306a36Sopenharmony_ci * Alternate table which does batching without reassembly 233862306a36Sopenharmony_ci */ 233962306a36Sopenharmony_ci#ifdef USE_HP_IP46TCP4BATCH 234062306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_ip46tcp4batchtab[] = { 234162306a36Sopenharmony_ci CAS_PROG_IP46TCP4_PREAMBLE, 234262306a36Sopenharmony_ci { "TCP seq", /* DADDR should point to dest port */ 234362306a36Sopenharmony_ci 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 0, S1_TCPFG, LD_SEQ, 234462306a36Sopenharmony_ci 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ 234562306a36Sopenharmony_ci { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0, 234662306a36Sopenharmony_ci S1_TCPHL, ST_FLG, 0x000, 3, 0x0, 0x0000}, /* Load TCP flags */ 234762306a36Sopenharmony_ci { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, 234862306a36Sopenharmony_ci S1_TCPHc, LD_R1, 0x205, 3, 0xB, 0xf000}, 234962306a36Sopenharmony_ci { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, 235062306a36Sopenharmony_ci S1_PCKT, IM_CTL, 0x040, 3, 0x0, 0xffff}, /* set batch bit */ 235162306a36Sopenharmony_ci { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 235262306a36Sopenharmony_ci IM_CTL, 0x001, 3, 0x0, 0x0001}, 235362306a36Sopenharmony_ci { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, 235462306a36Sopenharmony_ci S1_PCKT, IM_CTL, 0x080, 3, 0x0, 0xffff}, 235562306a36Sopenharmony_ci { NULL }, 235662306a36Sopenharmony_ci}; 235762306a36Sopenharmony_ci#ifdef HP_IP46TCP4BATCH_DEFAULT 235862306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_ip46tcp4batchtab 235962306a36Sopenharmony_ci#endif 236062306a36Sopenharmony_ci#endif 236162306a36Sopenharmony_ci 236262306a36Sopenharmony_ci/* Workaround for Cassini rev2 descriptor corruption problem. 236362306a36Sopenharmony_ci * Does batching without reassembly, and sets the SAP to a known 236462306a36Sopenharmony_ci * data pattern for all packets. 236562306a36Sopenharmony_ci */ 236662306a36Sopenharmony_ci#ifdef USE_HP_WORKAROUND 236762306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_workaroundtab[] = { 236862306a36Sopenharmony_ci { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, 236962306a36Sopenharmony_ci S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000} , 237062306a36Sopenharmony_ci { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, 237162306a36Sopenharmony_ci IM_CTL, 0x04a, 3, 0x0, 0xffff}, 237262306a36Sopenharmony_ci { "CFI?", 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023, 237362306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 237462306a36Sopenharmony_ci { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, 237562306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 237662306a36Sopenharmony_ci { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, 237762306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 237862306a36Sopenharmony_ci { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, 237962306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 238062306a36Sopenharmony_ci { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, 238162306a36Sopenharmony_ci IM_SAP, 0x6AE, 3, 0x0, 0xffff}, 238262306a36Sopenharmony_ci { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, 238362306a36Sopenharmony_ci LD_SUM, 0x00a, 1, 0x0, 0x0000}, 238462306a36Sopenharmony_ci { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, 238562306a36Sopenharmony_ci LD_LEN, 0x03e, 1, 0x0, 0xffff}, 238662306a36Sopenharmony_ci { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_CLNP, 238762306a36Sopenharmony_ci LD_FID, 0x182, 3, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ 238862306a36Sopenharmony_ci { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, 238962306a36Sopenharmony_ci LD_SUM, 0x015, 1, 0x0, 0x0000}, 239062306a36Sopenharmony_ci { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, 239162306a36Sopenharmony_ci IM_R1, 0x128, 1, 0x0, 0xffff}, 239262306a36Sopenharmony_ci { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, 239362306a36Sopenharmony_ci LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ 239462306a36Sopenharmony_ci { "TCP64?", 0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_CLNP, 239562306a36Sopenharmony_ci LD_LEN, 0x03f, 1, 0x0, 0xffff}, 239662306a36Sopenharmony_ci { "TCP seq", /* DADDR should point to dest port */ 239762306a36Sopenharmony_ci 0x0000, 0x0000, OP_EQ, 0, S1_TCPFG, 4, S1_TCPFG, LD_SEQ, 239862306a36Sopenharmony_ci 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ 239962306a36Sopenharmony_ci { "TCP control flags", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHL, 0, 240062306a36Sopenharmony_ci S1_TCPHL, ST_FLG, 0x045, 3, 0x0, 0x002f}, /* Load TCP flags */ 240162306a36Sopenharmony_ci { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc, 240262306a36Sopenharmony_ci LD_R1, 0x205, 3, 0xB, 0xf000}, 240362306a36Sopenharmony_ci { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, 240462306a36Sopenharmony_ci S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff}, 240562306a36Sopenharmony_ci { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, 240662306a36Sopenharmony_ci IM_SAP, 0x6AE, 3, 0x0, 0xffff} , 240762306a36Sopenharmony_ci { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 240862306a36Sopenharmony_ci IM_CTL, 0x001, 3, 0x0, 0x0001}, 240962306a36Sopenharmony_ci { NULL }, 241062306a36Sopenharmony_ci}; 241162306a36Sopenharmony_ci#ifdef HP_WORKAROUND_DEFAULT 241262306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_workaroundtab 241362306a36Sopenharmony_ci#endif 241462306a36Sopenharmony_ci#endif 241562306a36Sopenharmony_ci 241662306a36Sopenharmony_ci#ifdef USE_HP_ENCRYPT 241762306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_encryptiontab[] = { 241862306a36Sopenharmony_ci { "packet arrival?", 0xffff, 0x0000, OP_NP, 6, S1_VLAN, 0, 241962306a36Sopenharmony_ci S1_PCKT, CL_REG, 0x3ff, 1, 0x0, 0x0000}, 242062306a36Sopenharmony_ci { "VLAN?", 0xffff, 0x8100, OP_EQ, 1, S1_CFI, 0, S1_8023, 242162306a36Sopenharmony_ci IM_CTL, 0x00a, 3, 0x0, 0xffff}, 242262306a36Sopenharmony_ci#if 0 242362306a36Sopenharmony_ci//"CFI?", /* 02 FIND CFI and If FIND go to S1_DROP */ 242462306a36Sopenharmony_ci//0x1000, 0x1000, OP_EQ, 0, S1_DROP, 1, S1_8023, CL_REG, 0x000, 0, 0x0, 0x00 242562306a36Sopenharmony_ci 00, 242662306a36Sopenharmony_ci#endif 242762306a36Sopenharmony_ci { "CFI?", /* FIND CFI and If FIND go to CleanUP1 (ignore and send to host) */ 242862306a36Sopenharmony_ci 0x1000, 0x1000, OP_EQ, 0, S1_CLNP, 1, S1_8023, 242962306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 243062306a36Sopenharmony_ci { "8023?", 0xffff, 0x0600, OP_LT, 1, S1_LLC, 0, S1_IPV4, 243162306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 243262306a36Sopenharmony_ci { "LLC?", 0xffff, 0xaaaa, OP_EQ, 1, S1_LLCc, 0, S1_CLNP, 243362306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 243462306a36Sopenharmony_ci { "LLCc?", 0xff00, 0x0300, OP_EQ, 2, S1_IPV4, 0, S1_CLNP, 243562306a36Sopenharmony_ci CL_REG, 0x000, 0, 0x0, 0x0000}, 243662306a36Sopenharmony_ci { "IPV4?", 0xffff, 0x0800, OP_EQ, 1, S1_IPV4c, 0, S1_IPV6, 243762306a36Sopenharmony_ci LD_SAP, 0x100, 3, 0x0, 0xffff}, 243862306a36Sopenharmony_ci { "IPV4 cont?", 0xff00, 0x4500, OP_EQ, 3, S1_IPV4F, 0, S1_CLNP, 243962306a36Sopenharmony_ci LD_SUM, 0x00a, 1, 0x0, 0x0000}, 244062306a36Sopenharmony_ci { "IPV4 frag?", 0x3fff, 0x0000, OP_EQ, 1, S1_TCP44, 0, S1_CLNP, 244162306a36Sopenharmony_ci LD_LEN, 0x03e, 1, 0x0, 0xffff}, 244262306a36Sopenharmony_ci { "TCP44?", 0x00ff, 0x0006, OP_EQ, 7, S1_TCPSQ, 0, S1_ESP4, 244362306a36Sopenharmony_ci LD_FID, 0x182, 1, 0x0, 0xffff}, /* FID IP4&TCP src+dst */ 244462306a36Sopenharmony_ci { "IPV6?", 0xffff, 0x86dd, OP_EQ, 1, S1_IPV6L, 0, S1_CLNP, 244562306a36Sopenharmony_ci LD_SUM, 0x015, 1, 0x0, 0x0000}, 244662306a36Sopenharmony_ci { "IPV6 len", 0xf000, 0x6000, OP_EQ, 0, S1_IPV6c, 0, S1_CLNP, 244762306a36Sopenharmony_ci IM_R1, 0x128, 1, 0x0, 0xffff}, 244862306a36Sopenharmony_ci { "IPV6 cont?", 0x0000, 0x0000, OP_EQ, 3, S1_TCP64, 0, S1_CLNP, 244962306a36Sopenharmony_ci LD_FID, 0x484, 1, 0x0, 0xffff}, /* FID IP6&TCP src+dst */ 245062306a36Sopenharmony_ci { "TCP64?", 245162306a36Sopenharmony_ci#if 0 245262306a36Sopenharmony_ci//@@@0xff00, 0x0600, OP_EQ, 18, S1_TCPSQ, 0, S1_ESP6, LD_LEN, 0x03f, 1, 0x0, 0xffff, 245362306a36Sopenharmony_ci#endif 245462306a36Sopenharmony_ci 0xff00, 0x0600, OP_EQ, 12, S1_TCPSQ, 0, S1_ESP6, LD_LEN, 245562306a36Sopenharmony_ci 0x03f, 1, 0x0, 0xffff}, 245662306a36Sopenharmony_ci { "TCP seq", /* 14:DADDR should point to dest port */ 245762306a36Sopenharmony_ci 0xFFFF, 0x0080, OP_EQ, 0, S2_HTTP, 0, S1_TCPFG, LD_SEQ, 245862306a36Sopenharmony_ci 0x081, 3, 0x0, 0xffff}, /* Load TCP seq # */ 245962306a36Sopenharmony_ci { "TCP control flags", 0xFFFF, 0x8080, OP_EQ, 0, S2_HTTP, 0, 246062306a36Sopenharmony_ci S1_TCPHL, ST_FLG, 0x145, 2, 0x0, 0x002f}, /* Load TCP flags */ 246162306a36Sopenharmony_ci { "TCP length", 0x0000, 0x0000, OP_EQ, 0, S1_TCPHc, 0, S1_TCPHc, 246262306a36Sopenharmony_ci LD_R1, 0x205, 3, 0xB, 0xf000} , 246362306a36Sopenharmony_ci { "TCP length cont", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, 246462306a36Sopenharmony_ci S1_PCKT, LD_HDR, 0x0ff, 3, 0x0, 0xffff}, 246562306a36Sopenharmony_ci { "Cleanup", 0x0000, 0x0000, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP2, 246662306a36Sopenharmony_ci IM_CTL, 0x001, 3, 0x0, 0x0001}, 246762306a36Sopenharmony_ci { "Cleanup 2", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 246862306a36Sopenharmony_ci CL_REG, 0x002, 3, 0x0, 0x0000}, 246962306a36Sopenharmony_ci { "Drop packet", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 247062306a36Sopenharmony_ci IM_CTL, 0x080, 3, 0x0, 0xffff}, 247162306a36Sopenharmony_ci { "No HTTP", 0x0000, 0x0000, OP_EQ, 0, S1_PCKT, 0, S1_PCKT, 247262306a36Sopenharmony_ci IM_CTL, 0x044, 3, 0x0, 0xffff}, 247362306a36Sopenharmony_ci { "IPV4 ESP encrypted?", /* S1_ESP4 */ 247462306a36Sopenharmony_ci 0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH4, IM_CTL, 247562306a36Sopenharmony_ci 0x021, 1, 0x0, 0xffff}, 247662306a36Sopenharmony_ci { "IPV4 AH encrypted?", /* S1_AH4 */ 247762306a36Sopenharmony_ci 0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, 247862306a36Sopenharmony_ci 0x021, 1, 0x0, 0xffff}, 247962306a36Sopenharmony_ci { "IPV6 ESP encrypted?", /* S1_ESP6 */ 248062306a36Sopenharmony_ci#if 0 248162306a36Sopenharmony_ci//@@@0x00ff, 0x0032, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL, 0x021, 1, 0x0, 0xffff, 248262306a36Sopenharmony_ci#endif 248362306a36Sopenharmony_ci 0xff00, 0x3200, OP_EQ, 0, S1_CLNP2, 0, S1_AH6, IM_CTL, 248462306a36Sopenharmony_ci 0x021, 1, 0x0, 0xffff}, 248562306a36Sopenharmony_ci { "IPV6 AH encrypted?", /* S1_AH6 */ 248662306a36Sopenharmony_ci#if 0 248762306a36Sopenharmony_ci//@@@0x00ff, 0x0033, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, 0x021, 1, 0x0, 0xffff, 248862306a36Sopenharmony_ci#endif 248962306a36Sopenharmony_ci 0xff00, 0x3300, OP_EQ, 0, S1_CLNP2, 0, S1_CLNP, IM_CTL, 249062306a36Sopenharmony_ci 0x021, 1, 0x0, 0xffff}, 249162306a36Sopenharmony_ci { NULL }, 249262306a36Sopenharmony_ci}; 249362306a36Sopenharmony_ci#ifdef HP_ENCRYPT_DEFAULT 249462306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_encryptiontab 249562306a36Sopenharmony_ci#endif 249662306a36Sopenharmony_ci#endif 249762306a36Sopenharmony_ci 249862306a36Sopenharmony_cistatic cas_hp_inst_t cas_prog_null[] = { {NULL} }; 249962306a36Sopenharmony_ci#ifdef HP_NULL_DEFAULT 250062306a36Sopenharmony_ci#define CAS_HP_FIRMWARE cas_prog_null 250162306a36Sopenharmony_ci#endif 250262306a36Sopenharmony_ci 250362306a36Sopenharmony_ci/* phy types */ 250462306a36Sopenharmony_ci#define CAS_PHY_UNKNOWN 0x00 250562306a36Sopenharmony_ci#define CAS_PHY_SERDES 0x01 250662306a36Sopenharmony_ci#define CAS_PHY_MII_MDIO0 0x02 250762306a36Sopenharmony_ci#define CAS_PHY_MII_MDIO1 0x04 250862306a36Sopenharmony_ci#define CAS_PHY_MII(x) ((x) & (CAS_PHY_MII_MDIO0 | CAS_PHY_MII_MDIO1)) 250962306a36Sopenharmony_ci 251062306a36Sopenharmony_ci/* _RING_INDEX is the index for the ring sizes to be used. _RING_SIZE 251162306a36Sopenharmony_ci * is the actual size. the default index for the various rings is 251262306a36Sopenharmony_ci * 8. NOTE: there a bunch of alignment constraints for the rings. to 251362306a36Sopenharmony_ci * deal with that, i just allocate rings to create the desired 251462306a36Sopenharmony_ci * alignment. here are the constraints: 251562306a36Sopenharmony_ci * RX DESC and COMP rings must be 8KB aligned 251662306a36Sopenharmony_ci * TX DESC must be 2KB aligned. 251762306a36Sopenharmony_ci * if you change the numbers, be cognizant of how the alignment will change 251862306a36Sopenharmony_ci * in INIT_BLOCK as well. 251962306a36Sopenharmony_ci */ 252062306a36Sopenharmony_ci 252162306a36Sopenharmony_ci#define DESC_RING_I_TO_S(x) (32*(1 << (x))) 252262306a36Sopenharmony_ci#define COMP_RING_I_TO_S(x) (128*(1 << (x))) 252362306a36Sopenharmony_ci#define TX_DESC_RING_INDEX 4 /* 512 = 8k */ 252462306a36Sopenharmony_ci#define RX_DESC_RING_INDEX 4 /* 512 = 8k */ 252562306a36Sopenharmony_ci#define RX_COMP_RING_INDEX 4 /* 2048 = 64k: should be 4x rx ring size */ 252662306a36Sopenharmony_ci 252762306a36Sopenharmony_ci#if (TX_DESC_RING_INDEX > 8) || (TX_DESC_RING_INDEX < 0) 252862306a36Sopenharmony_ci#error TX_DESC_RING_INDEX must be between 0 and 8 252962306a36Sopenharmony_ci#endif 253062306a36Sopenharmony_ci 253162306a36Sopenharmony_ci#if (RX_DESC_RING_INDEX > 8) || (RX_DESC_RING_INDEX < 0) 253262306a36Sopenharmony_ci#error RX_DESC_RING_INDEX must be between 0 and 8 253362306a36Sopenharmony_ci#endif 253462306a36Sopenharmony_ci 253562306a36Sopenharmony_ci#if (RX_COMP_RING_INDEX > 8) || (RX_COMP_RING_INDEX < 0) 253662306a36Sopenharmony_ci#error RX_COMP_RING_INDEX must be between 0 and 8 253762306a36Sopenharmony_ci#endif 253862306a36Sopenharmony_ci 253962306a36Sopenharmony_ci#define N_TX_RINGS MAX_TX_RINGS /* for QoS */ 254062306a36Sopenharmony_ci#define N_TX_RINGS_MASK MAX_TX_RINGS_MASK 254162306a36Sopenharmony_ci#define N_RX_DESC_RINGS MAX_RX_DESC_RINGS /* 1 for ipsec */ 254262306a36Sopenharmony_ci#define N_RX_COMP_RINGS 0x1 /* for mult. PCI interrupts */ 254362306a36Sopenharmony_ci 254462306a36Sopenharmony_ci/* number of flows that can go through re-assembly */ 254562306a36Sopenharmony_ci#define N_RX_FLOWS 64 254662306a36Sopenharmony_ci 254762306a36Sopenharmony_ci#define TX_DESC_RING_SIZE DESC_RING_I_TO_S(TX_DESC_RING_INDEX) 254862306a36Sopenharmony_ci#define RX_DESC_RING_SIZE DESC_RING_I_TO_S(RX_DESC_RING_INDEX) 254962306a36Sopenharmony_ci#define RX_COMP_RING_SIZE COMP_RING_I_TO_S(RX_COMP_RING_INDEX) 255062306a36Sopenharmony_ci#define TX_DESC_RINGN_INDEX(x) TX_DESC_RING_INDEX 255162306a36Sopenharmony_ci#define RX_DESC_RINGN_INDEX(x) RX_DESC_RING_INDEX 255262306a36Sopenharmony_ci#define RX_COMP_RINGN_INDEX(x) RX_COMP_RING_INDEX 255362306a36Sopenharmony_ci#define TX_DESC_RINGN_SIZE(x) TX_DESC_RING_SIZE 255462306a36Sopenharmony_ci#define RX_DESC_RINGN_SIZE(x) RX_DESC_RING_SIZE 255562306a36Sopenharmony_ci#define RX_COMP_RINGN_SIZE(x) RX_COMP_RING_SIZE 255662306a36Sopenharmony_ci 255762306a36Sopenharmony_ci/* convert values */ 255862306a36Sopenharmony_ci#define CAS_BASE(x, y) (((y) << (x ## _SHIFT)) & (x ## _MASK)) 255962306a36Sopenharmony_ci#define CAS_VAL(x, y) (((y) & (x ## _MASK)) >> (x ## _SHIFT)) 256062306a36Sopenharmony_ci#define CAS_TX_RINGN_BASE(y) ((TX_DESC_RINGN_INDEX(y) << \ 256162306a36Sopenharmony_ci TX_CFG_DESC_RINGN_SHIFT(y)) & \ 256262306a36Sopenharmony_ci TX_CFG_DESC_RINGN_MASK(y)) 256362306a36Sopenharmony_ci 256462306a36Sopenharmony_ci/* min is 2k, but we can't do jumbo frames unless it's at least 8k */ 256562306a36Sopenharmony_ci#define CAS_MIN_PAGE_SHIFT 11 /* 2048 */ 256662306a36Sopenharmony_ci#define CAS_JUMBO_PAGE_SHIFT 13 /* 8192 */ 256762306a36Sopenharmony_ci#define CAS_MAX_PAGE_SHIFT 14 /* 16384 */ 256862306a36Sopenharmony_ci 256962306a36Sopenharmony_ci#define TX_DESC_BUFLEN_MASK 0x0000000000003FFFULL /* buffer length in 257062306a36Sopenharmony_ci bytes. 0 - 9256 */ 257162306a36Sopenharmony_ci#define TX_DESC_BUFLEN_SHIFT 0 257262306a36Sopenharmony_ci#define TX_DESC_CSUM_START_MASK 0x00000000001F8000ULL /* checksum start. # 257362306a36Sopenharmony_ci of bytes to be 257462306a36Sopenharmony_ci skipped before 257562306a36Sopenharmony_ci csum calc begins. 257662306a36Sopenharmony_ci value must be 257762306a36Sopenharmony_ci even */ 257862306a36Sopenharmony_ci#define TX_DESC_CSUM_START_SHIFT 15 257962306a36Sopenharmony_ci#define TX_DESC_CSUM_STUFF_MASK 0x000000001FE00000ULL /* checksum stuff. 258062306a36Sopenharmony_ci byte offset w/in 258162306a36Sopenharmony_ci the pkt for the 258262306a36Sopenharmony_ci 1st csum byte. 258362306a36Sopenharmony_ci must be > 8 */ 258462306a36Sopenharmony_ci#define TX_DESC_CSUM_STUFF_SHIFT 21 258562306a36Sopenharmony_ci#define TX_DESC_CSUM_EN 0x0000000020000000ULL /* enable checksum */ 258662306a36Sopenharmony_ci#define TX_DESC_EOF 0x0000000040000000ULL /* end of frame */ 258762306a36Sopenharmony_ci#define TX_DESC_SOF 0x0000000080000000ULL /* start of frame */ 258862306a36Sopenharmony_ci#define TX_DESC_INTME 0x0000000100000000ULL /* interrupt me */ 258962306a36Sopenharmony_ci#define TX_DESC_NO_CRC 0x0000000200000000ULL /* debugging only. 259062306a36Sopenharmony_ci CRC will not be 259162306a36Sopenharmony_ci inserted into 259262306a36Sopenharmony_ci outgoing frame. */ 259362306a36Sopenharmony_cistruct cas_tx_desc { 259462306a36Sopenharmony_ci __le64 control; 259562306a36Sopenharmony_ci __le64 buffer; 259662306a36Sopenharmony_ci}; 259762306a36Sopenharmony_ci 259862306a36Sopenharmony_ci/* descriptor ring for free buffers contains page-sized buffers. the index 259962306a36Sopenharmony_ci * value is not used by the hw in any way. it's just stored and returned in 260062306a36Sopenharmony_ci * the completion ring. 260162306a36Sopenharmony_ci */ 260262306a36Sopenharmony_cistruct cas_rx_desc { 260362306a36Sopenharmony_ci __le64 index; 260462306a36Sopenharmony_ci __le64 buffer; 260562306a36Sopenharmony_ci}; 260662306a36Sopenharmony_ci 260762306a36Sopenharmony_ci/* received packets are put on the completion ring. */ 260862306a36Sopenharmony_ci/* word 1 */ 260962306a36Sopenharmony_ci#define RX_COMP1_DATA_SIZE_MASK 0x0000000007FFE000ULL 261062306a36Sopenharmony_ci#define RX_COMP1_DATA_SIZE_SHIFT 13 261162306a36Sopenharmony_ci#define RX_COMP1_DATA_OFF_MASK 0x000001FFF8000000ULL 261262306a36Sopenharmony_ci#define RX_COMP1_DATA_OFF_SHIFT 27 261362306a36Sopenharmony_ci#define RX_COMP1_DATA_INDEX_MASK 0x007FFE0000000000ULL 261462306a36Sopenharmony_ci#define RX_COMP1_DATA_INDEX_SHIFT 41 261562306a36Sopenharmony_ci#define RX_COMP1_SKIP_MASK 0x0180000000000000ULL 261662306a36Sopenharmony_ci#define RX_COMP1_SKIP_SHIFT 55 261762306a36Sopenharmony_ci#define RX_COMP1_RELEASE_NEXT 0x0200000000000000ULL 261862306a36Sopenharmony_ci#define RX_COMP1_SPLIT_PKT 0x0400000000000000ULL 261962306a36Sopenharmony_ci#define RX_COMP1_RELEASE_FLOW 0x0800000000000000ULL 262062306a36Sopenharmony_ci#define RX_COMP1_RELEASE_DATA 0x1000000000000000ULL 262162306a36Sopenharmony_ci#define RX_COMP1_RELEASE_HDR 0x2000000000000000ULL 262262306a36Sopenharmony_ci#define RX_COMP1_TYPE_MASK 0xC000000000000000ULL 262362306a36Sopenharmony_ci#define RX_COMP1_TYPE_SHIFT 62 262462306a36Sopenharmony_ci 262562306a36Sopenharmony_ci/* word 2 */ 262662306a36Sopenharmony_ci#define RX_COMP2_NEXT_INDEX_MASK 0x00000007FFE00000ULL 262762306a36Sopenharmony_ci#define RX_COMP2_NEXT_INDEX_SHIFT 21 262862306a36Sopenharmony_ci#define RX_COMP2_HDR_SIZE_MASK 0x00000FF800000000ULL 262962306a36Sopenharmony_ci#define RX_COMP2_HDR_SIZE_SHIFT 35 263062306a36Sopenharmony_ci#define RX_COMP2_HDR_OFF_MASK 0x0003F00000000000ULL 263162306a36Sopenharmony_ci#define RX_COMP2_HDR_OFF_SHIFT 44 263262306a36Sopenharmony_ci#define RX_COMP2_HDR_INDEX_MASK 0xFFFC000000000000ULL 263362306a36Sopenharmony_ci#define RX_COMP2_HDR_INDEX_SHIFT 50 263462306a36Sopenharmony_ci 263562306a36Sopenharmony_ci/* word 3 */ 263662306a36Sopenharmony_ci#define RX_COMP3_SMALL_PKT 0x0000000000000001ULL 263762306a36Sopenharmony_ci#define RX_COMP3_JUMBO_PKT 0x0000000000000002ULL 263862306a36Sopenharmony_ci#define RX_COMP3_JUMBO_HDR_SPLIT_EN 0x0000000000000004ULL 263962306a36Sopenharmony_ci#define RX_COMP3_CSUM_START_MASK 0x000000000007F000ULL 264062306a36Sopenharmony_ci#define RX_COMP3_CSUM_START_SHIFT 12 264162306a36Sopenharmony_ci#define RX_COMP3_FLOWID_MASK 0x0000000001F80000ULL 264262306a36Sopenharmony_ci#define RX_COMP3_FLOWID_SHIFT 19 264362306a36Sopenharmony_ci#define RX_COMP3_OPCODE_MASK 0x000000000E000000ULL 264462306a36Sopenharmony_ci#define RX_COMP3_OPCODE_SHIFT 25 264562306a36Sopenharmony_ci#define RX_COMP3_FORCE_FLAG 0x0000000010000000ULL 264662306a36Sopenharmony_ci#define RX_COMP3_NO_ASSIST 0x0000000020000000ULL 264762306a36Sopenharmony_ci#define RX_COMP3_LOAD_BAL_MASK 0x000001F800000000ULL 264862306a36Sopenharmony_ci#define RX_COMP3_LOAD_BAL_SHIFT 35 264962306a36Sopenharmony_ci#define RX_PLUS_COMP3_ENC_PKT 0x0000020000000000ULL /* cas+ */ 265062306a36Sopenharmony_ci#define RX_COMP3_L3_HEAD_OFF_MASK 0x0000FE0000000000ULL /* cas */ 265162306a36Sopenharmony_ci#define RX_COMP3_L3_HEAD_OFF_SHIFT 41 265262306a36Sopenharmony_ci#define RX_PLUS_COMP_L3_HEAD_OFF_MASK 0x0000FC0000000000ULL /* cas+ */ 265362306a36Sopenharmony_ci#define RX_PLUS_COMP_L3_HEAD_OFF_SHIFT 42 265462306a36Sopenharmony_ci#define RX_COMP3_SAP_MASK 0xFFFF000000000000ULL 265562306a36Sopenharmony_ci#define RX_COMP3_SAP_SHIFT 48 265662306a36Sopenharmony_ci 265762306a36Sopenharmony_ci/* word 4 */ 265862306a36Sopenharmony_ci#define RX_COMP4_TCP_CSUM_MASK 0x000000000000FFFFULL 265962306a36Sopenharmony_ci#define RX_COMP4_TCP_CSUM_SHIFT 0 266062306a36Sopenharmony_ci#define RX_COMP4_PKT_LEN_MASK 0x000000003FFF0000ULL 266162306a36Sopenharmony_ci#define RX_COMP4_PKT_LEN_SHIFT 16 266262306a36Sopenharmony_ci#define RX_COMP4_PERFECT_MATCH_MASK 0x00000003C0000000ULL 266362306a36Sopenharmony_ci#define RX_COMP4_PERFECT_MATCH_SHIFT 30 266462306a36Sopenharmony_ci#define RX_COMP4_ZERO 0x0000080000000000ULL 266562306a36Sopenharmony_ci#define RX_COMP4_HASH_VAL_MASK 0x0FFFF00000000000ULL 266662306a36Sopenharmony_ci#define RX_COMP4_HASH_VAL_SHIFT 44 266762306a36Sopenharmony_ci#define RX_COMP4_HASH_PASS 0x1000000000000000ULL 266862306a36Sopenharmony_ci#define RX_COMP4_BAD 0x4000000000000000ULL 266962306a36Sopenharmony_ci#define RX_COMP4_LEN_MISMATCH 0x8000000000000000ULL 267062306a36Sopenharmony_ci 267162306a36Sopenharmony_ci/* we encode the following: ring/index/release. only 14 bits 267262306a36Sopenharmony_ci * are usable. 267362306a36Sopenharmony_ci * NOTE: the encoding is dependent upon RX_DESC_RING_SIZE and 267462306a36Sopenharmony_ci * MAX_RX_DESC_RINGS. */ 267562306a36Sopenharmony_ci#define RX_INDEX_NUM_MASK 0x0000000000000FFFULL 267662306a36Sopenharmony_ci#define RX_INDEX_NUM_SHIFT 0 267762306a36Sopenharmony_ci#define RX_INDEX_RING_MASK 0x0000000000001000ULL 267862306a36Sopenharmony_ci#define RX_INDEX_RING_SHIFT 12 267962306a36Sopenharmony_ci#define RX_INDEX_RELEASE 0x0000000000002000ULL 268062306a36Sopenharmony_ci 268162306a36Sopenharmony_cistruct cas_rx_comp { 268262306a36Sopenharmony_ci __le64 word1; 268362306a36Sopenharmony_ci __le64 word2; 268462306a36Sopenharmony_ci __le64 word3; 268562306a36Sopenharmony_ci __le64 word4; 268662306a36Sopenharmony_ci}; 268762306a36Sopenharmony_ci 268862306a36Sopenharmony_cienum link_state { 268962306a36Sopenharmony_ci link_down = 0, /* No link, will retry */ 269062306a36Sopenharmony_ci link_aneg, /* Autoneg in progress */ 269162306a36Sopenharmony_ci link_force_try, /* Try Forced link speed */ 269262306a36Sopenharmony_ci link_force_ret, /* Forced mode worked, retrying autoneg */ 269362306a36Sopenharmony_ci link_force_ok, /* Stay in forced mode */ 269462306a36Sopenharmony_ci link_up /* Link is up */ 269562306a36Sopenharmony_ci}; 269662306a36Sopenharmony_ci 269762306a36Sopenharmony_citypedef struct cas_page { 269862306a36Sopenharmony_ci struct list_head list; 269962306a36Sopenharmony_ci struct page *buffer; 270062306a36Sopenharmony_ci dma_addr_t dma_addr; 270162306a36Sopenharmony_ci int used; 270262306a36Sopenharmony_ci} cas_page_t; 270362306a36Sopenharmony_ci 270462306a36Sopenharmony_ci 270562306a36Sopenharmony_ci/* some alignment constraints: 270662306a36Sopenharmony_ci * TX DESC, RX DESC, and RX COMP must each be 8K aligned. 270762306a36Sopenharmony_ci * TX COMPWB must be 8-byte aligned. 270862306a36Sopenharmony_ci * to accomplish this, here's what we do: 270962306a36Sopenharmony_ci * 271062306a36Sopenharmony_ci * INIT_BLOCK_RX_COMP = 64k (already aligned) 271162306a36Sopenharmony_ci * INIT_BLOCK_RX_DESC = 8k 271262306a36Sopenharmony_ci * INIT_BLOCK_TX = 8k 271362306a36Sopenharmony_ci * INIT_BLOCK_RX1_DESC = 8k 271462306a36Sopenharmony_ci * TX COMPWB 271562306a36Sopenharmony_ci */ 271662306a36Sopenharmony_ci#define INIT_BLOCK_TX (TX_DESC_RING_SIZE) 271762306a36Sopenharmony_ci#define INIT_BLOCK_RX_DESC (RX_DESC_RING_SIZE) 271862306a36Sopenharmony_ci#define INIT_BLOCK_RX_COMP (RX_COMP_RING_SIZE) 271962306a36Sopenharmony_ci 272062306a36Sopenharmony_cistruct cas_init_block { 272162306a36Sopenharmony_ci struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; 272262306a36Sopenharmony_ci struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; 272362306a36Sopenharmony_ci struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; 272462306a36Sopenharmony_ci __le64 tx_compwb; 272562306a36Sopenharmony_ci}; 272662306a36Sopenharmony_ci 272762306a36Sopenharmony_ci/* tiny buffers to deal with target abort issue. we allocate a bit 272862306a36Sopenharmony_ci * over so that we don't have target abort issues with these buffers 272962306a36Sopenharmony_ci * as well. 273062306a36Sopenharmony_ci */ 273162306a36Sopenharmony_ci#define TX_TINY_BUF_LEN 0x100 273262306a36Sopenharmony_ci#define TX_TINY_BUF_BLOCK ((INIT_BLOCK_TX + 1)*TX_TINY_BUF_LEN) 273362306a36Sopenharmony_ci 273462306a36Sopenharmony_cistruct cas_tiny_count { 273562306a36Sopenharmony_ci int nbufs; 273662306a36Sopenharmony_ci int used; 273762306a36Sopenharmony_ci}; 273862306a36Sopenharmony_ci 273962306a36Sopenharmony_cistruct cas { 274062306a36Sopenharmony_ci spinlock_t lock; /* for most bits */ 274162306a36Sopenharmony_ci spinlock_t tx_lock[N_TX_RINGS]; /* tx bits */ 274262306a36Sopenharmony_ci spinlock_t stat_lock[N_TX_RINGS + 1]; /* for stat gathering */ 274362306a36Sopenharmony_ci spinlock_t rx_inuse_lock; /* rx inuse list */ 274462306a36Sopenharmony_ci spinlock_t rx_spare_lock; /* rx spare list */ 274562306a36Sopenharmony_ci 274662306a36Sopenharmony_ci void __iomem *regs; 274762306a36Sopenharmony_ci int tx_new[N_TX_RINGS], tx_old[N_TX_RINGS]; 274862306a36Sopenharmony_ci int rx_old[N_RX_DESC_RINGS]; 274962306a36Sopenharmony_ci int rx_cur[N_RX_COMP_RINGS], rx_new[N_RX_COMP_RINGS]; 275062306a36Sopenharmony_ci int rx_last[N_RX_DESC_RINGS]; 275162306a36Sopenharmony_ci 275262306a36Sopenharmony_ci struct napi_struct napi; 275362306a36Sopenharmony_ci 275462306a36Sopenharmony_ci /* Set when chip is actually in operational state 275562306a36Sopenharmony_ci * (ie. not power managed) */ 275662306a36Sopenharmony_ci int hw_running; 275762306a36Sopenharmony_ci int opened; 275862306a36Sopenharmony_ci struct mutex pm_mutex; /* open/close/suspend/resume */ 275962306a36Sopenharmony_ci 276062306a36Sopenharmony_ci struct cas_init_block *init_block; 276162306a36Sopenharmony_ci struct cas_tx_desc *init_txds[MAX_TX_RINGS]; 276262306a36Sopenharmony_ci struct cas_rx_desc *init_rxds[MAX_RX_DESC_RINGS]; 276362306a36Sopenharmony_ci struct cas_rx_comp *init_rxcs[MAX_RX_COMP_RINGS]; 276462306a36Sopenharmony_ci 276562306a36Sopenharmony_ci /* we use sk_buffs for tx and pages for rx. the rx skbuffs 276662306a36Sopenharmony_ci * are there for flow re-assembly. */ 276762306a36Sopenharmony_ci struct sk_buff *tx_skbs[N_TX_RINGS][TX_DESC_RING_SIZE]; 276862306a36Sopenharmony_ci struct sk_buff_head rx_flows[N_RX_FLOWS]; 276962306a36Sopenharmony_ci cas_page_t *rx_pages[N_RX_DESC_RINGS][RX_DESC_RING_SIZE]; 277062306a36Sopenharmony_ci struct list_head rx_spare_list, rx_inuse_list; 277162306a36Sopenharmony_ci int rx_spares_needed; 277262306a36Sopenharmony_ci 277362306a36Sopenharmony_ci /* for small packets when copying would be quicker than 277462306a36Sopenharmony_ci mapping */ 277562306a36Sopenharmony_ci struct cas_tiny_count tx_tiny_use[N_TX_RINGS][TX_DESC_RING_SIZE]; 277662306a36Sopenharmony_ci u8 *tx_tiny_bufs[N_TX_RINGS]; 277762306a36Sopenharmony_ci 277862306a36Sopenharmony_ci u32 msg_enable; 277962306a36Sopenharmony_ci 278062306a36Sopenharmony_ci /* N_TX_RINGS must be >= N_RX_DESC_RINGS */ 278162306a36Sopenharmony_ci struct net_device_stats net_stats[N_TX_RINGS + 1]; 278262306a36Sopenharmony_ci 278362306a36Sopenharmony_ci u32 pci_cfg[64 >> 2]; 278462306a36Sopenharmony_ci u8 pci_revision; 278562306a36Sopenharmony_ci 278662306a36Sopenharmony_ci int phy_type; 278762306a36Sopenharmony_ci int phy_addr; 278862306a36Sopenharmony_ci u32 phy_id; 278962306a36Sopenharmony_ci#define CAS_FLAG_1000MB_CAP 0x00000001 279062306a36Sopenharmony_ci#define CAS_FLAG_REG_PLUS 0x00000002 279162306a36Sopenharmony_ci#define CAS_FLAG_TARGET_ABORT 0x00000004 279262306a36Sopenharmony_ci#define CAS_FLAG_SATURN 0x00000008 279362306a36Sopenharmony_ci#define CAS_FLAG_RXD_POST_MASK 0x000000F0 279462306a36Sopenharmony_ci#define CAS_FLAG_RXD_POST_SHIFT 4 279562306a36Sopenharmony_ci#define CAS_FLAG_RXD_POST(x) ((1 << (CAS_FLAG_RXD_POST_SHIFT + (x))) & \ 279662306a36Sopenharmony_ci CAS_FLAG_RXD_POST_MASK) 279762306a36Sopenharmony_ci#define CAS_FLAG_ENTROPY_DEV 0x00000100 279862306a36Sopenharmony_ci#define CAS_FLAG_NO_HW_CSUM 0x00000200 279962306a36Sopenharmony_ci u32 cas_flags; 280062306a36Sopenharmony_ci int packet_min; /* minimum packet size */ 280162306a36Sopenharmony_ci int tx_fifo_size; 280262306a36Sopenharmony_ci int rx_fifo_size; 280362306a36Sopenharmony_ci int rx_pause_off; 280462306a36Sopenharmony_ci int rx_pause_on; 280562306a36Sopenharmony_ci int crc_size; /* 4 if half-duplex */ 280662306a36Sopenharmony_ci 280762306a36Sopenharmony_ci int pci_irq_INTC; 280862306a36Sopenharmony_ci int min_frame_size; /* for tx fifo workaround */ 280962306a36Sopenharmony_ci 281062306a36Sopenharmony_ci /* page size allocation */ 281162306a36Sopenharmony_ci int page_size; 281262306a36Sopenharmony_ci int page_order; 281362306a36Sopenharmony_ci int mtu_stride; 281462306a36Sopenharmony_ci 281562306a36Sopenharmony_ci u32 mac_rx_cfg; 281662306a36Sopenharmony_ci 281762306a36Sopenharmony_ci /* Autoneg & PHY control */ 281862306a36Sopenharmony_ci int link_cntl; 281962306a36Sopenharmony_ci int link_fcntl; 282062306a36Sopenharmony_ci enum link_state lstate; 282162306a36Sopenharmony_ci struct timer_list link_timer; 282262306a36Sopenharmony_ci int timer_ticks; 282362306a36Sopenharmony_ci struct work_struct reset_task; 282462306a36Sopenharmony_ci#if 0 282562306a36Sopenharmony_ci atomic_t reset_task_pending; 282662306a36Sopenharmony_ci#else 282762306a36Sopenharmony_ci atomic_t reset_task_pending; 282862306a36Sopenharmony_ci atomic_t reset_task_pending_mtu; 282962306a36Sopenharmony_ci atomic_t reset_task_pending_spare; 283062306a36Sopenharmony_ci atomic_t reset_task_pending_all; 283162306a36Sopenharmony_ci#endif 283262306a36Sopenharmony_ci 283362306a36Sopenharmony_ci /* Link-down problem workaround */ 283462306a36Sopenharmony_ci#define LINK_TRANSITION_UNKNOWN 0 283562306a36Sopenharmony_ci#define LINK_TRANSITION_ON_FAILURE 1 283662306a36Sopenharmony_ci#define LINK_TRANSITION_STILL_FAILED 2 283762306a36Sopenharmony_ci#define LINK_TRANSITION_LINK_UP 3 283862306a36Sopenharmony_ci#define LINK_TRANSITION_LINK_CONFIG 4 283962306a36Sopenharmony_ci#define LINK_TRANSITION_LINK_DOWN 5 284062306a36Sopenharmony_ci#define LINK_TRANSITION_REQUESTED_RESET 6 284162306a36Sopenharmony_ci int link_transition; 284262306a36Sopenharmony_ci int link_transition_jiffies_valid; 284362306a36Sopenharmony_ci unsigned long link_transition_jiffies; 284462306a36Sopenharmony_ci 284562306a36Sopenharmony_ci /* Tuning */ 284662306a36Sopenharmony_ci u8 orig_cacheline_size; /* value when loaded */ 284762306a36Sopenharmony_ci#define CAS_PREF_CACHELINE_SIZE 0x20 /* Minimum desired */ 284862306a36Sopenharmony_ci 284962306a36Sopenharmony_ci /* Diagnostic counters and state. */ 285062306a36Sopenharmony_ci int casreg_len; /* reg-space size for dumping */ 285162306a36Sopenharmony_ci u64 pause_entered; 285262306a36Sopenharmony_ci u16 pause_last_time_recvd; 285362306a36Sopenharmony_ci 285462306a36Sopenharmony_ci dma_addr_t block_dvma, tx_tiny_dvma[N_TX_RINGS]; 285562306a36Sopenharmony_ci struct pci_dev *pdev; 285662306a36Sopenharmony_ci struct net_device *dev; 285762306a36Sopenharmony_ci#if defined(CONFIG_OF) 285862306a36Sopenharmony_ci struct device_node *of_node; 285962306a36Sopenharmony_ci#endif 286062306a36Sopenharmony_ci 286162306a36Sopenharmony_ci /* Firmware Info */ 286262306a36Sopenharmony_ci u16 fw_load_addr; 286362306a36Sopenharmony_ci u32 fw_size; 286462306a36Sopenharmony_ci u8 *fw_data; 286562306a36Sopenharmony_ci}; 286662306a36Sopenharmony_ci 286762306a36Sopenharmony_ci#define TX_DESC_NEXT(r, x) (((x) + 1) & (TX_DESC_RINGN_SIZE(r) - 1)) 286862306a36Sopenharmony_ci#define RX_DESC_ENTRY(r, x) ((x) & (RX_DESC_RINGN_SIZE(r) - 1)) 286962306a36Sopenharmony_ci#define RX_COMP_ENTRY(r, x) ((x) & (RX_COMP_RINGN_SIZE(r) - 1)) 287062306a36Sopenharmony_ci 287162306a36Sopenharmony_ci#define TX_BUFF_COUNT(r, x, y) ((x) <= (y) ? ((y) - (x)) : \ 287262306a36Sopenharmony_ci (TX_DESC_RINGN_SIZE(r) - (x) + (y))) 287362306a36Sopenharmony_ci 287462306a36Sopenharmony_ci#define TX_BUFFS_AVAIL(cp, i) ((cp)->tx_old[(i)] <= (cp)->tx_new[(i)] ? \ 287562306a36Sopenharmony_ci (cp)->tx_old[(i)] + (TX_DESC_RINGN_SIZE(i) - 1) - (cp)->tx_new[(i)] : \ 287662306a36Sopenharmony_ci (cp)->tx_old[(i)] - (cp)->tx_new[(i)] - 1) 287762306a36Sopenharmony_ci 287862306a36Sopenharmony_ci#define CAS_ALIGN(addr, align) \ 287962306a36Sopenharmony_ci (((unsigned long) (addr) + ((align) - 1UL)) & ~((align) - 1)) 288062306a36Sopenharmony_ci 288162306a36Sopenharmony_ci#define RX_FIFO_SIZE 16384 288262306a36Sopenharmony_ci#define EXPANSION_ROM_SIZE 65536 288362306a36Sopenharmony_ci 288462306a36Sopenharmony_ci#define CAS_MC_EXACT_MATCH_SIZE 15 288562306a36Sopenharmony_ci#define CAS_MC_HASH_SIZE 256 288662306a36Sopenharmony_ci#define CAS_MC_HASH_MAX (CAS_MC_EXACT_MATCH_SIZE + \ 288762306a36Sopenharmony_ci CAS_MC_HASH_SIZE) 288862306a36Sopenharmony_ci 288962306a36Sopenharmony_ci#define TX_TARGET_ABORT_LEN 0x20 289062306a36Sopenharmony_ci#define RX_SWIVEL_OFF_VAL 0x2 289162306a36Sopenharmony_ci#define RX_AE_FREEN_VAL(x) (RX_DESC_RINGN_SIZE(x) >> 1) 289262306a36Sopenharmony_ci#define RX_AE_COMP_VAL (RX_COMP_RING_SIZE >> 1) 289362306a36Sopenharmony_ci#define RX_BLANK_INTR_PKT_VAL 0x05 289462306a36Sopenharmony_ci#define RX_BLANK_INTR_TIME_VAL 0x0F 289562306a36Sopenharmony_ci#define HP_TCP_THRESH_VAL 1530 /* reduce to enable reassembly */ 289662306a36Sopenharmony_ci 289762306a36Sopenharmony_ci#define RX_SPARE_COUNT (RX_DESC_RING_SIZE >> 1) 289862306a36Sopenharmony_ci#define RX_SPARE_RECOVER_VAL (RX_SPARE_COUNT >> 2) 289962306a36Sopenharmony_ci 290062306a36Sopenharmony_ci#endif /* _CASSINI_H */ 2901