18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* Copyright(c) 1999 - 2018 Intel Corporation. */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#ifndef _E1000_DEFINES_H_ 58c2ecf20Sopenharmony_ci#define _E1000_DEFINES_H_ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ 88c2ecf20Sopenharmony_ci#define REQ_TX_DESCRIPTOR_MULTIPLE 8 98c2ecf20Sopenharmony_ci#define REQ_RX_DESCRIPTOR_MULTIPLE 8 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* Definitions for power management and wakeup registers */ 128c2ecf20Sopenharmony_ci/* Wake Up Control */ 138c2ecf20Sopenharmony_ci#define E1000_WUC_APME 0x00000001 /* APM Enable */ 148c2ecf20Sopenharmony_ci#define E1000_WUC_PME_EN 0x00000002 /* PME Enable */ 158c2ecf20Sopenharmony_ci#define E1000_WUC_PME_STATUS 0x00000004 /* PME Status */ 168c2ecf20Sopenharmony_ci#define E1000_WUC_APMPME 0x00000008 /* Assert PME on APM Wakeup */ 178c2ecf20Sopenharmony_ci#define E1000_WUC_PHY_WAKE 0x00000100 /* if PHY supports wakeup */ 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* Wake Up Filter Control */ 208c2ecf20Sopenharmony_ci#define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ 218c2ecf20Sopenharmony_ci#define E1000_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ 228c2ecf20Sopenharmony_ci#define E1000_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ 238c2ecf20Sopenharmony_ci#define E1000_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ 248c2ecf20Sopenharmony_ci#define E1000_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 258c2ecf20Sopenharmony_ci#define E1000_WUFC_ARP 0x00000020 /* ARP Request Packet Wakeup Enable */ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* Wake Up Status */ 288c2ecf20Sopenharmony_ci#define E1000_WUS_LNKC E1000_WUFC_LNKC 298c2ecf20Sopenharmony_ci#define E1000_WUS_MAG E1000_WUFC_MAG 308c2ecf20Sopenharmony_ci#define E1000_WUS_EX E1000_WUFC_EX 318c2ecf20Sopenharmony_ci#define E1000_WUS_MC E1000_WUFC_MC 328c2ecf20Sopenharmony_ci#define E1000_WUS_BC E1000_WUFC_BC 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* Extended Device Control */ 358c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_LPCD 0x00000004 /* LCD Power Cycle Done */ 368c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Definable Pin 3 */ 378c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_FORCE_SMBUS 0x00000800 /* Force SMBus mode */ 388c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_EE_RST 0x00002000 /* Reinitialize from EEPROM */ 398c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_SPD_BYPS 0x00008000 /* Speed Select Bypass */ 408c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_RO_DIS 0x00020000 /* Relaxed Ordering disable */ 418c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */ 428c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 438c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES 0x00C00000 448c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_EIAME 0x01000000 458c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ 468c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_IAME 0x08000000 /* Int ACK Auto-mask */ 478c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */ 488c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_LSECCK 0x00001000 498c2ecf20Sopenharmony_ci#define E1000_CTRL_EXT_PHYPDEN 0x00100000 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* Receive Descriptor bit definitions */ 528c2ecf20Sopenharmony_ci#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */ 538c2ecf20Sopenharmony_ci#define E1000_RXD_STAT_EOP 0x02 /* End of Packet */ 548c2ecf20Sopenharmony_ci#define E1000_RXD_STAT_IXSM 0x04 /* Ignore checksum */ 558c2ecf20Sopenharmony_ci#define E1000_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ 568c2ecf20Sopenharmony_ci#define E1000_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ 578c2ecf20Sopenharmony_ci#define E1000_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ 588c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_CE 0x01 /* CRC Error */ 598c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_SE 0x02 /* Symbol Error */ 608c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ 618c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ 628c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ 638c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ 648c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ 658c2ecf20Sopenharmony_ci#define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define E1000_RXDEXT_STATERR_TST 0x00000100 /* Time Stamp taken */ 688c2ecf20Sopenharmony_ci#define E1000_RXDEXT_STATERR_CE 0x01000000 698c2ecf20Sopenharmony_ci#define E1000_RXDEXT_STATERR_SE 0x02000000 708c2ecf20Sopenharmony_ci#define E1000_RXDEXT_STATERR_SEQ 0x04000000 718c2ecf20Sopenharmony_ci#define E1000_RXDEXT_STATERR_CXE 0x10000000 728c2ecf20Sopenharmony_ci#define E1000_RXDEXT_STATERR_RXE 0x80000000 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci/* mask to determine if packets should be dropped due to frame errors */ 758c2ecf20Sopenharmony_ci#define E1000_RXD_ERR_FRAME_ERR_MASK ( \ 768c2ecf20Sopenharmony_ci E1000_RXD_ERR_CE | \ 778c2ecf20Sopenharmony_ci E1000_RXD_ERR_SE | \ 788c2ecf20Sopenharmony_ci E1000_RXD_ERR_SEQ | \ 798c2ecf20Sopenharmony_ci E1000_RXD_ERR_CXE | \ 808c2ecf20Sopenharmony_ci E1000_RXD_ERR_RXE) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci/* Same mask, but for extended and packet split descriptors */ 838c2ecf20Sopenharmony_ci#define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \ 848c2ecf20Sopenharmony_ci E1000_RXDEXT_STATERR_CE | \ 858c2ecf20Sopenharmony_ci E1000_RXDEXT_STATERR_SE | \ 868c2ecf20Sopenharmony_ci E1000_RXDEXT_STATERR_SEQ | \ 878c2ecf20Sopenharmony_ci E1000_RXDEXT_STATERR_CXE | \ 888c2ecf20Sopenharmony_ci E1000_RXDEXT_STATERR_RXE) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define E1000_MRQC_RSS_FIELD_MASK 0xFFFF0000 918c2ecf20Sopenharmony_ci#define E1000_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 928c2ecf20Sopenharmony_ci#define E1000_MRQC_RSS_FIELD_IPV4 0x00020000 938c2ecf20Sopenharmony_ci#define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 948c2ecf20Sopenharmony_ci#define E1000_MRQC_RSS_FIELD_IPV6 0x00100000 958c2ecf20Sopenharmony_ci#define E1000_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci#define E1000_RXDPS_HDRSTAT_HDRSP 0x00008000 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci/* Management Control */ 1008c2ecf20Sopenharmony_ci#define E1000_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ 1018c2ecf20Sopenharmony_ci#define E1000_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ 1028c2ecf20Sopenharmony_ci#define E1000_MANC_ARP_EN 0x00002000 /* Enable ARP Request Filtering */ 1038c2ecf20Sopenharmony_ci#define E1000_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ 1048c2ecf20Sopenharmony_ci#define E1000_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */ 1058c2ecf20Sopenharmony_ci/* Enable MAC address filtering */ 1068c2ecf20Sopenharmony_ci#define E1000_MANC_EN_MAC_ADDR_FILTER 0x00100000 1078c2ecf20Sopenharmony_ci/* Enable MNG packets to host memory */ 1088c2ecf20Sopenharmony_ci#define E1000_MANC_EN_MNG2HOST 0x00200000 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci#define E1000_MANC2H_PORT_623 0x00000020 /* Port 0x26f */ 1118c2ecf20Sopenharmony_ci#define E1000_MANC2H_PORT_664 0x00000040 /* Port 0x298 */ 1128c2ecf20Sopenharmony_ci#define E1000_MDEF_PORT_623 0x00000800 /* Port 0x26f */ 1138c2ecf20Sopenharmony_ci#define E1000_MDEF_PORT_664 0x00000400 /* Port 0x298 */ 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci/* Receive Control */ 1168c2ecf20Sopenharmony_ci#define E1000_RCTL_EN 0x00000002 /* enable */ 1178c2ecf20Sopenharmony_ci#define E1000_RCTL_SBP 0x00000004 /* store bad packet */ 1188c2ecf20Sopenharmony_ci#define E1000_RCTL_UPE 0x00000008 /* unicast promiscuous enable */ 1198c2ecf20Sopenharmony_ci#define E1000_RCTL_MPE 0x00000010 /* multicast promiscuous enab */ 1208c2ecf20Sopenharmony_ci#define E1000_RCTL_LPE 0x00000020 /* long packet enable */ 1218c2ecf20Sopenharmony_ci#define E1000_RCTL_LBM_NO 0x00000000 /* no loopback mode */ 1228c2ecf20Sopenharmony_ci#define E1000_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ 1238c2ecf20Sopenharmony_ci#define E1000_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ 1248c2ecf20Sopenharmony_ci#define E1000_RCTL_DTYP_PS 0x00000400 /* Packet Split descriptor */ 1258c2ecf20Sopenharmony_ci#define E1000_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min threshold size */ 1268c2ecf20Sopenharmony_ci#define E1000_RCTL_RDMTS_HEX 0x00010000 1278c2ecf20Sopenharmony_ci#define E1000_RCTL_MO_SHIFT 12 /* multicast offset shift */ 1288c2ecf20Sopenharmony_ci#define E1000_RCTL_MO_3 0x00003000 /* multicast offset 15:4 */ 1298c2ecf20Sopenharmony_ci#define E1000_RCTL_BAM 0x00008000 /* broadcast enable */ 1308c2ecf20Sopenharmony_ci/* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ 1318c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_2048 0x00000000 /* Rx buffer size 2048 */ 1328c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_1024 0x00010000 /* Rx buffer size 1024 */ 1338c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_512 0x00020000 /* Rx buffer size 512 */ 1348c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */ 1358c2ecf20Sopenharmony_ci/* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ 1368c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_16384 0x00010000 /* Rx buffer size 16384 */ 1378c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_8192 0x00020000 /* Rx buffer size 8192 */ 1388c2ecf20Sopenharmony_ci#define E1000_RCTL_SZ_4096 0x00030000 /* Rx buffer size 4096 */ 1398c2ecf20Sopenharmony_ci#define E1000_RCTL_VFE 0x00040000 /* vlan filter enable */ 1408c2ecf20Sopenharmony_ci#define E1000_RCTL_CFIEN 0x00080000 /* canonical form enable */ 1418c2ecf20Sopenharmony_ci#define E1000_RCTL_CFI 0x00100000 /* canonical form indicator */ 1428c2ecf20Sopenharmony_ci#define E1000_RCTL_DPF 0x00400000 /* Discard Pause Frames */ 1438c2ecf20Sopenharmony_ci#define E1000_RCTL_PMCF 0x00800000 /* pass MAC control frames */ 1448c2ecf20Sopenharmony_ci#define E1000_RCTL_BSEX 0x02000000 /* Buffer size extension */ 1458c2ecf20Sopenharmony_ci#define E1000_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */ 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci/* Use byte values for the following shift parameters 1488c2ecf20Sopenharmony_ci * Usage: 1498c2ecf20Sopenharmony_ci * psrctl |= (((ROUNDUP(value0, 128) >> E1000_PSRCTL_BSIZE0_SHIFT) & 1508c2ecf20Sopenharmony_ci * E1000_PSRCTL_BSIZE0_MASK) | 1518c2ecf20Sopenharmony_ci * ((ROUNDUP(value1, 1024) >> E1000_PSRCTL_BSIZE1_SHIFT) & 1528c2ecf20Sopenharmony_ci * E1000_PSRCTL_BSIZE1_MASK) | 1538c2ecf20Sopenharmony_ci * ((ROUNDUP(value2, 1024) << E1000_PSRCTL_BSIZE2_SHIFT) & 1548c2ecf20Sopenharmony_ci * E1000_PSRCTL_BSIZE2_MASK) | 1558c2ecf20Sopenharmony_ci * ((ROUNDUP(value3, 1024) << E1000_PSRCTL_BSIZE3_SHIFT) |; 1568c2ecf20Sopenharmony_ci * E1000_PSRCTL_BSIZE3_MASK)) 1578c2ecf20Sopenharmony_ci * where value0 = [128..16256], default=256 1588c2ecf20Sopenharmony_ci * value1 = [1024..64512], default=4096 1598c2ecf20Sopenharmony_ci * value2 = [0..64512], default=4096 1608c2ecf20Sopenharmony_ci * value3 = [0..64512], default=0 1618c2ecf20Sopenharmony_ci */ 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE0_MASK 0x0000007F 1648c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE1_MASK 0x00003F00 1658c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE2_MASK 0x003F0000 1668c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE3_MASK 0x3F000000 1678c2ecf20Sopenharmony_ci 1688c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE0_SHIFT 7 /* Shift _right_ 7 */ 1698c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE1_SHIFT 2 /* Shift _right_ 2 */ 1708c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE2_SHIFT 6 /* Shift _left_ 6 */ 1718c2ecf20Sopenharmony_ci#define E1000_PSRCTL_BSIZE3_SHIFT 14 /* Shift _left_ 14 */ 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci/* SWFW_SYNC Definitions */ 1748c2ecf20Sopenharmony_ci#define E1000_SWFW_EEP_SM 0x1 1758c2ecf20Sopenharmony_ci#define E1000_SWFW_PHY0_SM 0x2 1768c2ecf20Sopenharmony_ci#define E1000_SWFW_PHY1_SM 0x4 1778c2ecf20Sopenharmony_ci#define E1000_SWFW_CSR_SM 0x8 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci/* Device Control */ 1808c2ecf20Sopenharmony_ci#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */ 1818c2ecf20Sopenharmony_ci#define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master requests */ 1828c2ecf20Sopenharmony_ci#define E1000_CTRL_LRST 0x00000008 /* Link reset. 0=normal,1=reset */ 1838c2ecf20Sopenharmony_ci#define E1000_CTRL_ASDE 0x00000020 /* Auto-speed detect enable */ 1848c2ecf20Sopenharmony_ci#define E1000_CTRL_SLU 0x00000040 /* Set link up (Force Link) */ 1858c2ecf20Sopenharmony_ci#define E1000_CTRL_ILOS 0x00000080 /* Invert Loss-Of Signal */ 1868c2ecf20Sopenharmony_ci#define E1000_CTRL_SPD_SEL 0x00000300 /* Speed Select Mask */ 1878c2ecf20Sopenharmony_ci#define E1000_CTRL_SPD_10 0x00000000 /* Force 10Mb */ 1888c2ecf20Sopenharmony_ci#define E1000_CTRL_SPD_100 0x00000100 /* Force 100Mb */ 1898c2ecf20Sopenharmony_ci#define E1000_CTRL_SPD_1000 0x00000200 /* Force 1Gb */ 1908c2ecf20Sopenharmony_ci#define E1000_CTRL_FRCSPD 0x00000800 /* Force Speed */ 1918c2ecf20Sopenharmony_ci#define E1000_CTRL_FRCDPX 0x00001000 /* Force Duplex */ 1928c2ecf20Sopenharmony_ci#define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ 1938c2ecf20Sopenharmony_ci#define E1000_CTRL_LANPHYPC_VALUE 0x00020000 /* SW value of LANPHYPC */ 1948c2ecf20Sopenharmony_ci#define E1000_CTRL_MEHE 0x00080000 /* Memory Error Handling Enable */ 1958c2ecf20Sopenharmony_ci#define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ 1968c2ecf20Sopenharmony_ci#define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ 1978c2ecf20Sopenharmony_ci#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ 1988c2ecf20Sopenharmony_ci#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ 1998c2ecf20Sopenharmony_ci#define E1000_CTRL_SWDPIO0 0x00400000 /* SWDPIN 0 Input or output */ 2008c2ecf20Sopenharmony_ci#define E1000_CTRL_RST 0x04000000 /* Global reset */ 2018c2ecf20Sopenharmony_ci#define E1000_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */ 2028c2ecf20Sopenharmony_ci#define E1000_CTRL_TFCE 0x10000000 /* Transmit flow control enable */ 2038c2ecf20Sopenharmony_ci#define E1000_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ 2048c2ecf20Sopenharmony_ci#define E1000_CTRL_PHY_RST 0x80000000 /* PHY Reset */ 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci#define E1000_PCS_LCTL_FORCE_FCTRL 0x80 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci#define E1000_PCS_LSTS_AN_COMPLETE 0x10000 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci/* Device Status */ 2118c2ecf20Sopenharmony_ci#define E1000_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ 2128c2ecf20Sopenharmony_ci#define E1000_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ 2138c2ecf20Sopenharmony_ci#define E1000_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */ 2148c2ecf20Sopenharmony_ci#define E1000_STATUS_FUNC_SHIFT 2 2158c2ecf20Sopenharmony_ci#define E1000_STATUS_FUNC_1 0x00000004 /* Function 1 */ 2168c2ecf20Sopenharmony_ci#define E1000_STATUS_TXOFF 0x00000010 /* transmission paused */ 2178c2ecf20Sopenharmony_ci#define E1000_STATUS_SPEED_MASK 0x000000C0 2188c2ecf20Sopenharmony_ci#define E1000_STATUS_SPEED_10 0x00000000 /* Speed 10Mb/s */ 2198c2ecf20Sopenharmony_ci#define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ 2208c2ecf20Sopenharmony_ci#define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ 2218c2ecf20Sopenharmony_ci#define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ 2228c2ecf20Sopenharmony_ci#define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ 2238c2ecf20Sopenharmony_ci#define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Master Req status */ 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/* PCIm function state */ 2268c2ecf20Sopenharmony_ci#define E1000_STATUS_PCIM_STATE 0x40000000 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci#define HALF_DUPLEX 1 2298c2ecf20Sopenharmony_ci#define FULL_DUPLEX 2 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci#define ADVERTISE_10_HALF 0x0001 2328c2ecf20Sopenharmony_ci#define ADVERTISE_10_FULL 0x0002 2338c2ecf20Sopenharmony_ci#define ADVERTISE_100_HALF 0x0004 2348c2ecf20Sopenharmony_ci#define ADVERTISE_100_FULL 0x0008 2358c2ecf20Sopenharmony_ci#define ADVERTISE_1000_HALF 0x0010 /* Not used, just FYI */ 2368c2ecf20Sopenharmony_ci#define ADVERTISE_1000_FULL 0x0020 2378c2ecf20Sopenharmony_ci 2388c2ecf20Sopenharmony_ci/* 1000/H is not supported, nor spec-compliant. */ 2398c2ecf20Sopenharmony_ci#define E1000_ALL_SPEED_DUPLEX ( \ 2408c2ecf20Sopenharmony_ci ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ 2418c2ecf20Sopenharmony_ci ADVERTISE_100_FULL | ADVERTISE_1000_FULL) 2428c2ecf20Sopenharmony_ci#define E1000_ALL_NOT_GIG ( \ 2438c2ecf20Sopenharmony_ci ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ 2448c2ecf20Sopenharmony_ci ADVERTISE_100_FULL) 2458c2ecf20Sopenharmony_ci#define E1000_ALL_100_SPEED (ADVERTISE_100_HALF | ADVERTISE_100_FULL) 2468c2ecf20Sopenharmony_ci#define E1000_ALL_10_SPEED (ADVERTISE_10_HALF | ADVERTISE_10_FULL) 2478c2ecf20Sopenharmony_ci#define E1000_ALL_HALF_DUPLEX (ADVERTISE_10_HALF | ADVERTISE_100_HALF) 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci#define AUTONEG_ADVERTISE_SPEED_DEFAULT E1000_ALL_SPEED_DUPLEX 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci/* LED Control */ 2528c2ecf20Sopenharmony_ci#define E1000_PHY_LED0_MODE_MASK 0x00000007 2538c2ecf20Sopenharmony_ci#define E1000_PHY_LED0_IVRT 0x00000008 2548c2ecf20Sopenharmony_ci#define E1000_PHY_LED0_MASK 0x0000001F 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci#define E1000_LEDCTL_LED0_MODE_MASK 0x0000000F 2578c2ecf20Sopenharmony_ci#define E1000_LEDCTL_LED0_MODE_SHIFT 0 2588c2ecf20Sopenharmony_ci#define E1000_LEDCTL_LED0_IVRT 0x00000040 2598c2ecf20Sopenharmony_ci#define E1000_LEDCTL_LED0_BLINK 0x00000080 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci#define E1000_LEDCTL_MODE_LINK_UP 0x2 2628c2ecf20Sopenharmony_ci#define E1000_LEDCTL_MODE_LED_ON 0xE 2638c2ecf20Sopenharmony_ci#define E1000_LEDCTL_MODE_LED_OFF 0xF 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci/* Transmit Descriptor bit definitions */ 2668c2ecf20Sopenharmony_ci#define E1000_TXD_DTYP_D 0x00100000 /* Data Descriptor */ 2678c2ecf20Sopenharmony_ci#define E1000_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ 2688c2ecf20Sopenharmony_ci#define E1000_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ 2698c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_EOP 0x01000000 /* End of Packet */ 2708c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */ 2718c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_IC 0x04000000 /* Insert Checksum */ 2728c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_RS 0x08000000 /* Report Status */ 2738c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_RPS 0x10000000 /* Report Packet Sent */ 2748c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_DEXT 0x20000000 /* Descriptor extension (0 = legacy) */ 2758c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ 2768c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_IDE 0x80000000 /* Enable Tidv register */ 2778c2ecf20Sopenharmony_ci#define E1000_TXD_STAT_DD 0x00000001 /* Descriptor Done */ 2788c2ecf20Sopenharmony_ci#define E1000_TXD_STAT_EC 0x00000002 /* Excess Collisions */ 2798c2ecf20Sopenharmony_ci#define E1000_TXD_STAT_LC 0x00000004 /* Late Collisions */ 2808c2ecf20Sopenharmony_ci#define E1000_TXD_STAT_TU 0x00000008 /* Transmit underrun */ 2818c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_TCP 0x01000000 /* TCP packet */ 2828c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_IP 0x02000000 /* IP packet */ 2838c2ecf20Sopenharmony_ci#define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ 2848c2ecf20Sopenharmony_ci#define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ 2858c2ecf20Sopenharmony_ci#define E1000_TXD_EXTCMD_TSTAMP 0x00000010 /* IEEE1588 Timestamp packet */ 2868c2ecf20Sopenharmony_ci 2878c2ecf20Sopenharmony_ci/* Transmit Control */ 2888c2ecf20Sopenharmony_ci#define E1000_TCTL_EN 0x00000002 /* enable Tx */ 2898c2ecf20Sopenharmony_ci#define E1000_TCTL_PSP 0x00000008 /* pad short packets */ 2908c2ecf20Sopenharmony_ci#define E1000_TCTL_CT 0x00000ff0 /* collision threshold */ 2918c2ecf20Sopenharmony_ci#define E1000_TCTL_COLD 0x003ff000 /* collision distance */ 2928c2ecf20Sopenharmony_ci#define E1000_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ 2938c2ecf20Sopenharmony_ci#define E1000_TCTL_MULR 0x10000000 /* Multiple request support */ 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci/* SerDes Control */ 2968c2ecf20Sopenharmony_ci#define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400 2978c2ecf20Sopenharmony_ci#define E1000_SCTL_ENABLE_SERDES_LOOPBACK 0x0410 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* Receive Checksum Control */ 3008c2ecf20Sopenharmony_ci#define E1000_RXCSUM_TUOFL 0x00000200 /* TCP / UDP checksum offload */ 3018c2ecf20Sopenharmony_ci#define E1000_RXCSUM_IPPCSE 0x00001000 /* IP payload checksum enable */ 3028c2ecf20Sopenharmony_ci#define E1000_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_ci/* Header split receive */ 3058c2ecf20Sopenharmony_ci#define E1000_RFCTL_NFSW_DIS 0x00000040 3068c2ecf20Sopenharmony_ci#define E1000_RFCTL_NFSR_DIS 0x00000080 3078c2ecf20Sopenharmony_ci#define E1000_RFCTL_ACK_DIS 0x00001000 3088c2ecf20Sopenharmony_ci#define E1000_RFCTL_EXTEN 0x00008000 3098c2ecf20Sopenharmony_ci#define E1000_RFCTL_IPV6_EX_DIS 0x00010000 3108c2ecf20Sopenharmony_ci#define E1000_RFCTL_NEW_IPV6_EXT_DIS 0x00020000 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/* Collision related configuration parameters */ 3138c2ecf20Sopenharmony_ci#define E1000_COLLISION_THRESHOLD 15 3148c2ecf20Sopenharmony_ci#define E1000_CT_SHIFT 4 3158c2ecf20Sopenharmony_ci#define E1000_COLLISION_DISTANCE 63 3168c2ecf20Sopenharmony_ci#define E1000_COLD_SHIFT 12 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci/* Default values for the transmit IPG register */ 3198c2ecf20Sopenharmony_ci#define DEFAULT_82543_TIPG_IPGT_COPPER 8 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci#define E1000_TIPG_IPGT_MASK 0x000003FF 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_ci#define DEFAULT_82543_TIPG_IPGR1 8 3248c2ecf20Sopenharmony_ci#define E1000_TIPG_IPGR1_SHIFT 10 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci#define DEFAULT_82543_TIPG_IPGR2 6 3278c2ecf20Sopenharmony_ci#define DEFAULT_80003ES2LAN_TIPG_IPGR2 7 3288c2ecf20Sopenharmony_ci#define E1000_TIPG_IPGR2_SHIFT 20 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci#define MAX_JUMBO_FRAME_SIZE 0x3F00 3318c2ecf20Sopenharmony_ci#define E1000_TX_PTR_GAP 0x1F 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/* Extended Configuration Control and Size */ 3348c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP 0x00000020 3358c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001 3368c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE 0x00000008 3378c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020 3388c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_GATE_PHY_CFG 0x00000080 3398c2ecf20Sopenharmony_ci#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK 0x00FF0000 3408c2ecf20Sopenharmony_ci#define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT 16 3418c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK 0x0FFF0000 3428c2ecf20Sopenharmony_ci#define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT 16 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ci#define E1000_PHY_CTRL_D0A_LPLU 0x00000002 3458c2ecf20Sopenharmony_ci#define E1000_PHY_CTRL_NOND0A_LPLU 0x00000004 3468c2ecf20Sopenharmony_ci#define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008 3478c2ecf20Sopenharmony_ci#define E1000_PHY_CTRL_GBE_DISABLE 0x00000040 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci#define E1000_KABGTXD_BGSQLBIAS 0x00050000 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci/* Low Power IDLE Control */ 3528c2ecf20Sopenharmony_ci#define E1000_LPIC_LPIET_SHIFT 24 /* Low Power Idle Entry Time */ 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/* PBA constants */ 3558c2ecf20Sopenharmony_ci#define E1000_PBA_8K 0x0008 /* 8KB */ 3568c2ecf20Sopenharmony_ci#define E1000_PBA_16K 0x0010 /* 16KB */ 3578c2ecf20Sopenharmony_ci 3588c2ecf20Sopenharmony_ci#define E1000_PBA_RXA_MASK 0xFFFF 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_ci#define E1000_PBS_16K E1000_PBA_16K 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/* Uncorrectable/correctable ECC Error counts and enable bits */ 3638c2ecf20Sopenharmony_ci#define E1000_PBECCSTS_CORR_ERR_CNT_MASK 0x000000FF 3648c2ecf20Sopenharmony_ci#define E1000_PBECCSTS_UNCORR_ERR_CNT_MASK 0x0000FF00 3658c2ecf20Sopenharmony_ci#define E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT 8 3668c2ecf20Sopenharmony_ci#define E1000_PBECCSTS_ECC_ENABLE 0x00010000 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci#define IFS_MAX 80 3698c2ecf20Sopenharmony_ci#define IFS_MIN 40 3708c2ecf20Sopenharmony_ci#define IFS_RATIO 4 3718c2ecf20Sopenharmony_ci#define IFS_STEP 10 3728c2ecf20Sopenharmony_ci#define MIN_NUM_XMITS 1000 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci/* SW Semaphore Register */ 3758c2ecf20Sopenharmony_ci#define E1000_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ 3768c2ecf20Sopenharmony_ci#define E1000_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ 3778c2ecf20Sopenharmony_ci#define E1000_SWSM_DRV_LOAD 0x00000008 /* Driver Loaded Bit */ 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci#define E1000_SWSM2_LOCK 0x00000002 /* Secondary driver semaphore bit */ 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci/* Interrupt Cause Read */ 3828c2ecf20Sopenharmony_ci#define E1000_ICR_TXDW 0x00000001 /* Transmit desc written back */ 3838c2ecf20Sopenharmony_ci#define E1000_ICR_LSC 0x00000004 /* Link Status Change */ 3848c2ecf20Sopenharmony_ci#define E1000_ICR_RXSEQ 0x00000008 /* Rx sequence error */ 3858c2ecf20Sopenharmony_ci#define E1000_ICR_RXDMT0 0x00000010 /* Rx desc min. threshold (0) */ 3868c2ecf20Sopenharmony_ci#define E1000_ICR_RXO 0x00000040 /* Receiver Overrun */ 3878c2ecf20Sopenharmony_ci#define E1000_ICR_RXT0 0x00000080 /* Rx timer intr (ring 0) */ 3888c2ecf20Sopenharmony_ci#define E1000_ICR_MDAC 0x00000200 /* MDIO Access Complete */ 3898c2ecf20Sopenharmony_ci#define E1000_ICR_SRPD 0x00010000 /* Small Receive Packet Detected */ 3908c2ecf20Sopenharmony_ci#define E1000_ICR_ACK 0x00020000 /* Receive ACK Frame Detected */ 3918c2ecf20Sopenharmony_ci#define E1000_ICR_MNG 0x00040000 /* Manageability Event Detected */ 3928c2ecf20Sopenharmony_ci#define E1000_ICR_ECCER 0x00400000 /* Uncorrectable ECC Error */ 3938c2ecf20Sopenharmony_ci/* If this bit asserted, the driver should claim the interrupt */ 3948c2ecf20Sopenharmony_ci#define E1000_ICR_INT_ASSERTED 0x80000000 3958c2ecf20Sopenharmony_ci#define E1000_ICR_RXQ0 0x00100000 /* Rx Queue 0 Interrupt */ 3968c2ecf20Sopenharmony_ci#define E1000_ICR_RXQ1 0x00200000 /* Rx Queue 1 Interrupt */ 3978c2ecf20Sopenharmony_ci#define E1000_ICR_TXQ0 0x00400000 /* Tx Queue 0 Interrupt */ 3988c2ecf20Sopenharmony_ci#define E1000_ICR_TXQ1 0x00800000 /* Tx Queue 1 Interrupt */ 3998c2ecf20Sopenharmony_ci#define E1000_ICR_OTHER 0x01000000 /* Other Interrupt */ 4008c2ecf20Sopenharmony_ci 4018c2ecf20Sopenharmony_ci/* PBA ECC Register */ 4028c2ecf20Sopenharmony_ci#define E1000_PBA_ECC_COUNTER_MASK 0xFFF00000 /* ECC counter mask */ 4038c2ecf20Sopenharmony_ci#define E1000_PBA_ECC_COUNTER_SHIFT 20 /* ECC counter shift value */ 4048c2ecf20Sopenharmony_ci#define E1000_PBA_ECC_CORR_EN 0x00000001 /* ECC correction enable */ 4058c2ecf20Sopenharmony_ci#define E1000_PBA_ECC_STAT_CLR 0x00000002 /* Clear ECC error counter */ 4068c2ecf20Sopenharmony_ci#define E1000_PBA_ECC_INT_EN 0x00000004 /* Enable ICR bit 5 for ECC */ 4078c2ecf20Sopenharmony_ci 4088c2ecf20Sopenharmony_ci/* This defines the bits that are set in the Interrupt Mask 4098c2ecf20Sopenharmony_ci * Set/Read Register. Each bit is documented below: 4108c2ecf20Sopenharmony_ci * o RXT0 = Receiver Timer Interrupt (ring 0) 4118c2ecf20Sopenharmony_ci * o TXDW = Transmit Descriptor Written Back 4128c2ecf20Sopenharmony_ci * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) 4138c2ecf20Sopenharmony_ci * o RXSEQ = Receive Sequence Error 4148c2ecf20Sopenharmony_ci * o LSC = Link Status Change 4158c2ecf20Sopenharmony_ci */ 4168c2ecf20Sopenharmony_ci#define IMS_ENABLE_MASK ( \ 4178c2ecf20Sopenharmony_ci E1000_IMS_RXT0 | \ 4188c2ecf20Sopenharmony_ci E1000_IMS_TXDW | \ 4198c2ecf20Sopenharmony_ci E1000_IMS_RXDMT0 | \ 4208c2ecf20Sopenharmony_ci E1000_IMS_RXSEQ | \ 4218c2ecf20Sopenharmony_ci E1000_IMS_LSC) 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_ci/* These are all of the events related to the OTHER interrupt. 4248c2ecf20Sopenharmony_ci */ 4258c2ecf20Sopenharmony_ci#define IMS_OTHER_MASK ( \ 4268c2ecf20Sopenharmony_ci E1000_IMS_LSC | \ 4278c2ecf20Sopenharmony_ci E1000_IMS_RXO | \ 4288c2ecf20Sopenharmony_ci E1000_IMS_MDAC | \ 4298c2ecf20Sopenharmony_ci E1000_IMS_SRPD | \ 4308c2ecf20Sopenharmony_ci E1000_IMS_ACK | \ 4318c2ecf20Sopenharmony_ci E1000_IMS_MNG) 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci/* Interrupt Mask Set */ 4348c2ecf20Sopenharmony_ci#define E1000_IMS_TXDW E1000_ICR_TXDW /* Transmit desc written back */ 4358c2ecf20Sopenharmony_ci#define E1000_IMS_LSC E1000_ICR_LSC /* Link Status Change */ 4368c2ecf20Sopenharmony_ci#define E1000_IMS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ 4378c2ecf20Sopenharmony_ci#define E1000_IMS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ 4388c2ecf20Sopenharmony_ci#define E1000_IMS_RXO E1000_ICR_RXO /* Receiver Overrun */ 4398c2ecf20Sopenharmony_ci#define E1000_IMS_RXT0 E1000_ICR_RXT0 /* Rx timer intr */ 4408c2ecf20Sopenharmony_ci#define E1000_IMS_MDAC E1000_ICR_MDAC /* MDIO Access Complete */ 4418c2ecf20Sopenharmony_ci#define E1000_IMS_SRPD E1000_ICR_SRPD /* Small Receive Packet */ 4428c2ecf20Sopenharmony_ci#define E1000_IMS_ACK E1000_ICR_ACK /* Receive ACK Frame Detected */ 4438c2ecf20Sopenharmony_ci#define E1000_IMS_MNG E1000_ICR_MNG /* Manageability Event */ 4448c2ecf20Sopenharmony_ci#define E1000_IMS_ECCER E1000_ICR_ECCER /* Uncorrectable ECC Error */ 4458c2ecf20Sopenharmony_ci#define E1000_IMS_RXQ0 E1000_ICR_RXQ0 /* Rx Queue 0 Interrupt */ 4468c2ecf20Sopenharmony_ci#define E1000_IMS_RXQ1 E1000_ICR_RXQ1 /* Rx Queue 1 Interrupt */ 4478c2ecf20Sopenharmony_ci#define E1000_IMS_TXQ0 E1000_ICR_TXQ0 /* Tx Queue 0 Interrupt */ 4488c2ecf20Sopenharmony_ci#define E1000_IMS_TXQ1 E1000_ICR_TXQ1 /* Tx Queue 1 Interrupt */ 4498c2ecf20Sopenharmony_ci#define E1000_IMS_OTHER E1000_ICR_OTHER /* Other Interrupt */ 4508c2ecf20Sopenharmony_ci 4518c2ecf20Sopenharmony_ci/* Interrupt Cause Set */ 4528c2ecf20Sopenharmony_ci#define E1000_ICS_LSC E1000_ICR_LSC /* Link Status Change */ 4538c2ecf20Sopenharmony_ci#define E1000_ICS_RXSEQ E1000_ICR_RXSEQ /* Rx sequence error */ 4548c2ecf20Sopenharmony_ci#define E1000_ICS_RXDMT0 E1000_ICR_RXDMT0 /* Rx desc min. threshold */ 4558c2ecf20Sopenharmony_ci#define E1000_ICS_OTHER E1000_ICR_OTHER /* Other Interrupt */ 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci/* Transmit Descriptor Control */ 4588c2ecf20Sopenharmony_ci#define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */ 4598c2ecf20Sopenharmony_ci#define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */ 4608c2ecf20Sopenharmony_ci#define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */ 4618c2ecf20Sopenharmony_ci#define E1000_TXDCTL_GRAN 0x01000000 /* TXDCTL Granularity */ 4628c2ecf20Sopenharmony_ci#define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ 4638c2ecf20Sopenharmony_ci#define E1000_TXDCTL_MAX_TX_DESC_PREFETCH 0x0100001F /* GRAN=1, PTHRESH=31 */ 4648c2ecf20Sopenharmony_ci/* Enable the counting of desc. still to be processed. */ 4658c2ecf20Sopenharmony_ci#define E1000_TXDCTL_COUNT_DESC 0x00400000 4668c2ecf20Sopenharmony_ci 4678c2ecf20Sopenharmony_ci/* Flow Control Constants */ 4688c2ecf20Sopenharmony_ci#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 4698c2ecf20Sopenharmony_ci#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 4708c2ecf20Sopenharmony_ci#define FLOW_CONTROL_TYPE 0x8808 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci/* 802.1q VLAN Packet Size */ 4738c2ecf20Sopenharmony_ci#define E1000_VLAN_FILTER_TBL_SIZE 128 /* VLAN Filter Table (4096 bits) */ 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_ci/* Receive Address 4768c2ecf20Sopenharmony_ci * Number of high/low register pairs in the RAR. The RAR (Receive Address 4778c2ecf20Sopenharmony_ci * Registers) holds the directed and multicast addresses that we monitor. 4788c2ecf20Sopenharmony_ci * Technically, we have 16 spots. However, we reserve one of these spots 4798c2ecf20Sopenharmony_ci * (RAR[15]) for our directed address used by controllers with 4808c2ecf20Sopenharmony_ci * manageability enabled, allowing us room for 15 multicast addresses. 4818c2ecf20Sopenharmony_ci */ 4828c2ecf20Sopenharmony_ci#define E1000_RAR_ENTRIES 15 4838c2ecf20Sopenharmony_ci#define E1000_RAH_AV 0x80000000 /* Receive descriptor valid */ 4848c2ecf20Sopenharmony_ci#define E1000_RAL_MAC_ADDR_LEN 4 4858c2ecf20Sopenharmony_ci#define E1000_RAH_MAC_ADDR_LEN 2 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci/* Error Codes */ 4888c2ecf20Sopenharmony_ci#define E1000_ERR_NVM 1 4898c2ecf20Sopenharmony_ci#define E1000_ERR_PHY 2 4908c2ecf20Sopenharmony_ci#define E1000_ERR_CONFIG 3 4918c2ecf20Sopenharmony_ci#define E1000_ERR_PARAM 4 4928c2ecf20Sopenharmony_ci#define E1000_ERR_MAC_INIT 5 4938c2ecf20Sopenharmony_ci#define E1000_ERR_PHY_TYPE 6 4948c2ecf20Sopenharmony_ci#define E1000_ERR_RESET 9 4958c2ecf20Sopenharmony_ci#define E1000_ERR_MASTER_REQUESTS_PENDING 10 4968c2ecf20Sopenharmony_ci#define E1000_ERR_HOST_INTERFACE_COMMAND 11 4978c2ecf20Sopenharmony_ci#define E1000_BLK_PHY_RESET 12 4988c2ecf20Sopenharmony_ci#define E1000_ERR_SWFW_SYNC 13 4998c2ecf20Sopenharmony_ci#define E1000_NOT_IMPLEMENTED 14 5008c2ecf20Sopenharmony_ci#define E1000_ERR_INVALID_ARGUMENT 16 5018c2ecf20Sopenharmony_ci#define E1000_ERR_NO_SPACE 17 5028c2ecf20Sopenharmony_ci#define E1000_ERR_NVM_PBA_SECTION 18 5038c2ecf20Sopenharmony_ci 5048c2ecf20Sopenharmony_ci/* Loop limit on how long we wait for auto-negotiation to complete */ 5058c2ecf20Sopenharmony_ci#define FIBER_LINK_UP_LIMIT 50 5068c2ecf20Sopenharmony_ci#define COPPER_LINK_UP_LIMIT 10 5078c2ecf20Sopenharmony_ci#define PHY_AUTO_NEG_LIMIT 45 5088c2ecf20Sopenharmony_ci#define PHY_FORCE_LIMIT 20 5098c2ecf20Sopenharmony_ci/* Number of 100 microseconds we wait for PCI Express master disable */ 5108c2ecf20Sopenharmony_ci#define MASTER_DISABLE_TIMEOUT 800 5118c2ecf20Sopenharmony_ci/* Number of milliseconds we wait for PHY configuration done after MAC reset */ 5128c2ecf20Sopenharmony_ci#define PHY_CFG_TIMEOUT 100 5138c2ecf20Sopenharmony_ci/* Number of 2 milliseconds we wait for acquiring MDIO ownership. */ 5148c2ecf20Sopenharmony_ci#define MDIO_OWNERSHIP_TIMEOUT 10 5158c2ecf20Sopenharmony_ci/* Number of milliseconds for NVM auto read done after MAC reset. */ 5168c2ecf20Sopenharmony_ci#define AUTO_READ_DONE_TIMEOUT 10 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci/* Flow Control */ 5198c2ecf20Sopenharmony_ci#define E1000_FCRTH_RTH 0x0000FFF8 /* Mask Bits[15:3] for RTH */ 5208c2ecf20Sopenharmony_ci#define E1000_FCRTL_RTL 0x0000FFF8 /* Mask Bits[15:3] for RTL */ 5218c2ecf20Sopenharmony_ci#define E1000_FCRTL_XONE 0x80000000 /* Enable XON frame transmission */ 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci/* Transmit Configuration Word */ 5248c2ecf20Sopenharmony_ci#define E1000_TXCW_FD 0x00000020 /* TXCW full duplex */ 5258c2ecf20Sopenharmony_ci#define E1000_TXCW_PAUSE 0x00000080 /* TXCW sym pause request */ 5268c2ecf20Sopenharmony_ci#define E1000_TXCW_ASM_DIR 0x00000100 /* TXCW astm pause direction */ 5278c2ecf20Sopenharmony_ci#define E1000_TXCW_PAUSE_MASK 0x00000180 /* TXCW pause request mask */ 5288c2ecf20Sopenharmony_ci#define E1000_TXCW_ANE 0x80000000 /* Auto-neg enable */ 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_ci/* Receive Configuration Word */ 5318c2ecf20Sopenharmony_ci#define E1000_RXCW_CW 0x0000ffff /* RxConfigWord mask */ 5328c2ecf20Sopenharmony_ci#define E1000_RXCW_IV 0x08000000 /* Receive config invalid */ 5338c2ecf20Sopenharmony_ci#define E1000_RXCW_C 0x20000000 /* Receive config */ 5348c2ecf20Sopenharmony_ci#define E1000_RXCW_SYNCH 0x40000000 /* Receive config synch */ 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci/* HH Time Sync */ 5378c2ecf20Sopenharmony_ci#define E1000_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000 /* max delay */ 5388c2ecf20Sopenharmony_ci#define E1000_TSYNCTXCTL_SYNC_COMP 0x40000000 /* sync complete */ 5398c2ecf20Sopenharmony_ci#define E1000_TSYNCTXCTL_START_SYNC 0x80000000 /* initiate sync */ 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_ci#define E1000_TSYNCTXCTL_VALID 0x00000001 /* Tx timestamp valid */ 5428c2ecf20Sopenharmony_ci#define E1000_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */ 5438c2ecf20Sopenharmony_ci 5448c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_VALID 0x00000001 /* Rx timestamp valid */ 5458c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ 5468c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_TYPE_L2_V2 0x00 5478c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_TYPE_L4_V1 0x02 5488c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 5498c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_TYPE_ALL 0x08 5508c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_TYPE_EVENT_V2 0x0A 5518c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_ENABLED 0x00000010 /* enable Rx timestamping */ 5528c2ecf20Sopenharmony_ci#define E1000_TSYNCRXCTL_SYSCFI 0x00000020 /* Sys clock frequency */ 5538c2ecf20Sopenharmony_ci 5548c2ecf20Sopenharmony_ci#define E1000_RXMTRL_PTP_V1_SYNC_MESSAGE 0x00000000 5558c2ecf20Sopenharmony_ci#define E1000_RXMTRL_PTP_V1_DELAY_REQ_MESSAGE 0x00010000 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_ci#define E1000_RXMTRL_PTP_V2_SYNC_MESSAGE 0x00000000 5588c2ecf20Sopenharmony_ci#define E1000_RXMTRL_PTP_V2_DELAY_REQ_MESSAGE 0x01000000 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci#define E1000_TIMINCA_INCPERIOD_SHIFT 24 5618c2ecf20Sopenharmony_ci#define E1000_TIMINCA_INCVALUE_MASK 0x00FFFFFF 5628c2ecf20Sopenharmony_ci 5638c2ecf20Sopenharmony_ci/* PCI Express Control */ 5648c2ecf20Sopenharmony_ci#define E1000_GCR_RXD_NO_SNOOP 0x00000001 5658c2ecf20Sopenharmony_ci#define E1000_GCR_RXDSCW_NO_SNOOP 0x00000002 5668c2ecf20Sopenharmony_ci#define E1000_GCR_RXDSCR_NO_SNOOP 0x00000004 5678c2ecf20Sopenharmony_ci#define E1000_GCR_TXD_NO_SNOOP 0x00000008 5688c2ecf20Sopenharmony_ci#define E1000_GCR_TXDSCW_NO_SNOOP 0x00000010 5698c2ecf20Sopenharmony_ci#define E1000_GCR_TXDSCR_NO_SNOOP 0x00000020 5708c2ecf20Sopenharmony_ci 5718c2ecf20Sopenharmony_ci#define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP | \ 5728c2ecf20Sopenharmony_ci E1000_GCR_RXDSCW_NO_SNOOP | \ 5738c2ecf20Sopenharmony_ci E1000_GCR_RXDSCR_NO_SNOOP | \ 5748c2ecf20Sopenharmony_ci E1000_GCR_TXD_NO_SNOOP | \ 5758c2ecf20Sopenharmony_ci E1000_GCR_TXDSCW_NO_SNOOP | \ 5768c2ecf20Sopenharmony_ci E1000_GCR_TXDSCR_NO_SNOOP) 5778c2ecf20Sopenharmony_ci 5788c2ecf20Sopenharmony_ci/* NVM Control */ 5798c2ecf20Sopenharmony_ci#define E1000_EECD_SK 0x00000001 /* NVM Clock */ 5808c2ecf20Sopenharmony_ci#define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ 5818c2ecf20Sopenharmony_ci#define E1000_EECD_DI 0x00000004 /* NVM Data In */ 5828c2ecf20Sopenharmony_ci#define E1000_EECD_DO 0x00000008 /* NVM Data Out */ 5838c2ecf20Sopenharmony_ci#define E1000_EECD_REQ 0x00000040 /* NVM Access Request */ 5848c2ecf20Sopenharmony_ci#define E1000_EECD_GNT 0x00000080 /* NVM Access Grant */ 5858c2ecf20Sopenharmony_ci#define E1000_EECD_PRES 0x00000100 /* NVM Present */ 5868c2ecf20Sopenharmony_ci#define E1000_EECD_SIZE 0x00000200 /* NVM Size (0=64 word 1=256 word) */ 5878c2ecf20Sopenharmony_ci/* NVM Addressing bits based on type (0-small, 1-large) */ 5888c2ecf20Sopenharmony_ci#define E1000_EECD_ADDR_BITS 0x00000400 5898c2ecf20Sopenharmony_ci#define E1000_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */ 5908c2ecf20Sopenharmony_ci#define E1000_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */ 5918c2ecf20Sopenharmony_ci#define E1000_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */ 5928c2ecf20Sopenharmony_ci#define E1000_EECD_SIZE_EX_SHIFT 11 5938c2ecf20Sopenharmony_ci#define E1000_EECD_FLUPD 0x00080000 /* Update FLASH */ 5948c2ecf20Sopenharmony_ci#define E1000_EECD_AUPDEN 0x00100000 /* Enable Autonomous FLASH update */ 5958c2ecf20Sopenharmony_ci#define E1000_EECD_SEC1VAL 0x00400000 /* Sector One Valid */ 5968c2ecf20Sopenharmony_ci#define E1000_EECD_SEC1VAL_VALID_MASK (E1000_EECD_AUTO_RD | E1000_EECD_PRES) 5978c2ecf20Sopenharmony_ci 5988c2ecf20Sopenharmony_ci#define E1000_NVM_RW_REG_DATA 16 /* Offset to data in NVM r/w regs */ 5998c2ecf20Sopenharmony_ci#define E1000_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */ 6008c2ecf20Sopenharmony_ci#define E1000_NVM_RW_REG_START 1 /* Start operation */ 6018c2ecf20Sopenharmony_ci#define E1000_NVM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ 6028c2ecf20Sopenharmony_ci#define E1000_NVM_POLL_WRITE 1 /* Flag for polling write complete */ 6038c2ecf20Sopenharmony_ci#define E1000_NVM_POLL_READ 0 /* Flag for polling read complete */ 6048c2ecf20Sopenharmony_ci#define E1000_FLASH_UPDATES 2000 6058c2ecf20Sopenharmony_ci 6068c2ecf20Sopenharmony_ci/* NVM Word Offsets */ 6078c2ecf20Sopenharmony_ci#define NVM_COMPAT 0x0003 6088c2ecf20Sopenharmony_ci#define NVM_ID_LED_SETTINGS 0x0004 6098c2ecf20Sopenharmony_ci#define NVM_FUTURE_INIT_WORD1 0x0019 6108c2ecf20Sopenharmony_ci#define NVM_COMPAT_VALID_CSUM 0x0001 6118c2ecf20Sopenharmony_ci#define NVM_FUTURE_INIT_WORD1_VALID_CSUM 0x0040 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci#define NVM_INIT_CONTROL2_REG 0x000F 6148c2ecf20Sopenharmony_ci#define NVM_INIT_CONTROL3_PORT_B 0x0014 6158c2ecf20Sopenharmony_ci#define NVM_INIT_3GIO_3 0x001A 6168c2ecf20Sopenharmony_ci#define NVM_INIT_CONTROL3_PORT_A 0x0024 6178c2ecf20Sopenharmony_ci#define NVM_CFG 0x0012 6188c2ecf20Sopenharmony_ci#define NVM_ALT_MAC_ADDR_PTR 0x0037 6198c2ecf20Sopenharmony_ci#define NVM_CHECKSUM_REG 0x003F 6208c2ecf20Sopenharmony_ci 6218c2ecf20Sopenharmony_ci#define E1000_NVM_CFG_DONE_PORT_0 0x40000 /* MNG config cycle done */ 6228c2ecf20Sopenharmony_ci#define E1000_NVM_CFG_DONE_PORT_1 0x80000 /* ...for second port */ 6238c2ecf20Sopenharmony_ci 6248c2ecf20Sopenharmony_ci/* Mask bits for fields in Word 0x0f of the NVM */ 6258c2ecf20Sopenharmony_ci#define NVM_WORD0F_PAUSE_MASK 0x3000 6268c2ecf20Sopenharmony_ci#define NVM_WORD0F_PAUSE 0x1000 6278c2ecf20Sopenharmony_ci#define NVM_WORD0F_ASM_DIR 0x2000 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci/* Mask bits for fields in Word 0x1a of the NVM */ 6308c2ecf20Sopenharmony_ci#define NVM_WORD1A_ASPM_MASK 0x000C 6318c2ecf20Sopenharmony_ci 6328c2ecf20Sopenharmony_ci/* Mask bits for fields in Word 0x03 of the EEPROM */ 6338c2ecf20Sopenharmony_ci#define NVM_COMPAT_LOM 0x0800 6348c2ecf20Sopenharmony_ci 6358c2ecf20Sopenharmony_ci/* length of string needed to store PBA number */ 6368c2ecf20Sopenharmony_ci#define E1000_PBANUM_LENGTH 11 6378c2ecf20Sopenharmony_ci 6388c2ecf20Sopenharmony_ci/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ 6398c2ecf20Sopenharmony_ci#define NVM_SUM 0xBABA 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_ci/* PBA (printed board assembly) number words */ 6428c2ecf20Sopenharmony_ci#define NVM_PBA_OFFSET_0 8 6438c2ecf20Sopenharmony_ci#define NVM_PBA_OFFSET_1 9 6448c2ecf20Sopenharmony_ci#define NVM_PBA_PTR_GUARD 0xFAFA 6458c2ecf20Sopenharmony_ci#define NVM_WORD_SIZE_BASE_SHIFT 6 6468c2ecf20Sopenharmony_ci 6478c2ecf20Sopenharmony_ci/* NVM Commands - SPI */ 6488c2ecf20Sopenharmony_ci#define NVM_MAX_RETRY_SPI 5000 /* Max wait of 5ms, for RDY signal */ 6498c2ecf20Sopenharmony_ci#define NVM_READ_OPCODE_SPI 0x03 /* NVM read opcode */ 6508c2ecf20Sopenharmony_ci#define NVM_WRITE_OPCODE_SPI 0x02 /* NVM write opcode */ 6518c2ecf20Sopenharmony_ci#define NVM_A8_OPCODE_SPI 0x08 /* opcode bit-3 = address bit-8 */ 6528c2ecf20Sopenharmony_ci#define NVM_WREN_OPCODE_SPI 0x06 /* NVM set Write Enable latch */ 6538c2ecf20Sopenharmony_ci#define NVM_RDSR_OPCODE_SPI 0x05 /* NVM read Status register */ 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci/* SPI NVM Status Register */ 6568c2ecf20Sopenharmony_ci#define NVM_STATUS_RDY_SPI 0x01 6578c2ecf20Sopenharmony_ci 6588c2ecf20Sopenharmony_ci/* Word definitions for ID LED Settings */ 6598c2ecf20Sopenharmony_ci#define ID_LED_RESERVED_0000 0x0000 6608c2ecf20Sopenharmony_ci#define ID_LED_RESERVED_FFFF 0xFFFF 6618c2ecf20Sopenharmony_ci#define ID_LED_DEFAULT ((ID_LED_OFF1_ON2 << 12) | \ 6628c2ecf20Sopenharmony_ci (ID_LED_OFF1_OFF2 << 8) | \ 6638c2ecf20Sopenharmony_ci (ID_LED_DEF1_DEF2 << 4) | \ 6648c2ecf20Sopenharmony_ci (ID_LED_DEF1_DEF2)) 6658c2ecf20Sopenharmony_ci#define ID_LED_DEF1_DEF2 0x1 6668c2ecf20Sopenharmony_ci#define ID_LED_DEF1_ON2 0x2 6678c2ecf20Sopenharmony_ci#define ID_LED_DEF1_OFF2 0x3 6688c2ecf20Sopenharmony_ci#define ID_LED_ON1_DEF2 0x4 6698c2ecf20Sopenharmony_ci#define ID_LED_ON1_ON2 0x5 6708c2ecf20Sopenharmony_ci#define ID_LED_ON1_OFF2 0x6 6718c2ecf20Sopenharmony_ci#define ID_LED_OFF1_DEF2 0x7 6728c2ecf20Sopenharmony_ci#define ID_LED_OFF1_ON2 0x8 6738c2ecf20Sopenharmony_ci#define ID_LED_OFF1_OFF2 0x9 6748c2ecf20Sopenharmony_ci 6758c2ecf20Sopenharmony_ci#define IGP_ACTIVITY_LED_MASK 0xFFFFF0FF 6768c2ecf20Sopenharmony_ci#define IGP_ACTIVITY_LED_ENABLE 0x0300 6778c2ecf20Sopenharmony_ci#define IGP_LED3_MODE 0x07000000 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci/* PCI/PCI-X/PCI-EX Config space */ 6808c2ecf20Sopenharmony_ci#define PCI_HEADER_TYPE_REGISTER 0x0E 6818c2ecf20Sopenharmony_ci#define PCIE_LINK_STATUS 0x12 6828c2ecf20Sopenharmony_ci 6838c2ecf20Sopenharmony_ci#define PCI_HEADER_TYPE_MULTIFUNC 0x80 6848c2ecf20Sopenharmony_ci#define PCIE_LINK_WIDTH_MASK 0x3F0 6858c2ecf20Sopenharmony_ci#define PCIE_LINK_WIDTH_SHIFT 4 6868c2ecf20Sopenharmony_ci 6878c2ecf20Sopenharmony_ci#define PHY_REVISION_MASK 0xFFFFFFF0 6888c2ecf20Sopenharmony_ci#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ 6898c2ecf20Sopenharmony_ci#define MAX_PHY_MULTI_PAGE_REG 0xF 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci/* Bit definitions for valid PHY IDs. 6928c2ecf20Sopenharmony_ci * I = Integrated 6938c2ecf20Sopenharmony_ci * E = External 6948c2ecf20Sopenharmony_ci */ 6958c2ecf20Sopenharmony_ci#define M88E1000_E_PHY_ID 0x01410C50 6968c2ecf20Sopenharmony_ci#define M88E1000_I_PHY_ID 0x01410C30 6978c2ecf20Sopenharmony_ci#define M88E1011_I_PHY_ID 0x01410C20 6988c2ecf20Sopenharmony_ci#define IGP01E1000_I_PHY_ID 0x02A80380 6998c2ecf20Sopenharmony_ci#define M88E1111_I_PHY_ID 0x01410CC0 7008c2ecf20Sopenharmony_ci#define GG82563_E_PHY_ID 0x01410CA0 7018c2ecf20Sopenharmony_ci#define IGP03E1000_E_PHY_ID 0x02A80390 7028c2ecf20Sopenharmony_ci#define IFE_E_PHY_ID 0x02A80330 7038c2ecf20Sopenharmony_ci#define IFE_PLUS_E_PHY_ID 0x02A80320 7048c2ecf20Sopenharmony_ci#define IFE_C_E_PHY_ID 0x02A80310 7058c2ecf20Sopenharmony_ci#define BME1000_E_PHY_ID 0x01410CB0 7068c2ecf20Sopenharmony_ci#define BME1000_E_PHY_ID_R2 0x01410CB1 7078c2ecf20Sopenharmony_ci#define I82577_E_PHY_ID 0x01540050 7088c2ecf20Sopenharmony_ci#define I82578_E_PHY_ID 0x004DD040 7098c2ecf20Sopenharmony_ci#define I82579_E_PHY_ID 0x01540090 7108c2ecf20Sopenharmony_ci#define I217_E_PHY_ID 0x015400A0 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci/* M88E1000 Specific Registers */ 7138c2ecf20Sopenharmony_ci#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */ 7148c2ecf20Sopenharmony_ci#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Register */ 7158c2ecf20Sopenharmony_ci#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Control */ 7168c2ecf20Sopenharmony_ci 7178c2ecf20Sopenharmony_ci#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for page number setting */ 7188c2ecf20Sopenharmony_ci#define M88E1000_PHY_GEN_CONTROL 0x1E /* Its meaning depends on reg 29 */ 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci/* M88E1000 PHY Specific Control Register */ 7218c2ecf20Sopenharmony_ci#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */ 7228c2ecf20Sopenharmony_ci#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ 7238c2ecf20Sopenharmony_ci /* Manual MDI configuration */ 7248c2ecf20Sopenharmony_ci#define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ 7258c2ecf20Sopenharmony_ci/* 1000BASE-T: Auto crossover, 100BASE-TX/10BASE-T: MDI Mode */ 7268c2ecf20Sopenharmony_ci#define M88E1000_PSCR_AUTO_X_1000T 0x0040 7278c2ecf20Sopenharmony_ci/* Auto crossover enabled all speeds */ 7288c2ecf20Sopenharmony_ci#define M88E1000_PSCR_AUTO_X_MODE 0x0060 7298c2ecf20Sopenharmony_ci#define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_ci/* M88E1000 PHY Specific Status Register */ 7328c2ecf20Sopenharmony_ci#define M88E1000_PSSR_REV_POLARITY 0x0002 /* 1=Polarity reversed */ 7338c2ecf20Sopenharmony_ci#define M88E1000_PSSR_DOWNSHIFT 0x0020 /* 1=Downshifted */ 7348c2ecf20Sopenharmony_ci#define M88E1000_PSSR_MDIX 0x0040 /* 1=MDIX; 0=MDI */ 7358c2ecf20Sopenharmony_ci/* 0=<50M; 1=50-80M; 2=80-110M; 3=110-140M; 4=>140M */ 7368c2ecf20Sopenharmony_ci#define M88E1000_PSSR_CABLE_LENGTH 0x0380 7378c2ecf20Sopenharmony_ci#define M88E1000_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ 7388c2ecf20Sopenharmony_ci#define M88E1000_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ 7398c2ecf20Sopenharmony_ci 7408c2ecf20Sopenharmony_ci#define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_ci/* Number of times we will attempt to autonegotiate before downshifting if we 7438c2ecf20Sopenharmony_ci * are the master 7448c2ecf20Sopenharmony_ci */ 7458c2ecf20Sopenharmony_ci#define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 7468c2ecf20Sopenharmony_ci#define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X 0x0000 7478c2ecf20Sopenharmony_ci/* Number of times we will attempt to autonegotiate before downshifting if we 7488c2ecf20Sopenharmony_ci * are the slave 7498c2ecf20Sopenharmony_ci */ 7508c2ecf20Sopenharmony_ci#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK 0x0300 7518c2ecf20Sopenharmony_ci#define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X 0x0100 7528c2ecf20Sopenharmony_ci#define M88E1000_EPSCR_TX_CLK_25 0x0070 /* 25 MHz TX_CLK */ 7538c2ecf20Sopenharmony_ci 7548c2ecf20Sopenharmony_ci/* M88EC018 Rev 2 specific DownShift settings */ 7558c2ecf20Sopenharmony_ci#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK 0x0E00 7568c2ecf20Sopenharmony_ci#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X 0x0800 7578c2ecf20Sopenharmony_ci 7588c2ecf20Sopenharmony_ci#define I82578_EPSCR_DOWNSHIFT_ENABLE 0x0020 7598c2ecf20Sopenharmony_ci#define I82578_EPSCR_DOWNSHIFT_COUNTER_MASK 0x001C 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_ci/* BME1000 PHY Specific Control Register */ 7628c2ecf20Sopenharmony_ci#define BME1000_PSCR_ENABLE_DOWNSHIFT 0x0800 /* 1 = enable downshift */ 7638c2ecf20Sopenharmony_ci 7648c2ecf20Sopenharmony_ci/* Bits... 7658c2ecf20Sopenharmony_ci * 15-5: page 7668c2ecf20Sopenharmony_ci * 4-0: register offset 7678c2ecf20Sopenharmony_ci */ 7688c2ecf20Sopenharmony_ci#define GG82563_PAGE_SHIFT 5 7698c2ecf20Sopenharmony_ci#define GG82563_REG(page, reg) \ 7708c2ecf20Sopenharmony_ci (((page) << GG82563_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS)) 7718c2ecf20Sopenharmony_ci#define GG82563_MIN_ALT_REG 30 7728c2ecf20Sopenharmony_ci 7738c2ecf20Sopenharmony_ci/* GG82563 Specific Registers */ 7748c2ecf20Sopenharmony_ci#define GG82563_PHY_SPEC_CTRL \ 7758c2ecf20Sopenharmony_ci GG82563_REG(0, 16) /* PHY Specific Control */ 7768c2ecf20Sopenharmony_ci#define GG82563_PHY_PAGE_SELECT \ 7778c2ecf20Sopenharmony_ci GG82563_REG(0, 22) /* Page Select */ 7788c2ecf20Sopenharmony_ci#define GG82563_PHY_SPEC_CTRL_2 \ 7798c2ecf20Sopenharmony_ci GG82563_REG(0, 26) /* PHY Specific Control 2 */ 7808c2ecf20Sopenharmony_ci#define GG82563_PHY_PAGE_SELECT_ALT \ 7818c2ecf20Sopenharmony_ci GG82563_REG(0, 29) /* Alternate Page Select */ 7828c2ecf20Sopenharmony_ci 7838c2ecf20Sopenharmony_ci#define GG82563_PHY_MAC_SPEC_CTRL \ 7848c2ecf20Sopenharmony_ci GG82563_REG(2, 21) /* MAC Specific Control Register */ 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci#define GG82563_PHY_DSP_DISTANCE \ 7878c2ecf20Sopenharmony_ci GG82563_REG(5, 26) /* DSP Distance */ 7888c2ecf20Sopenharmony_ci 7898c2ecf20Sopenharmony_ci/* Page 193 - Port Control Registers */ 7908c2ecf20Sopenharmony_ci#define GG82563_PHY_KMRN_MODE_CTRL \ 7918c2ecf20Sopenharmony_ci GG82563_REG(193, 16) /* Kumeran Mode Control */ 7928c2ecf20Sopenharmony_ci#define GG82563_PHY_PWR_MGMT_CTRL \ 7938c2ecf20Sopenharmony_ci GG82563_REG(193, 20) /* Power Management Control */ 7948c2ecf20Sopenharmony_ci 7958c2ecf20Sopenharmony_ci/* Page 194 - KMRN Registers */ 7968c2ecf20Sopenharmony_ci#define GG82563_PHY_INBAND_CTRL \ 7978c2ecf20Sopenharmony_ci GG82563_REG(194, 18) /* Inband Control */ 7988c2ecf20Sopenharmony_ci 7998c2ecf20Sopenharmony_ci/* MDI Control */ 8008c2ecf20Sopenharmony_ci#define E1000_MDIC_REG_MASK 0x001F0000 8018c2ecf20Sopenharmony_ci#define E1000_MDIC_REG_SHIFT 16 8028c2ecf20Sopenharmony_ci#define E1000_MDIC_PHY_SHIFT 21 8038c2ecf20Sopenharmony_ci#define E1000_MDIC_OP_WRITE 0x04000000 8048c2ecf20Sopenharmony_ci#define E1000_MDIC_OP_READ 0x08000000 8058c2ecf20Sopenharmony_ci#define E1000_MDIC_READY 0x10000000 8068c2ecf20Sopenharmony_ci#define E1000_MDIC_ERROR 0x40000000 8078c2ecf20Sopenharmony_ci 8088c2ecf20Sopenharmony_ci/* SerDes Control */ 8098c2ecf20Sopenharmony_ci#define E1000_GEN_POLL_TIMEOUT 640 8108c2ecf20Sopenharmony_ci 8118c2ecf20Sopenharmony_ci#endif /* _E1000_DEFINES_H_ */ 812