162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright (c) 2018 Intel Corporation */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _IGC_DEFINES_H_ 562306a36Sopenharmony_ci#define _IGC_DEFINES_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci/* Number of Transmit and Receive Descriptors must be a multiple of 8 */ 862306a36Sopenharmony_ci#define REQ_TX_DESCRIPTOR_MULTIPLE 8 962306a36Sopenharmony_ci#define REQ_RX_DESCRIPTOR_MULTIPLE 8 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#define IGC_CTRL_EXT_SDP2_DIR 0x00000400 /* SDP2 Data direction */ 1262306a36Sopenharmony_ci#define IGC_CTRL_EXT_SDP3_DIR 0x00000800 /* SDP3 Data direction */ 1362306a36Sopenharmony_ci#define IGC_CTRL_EXT_DRV_LOAD 0x10000000 /* Drv loaded bit for FW */ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* Definitions for power management and wakeup registers */ 1662306a36Sopenharmony_ci/* Wake Up Control */ 1762306a36Sopenharmony_ci#define IGC_WUC_PME_EN 0x00000002 /* PME Enable */ 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci/* Wake Up Filter Control */ 2062306a36Sopenharmony_ci#define IGC_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ 2162306a36Sopenharmony_ci#define IGC_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ 2262306a36Sopenharmony_ci#define IGC_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ 2362306a36Sopenharmony_ci#define IGC_WUFC_MC 0x00000008 /* Directed Multicast Wakeup Enable */ 2462306a36Sopenharmony_ci#define IGC_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 2562306a36Sopenharmony_ci#define IGC_WUFC_FLEX_HQ BIT(14) /* Flex Filters Host Queuing */ 2662306a36Sopenharmony_ci#define IGC_WUFC_FLX0 BIT(16) /* Flexible Filter 0 Enable */ 2762306a36Sopenharmony_ci#define IGC_WUFC_FLX1 BIT(17) /* Flexible Filter 1 Enable */ 2862306a36Sopenharmony_ci#define IGC_WUFC_FLX2 BIT(18) /* Flexible Filter 2 Enable */ 2962306a36Sopenharmony_ci#define IGC_WUFC_FLX3 BIT(19) /* Flexible Filter 3 Enable */ 3062306a36Sopenharmony_ci#define IGC_WUFC_FLX4 BIT(20) /* Flexible Filter 4 Enable */ 3162306a36Sopenharmony_ci#define IGC_WUFC_FLX5 BIT(21) /* Flexible Filter 5 Enable */ 3262306a36Sopenharmony_ci#define IGC_WUFC_FLX6 BIT(22) /* Flexible Filter 6 Enable */ 3362306a36Sopenharmony_ci#define IGC_WUFC_FLX7 BIT(23) /* Flexible Filter 7 Enable */ 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define IGC_WUFC_FILTER_MASK GENMASK(23, 14) 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#define IGC_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* Wake Up Status */ 4062306a36Sopenharmony_ci#define IGC_WUS_EX 0x00000004 /* Directed Exact */ 4162306a36Sopenharmony_ci#define IGC_WUS_ARPD 0x00000020 /* Directed ARP Request */ 4262306a36Sopenharmony_ci#define IGC_WUS_IPV4 0x00000040 /* Directed IPv4 */ 4362306a36Sopenharmony_ci#define IGC_WUS_IPV6 0x00000080 /* Directed IPv6 */ 4462306a36Sopenharmony_ci#define IGC_WUS_NSD 0x00000400 /* Directed IPv6 Neighbor Solicitation */ 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci/* Packet types that are enabled for wake packet delivery */ 4762306a36Sopenharmony_ci#define WAKE_PKT_WUS ( \ 4862306a36Sopenharmony_ci IGC_WUS_EX | \ 4962306a36Sopenharmony_ci IGC_WUS_ARPD | \ 5062306a36Sopenharmony_ci IGC_WUS_IPV4 | \ 5162306a36Sopenharmony_ci IGC_WUS_IPV6 | \ 5262306a36Sopenharmony_ci IGC_WUS_NSD) 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* Wake Up Packet Length */ 5562306a36Sopenharmony_ci#define IGC_WUPL_MASK 0x00000FFF 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/* Wake Up Packet Memory stores the first 128 bytes of the wake up packet */ 5862306a36Sopenharmony_ci#define IGC_WUPM_BYTES 128 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/* Wakeup Filter Control Extended */ 6162306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX8 BIT(8) /* Flexible Filter 8 Enable */ 6262306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX9 BIT(9) /* Flexible Filter 9 Enable */ 6362306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX10 BIT(10) /* Flexible Filter 10 Enable */ 6462306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX11 BIT(11) /* Flexible Filter 11 Enable */ 6562306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX12 BIT(12) /* Flexible Filter 12 Enable */ 6662306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX13 BIT(13) /* Flexible Filter 13 Enable */ 6762306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX14 BIT(14) /* Flexible Filter 14 Enable */ 6862306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX15 BIT(15) /* Flexible Filter 15 Enable */ 6962306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX16 BIT(16) /* Flexible Filter 16 Enable */ 7062306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX17 BIT(17) /* Flexible Filter 17 Enable */ 7162306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX18 BIT(18) /* Flexible Filter 18 Enable */ 7262306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX19 BIT(19) /* Flexible Filter 19 Enable */ 7362306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX20 BIT(20) /* Flexible Filter 20 Enable */ 7462306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX21 BIT(21) /* Flexible Filter 21 Enable */ 7562306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX22 BIT(22) /* Flexible Filter 22 Enable */ 7662306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX23 BIT(23) /* Flexible Filter 23 Enable */ 7762306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX24 BIT(24) /* Flexible Filter 24 Enable */ 7862306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX25 BIT(25) /* Flexible Filter 25 Enable */ 7962306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX26 BIT(26) /* Flexible Filter 26 Enable */ 8062306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX27 BIT(27) /* Flexible Filter 27 Enable */ 8162306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX28 BIT(28) /* Flexible Filter 28 Enable */ 8262306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX29 BIT(29) /* Flexible Filter 29 Enable */ 8362306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX30 BIT(30) /* Flexible Filter 30 Enable */ 8462306a36Sopenharmony_ci#define IGC_WUFC_EXT_FLX31 BIT(31) /* Flexible Filter 31 Enable */ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define IGC_WUFC_EXT_FILTER_MASK GENMASK(31, 8) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci/* Loop limit on how long we wait for auto-negotiation to complete */ 8962306a36Sopenharmony_ci#define COPPER_LINK_UP_LIMIT 10 9062306a36Sopenharmony_ci#define PHY_AUTO_NEG_LIMIT 45 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* Number of 100 microseconds we wait for PCI Express master disable */ 9362306a36Sopenharmony_ci#define MASTER_DISABLE_TIMEOUT 800 9462306a36Sopenharmony_ci/*Blocks new Master requests */ 9562306a36Sopenharmony_ci#define IGC_CTRL_GIO_MASTER_DISABLE 0x00000004 9662306a36Sopenharmony_ci/* Status of Master requests. */ 9762306a36Sopenharmony_ci#define IGC_STATUS_GIO_MASTER_ENABLE 0x00080000 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci/* Receive Address 10062306a36Sopenharmony_ci * Number of high/low register pairs in the RAR. The RAR (Receive Address 10162306a36Sopenharmony_ci * Registers) holds the directed and multicast addresses that we monitor. 10262306a36Sopenharmony_ci * Technically, we have 16 spots. However, we reserve one of these spots 10362306a36Sopenharmony_ci * (RAR[15]) for our directed address used by controllers with 10462306a36Sopenharmony_ci * manageability enabled, allowing us room for 15 multicast addresses. 10562306a36Sopenharmony_ci */ 10662306a36Sopenharmony_ci#define IGC_RAH_RAH_MASK 0x0000FFFF 10762306a36Sopenharmony_ci#define IGC_RAH_ASEL_MASK 0x00030000 10862306a36Sopenharmony_ci#define IGC_RAH_ASEL_SRC_ADDR BIT(16) 10962306a36Sopenharmony_ci#define IGC_RAH_QSEL_MASK 0x000C0000 11062306a36Sopenharmony_ci#define IGC_RAH_QSEL_SHIFT 18 11162306a36Sopenharmony_ci#define IGC_RAH_QSEL_ENABLE BIT(28) 11262306a36Sopenharmony_ci#define IGC_RAH_AV 0x80000000 /* Receive descriptor valid */ 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci#define IGC_RAL_MAC_ADDR_LEN 4 11562306a36Sopenharmony_ci#define IGC_RAH_MAC_ADDR_LEN 2 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci/* Error Codes */ 11862306a36Sopenharmony_ci#define IGC_SUCCESS 0 11962306a36Sopenharmony_ci#define IGC_ERR_NVM 1 12062306a36Sopenharmony_ci#define IGC_ERR_PHY 2 12162306a36Sopenharmony_ci#define IGC_ERR_CONFIG 3 12262306a36Sopenharmony_ci#define IGC_ERR_PARAM 4 12362306a36Sopenharmony_ci#define IGC_ERR_MAC_INIT 5 12462306a36Sopenharmony_ci#define IGC_ERR_RESET 9 12562306a36Sopenharmony_ci#define IGC_ERR_MASTER_REQUESTS_PENDING 10 12662306a36Sopenharmony_ci#define IGC_ERR_BLK_PHY_RESET 12 12762306a36Sopenharmony_ci#define IGC_ERR_SWFW_SYNC 13 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ci/* Device Control */ 13062306a36Sopenharmony_ci#define IGC_CTRL_RST 0x04000000 /* Global reset */ 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define IGC_CTRL_PHY_RST 0x80000000 /* PHY Reset */ 13362306a36Sopenharmony_ci#define IGC_CTRL_SLU 0x00000040 /* Set link up (Force Link) */ 13462306a36Sopenharmony_ci#define IGC_CTRL_FRCSPD 0x00000800 /* Force Speed */ 13562306a36Sopenharmony_ci#define IGC_CTRL_FRCDPX 0x00001000 /* Force Duplex */ 13662306a36Sopenharmony_ci#define IGC_CTRL_VME 0x40000000 /* IEEE VLAN mode enable */ 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci#define IGC_CTRL_RFCE 0x08000000 /* Receive Flow Control enable */ 13962306a36Sopenharmony_ci#define IGC_CTRL_TFCE 0x10000000 /* Transmit flow control enable */ 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci#define IGC_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ 14262306a36Sopenharmony_ci#define IGC_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci/* As per the EAS the maximum supported size is 9.5KB (9728 bytes) */ 14562306a36Sopenharmony_ci#define MAX_JUMBO_FRAME_SIZE 0x2600 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci/* PBA constants */ 14862306a36Sopenharmony_ci#define IGC_PBA_34K 0x0022 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/* SW Semaphore Register */ 15162306a36Sopenharmony_ci#define IGC_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */ 15262306a36Sopenharmony_ci#define IGC_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */ 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci/* SWFW_SYNC Definitions */ 15562306a36Sopenharmony_ci#define IGC_SWFW_EEP_SM 0x1 15662306a36Sopenharmony_ci#define IGC_SWFW_PHY0_SM 0x2 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ci/* Autoneg Advertisement Register */ 15962306a36Sopenharmony_ci#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ 16062306a36Sopenharmony_ci#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ 16162306a36Sopenharmony_ci#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ 16262306a36Sopenharmony_ci#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ 16362306a36Sopenharmony_ci#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */ 16462306a36Sopenharmony_ci#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci/* Link Partner Ability Register (Base Page) */ 16762306a36Sopenharmony_ci#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ 16862306a36Sopenharmony_ci#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */ 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci/* 1000BASE-T Control Register */ 17162306a36Sopenharmony_ci#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ 17262306a36Sopenharmony_ci#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci/* 1000BASE-T Status Register */ 17562306a36Sopenharmony_ci#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* PHY GPY 211 registers */ 17862306a36Sopenharmony_ci#define STANDARD_AN_REG_MASK 0x0007 /* MMD */ 17962306a36Sopenharmony_ci#define ANEG_MULTIGBT_AN_CTRL 0x0020 /* MULTI GBT AN Control Register */ 18062306a36Sopenharmony_ci#define MMD_DEVADDR_SHIFT 16 /* Shift MMD to higher bits */ 18162306a36Sopenharmony_ci#define CR_2500T_FD_CAPS 0x0080 /* Advertise 2500T FD capability */ 18262306a36Sopenharmony_ci 18362306a36Sopenharmony_ci/* NVM Control */ 18462306a36Sopenharmony_ci/* Number of milliseconds for NVM auto read done after MAC reset. */ 18562306a36Sopenharmony_ci#define AUTO_READ_DONE_TIMEOUT 10 18662306a36Sopenharmony_ci#define IGC_EECD_AUTO_RD 0x00000200 /* NVM Auto Read done */ 18762306a36Sopenharmony_ci#define IGC_EECD_REQ 0x00000040 /* NVM Access Request */ 18862306a36Sopenharmony_ci#define IGC_EECD_GNT 0x00000080 /* NVM Access Grant */ 18962306a36Sopenharmony_ci/* NVM Addressing bits based on type 0=small, 1=large */ 19062306a36Sopenharmony_ci#define IGC_EECD_ADDR_BITS 0x00000400 19162306a36Sopenharmony_ci#define IGC_NVM_GRANT_ATTEMPTS 1000 /* NVM # attempts to gain grant */ 19262306a36Sopenharmony_ci#define IGC_EECD_SIZE_EX_MASK 0x00007800 /* NVM Size */ 19362306a36Sopenharmony_ci#define IGC_EECD_SIZE_EX_SHIFT 11 19462306a36Sopenharmony_ci#define IGC_EECD_FLUPD_I225 0x00800000 /* Update FLASH */ 19562306a36Sopenharmony_ci#define IGC_EECD_FLUDONE_I225 0x04000000 /* Update FLASH done*/ 19662306a36Sopenharmony_ci#define IGC_EECD_FLASH_DETECTED_I225 0x00080000 /* FLASH detected */ 19762306a36Sopenharmony_ci#define IGC_FLUDONE_ATTEMPTS 20000 19862306a36Sopenharmony_ci#define IGC_EERD_EEWR_MAX_COUNT 512 /* buffered EEPROM words rw */ 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci/* Offset to data in NVM read/write registers */ 20162306a36Sopenharmony_ci#define IGC_NVM_RW_REG_DATA 16 20262306a36Sopenharmony_ci#define IGC_NVM_RW_REG_DONE 2 /* Offset to READ/WRITE done bit */ 20362306a36Sopenharmony_ci#define IGC_NVM_RW_REG_START 1 /* Start operation */ 20462306a36Sopenharmony_ci#define IGC_NVM_RW_ADDR_SHIFT 2 /* Shift to the address bits */ 20562306a36Sopenharmony_ci#define IGC_NVM_POLL_READ 0 /* Flag for polling for read complete */ 20662306a36Sopenharmony_ci#define IGC_NVM_DEV_STARTER 5 /* Dev_starter Version */ 20762306a36Sopenharmony_ci 20862306a36Sopenharmony_ci/* NVM Word Offsets */ 20962306a36Sopenharmony_ci#define NVM_CHECKSUM_REG 0x003F 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ 21262306a36Sopenharmony_ci#define NVM_SUM 0xBABA 21362306a36Sopenharmony_ci#define NVM_WORD_SIZE_BASE_SHIFT 6 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci/* Collision related configuration parameters */ 21662306a36Sopenharmony_ci#define IGC_COLLISION_THRESHOLD 15 21762306a36Sopenharmony_ci#define IGC_CT_SHIFT 4 21862306a36Sopenharmony_ci#define IGC_COLLISION_DISTANCE 63 21962306a36Sopenharmony_ci#define IGC_COLD_SHIFT 12 22062306a36Sopenharmony_ci 22162306a36Sopenharmony_ci/* Device Status */ 22262306a36Sopenharmony_ci#define IGC_STATUS_FD 0x00000001 /* Full duplex.0=half,1=full */ 22362306a36Sopenharmony_ci#define IGC_STATUS_LU 0x00000002 /* Link up.0=no,1=link */ 22462306a36Sopenharmony_ci#define IGC_STATUS_FUNC_MASK 0x0000000C /* PCI Function Mask */ 22562306a36Sopenharmony_ci#define IGC_STATUS_FUNC_SHIFT 2 22662306a36Sopenharmony_ci#define IGC_STATUS_TXOFF 0x00000010 /* transmission paused */ 22762306a36Sopenharmony_ci#define IGC_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ 22862306a36Sopenharmony_ci#define IGC_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ 22962306a36Sopenharmony_ci#define IGC_STATUS_SPEED_2500 0x00400000 /* Speed 2.5Gb/s */ 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci#define SPEED_10 10 23262306a36Sopenharmony_ci#define SPEED_100 100 23362306a36Sopenharmony_ci#define SPEED_1000 1000 23462306a36Sopenharmony_ci#define SPEED_2500 2500 23562306a36Sopenharmony_ci#define HALF_DUPLEX 1 23662306a36Sopenharmony_ci#define FULL_DUPLEX 2 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci/* 1Gbps and 2.5Gbps half duplex is not supported, nor spec-compliant. */ 23962306a36Sopenharmony_ci#define ADVERTISE_10_HALF 0x0001 24062306a36Sopenharmony_ci#define ADVERTISE_10_FULL 0x0002 24162306a36Sopenharmony_ci#define ADVERTISE_100_HALF 0x0004 24262306a36Sopenharmony_ci#define ADVERTISE_100_FULL 0x0008 24362306a36Sopenharmony_ci#define ADVERTISE_1000_HALF 0x0010 /* Not used, just FYI */ 24462306a36Sopenharmony_ci#define ADVERTISE_1000_FULL 0x0020 24562306a36Sopenharmony_ci#define ADVERTISE_2500_HALF 0x0040 /* Not used, just FYI */ 24662306a36Sopenharmony_ci#define ADVERTISE_2500_FULL 0x0080 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci#define IGC_ALL_SPEED_DUPLEX_2500 ( \ 24962306a36Sopenharmony_ci ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ 25062306a36Sopenharmony_ci ADVERTISE_100_FULL | ADVERTISE_1000_FULL | ADVERTISE_2500_FULL) 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci#define AUTONEG_ADVERTISE_SPEED_DEFAULT_2500 IGC_ALL_SPEED_DUPLEX_2500 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/* Interrupt Cause Read */ 25562306a36Sopenharmony_ci#define IGC_ICR_TXDW BIT(0) /* Transmit desc written back */ 25662306a36Sopenharmony_ci#define IGC_ICR_TXQE BIT(1) /* Transmit Queue empty */ 25762306a36Sopenharmony_ci#define IGC_ICR_LSC BIT(2) /* Link Status Change */ 25862306a36Sopenharmony_ci#define IGC_ICR_RXSEQ BIT(3) /* Rx sequence error */ 25962306a36Sopenharmony_ci#define IGC_ICR_RXDMT0 BIT(4) /* Rx desc min. threshold (0) */ 26062306a36Sopenharmony_ci#define IGC_ICR_RXO BIT(6) /* Rx overrun */ 26162306a36Sopenharmony_ci#define IGC_ICR_RXT0 BIT(7) /* Rx timer intr (ring 0) */ 26262306a36Sopenharmony_ci#define IGC_ICR_TS BIT(19) /* Time Sync Interrupt */ 26362306a36Sopenharmony_ci#define IGC_ICR_DRSTA BIT(30) /* Device Reset Asserted */ 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci/* If this bit asserted, the driver should claim the interrupt */ 26662306a36Sopenharmony_ci#define IGC_ICR_INT_ASSERTED BIT(31) 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci#define IGC_ICS_RXT0 IGC_ICR_RXT0 /* Rx timer intr */ 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci#define IMS_ENABLE_MASK ( \ 27162306a36Sopenharmony_ci IGC_IMS_RXT0 | \ 27262306a36Sopenharmony_ci IGC_IMS_TXDW | \ 27362306a36Sopenharmony_ci IGC_IMS_RXDMT0 | \ 27462306a36Sopenharmony_ci IGC_IMS_RXSEQ | \ 27562306a36Sopenharmony_ci IGC_IMS_LSC) 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci/* Interrupt Mask Set */ 27862306a36Sopenharmony_ci#define IGC_IMS_TXDW IGC_ICR_TXDW /* Tx desc written back */ 27962306a36Sopenharmony_ci#define IGC_IMS_RXSEQ IGC_ICR_RXSEQ /* Rx sequence error */ 28062306a36Sopenharmony_ci#define IGC_IMS_LSC IGC_ICR_LSC /* Link Status Change */ 28162306a36Sopenharmony_ci#define IGC_IMS_DOUTSYNC IGC_ICR_DOUTSYNC /* NIC DMA out of sync */ 28262306a36Sopenharmony_ci#define IGC_IMS_DRSTA IGC_ICR_DRSTA /* Device Reset Asserted */ 28362306a36Sopenharmony_ci#define IGC_IMS_RXT0 IGC_ICR_RXT0 /* Rx timer intr */ 28462306a36Sopenharmony_ci#define IGC_IMS_RXDMT0 IGC_ICR_RXDMT0 /* Rx desc min. threshold */ 28562306a36Sopenharmony_ci#define IGC_IMS_TS IGC_ICR_TS /* Time Sync Interrupt */ 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci#define IGC_QVECTOR_MASK 0x7FFC /* Q-vector mask */ 28862306a36Sopenharmony_ci#define IGC_ITR_VAL_MASK 0x04 /* ITR value mask */ 28962306a36Sopenharmony_ci 29062306a36Sopenharmony_ci/* Interrupt Cause Set */ 29162306a36Sopenharmony_ci#define IGC_ICS_LSC IGC_ICR_LSC /* Link Status Change */ 29262306a36Sopenharmony_ci#define IGC_ICS_RXDMT0 IGC_ICR_RXDMT0 /* rx desc min. threshold */ 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci#define IGC_ICR_DOUTSYNC 0x10000000 /* NIC DMA out of sync */ 29562306a36Sopenharmony_ci#define IGC_EITR_CNT_IGNR 0x80000000 /* Don't reset counters on write */ 29662306a36Sopenharmony_ci#define IGC_IVAR_VALID 0x80 29762306a36Sopenharmony_ci#define IGC_GPIE_NSICR 0x00000001 29862306a36Sopenharmony_ci#define IGC_GPIE_MSIX_MODE 0x00000010 29962306a36Sopenharmony_ci#define IGC_GPIE_EIAME 0x40000000 30062306a36Sopenharmony_ci#define IGC_GPIE_PBA 0x80000000 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci/* Receive Descriptor bit definitions */ 30362306a36Sopenharmony_ci#define IGC_RXD_STAT_DD 0x01 /* Descriptor Done */ 30462306a36Sopenharmony_ci 30562306a36Sopenharmony_ci/* Transmit Descriptor bit definitions */ 30662306a36Sopenharmony_ci#define IGC_TXD_DTYP_D 0x00100000 /* Data Descriptor */ 30762306a36Sopenharmony_ci#define IGC_TXD_DTYP_C 0x00000000 /* Context Descriptor */ 30862306a36Sopenharmony_ci#define IGC_TXD_POPTS_IXSM 0x01 /* Insert IP checksum */ 30962306a36Sopenharmony_ci#define IGC_TXD_POPTS_TXSM 0x02 /* Insert TCP/UDP checksum */ 31062306a36Sopenharmony_ci#define IGC_TXD_CMD_EOP 0x01000000 /* End of Packet */ 31162306a36Sopenharmony_ci#define IGC_TXD_CMD_IC 0x04000000 /* Insert Checksum */ 31262306a36Sopenharmony_ci#define IGC_TXD_CMD_DEXT 0x20000000 /* Desc extension (0 = legacy) */ 31362306a36Sopenharmony_ci#define IGC_TXD_CMD_VLE 0x40000000 /* Add VLAN tag */ 31462306a36Sopenharmony_ci#define IGC_TXD_STAT_DD 0x00000001 /* Descriptor Done */ 31562306a36Sopenharmony_ci#define IGC_TXD_CMD_TCP 0x01000000 /* TCP packet */ 31662306a36Sopenharmony_ci#define IGC_TXD_CMD_IP 0x02000000 /* IP packet */ 31762306a36Sopenharmony_ci#define IGC_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ 31862306a36Sopenharmony_ci#define IGC_TXD_EXTCMD_TSTAMP 0x00000010 /* IEEE1588 Timestamp packet */ 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ci/* IPSec Encrypt Enable */ 32162306a36Sopenharmony_ci#define IGC_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ 32262306a36Sopenharmony_ci#define IGC_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ci#define IGC_ADVTXD_TSN_CNTX_FIRST 0x00000080 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci/* Transmit Control */ 32762306a36Sopenharmony_ci#define IGC_TCTL_EN 0x00000002 /* enable Tx */ 32862306a36Sopenharmony_ci#define IGC_TCTL_PSP 0x00000008 /* pad short packets */ 32962306a36Sopenharmony_ci#define IGC_TCTL_CT 0x00000ff0 /* collision threshold */ 33062306a36Sopenharmony_ci#define IGC_TCTL_COLD 0x003ff000 /* collision distance */ 33162306a36Sopenharmony_ci#define IGC_TCTL_RTLC 0x01000000 /* Re-transmit on late collision */ 33262306a36Sopenharmony_ci 33362306a36Sopenharmony_ci/* Flow Control Constants */ 33462306a36Sopenharmony_ci#define FLOW_CONTROL_ADDRESS_LOW 0x00C28001 33562306a36Sopenharmony_ci#define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 33662306a36Sopenharmony_ci#define FLOW_CONTROL_TYPE 0x8808 33762306a36Sopenharmony_ci/* Enable XON frame transmission */ 33862306a36Sopenharmony_ci#define IGC_FCRTL_XONE 0x80000000 33962306a36Sopenharmony_ci 34062306a36Sopenharmony_ci/* Management Control */ 34162306a36Sopenharmony_ci#define IGC_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */ 34262306a36Sopenharmony_ci#define IGC_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */ 34362306a36Sopenharmony_ci 34462306a36Sopenharmony_ci/* Receive Control */ 34562306a36Sopenharmony_ci#define IGC_RCTL_RST 0x00000001 /* Software reset */ 34662306a36Sopenharmony_ci#define IGC_RCTL_EN 0x00000002 /* enable */ 34762306a36Sopenharmony_ci#define IGC_RCTL_SBP 0x00000004 /* store bad packet */ 34862306a36Sopenharmony_ci#define IGC_RCTL_UPE 0x00000008 /* unicast promisc enable */ 34962306a36Sopenharmony_ci#define IGC_RCTL_MPE 0x00000010 /* multicast promisc enable */ 35062306a36Sopenharmony_ci#define IGC_RCTL_LPE 0x00000020 /* long packet enable */ 35162306a36Sopenharmony_ci#define IGC_RCTL_LBM_MAC 0x00000040 /* MAC loopback mode */ 35262306a36Sopenharmony_ci#define IGC_RCTL_LBM_TCVR 0x000000C0 /* tcvr loopback mode */ 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ci#define IGC_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */ 35562306a36Sopenharmony_ci#define IGC_RCTL_BAM 0x00008000 /* broadcast enable */ 35662306a36Sopenharmony_ci 35762306a36Sopenharmony_ci/* Split Replication Receive Control */ 35862306a36Sopenharmony_ci#define IGC_SRRCTL_TIMESTAMP 0x40000000 35962306a36Sopenharmony_ci#define IGC_SRRCTL_TIMER1SEL(timer) (((timer) & 0x3) << 14) 36062306a36Sopenharmony_ci#define IGC_SRRCTL_TIMER0SEL(timer) (((timer) & 0x3) << 17) 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci/* Receive Descriptor bit definitions */ 36362306a36Sopenharmony_ci#define IGC_RXD_STAT_EOP 0x02 /* End of Packet */ 36462306a36Sopenharmony_ci#define IGC_RXD_STAT_IXSM 0x04 /* Ignore checksum */ 36562306a36Sopenharmony_ci#define IGC_RXD_STAT_UDPCS 0x10 /* UDP xsum calculated */ 36662306a36Sopenharmony_ci#define IGC_RXD_STAT_TCPCS 0x20 /* TCP xsum calculated */ 36762306a36Sopenharmony_ci#define IGC_RXD_STAT_VP 0x08 /* IEEE VLAN Packet */ 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci#define IGC_RXDEXT_STATERR_LB 0x00040000 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci/* Advanced Receive Descriptor bit definitions */ 37262306a36Sopenharmony_ci#define IGC_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */ 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci#define IGC_RXDEXT_STATERR_L4E 0x20000000 37562306a36Sopenharmony_ci#define IGC_RXDEXT_STATERR_IPE 0x40000000 37662306a36Sopenharmony_ci#define IGC_RXDEXT_STATERR_RXE 0x80000000 37762306a36Sopenharmony_ci 37862306a36Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV4_TCP 0x00010000 37962306a36Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV4 0x00020000 38062306a36Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV6_TCP_EX 0x00040000 38162306a36Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV6 0x00100000 38262306a36Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV6_TCP 0x00200000 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_ci/* Header split receive */ 38562306a36Sopenharmony_ci#define IGC_RFCTL_IPV6_EX_DIS 0x00010000 38662306a36Sopenharmony_ci#define IGC_RFCTL_LEF 0x00040000 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci#define IGC_RCTL_SZ_256 0x00030000 /* Rx buffer size 256 */ 38962306a36Sopenharmony_ci 39062306a36Sopenharmony_ci#define IGC_RCTL_MO_SHIFT 12 /* multicast offset shift */ 39162306a36Sopenharmony_ci#define IGC_RCTL_CFIEN 0x00080000 /* canonical form enable */ 39262306a36Sopenharmony_ci#define IGC_RCTL_DPF 0x00400000 /* discard pause frames */ 39362306a36Sopenharmony_ci#define IGC_RCTL_PMCF 0x00800000 /* pass MAC control frames */ 39462306a36Sopenharmony_ci#define IGC_RCTL_SECRC 0x04000000 /* Strip Ethernet CRC */ 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_ci#define I225_RXPBSIZE_DEFAULT 0x000000A2 /* RXPBSIZE default */ 39762306a36Sopenharmony_ci#define I225_TXPBSIZE_DEFAULT 0x04000014 /* TXPBSIZE default */ 39862306a36Sopenharmony_ci#define IGC_RXPBS_CFG_TS_EN 0x80000000 /* Timestamp in Rx buffer */ 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci#define IGC_TXPBSIZE_TSN 0x04145145 /* 5k bytes buffer for each queue */ 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci#define IGC_DTXMXPKTSZ_TSN 0x19 /* 1600 bytes of max TX DMA packet size */ 40362306a36Sopenharmony_ci#define IGC_DTXMXPKTSZ_DEFAULT 0x98 /* 9728-byte Jumbo frames */ 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_ci/* Transmit Scheduling Latency */ 40662306a36Sopenharmony_ci/* Latency between transmission scheduling (LaunchTime) and the time 40762306a36Sopenharmony_ci * the packet is transmitted to the network in nanosecond. 40862306a36Sopenharmony_ci */ 40962306a36Sopenharmony_ci#define IGC_TXOFFSET_SPEED_10 0x000034BC 41062306a36Sopenharmony_ci#define IGC_TXOFFSET_SPEED_100 0x00000578 41162306a36Sopenharmony_ci#define IGC_TXOFFSET_SPEED_1000 0x0000012C 41262306a36Sopenharmony_ci#define IGC_TXOFFSET_SPEED_2500 0x00000578 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci/* Time Sync Interrupt Causes */ 41562306a36Sopenharmony_ci#define IGC_TSICR_SYS_WRAP BIT(0) /* SYSTIM Wrap around. */ 41662306a36Sopenharmony_ci#define IGC_TSICR_TXTS BIT(1) /* Transmit Timestamp. */ 41762306a36Sopenharmony_ci#define IGC_TSICR_TT0 BIT(3) /* Target Time 0 Trigger. */ 41862306a36Sopenharmony_ci#define IGC_TSICR_TT1 BIT(4) /* Target Time 1 Trigger. */ 41962306a36Sopenharmony_ci#define IGC_TSICR_AUTT0 BIT(5) /* Auxiliary Timestamp 0 Taken. */ 42062306a36Sopenharmony_ci#define IGC_TSICR_AUTT1 BIT(6) /* Auxiliary Timestamp 1 Taken. */ 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ci#define IGC_TSICR_INTERRUPTS IGC_TSICR_TXTS 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci#define IGC_FTQF_VF_BP 0x00008000 42562306a36Sopenharmony_ci#define IGC_FTQF_1588_TIME_STAMP 0x08000000 42662306a36Sopenharmony_ci#define IGC_FTQF_MASK 0xF0000000 42762306a36Sopenharmony_ci#define IGC_FTQF_MASK_PROTO_BP 0x10000000 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci/* Time Sync Receive Control bit definitions */ 43062306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_MASK 0x0000000E /* Rx type mask */ 43162306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_L2_V2 0x00 43262306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_L4_V1 0x02 43362306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_L2_L4_V2 0x04 43462306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_ALL 0x08 43562306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_EVENT_V2 0x0A 43662306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_ENABLED 0x00000010 /* enable Rx timestamping */ 43762306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_SYSCFI 0x00000020 /* Sys clock frequency */ 43862306a36Sopenharmony_ci#define IGC_TSYNCRXCTL_RXSYNSIG 0x00000400 /* Sample RX tstamp in PHY sop */ 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_ci/* Time Sync Receive Configuration */ 44162306a36Sopenharmony_ci#define IGC_TSYNCRXCFG_PTP_V1_CTRLT_MASK 0x000000FF 44262306a36Sopenharmony_ci#define IGC_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE 0x00 44362306a36Sopenharmony_ci#define IGC_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE 0x01 44462306a36Sopenharmony_ci 44562306a36Sopenharmony_ci/* Immediate Interrupt Receive */ 44662306a36Sopenharmony_ci#define IGC_IMIR_CLEAR_MASK 0xF001FFFF /* IMIR Reg Clear Mask */ 44762306a36Sopenharmony_ci#define IGC_IMIR_PORT_BYPASS 0x20000 /* IMIR Port Bypass Bit */ 44862306a36Sopenharmony_ci#define IGC_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */ 44962306a36Sopenharmony_ci#define IGC_IMIREXT_CLEAR_MASK 0x7FFFF /* IMIREXT Reg Clear Mask */ 45062306a36Sopenharmony_ci 45162306a36Sopenharmony_ci/* Immediate Interrupt Receive Extended */ 45262306a36Sopenharmony_ci#define IGC_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */ 45362306a36Sopenharmony_ci#define IGC_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_ci/* Time Sync Transmit Control bit definitions */ 45662306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_TXTT_0 0x00000001 /* Tx timestamp reg 0 valid */ 45762306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_TXTT_1 0x00000002 /* Tx timestamp reg 1 valid */ 45862306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_TXTT_2 0x00000004 /* Tx timestamp reg 2 valid */ 45962306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_TXTT_3 0x00000008 /* Tx timestamp reg 3 valid */ 46062306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_ENABLED 0x00000010 /* enable Tx timestamping */ 46162306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000 /* max delay */ 46262306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_SYNC_COMP_ERR 0x20000000 /* sync err */ 46362306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_SYNC_COMP 0x40000000 /* sync complete */ 46462306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_START_SYNC 0x80000000 /* initiate sync */ 46562306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_TXSYNSIG 0x00000020 /* Sample TX tstamp in PHY sop */ 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_ci#define IGC_TSYNCTXCTL_TXTT_ANY ( \ 46862306a36Sopenharmony_ci IGC_TSYNCTXCTL_TXTT_0 | IGC_TSYNCTXCTL_TXTT_1 | \ 46962306a36Sopenharmony_ci IGC_TSYNCTXCTL_TXTT_2 | IGC_TSYNCTXCTL_TXTT_3) 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_ci/* Timer selection bits */ 47262306a36Sopenharmony_ci#define IGC_AUX_IO_TIMER_SEL_SYSTIM0 (0u << 30) /* Select SYSTIM0 for auxiliary time stamp */ 47362306a36Sopenharmony_ci#define IGC_AUX_IO_TIMER_SEL_SYSTIM1 (1u << 30) /* Select SYSTIM1 for auxiliary time stamp */ 47462306a36Sopenharmony_ci#define IGC_AUX_IO_TIMER_SEL_SYSTIM2 (2u << 30) /* Select SYSTIM2 for auxiliary time stamp */ 47562306a36Sopenharmony_ci#define IGC_AUX_IO_TIMER_SEL_SYSTIM3 (3u << 30) /* Select SYSTIM3 for auxiliary time stamp */ 47662306a36Sopenharmony_ci#define IGC_TT_IO_TIMER_SEL_SYSTIM0 (0u << 30) /* Select SYSTIM0 for target time stamp */ 47762306a36Sopenharmony_ci#define IGC_TT_IO_TIMER_SEL_SYSTIM1 (1u << 30) /* Select SYSTIM1 for target time stamp */ 47862306a36Sopenharmony_ci#define IGC_TT_IO_TIMER_SEL_SYSTIM2 (2u << 30) /* Select SYSTIM2 for target time stamp */ 47962306a36Sopenharmony_ci#define IGC_TT_IO_TIMER_SEL_SYSTIM3 (3u << 30) /* Select SYSTIM3 for target time stamp */ 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci/* TSAUXC Configuration Bits */ 48262306a36Sopenharmony_ci#define IGC_TSAUXC_EN_TT0 BIT(0) /* Enable target time 0. */ 48362306a36Sopenharmony_ci#define IGC_TSAUXC_EN_TT1 BIT(1) /* Enable target time 1. */ 48462306a36Sopenharmony_ci#define IGC_TSAUXC_EN_CLK0 BIT(2) /* Enable Configurable Frequency Clock 0. */ 48562306a36Sopenharmony_ci#define IGC_TSAUXC_ST0 BIT(4) /* Start Clock 0 Toggle on Target Time 0. */ 48662306a36Sopenharmony_ci#define IGC_TSAUXC_EN_CLK1 BIT(5) /* Enable Configurable Frequency Clock 1. */ 48762306a36Sopenharmony_ci#define IGC_TSAUXC_ST1 BIT(7) /* Start Clock 1 Toggle on Target Time 1. */ 48862306a36Sopenharmony_ci#define IGC_TSAUXC_EN_TS0 BIT(8) /* Enable hardware timestamp 0. */ 48962306a36Sopenharmony_ci#define IGC_TSAUXC_AUTT0 BIT(9) /* Auxiliary Timestamp Taken. */ 49062306a36Sopenharmony_ci#define IGC_TSAUXC_EN_TS1 BIT(10) /* Enable hardware timestamp 0. */ 49162306a36Sopenharmony_ci#define IGC_TSAUXC_AUTT1 BIT(11) /* Auxiliary Timestamp Taken. */ 49262306a36Sopenharmony_ci#define IGC_TSAUXC_PLSG BIT(17) /* Generate a pulse. */ 49362306a36Sopenharmony_ci#define IGC_TSAUXC_DISABLE1 BIT(27) /* Disable SYSTIM0 Count Operation. */ 49462306a36Sopenharmony_ci#define IGC_TSAUXC_DISABLE2 BIT(28) /* Disable SYSTIM1 Count Operation. */ 49562306a36Sopenharmony_ci#define IGC_TSAUXC_DISABLE3 BIT(29) /* Disable SYSTIM2 Count Operation. */ 49662306a36Sopenharmony_ci#define IGC_TSAUXC_DIS_TS_CLEAR BIT(30) /* Disable EN_TT0/1 auto clear. */ 49762306a36Sopenharmony_ci#define IGC_TSAUXC_DISABLE0 BIT(31) /* Disable SYSTIM0 Count Operation. */ 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci/* SDP Configuration Bits */ 50062306a36Sopenharmony_ci#define IGC_AUX0_SEL_SDP0 (0u << 0) /* Assign SDP0 to auxiliary time stamp 0. */ 50162306a36Sopenharmony_ci#define IGC_AUX0_SEL_SDP1 (1u << 0) /* Assign SDP1 to auxiliary time stamp 0. */ 50262306a36Sopenharmony_ci#define IGC_AUX0_SEL_SDP2 (2u << 0) /* Assign SDP2 to auxiliary time stamp 0. */ 50362306a36Sopenharmony_ci#define IGC_AUX0_SEL_SDP3 (3u << 0) /* Assign SDP3 to auxiliary time stamp 0. */ 50462306a36Sopenharmony_ci#define IGC_AUX0_TS_SDP_EN (1u << 2) /* Enable auxiliary time stamp trigger 0. */ 50562306a36Sopenharmony_ci#define IGC_AUX1_SEL_SDP0 (0u << 3) /* Assign SDP0 to auxiliary time stamp 1. */ 50662306a36Sopenharmony_ci#define IGC_AUX1_SEL_SDP1 (1u << 3) /* Assign SDP1 to auxiliary time stamp 1. */ 50762306a36Sopenharmony_ci#define IGC_AUX1_SEL_SDP2 (2u << 3) /* Assign SDP2 to auxiliary time stamp 1. */ 50862306a36Sopenharmony_ci#define IGC_AUX1_SEL_SDP3 (3u << 3) /* Assign SDP3 to auxiliary time stamp 1. */ 50962306a36Sopenharmony_ci#define IGC_AUX1_TS_SDP_EN (1u << 5) /* Enable auxiliary time stamp trigger 1. */ 51062306a36Sopenharmony_ci#define IGC_TS_SDP0_SEL_TT0 (0u << 6) /* Target time 0 is output on SDP0. */ 51162306a36Sopenharmony_ci#define IGC_TS_SDP0_SEL_TT1 (1u << 6) /* Target time 1 is output on SDP0. */ 51262306a36Sopenharmony_ci#define IGC_TS_SDP0_SEL_FC0 (2u << 6) /* Freq clock 0 is output on SDP0. */ 51362306a36Sopenharmony_ci#define IGC_TS_SDP0_SEL_FC1 (3u << 6) /* Freq clock 1 is output on SDP0. */ 51462306a36Sopenharmony_ci#define IGC_TS_SDP0_EN (1u << 8) /* SDP0 is assigned to Tsync. */ 51562306a36Sopenharmony_ci#define IGC_TS_SDP1_SEL_TT0 (0u << 9) /* Target time 0 is output on SDP1. */ 51662306a36Sopenharmony_ci#define IGC_TS_SDP1_SEL_TT1 (1u << 9) /* Target time 1 is output on SDP1. */ 51762306a36Sopenharmony_ci#define IGC_TS_SDP1_SEL_FC0 (2u << 9) /* Freq clock 0 is output on SDP1. */ 51862306a36Sopenharmony_ci#define IGC_TS_SDP1_SEL_FC1 (3u << 9) /* Freq clock 1 is output on SDP1. */ 51962306a36Sopenharmony_ci#define IGC_TS_SDP1_EN (1u << 11) /* SDP1 is assigned to Tsync. */ 52062306a36Sopenharmony_ci#define IGC_TS_SDP2_SEL_TT0 (0u << 12) /* Target time 0 is output on SDP2. */ 52162306a36Sopenharmony_ci#define IGC_TS_SDP2_SEL_TT1 (1u << 12) /* Target time 1 is output on SDP2. */ 52262306a36Sopenharmony_ci#define IGC_TS_SDP2_SEL_FC0 (2u << 12) /* Freq clock 0 is output on SDP2. */ 52362306a36Sopenharmony_ci#define IGC_TS_SDP2_SEL_FC1 (3u << 12) /* Freq clock 1 is output on SDP2. */ 52462306a36Sopenharmony_ci#define IGC_TS_SDP2_EN (1u << 14) /* SDP2 is assigned to Tsync. */ 52562306a36Sopenharmony_ci#define IGC_TS_SDP3_SEL_TT0 (0u << 15) /* Target time 0 is output on SDP3. */ 52662306a36Sopenharmony_ci#define IGC_TS_SDP3_SEL_TT1 (1u << 15) /* Target time 1 is output on SDP3. */ 52762306a36Sopenharmony_ci#define IGC_TS_SDP3_SEL_FC0 (2u << 15) /* Freq clock 0 is output on SDP3. */ 52862306a36Sopenharmony_ci#define IGC_TS_SDP3_SEL_FC1 (3u << 15) /* Freq clock 1 is output on SDP3. */ 52962306a36Sopenharmony_ci#define IGC_TS_SDP3_EN (1u << 17) /* SDP3 is assigned to Tsync. */ 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci/* Transmit Scheduling */ 53262306a36Sopenharmony_ci#define IGC_TQAVCTRL_TRANSMIT_MODE_TSN 0x00000001 53362306a36Sopenharmony_ci#define IGC_TQAVCTRL_ENHANCED_QAV 0x00000008 53462306a36Sopenharmony_ci#define IGC_TQAVCTRL_FUTSCDDIS 0x00000080 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_ci#define IGC_TXQCTL_QUEUE_MODE_LAUNCHT 0x00000001 53762306a36Sopenharmony_ci#define IGC_TXQCTL_STRICT_CYCLE 0x00000002 53862306a36Sopenharmony_ci#define IGC_TXQCTL_STRICT_END 0x00000004 53962306a36Sopenharmony_ci#define IGC_TXQCTL_QAV_SEL_MASK 0x000000C0 54062306a36Sopenharmony_ci#define IGC_TXQCTL_QAV_SEL_CBS0 0x00000080 54162306a36Sopenharmony_ci#define IGC_TXQCTL_QAV_SEL_CBS1 0x000000C0 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci#define IGC_TQAVCC_IDLESLOPE_MASK 0xFFFF 54462306a36Sopenharmony_ci#define IGC_TQAVCC_KEEP_CREDITS BIT(30) 54562306a36Sopenharmony_ci 54662306a36Sopenharmony_ci#define IGC_MAX_SR_QUEUES 2 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ci/* Receive Checksum Control */ 54962306a36Sopenharmony_ci#define IGC_RXCSUM_CRCOFL 0x00000800 /* CRC32 offload enable */ 55062306a36Sopenharmony_ci#define IGC_RXCSUM_PCSD 0x00002000 /* packet checksum disabled */ 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci/* PCIe PTM Control */ 55362306a36Sopenharmony_ci#define IGC_PTM_CTRL_START_NOW BIT(29) /* Start PTM Now */ 55462306a36Sopenharmony_ci#define IGC_PTM_CTRL_EN BIT(30) /* Enable PTM */ 55562306a36Sopenharmony_ci#define IGC_PTM_CTRL_TRIG BIT(31) /* PTM Cycle trigger */ 55662306a36Sopenharmony_ci#define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x3f) << 2) 55762306a36Sopenharmony_ci#define IGC_PTM_CTRL_PTM_TO(usec) (((usec) & 0xff) << 8) 55862306a36Sopenharmony_ci 55962306a36Sopenharmony_ci#define IGC_PTM_SHORT_CYC_DEFAULT 1 /* Default short cycle interval */ 56062306a36Sopenharmony_ci#define IGC_PTM_CYC_TIME_DEFAULT 5 /* Default PTM cycle time */ 56162306a36Sopenharmony_ci#define IGC_PTM_TIMEOUT_DEFAULT 255 /* Default timeout for PTM errors */ 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci/* PCIe Digital Delay */ 56462306a36Sopenharmony_ci#define IGC_PCIE_DIG_DELAY_DEFAULT 0x01440000 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci/* PCIe PHY Delay */ 56762306a36Sopenharmony_ci#define IGC_PCIE_PHY_DELAY_DEFAULT 0x40900000 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci#define IGC_TIMADJ_ADJUST_METH 0x40000000 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_ci/* PCIe PTM Status */ 57262306a36Sopenharmony_ci#define IGC_PTM_STAT_VALID BIT(0) /* PTM Status */ 57362306a36Sopenharmony_ci#define IGC_PTM_STAT_RET_ERR BIT(1) /* Root port timeout */ 57462306a36Sopenharmony_ci#define IGC_PTM_STAT_BAD_PTM_RES BIT(2) /* PTM Response msg instead of PTM Response Data */ 57562306a36Sopenharmony_ci#define IGC_PTM_STAT_T4M1_OVFL BIT(3) /* T4 minus T1 overflow */ 57662306a36Sopenharmony_ci#define IGC_PTM_STAT_ADJUST_1ST BIT(4) /* 1588 timer adjusted during 1st PTM cycle */ 57762306a36Sopenharmony_ci#define IGC_PTM_STAT_ADJUST_CYC BIT(5) /* 1588 timer adjusted during non-1st PTM cycle */ 57862306a36Sopenharmony_ci 57962306a36Sopenharmony_ci/* PCIe PTM Cycle Control */ 58062306a36Sopenharmony_ci#define IGC_PTM_CYCLE_CTRL_CYC_TIME(msec) ((msec) & 0x3ff) /* PTM Cycle Time (msec) */ 58162306a36Sopenharmony_ci#define IGC_PTM_CYCLE_CTRL_AUTO_CYC_EN BIT(31) /* PTM Cycle Control */ 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_ci/* GPY211 - I225 defines */ 58462306a36Sopenharmony_ci#define GPY_MMD_MASK 0xFFFF0000 58562306a36Sopenharmony_ci#define GPY_MMD_SHIFT 16 58662306a36Sopenharmony_ci#define GPY_REG_MASK 0x0000FFFF 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci#define IGC_MMDAC_FUNC_DATA 0x4000 /* Data, no post increment */ 58962306a36Sopenharmony_ci 59062306a36Sopenharmony_ci/* MAC definitions */ 59162306a36Sopenharmony_ci#define IGC_FACTPS_MNGCG 0x20000000 59262306a36Sopenharmony_ci#define IGC_FWSM_MODE_MASK 0xE 59362306a36Sopenharmony_ci#define IGC_FWSM_MODE_SHIFT 1 59462306a36Sopenharmony_ci 59562306a36Sopenharmony_ci/* Management Control */ 59662306a36Sopenharmony_ci#define IGC_MANC_SMBUS_EN 0x00000001 /* SMBus Enabled - RO */ 59762306a36Sopenharmony_ci#define IGC_MANC_ASF_EN 0x00000002 /* ASF Enabled - RO */ 59862306a36Sopenharmony_ci 59962306a36Sopenharmony_ci/* PHY */ 60062306a36Sopenharmony_ci#define PHY_REVISION_MASK 0xFFFFFFF0 60162306a36Sopenharmony_ci#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */ 60262306a36Sopenharmony_ci#define IGC_GEN_POLL_TIMEOUT 1920 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ci/* PHY Control Register */ 60562306a36Sopenharmony_ci#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ 60662306a36Sopenharmony_ci#define MII_CR_POWER_DOWN 0x0800 /* Power down */ 60762306a36Sopenharmony_ci#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci/* PHY Status Register */ 61062306a36Sopenharmony_ci#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ 61162306a36Sopenharmony_ci#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ 61262306a36Sopenharmony_ci#define IGC_PHY_RST_COMP 0x0100 /* Internal PHY reset completion */ 61362306a36Sopenharmony_ci 61462306a36Sopenharmony_ci/* PHY 1000 MII Register/Bit Definitions */ 61562306a36Sopenharmony_ci/* PHY Registers defined by IEEE */ 61662306a36Sopenharmony_ci#define PHY_CONTROL 0x00 /* Control Register */ 61762306a36Sopenharmony_ci#define PHY_STATUS 0x01 /* Status Register */ 61862306a36Sopenharmony_ci#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ 61962306a36Sopenharmony_ci#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ 62062306a36Sopenharmony_ci#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ 62162306a36Sopenharmony_ci#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */ 62262306a36Sopenharmony_ci#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */ 62362306a36Sopenharmony_ci#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ 62462306a36Sopenharmony_ci 62562306a36Sopenharmony_ci/* MDI Control */ 62662306a36Sopenharmony_ci#define IGC_MDIC_DATA_MASK 0x0000FFFF 62762306a36Sopenharmony_ci#define IGC_MDIC_REG_MASK 0x001F0000 62862306a36Sopenharmony_ci#define IGC_MDIC_REG_SHIFT 16 62962306a36Sopenharmony_ci#define IGC_MDIC_PHY_MASK 0x03E00000 63062306a36Sopenharmony_ci#define IGC_MDIC_PHY_SHIFT 21 63162306a36Sopenharmony_ci#define IGC_MDIC_OP_WRITE 0x04000000 63262306a36Sopenharmony_ci#define IGC_MDIC_OP_READ 0x08000000 63362306a36Sopenharmony_ci#define IGC_MDIC_READY 0x10000000 63462306a36Sopenharmony_ci#define IGC_MDIC_ERROR 0x40000000 63562306a36Sopenharmony_ci 63662306a36Sopenharmony_ci#define IGC_N0_QUEUE -1 63762306a36Sopenharmony_ci 63862306a36Sopenharmony_ci#define IGC_MAX_MAC_HDR_LEN 127 63962306a36Sopenharmony_ci#define IGC_MAX_NETWORK_HDR_LEN 511 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ci#define IGC_VLANPQF_QSEL(_n, q_idx) ((q_idx) << ((_n) * 4)) 64262306a36Sopenharmony_ci#define IGC_VLANPQF_VALID(_n) (0x1 << (3 + (_n) * 4)) 64362306a36Sopenharmony_ci#define IGC_VLANPQF_QUEUE_MASK 0x03 64462306a36Sopenharmony_ci 64562306a36Sopenharmony_ci#define IGC_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ 64662306a36Sopenharmony_ci#define IGC_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type:1=IPv4 */ 64762306a36Sopenharmony_ci#define IGC_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet Type of TCP */ 64862306a36Sopenharmony_ci#define IGC_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 packet TYPE of SCTP */ 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci/* Maximum size of the MTA register table in all supported adapters */ 65162306a36Sopenharmony_ci#define MAX_MTA_REG 128 65262306a36Sopenharmony_ci 65362306a36Sopenharmony_ci/* EEE defines */ 65462306a36Sopenharmony_ci#define IGC_IPCNFG_EEE_2_5G_AN 0x00000010 /* IPCNFG EEE Ena 2.5G AN */ 65562306a36Sopenharmony_ci#define IGC_IPCNFG_EEE_1G_AN 0x00000008 /* IPCNFG EEE Ena 1G AN */ 65662306a36Sopenharmony_ci#define IGC_IPCNFG_EEE_100M_AN 0x00000004 /* IPCNFG EEE Ena 100M AN */ 65762306a36Sopenharmony_ci#define IGC_EEER_EEE_NEG 0x20000000 /* EEE capability nego */ 65862306a36Sopenharmony_ci#define IGC_EEER_TX_LPI_EN 0x00010000 /* EEER Tx LPI Enable */ 65962306a36Sopenharmony_ci#define IGC_EEER_RX_LPI_EN 0x00020000 /* EEER Rx LPI Enable */ 66062306a36Sopenharmony_ci#define IGC_EEER_LPI_FC 0x00040000 /* EEER Ena on Flow Cntrl */ 66162306a36Sopenharmony_ci#define IGC_EEE_SU_LPI_CLK_STP 0x00800000 /* EEE LPI Clock Stop */ 66262306a36Sopenharmony_ci 66362306a36Sopenharmony_ci/* LTR defines */ 66462306a36Sopenharmony_ci#define IGC_LTRC_EEEMS_EN 0x00000020 /* Enable EEE LTR max send */ 66562306a36Sopenharmony_ci#define IGC_RXPBS_SIZE_I225_MASK 0x0000003F /* Rx packet buffer size */ 66662306a36Sopenharmony_ci#define IGC_TW_SYSTEM_1000_MASK 0x000000FF 66762306a36Sopenharmony_ci/* Minimum time for 100BASE-T where no data will be transmit following move out 66862306a36Sopenharmony_ci * of EEE LPI Tx state 66962306a36Sopenharmony_ci */ 67062306a36Sopenharmony_ci#define IGC_TW_SYSTEM_100_MASK 0x0000FF00 67162306a36Sopenharmony_ci#define IGC_TW_SYSTEM_100_SHIFT 8 67262306a36Sopenharmony_ci/* Reg val to set scale to 1024 nsec */ 67362306a36Sopenharmony_ci#define IGC_LTRMINV_SCALE_1024 2 67462306a36Sopenharmony_ci/* Reg val to set scale to 32768 nsec */ 67562306a36Sopenharmony_ci#define IGC_LTRMINV_SCALE_32768 3 67662306a36Sopenharmony_ci/* Reg val to set scale to 1024 nsec */ 67762306a36Sopenharmony_ci#define IGC_LTRMAXV_SCALE_1024 2 67862306a36Sopenharmony_ci/* Reg val to set scale to 32768 nsec */ 67962306a36Sopenharmony_ci#define IGC_LTRMAXV_SCALE_32768 3 68062306a36Sopenharmony_ci#define IGC_LTRMINV_LTRV_MASK 0x000003FF /* LTR minimum value */ 68162306a36Sopenharmony_ci#define IGC_LTRMAXV_LTRV_MASK 0x000003FF /* LTR maximum value */ 68262306a36Sopenharmony_ci#define IGC_LTRMINV_LSNP_REQ 0x00008000 /* LTR Snoop Requirement */ 68362306a36Sopenharmony_ci#define IGC_LTRMINV_SCALE_SHIFT 10 68462306a36Sopenharmony_ci#define IGC_LTRMAXV_LSNP_REQ 0x00008000 /* LTR Snoop Requirement */ 68562306a36Sopenharmony_ci#define IGC_LTRMAXV_SCALE_SHIFT 10 68662306a36Sopenharmony_ci 68762306a36Sopenharmony_ci#endif /* _IGC_DEFINES_H_ */ 688