162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright(c) 2007 Atheros Corporation. All rights reserved. 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Derived from Intel e1000 driver 662306a36Sopenharmony_ci * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef _ATHL1E_HW_H_ 1062306a36Sopenharmony_ci#define _ATHL1E_HW_H_ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/types.h> 1362306a36Sopenharmony_ci#include <linux/mii.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cistruct atl1e_adapter; 1662306a36Sopenharmony_cistruct atl1e_hw; 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* function prototype */ 1962306a36Sopenharmony_cis32 atl1e_reset_hw(struct atl1e_hw *hw); 2062306a36Sopenharmony_cis32 atl1e_read_mac_addr(struct atl1e_hw *hw); 2162306a36Sopenharmony_cis32 atl1e_init_hw(struct atl1e_hw *hw); 2262306a36Sopenharmony_cis32 atl1e_phy_commit(struct atl1e_hw *hw); 2362306a36Sopenharmony_cis32 atl1e_get_speed_and_duplex(struct atl1e_hw *hw, u16 *speed, u16 *duplex); 2462306a36Sopenharmony_ciu32 atl1e_auto_get_fc(struct atl1e_adapter *adapter, u16 duplex); 2562306a36Sopenharmony_ciu32 atl1e_hash_mc_addr(struct atl1e_hw *hw, u8 *mc_addr); 2662306a36Sopenharmony_civoid atl1e_hash_set(struct atl1e_hw *hw, u32 hash_value); 2762306a36Sopenharmony_cis32 atl1e_read_phy_reg(struct atl1e_hw *hw, u16 reg_addr, u16 *phy_data); 2862306a36Sopenharmony_cis32 atl1e_write_phy_reg(struct atl1e_hw *hw, u32 reg_addr, u16 phy_data); 2962306a36Sopenharmony_cis32 atl1e_validate_mdi_setting(struct atl1e_hw *hw); 3062306a36Sopenharmony_civoid atl1e_hw_set_mac_addr(struct atl1e_hw *hw); 3162306a36Sopenharmony_cibool atl1e_read_eeprom(struct atl1e_hw *hw, u32 offset, u32 *p_value); 3262306a36Sopenharmony_cibool atl1e_write_eeprom(struct atl1e_hw *hw, u32 offset, u32 value); 3362306a36Sopenharmony_cis32 atl1e_phy_enter_power_saving(struct atl1e_hw *hw); 3462306a36Sopenharmony_cis32 atl1e_phy_leave_power_saving(struct atl1e_hw *hw); 3562306a36Sopenharmony_cis32 atl1e_phy_init(struct atl1e_hw *hw); 3662306a36Sopenharmony_ciint atl1e_check_eeprom_exist(struct atl1e_hw *hw); 3762306a36Sopenharmony_civoid atl1e_force_ps(struct atl1e_hw *hw); 3862306a36Sopenharmony_cis32 atl1e_restart_autoneg(struct atl1e_hw *hw); 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* register definition */ 4162306a36Sopenharmony_ci#define REG_PM_CTRLSTAT 0x44 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define REG_PCIE_CAP_LIST 0x58 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define REG_DEVICE_CAP 0x5C 4662306a36Sopenharmony_ci#define DEVICE_CAP_MAX_PAYLOAD_MASK 0x7 4762306a36Sopenharmony_ci#define DEVICE_CAP_MAX_PAYLOAD_SHIFT 0 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define REG_DEVICE_CTRL 0x60 5062306a36Sopenharmony_ci#define DEVICE_CTRL_MAX_PAYLOAD_MASK 0x7 5162306a36Sopenharmony_ci#define DEVICE_CTRL_MAX_PAYLOAD_SHIFT 5 5262306a36Sopenharmony_ci#define DEVICE_CTRL_MAX_RREQ_SZ_MASK 0x7 5362306a36Sopenharmony_ci#define DEVICE_CTRL_MAX_RREQ_SZ_SHIFT 12 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci#define REG_VPD_CAP 0x6C 5662306a36Sopenharmony_ci#define VPD_CAP_ID_MASK 0xff 5762306a36Sopenharmony_ci#define VPD_CAP_ID_SHIFT 0 5862306a36Sopenharmony_ci#define VPD_CAP_NEXT_PTR_MASK 0xFF 5962306a36Sopenharmony_ci#define VPD_CAP_NEXT_PTR_SHIFT 8 6062306a36Sopenharmony_ci#define VPD_CAP_VPD_ADDR_MASK 0x7FFF 6162306a36Sopenharmony_ci#define VPD_CAP_VPD_ADDR_SHIFT 16 6262306a36Sopenharmony_ci#define VPD_CAP_VPD_FLAG 0x80000000 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define REG_VPD_DATA 0x70 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci#define REG_SPI_FLASH_CTRL 0x200 6762306a36Sopenharmony_ci#define SPI_FLASH_CTRL_STS_NON_RDY 0x1 6862306a36Sopenharmony_ci#define SPI_FLASH_CTRL_STS_WEN 0x2 6962306a36Sopenharmony_ci#define SPI_FLASH_CTRL_STS_WPEN 0x80 7062306a36Sopenharmony_ci#define SPI_FLASH_CTRL_DEV_STS_MASK 0xFF 7162306a36Sopenharmony_ci#define SPI_FLASH_CTRL_DEV_STS_SHIFT 0 7262306a36Sopenharmony_ci#define SPI_FLASH_CTRL_INS_MASK 0x7 7362306a36Sopenharmony_ci#define SPI_FLASH_CTRL_INS_SHIFT 8 7462306a36Sopenharmony_ci#define SPI_FLASH_CTRL_START 0x800 7562306a36Sopenharmony_ci#define SPI_FLASH_CTRL_EN_VPD 0x2000 7662306a36Sopenharmony_ci#define SPI_FLASH_CTRL_LDSTART 0x8000 7762306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HI_MASK 0x3 7862306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HI_SHIFT 16 7962306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HOLD_MASK 0x3 8062306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HOLD_SHIFT 18 8162306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_LO_MASK 0x3 8262306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_LO_SHIFT 20 8362306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_HI_MASK 0x3 8462306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_HI_SHIFT 22 8562306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_SETUP_MASK 0x3 8662306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_SETUP_SHIFT 24 8762306a36Sopenharmony_ci#define SPI_FLASH_CTRL_EROM_PGSZ_MASK 0x3 8862306a36Sopenharmony_ci#define SPI_FLASH_CTRL_EROM_PGSZ_SHIFT 26 8962306a36Sopenharmony_ci#define SPI_FLASH_CTRL_WAIT_READY 0x10000000 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci#define REG_SPI_ADDR 0x204 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define REG_SPI_DATA 0x208 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define REG_SPI_FLASH_CONFIG 0x20C 9662306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_ADDR_MASK 0xFFFFFF 9762306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_ADDR_SHIFT 0 9862306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_VPD_ADDR_MASK 0x3 9962306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_VPD_ADDR_SHIFT 24 10062306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_EXIST 0x4000000 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_PROGRAM 0x210 10462306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_SC_ERASE 0x211 10562306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_CHIP_ERASE 0x212 10662306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_RDID 0x213 10762306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_WREN 0x214 10862306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_RDSR 0x215 10962306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_WRSR 0x216 11062306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_READ 0x217 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci#define REG_TWSI_CTRL 0x218 11362306a36Sopenharmony_ci#define TWSI_CTRL_LD_OFFSET_MASK 0xFF 11462306a36Sopenharmony_ci#define TWSI_CTRL_LD_OFFSET_SHIFT 0 11562306a36Sopenharmony_ci#define TWSI_CTRL_LD_SLV_ADDR_MASK 0x7 11662306a36Sopenharmony_ci#define TWSI_CTRL_LD_SLV_ADDR_SHIFT 8 11762306a36Sopenharmony_ci#define TWSI_CTRL_SW_LDSTART 0x800 11862306a36Sopenharmony_ci#define TWSI_CTRL_HW_LDSTART 0x1000 11962306a36Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR_MASK 0x7F 12062306a36Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR_SHIFT 15 12162306a36Sopenharmony_ci#define TWSI_CTRL_LD_EXIST 0x400000 12262306a36Sopenharmony_ci#define TWSI_CTRL_READ_FREQ_SEL_MASK 0x3 12362306a36Sopenharmony_ci#define TWSI_CTRL_READ_FREQ_SEL_SHIFT 23 12462306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_100K 0 12562306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_200K 1 12662306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_300K 2 12762306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_400K 3 12862306a36Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR 12962306a36Sopenharmony_ci#define TWSI_CTRL_WRITE_FREQ_SEL_MASK 0x3 13062306a36Sopenharmony_ci#define TWSI_CTRL_WRITE_FREQ_SEL_SHIFT 24 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci#define REG_PCIE_DEV_MISC_CTRL 0x21C 13462306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_EXT_PIPE 0x2 13562306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_RETRY_BUFDIS 0x1 13662306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SPIROM_EXIST 0x4 13762306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SERDES_ENDIAN 0x8 13862306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SERDES_SEL_DIN 0x10 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define REG_PCIE_PHYMISC 0x1000 14162306a36Sopenharmony_ci#define PCIE_PHYMISC_FORCE_RCV_DET 0x4 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci#define REG_LTSSM_TEST_MODE 0x12FC 14462306a36Sopenharmony_ci#define LTSSM_TEST_MODE_DEF 0xE000 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci/* Selene Master Control Register */ 14762306a36Sopenharmony_ci#define REG_MASTER_CTRL 0x1400 14862306a36Sopenharmony_ci#define MASTER_CTRL_SOFT_RST 0x1 14962306a36Sopenharmony_ci#define MASTER_CTRL_MTIMER_EN 0x2 15062306a36Sopenharmony_ci#define MASTER_CTRL_ITIMER_EN 0x4 15162306a36Sopenharmony_ci#define MASTER_CTRL_MANUAL_INT 0x8 15262306a36Sopenharmony_ci#define MASTER_CTRL_ITIMER2_EN 0x20 15362306a36Sopenharmony_ci#define MASTER_CTRL_INT_RDCLR 0x40 15462306a36Sopenharmony_ci#define MASTER_CTRL_LED_MODE 0x200 15562306a36Sopenharmony_ci#define MASTER_CTRL_REV_NUM_SHIFT 16 15662306a36Sopenharmony_ci#define MASTER_CTRL_REV_NUM_MASK 0xff 15762306a36Sopenharmony_ci#define MASTER_CTRL_DEV_ID_SHIFT 24 15862306a36Sopenharmony_ci#define MASTER_CTRL_DEV_ID_MASK 0xff 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci/* Timer Initial Value Register */ 16162306a36Sopenharmony_ci#define REG_MANUAL_TIMER_INIT 0x1404 16262306a36Sopenharmony_ci 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ci/* IRQ ModeratorTimer Initial Value Register */ 16562306a36Sopenharmony_ci#define REG_IRQ_MODU_TIMER_INIT 0x1408 /* w */ 16662306a36Sopenharmony_ci#define REG_IRQ_MODU_TIMER2_INIT 0x140A /* w */ 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci#define REG_GPHY_CTRL 0x140C 17062306a36Sopenharmony_ci#define GPHY_CTRL_EXT_RESET 1 17162306a36Sopenharmony_ci#define GPHY_CTRL_PIPE_MOD 2 17262306a36Sopenharmony_ci#define GPHY_CTRL_TEST_MODE_MASK 3 17362306a36Sopenharmony_ci#define GPHY_CTRL_TEST_MODE_SHIFT 2 17462306a36Sopenharmony_ci#define GPHY_CTRL_BERT_START 0x10 17562306a36Sopenharmony_ci#define GPHY_CTRL_GATE_25M_EN 0x20 17662306a36Sopenharmony_ci#define GPHY_CTRL_LPW_EXIT 0x40 17762306a36Sopenharmony_ci#define GPHY_CTRL_PHY_IDDQ 0x80 17862306a36Sopenharmony_ci#define GPHY_CTRL_PHY_IDDQ_DIS 0x100 17962306a36Sopenharmony_ci#define GPHY_CTRL_PCLK_SEL_DIS 0x200 18062306a36Sopenharmony_ci#define GPHY_CTRL_HIB_EN 0x400 18162306a36Sopenharmony_ci#define GPHY_CTRL_HIB_PULSE 0x800 18262306a36Sopenharmony_ci#define GPHY_CTRL_SEL_ANA_RST 0x1000 18362306a36Sopenharmony_ci#define GPHY_CTRL_PHY_PLL_ON 0x2000 18462306a36Sopenharmony_ci#define GPHY_CTRL_PWDOWN_HW 0x4000 18562306a36Sopenharmony_ci#define GPHY_CTRL_DEFAULT (\ 18662306a36Sopenharmony_ci GPHY_CTRL_PHY_PLL_ON |\ 18762306a36Sopenharmony_ci GPHY_CTRL_SEL_ANA_RST |\ 18862306a36Sopenharmony_ci GPHY_CTRL_HIB_PULSE |\ 18962306a36Sopenharmony_ci GPHY_CTRL_HIB_EN) 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci#define GPHY_CTRL_PW_WOL_DIS (\ 19262306a36Sopenharmony_ci GPHY_CTRL_PHY_PLL_ON |\ 19362306a36Sopenharmony_ci GPHY_CTRL_SEL_ANA_RST |\ 19462306a36Sopenharmony_ci GPHY_CTRL_HIB_PULSE |\ 19562306a36Sopenharmony_ci GPHY_CTRL_HIB_EN |\ 19662306a36Sopenharmony_ci GPHY_CTRL_PWDOWN_HW |\ 19762306a36Sopenharmony_ci GPHY_CTRL_PCLK_SEL_DIS |\ 19862306a36Sopenharmony_ci GPHY_CTRL_PHY_IDDQ) 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci/* IRQ Anti-Lost Timer Initial Value Register */ 20162306a36Sopenharmony_ci#define REG_CMBDISDMA_TIMER 0x140E 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci/* Block IDLE Status Register */ 20562306a36Sopenharmony_ci#define REG_IDLE_STATUS 0x1410 20662306a36Sopenharmony_ci#define IDLE_STATUS_RXMAC 1 /* 1: RXMAC state machine is in non-IDLE state. 0: RXMAC is idling */ 20762306a36Sopenharmony_ci#define IDLE_STATUS_TXMAC 2 /* 1: TXMAC state machine is in non-IDLE state. 0: TXMAC is idling */ 20862306a36Sopenharmony_ci#define IDLE_STATUS_RXQ 4 /* 1: RXQ state machine is in non-IDLE state. 0: RXQ is idling */ 20962306a36Sopenharmony_ci#define IDLE_STATUS_TXQ 8 /* 1: TXQ state machine is in non-IDLE state. 0: TXQ is idling */ 21062306a36Sopenharmony_ci#define IDLE_STATUS_DMAR 0x10 /* 1: DMAR state machine is in non-IDLE state. 0: DMAR is idling */ 21162306a36Sopenharmony_ci#define IDLE_STATUS_DMAW 0x20 /* 1: DMAW state machine is in non-IDLE state. 0: DMAW is idling */ 21262306a36Sopenharmony_ci#define IDLE_STATUS_SMB 0x40 /* 1: SMB state machine is in non-IDLE state. 0: SMB is idling */ 21362306a36Sopenharmony_ci#define IDLE_STATUS_CMB 0x80 /* 1: CMB state machine is in non-IDLE state. 0: CMB is idling */ 21462306a36Sopenharmony_ci 21562306a36Sopenharmony_ci/* MDIO Control Register */ 21662306a36Sopenharmony_ci#define REG_MDIO_CTRL 0x1414 21762306a36Sopenharmony_ci#define MDIO_DATA_MASK 0xffff /* On MDIO write, the 16-bit control data to write to PHY MII management register */ 21862306a36Sopenharmony_ci#define MDIO_DATA_SHIFT 0 /* On MDIO read, the 16-bit status data that was read from the PHY MII management register*/ 21962306a36Sopenharmony_ci#define MDIO_REG_ADDR_MASK 0x1f /* MDIO register address */ 22062306a36Sopenharmony_ci#define MDIO_REG_ADDR_SHIFT 16 22162306a36Sopenharmony_ci#define MDIO_RW 0x200000 /* 1: read, 0: write */ 22262306a36Sopenharmony_ci#define MDIO_SUP_PREAMBLE 0x400000 /* Suppress preamble */ 22362306a36Sopenharmony_ci#define MDIO_START 0x800000 /* Write 1 to initiate the MDIO master. And this bit is self cleared after one cycle*/ 22462306a36Sopenharmony_ci#define MDIO_CLK_SEL_SHIFT 24 22562306a36Sopenharmony_ci#define MDIO_CLK_25_4 0 22662306a36Sopenharmony_ci#define MDIO_CLK_25_6 2 22762306a36Sopenharmony_ci#define MDIO_CLK_25_8 3 22862306a36Sopenharmony_ci#define MDIO_CLK_25_10 4 22962306a36Sopenharmony_ci#define MDIO_CLK_25_14 5 23062306a36Sopenharmony_ci#define MDIO_CLK_25_20 6 23162306a36Sopenharmony_ci#define MDIO_CLK_25_28 7 23262306a36Sopenharmony_ci#define MDIO_BUSY 0x8000000 23362306a36Sopenharmony_ci#define MDIO_AP_EN 0x10000000 23462306a36Sopenharmony_ci#define MDIO_WAIT_TIMES 10 23562306a36Sopenharmony_ci 23662306a36Sopenharmony_ci/* MII PHY Status Register */ 23762306a36Sopenharmony_ci#define REG_PHY_STATUS 0x1418 23862306a36Sopenharmony_ci#define PHY_STATUS_100M 0x20000 23962306a36Sopenharmony_ci#define PHY_STATUS_EMI_CA 0x40000 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci/* BIST Control and Status Register0 (for the Packet Memory) */ 24262306a36Sopenharmony_ci#define REG_BIST0_CTRL 0x141c 24362306a36Sopenharmony_ci#define BIST0_NOW 0x1 /* 1: To trigger BIST0 logic. This bit stays high during the */ 24462306a36Sopenharmony_ci/* BIST process and reset to zero when BIST is done */ 24562306a36Sopenharmony_ci#define BIST0_SRAM_FAIL 0x2 /* 1: The SRAM failure is un-repairable because it has address */ 24662306a36Sopenharmony_ci/* decoder failure or more than 1 cell stuck-to-x failure */ 24762306a36Sopenharmony_ci#define BIST0_FUSE_FLAG 0x4 /* 1: Indicating one cell has been fixed */ 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci/* BIST Control and Status Register1(for the retry buffer of PCI Express) */ 25062306a36Sopenharmony_ci#define REG_BIST1_CTRL 0x1420 25162306a36Sopenharmony_ci#define BIST1_NOW 0x1 /* 1: To trigger BIST0 logic. This bit stays high during the */ 25262306a36Sopenharmony_ci/* BIST process and reset to zero when BIST is done */ 25362306a36Sopenharmony_ci#define BIST1_SRAM_FAIL 0x2 /* 1: The SRAM failure is un-repairable because it has address */ 25462306a36Sopenharmony_ci/* decoder failure or more than 1 cell stuck-to-x failure.*/ 25562306a36Sopenharmony_ci#define BIST1_FUSE_FLAG 0x4 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ci/* SerDes Lock Detect Control and Status Register */ 25862306a36Sopenharmony_ci#define REG_SERDES_LOCK 0x1424 25962306a36Sopenharmony_ci#define SERDES_LOCK_DETECT 1 /* 1: SerDes lock detected . This signal comes from Analog SerDes */ 26062306a36Sopenharmony_ci#define SERDES_LOCK_DETECT_EN 2 /* 1: Enable SerDes Lock detect function */ 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci/* MAC Control Register */ 26362306a36Sopenharmony_ci#define REG_MAC_CTRL 0x1480 26462306a36Sopenharmony_ci#define MAC_CTRL_TX_EN 1 /* 1: Transmit Enable */ 26562306a36Sopenharmony_ci#define MAC_CTRL_RX_EN 2 /* 1: Receive Enable */ 26662306a36Sopenharmony_ci#define MAC_CTRL_TX_FLOW 4 /* 1: Transmit Flow Control Enable */ 26762306a36Sopenharmony_ci#define MAC_CTRL_RX_FLOW 8 /* 1: Receive Flow Control Enable */ 26862306a36Sopenharmony_ci#define MAC_CTRL_LOOPBACK 0x10 /* 1: Loop back at G/MII Interface */ 26962306a36Sopenharmony_ci#define MAC_CTRL_DUPLX 0x20 /* 1: Full-duplex mode 0: Half-duplex mode */ 27062306a36Sopenharmony_ci#define MAC_CTRL_ADD_CRC 0x40 /* 1: Instruct MAC to attach CRC on all egress Ethernet frames */ 27162306a36Sopenharmony_ci#define MAC_CTRL_PAD 0x80 /* 1: Instruct MAC to pad short frames to 60-bytes, and then attach CRC. This bit has higher priority over CRC_EN */ 27262306a36Sopenharmony_ci#define MAC_CTRL_LENCHK 0x100 /* 1: Instruct MAC to check if length field matches the real packet length */ 27362306a36Sopenharmony_ci#define MAC_CTRL_HUGE_EN 0x200 /* 1: receive Jumbo frame enable */ 27462306a36Sopenharmony_ci#define MAC_CTRL_PRMLEN_SHIFT 10 /* Preamble length */ 27562306a36Sopenharmony_ci#define MAC_CTRL_PRMLEN_MASK 0xf 27662306a36Sopenharmony_ci#define MAC_CTRL_RMV_VLAN 0x4000 /* 1: to remove VLAN Tag automatically from all receive packets */ 27762306a36Sopenharmony_ci#define MAC_CTRL_PROMIS_EN 0x8000 /* 1: Promiscuous Mode Enable */ 27862306a36Sopenharmony_ci#define MAC_CTRL_TX_PAUSE 0x10000 /* 1: transmit test pause */ 27962306a36Sopenharmony_ci#define MAC_CTRL_SCNT 0x20000 /* 1: shortcut slot time counter */ 28062306a36Sopenharmony_ci#define MAC_CTRL_SRST_TX 0x40000 /* 1: synchronized reset Transmit MAC module */ 28162306a36Sopenharmony_ci#define MAC_CTRL_TX_SIMURST 0x80000 /* 1: transmit simulation reset */ 28262306a36Sopenharmony_ci#define MAC_CTRL_SPEED_SHIFT 20 /* 10: gigabit 01:10M/100M */ 28362306a36Sopenharmony_ci#define MAC_CTRL_SPEED_MASK 0x300000 28462306a36Sopenharmony_ci#define MAC_CTRL_SPEED_1000 2 28562306a36Sopenharmony_ci#define MAC_CTRL_SPEED_10_100 1 28662306a36Sopenharmony_ci#define MAC_CTRL_DBG_TX_BKPRESURE 0x400000 /* 1: transmit maximum backoff (half-duplex test bit) */ 28762306a36Sopenharmony_ci#define MAC_CTRL_TX_HUGE 0x800000 /* 1: transmit huge enable */ 28862306a36Sopenharmony_ci#define MAC_CTRL_RX_CHKSUM_EN 0x1000000 /* 1: RX checksum enable */ 28962306a36Sopenharmony_ci#define MAC_CTRL_MC_ALL_EN 0x2000000 /* 1: upload all multicast frame without error to system */ 29062306a36Sopenharmony_ci#define MAC_CTRL_BC_EN 0x4000000 /* 1: upload all broadcast frame without error to system */ 29162306a36Sopenharmony_ci#define MAC_CTRL_DBG 0x8000000 /* 1: upload all received frame to system (Debug Mode) */ 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci/* MAC IPG/IFG Control Register */ 29462306a36Sopenharmony_ci#define REG_MAC_IPG_IFG 0x1484 29562306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGT_SHIFT 0 /* Desired back to back inter-packet gap. The default is 96-bit time */ 29662306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGT_MASK 0x7f 29762306a36Sopenharmony_ci#define MAC_IPG_IFG_MIFG_SHIFT 8 /* Minimum number of IFG to enforce in between RX frames */ 29862306a36Sopenharmony_ci#define MAC_IPG_IFG_MIFG_MASK 0xff /* Frame gap below such IFP is dropped */ 29962306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR1_SHIFT 16 /* 64bit Carrier-Sense window */ 30062306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR1_MASK 0x7f 30162306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR2_SHIFT 24 /* 96-bit IPG window */ 30262306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR2_MASK 0x7f 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_ci/* MAC STATION ADDRESS */ 30562306a36Sopenharmony_ci#define REG_MAC_STA_ADDR 0x1488 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ci/* Hash table for multicast address */ 30862306a36Sopenharmony_ci#define REG_RX_HASH_TABLE 0x1490 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci/* MAC Half-Duplex Control Register */ 31262306a36Sopenharmony_ci#define REG_MAC_HALF_DUPLX_CTRL 0x1498 31362306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_LCOL_SHIFT 0 /* Collision Window */ 31462306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_LCOL_MASK 0x3ff 31562306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_RETRY_SHIFT 12 /* Retransmission maximum, afterwards the packet will be discarded */ 31662306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_RETRY_MASK 0xf 31762306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_EXC_DEF_EN 0x10000 /* 1: Allow the transmission of a packet which has been excessively deferred */ 31862306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_NO_BACK_C 0x20000 /* 1: No back-off on collision, immediately start the retransmission */ 31962306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_NO_BACK_P 0x40000 /* 1: No back-off on backpressure, immediately start the transmission after back pressure */ 32062306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBE 0x80000 /* 1: Alternative Binary Exponential Back-off Enabled */ 32162306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBT_SHIFT 20 /* Maximum binary exponential number */ 32262306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBT_MASK 0xf 32362306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_JAMIPG_SHIFT 24 /* IPG to start JAM for collision based flow control in half-duplex */ 32462306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_JAMIPG_MASK 0xf /* mode. In unit of 8-bit time */ 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci/* Maximum Frame Length Control Register */ 32762306a36Sopenharmony_ci#define REG_MTU 0x149c 32862306a36Sopenharmony_ci 32962306a36Sopenharmony_ci/* Wake-On-Lan control register */ 33062306a36Sopenharmony_ci#define REG_WOL_CTRL 0x14a0 33162306a36Sopenharmony_ci#define WOL_PATTERN_EN 0x00000001 33262306a36Sopenharmony_ci#define WOL_PATTERN_PME_EN 0x00000002 33362306a36Sopenharmony_ci#define WOL_MAGIC_EN 0x00000004 33462306a36Sopenharmony_ci#define WOL_MAGIC_PME_EN 0x00000008 33562306a36Sopenharmony_ci#define WOL_LINK_CHG_EN 0x00000010 33662306a36Sopenharmony_ci#define WOL_LINK_CHG_PME_EN 0x00000020 33762306a36Sopenharmony_ci#define WOL_PATTERN_ST 0x00000100 33862306a36Sopenharmony_ci#define WOL_MAGIC_ST 0x00000200 33962306a36Sopenharmony_ci#define WOL_LINKCHG_ST 0x00000400 34062306a36Sopenharmony_ci#define WOL_CLK_SWITCH_EN 0x00008000 34162306a36Sopenharmony_ci#define WOL_PT0_EN 0x00010000 34262306a36Sopenharmony_ci#define WOL_PT1_EN 0x00020000 34362306a36Sopenharmony_ci#define WOL_PT2_EN 0x00040000 34462306a36Sopenharmony_ci#define WOL_PT3_EN 0x00080000 34562306a36Sopenharmony_ci#define WOL_PT4_EN 0x00100000 34662306a36Sopenharmony_ci#define WOL_PT5_EN 0x00200000 34762306a36Sopenharmony_ci#define WOL_PT6_EN 0x00400000 34862306a36Sopenharmony_ci/* WOL Length ( 2 DWORD ) */ 34962306a36Sopenharmony_ci#define REG_WOL_PATTERN_LEN 0x14a4 35062306a36Sopenharmony_ci#define WOL_PT_LEN_MASK 0x7f 35162306a36Sopenharmony_ci#define WOL_PT0_LEN_SHIFT 0 35262306a36Sopenharmony_ci#define WOL_PT1_LEN_SHIFT 8 35362306a36Sopenharmony_ci#define WOL_PT2_LEN_SHIFT 16 35462306a36Sopenharmony_ci#define WOL_PT3_LEN_SHIFT 24 35562306a36Sopenharmony_ci#define WOL_PT4_LEN_SHIFT 0 35662306a36Sopenharmony_ci#define WOL_PT5_LEN_SHIFT 8 35762306a36Sopenharmony_ci#define WOL_PT6_LEN_SHIFT 16 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci/* Internal SRAM Partition Register */ 36062306a36Sopenharmony_ci#define REG_SRAM_TRD_ADDR 0x1518 36162306a36Sopenharmony_ci#define REG_SRAM_TRD_LEN 0x151C 36262306a36Sopenharmony_ci#define REG_SRAM_RXF_ADDR 0x1520 36362306a36Sopenharmony_ci#define REG_SRAM_RXF_LEN 0x1524 36462306a36Sopenharmony_ci#define REG_SRAM_TXF_ADDR 0x1528 36562306a36Sopenharmony_ci#define REG_SRAM_TXF_LEN 0x152C 36662306a36Sopenharmony_ci#define REG_SRAM_TCPH_ADDR 0x1530 36762306a36Sopenharmony_ci#define REG_SRAM_PKTH_ADDR 0x1532 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci/* Load Ptr Register */ 37062306a36Sopenharmony_ci#define REG_LOAD_PTR 0x1534 /* Software sets this bit after the initialization of the head and tail */ 37162306a36Sopenharmony_ci 37262306a36Sopenharmony_ci/* 37362306a36Sopenharmony_ci * addresses of all descriptors, as well as the following descriptor 37462306a36Sopenharmony_ci * control register, which triggers each function block to load the head 37562306a36Sopenharmony_ci * pointer to prepare for the operation. This bit is then self-cleared 37662306a36Sopenharmony_ci * after one cycle. 37762306a36Sopenharmony_ci */ 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci/* Descriptor Control register */ 38062306a36Sopenharmony_ci#define REG_RXF3_BASE_ADDR_HI 0x153C 38162306a36Sopenharmony_ci#define REG_DESC_BASE_ADDR_HI 0x1540 38262306a36Sopenharmony_ci#define REG_RXF0_BASE_ADDR_HI 0x1540 /* share with DESC BASE ADDR HI */ 38362306a36Sopenharmony_ci#define REG_HOST_RXF0_PAGE0_LO 0x1544 38462306a36Sopenharmony_ci#define REG_HOST_RXF0_PAGE1_LO 0x1548 38562306a36Sopenharmony_ci#define REG_TPD_BASE_ADDR_LO 0x154C 38662306a36Sopenharmony_ci#define REG_RXF1_BASE_ADDR_HI 0x1550 38762306a36Sopenharmony_ci#define REG_RXF2_BASE_ADDR_HI 0x1554 38862306a36Sopenharmony_ci#define REG_HOST_RXFPAGE_SIZE 0x1558 38962306a36Sopenharmony_ci#define REG_TPD_RING_SIZE 0x155C 39062306a36Sopenharmony_ci/* RSS about */ 39162306a36Sopenharmony_ci#define REG_RSS_KEY0 0x14B0 39262306a36Sopenharmony_ci#define REG_RSS_KEY1 0x14B4 39362306a36Sopenharmony_ci#define REG_RSS_KEY2 0x14B8 39462306a36Sopenharmony_ci#define REG_RSS_KEY3 0x14BC 39562306a36Sopenharmony_ci#define REG_RSS_KEY4 0x14C0 39662306a36Sopenharmony_ci#define REG_RSS_KEY5 0x14C4 39762306a36Sopenharmony_ci#define REG_RSS_KEY6 0x14C8 39862306a36Sopenharmony_ci#define REG_RSS_KEY7 0x14CC 39962306a36Sopenharmony_ci#define REG_RSS_KEY8 0x14D0 40062306a36Sopenharmony_ci#define REG_RSS_KEY9 0x14D4 40162306a36Sopenharmony_ci#define REG_IDT_TABLE4 0x14E0 40262306a36Sopenharmony_ci#define REG_IDT_TABLE5 0x14E4 40362306a36Sopenharmony_ci#define REG_IDT_TABLE6 0x14E8 40462306a36Sopenharmony_ci#define REG_IDT_TABLE7 0x14EC 40562306a36Sopenharmony_ci#define REG_IDT_TABLE0 0x1560 40662306a36Sopenharmony_ci#define REG_IDT_TABLE1 0x1564 40762306a36Sopenharmony_ci#define REG_IDT_TABLE2 0x1568 40862306a36Sopenharmony_ci#define REG_IDT_TABLE3 0x156C 40962306a36Sopenharmony_ci#define REG_IDT_TABLE REG_IDT_TABLE0 41062306a36Sopenharmony_ci#define REG_RSS_HASH_VALUE 0x1570 41162306a36Sopenharmony_ci#define REG_RSS_HASH_FLAG 0x1574 41262306a36Sopenharmony_ci#define REG_BASE_CPU_NUMBER 0x157C 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci 41562306a36Sopenharmony_ci/* TXQ Control Register */ 41662306a36Sopenharmony_ci#define REG_TXQ_CTRL 0x1580 41762306a36Sopenharmony_ci#define TXQ_CTRL_NUM_TPD_BURST_MASK 0xF 41862306a36Sopenharmony_ci#define TXQ_CTRL_NUM_TPD_BURST_SHIFT 0 41962306a36Sopenharmony_ci#define TXQ_CTRL_EN 0x20 /* 1: Enable TXQ */ 42062306a36Sopenharmony_ci#define TXQ_CTRL_ENH_MODE 0x40 /* Performance enhancement mode, in which up to two back-to-back DMA read commands might be dispatched. */ 42162306a36Sopenharmony_ci#define TXQ_CTRL_TXF_BURST_NUM_SHIFT 16 /* Number of data byte to read in a cache-aligned burst. Each SRAM entry is 8-byte in length. */ 42262306a36Sopenharmony_ci#define TXQ_CTRL_TXF_BURST_NUM_MASK 0xffff 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci/* Jumbo packet Threshold for task offload */ 42562306a36Sopenharmony_ci#define REG_TX_EARLY_TH 0x1584 /* Jumbo frame threshold in QWORD unit. Packet greater than */ 42662306a36Sopenharmony_ci/* JUMBO_TASK_OFFLOAD_THRESHOLD will not be task offloaded. */ 42762306a36Sopenharmony_ci#define TX_TX_EARLY_TH_MASK 0x7ff 42862306a36Sopenharmony_ci#define TX_TX_EARLY_TH_SHIFT 0 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci/* RXQ Control Register */ 43262306a36Sopenharmony_ci#define REG_RXQ_CTRL 0x15A0 43362306a36Sopenharmony_ci#define RXQ_CTRL_PBA_ALIGN_32 0 /* rx-packet alignment */ 43462306a36Sopenharmony_ci#define RXQ_CTRL_PBA_ALIGN_64 1 43562306a36Sopenharmony_ci#define RXQ_CTRL_PBA_ALIGN_128 2 43662306a36Sopenharmony_ci#define RXQ_CTRL_PBA_ALIGN_256 3 43762306a36Sopenharmony_ci#define RXQ_CTRL_Q1_EN 0x10 43862306a36Sopenharmony_ci#define RXQ_CTRL_Q2_EN 0x20 43962306a36Sopenharmony_ci#define RXQ_CTRL_Q3_EN 0x40 44062306a36Sopenharmony_ci#define RXQ_CTRL_IPV6_XSUM_VERIFY_EN 0x80 44162306a36Sopenharmony_ci#define RXQ_CTRL_HASH_TLEN_SHIFT 8 44262306a36Sopenharmony_ci#define RXQ_CTRL_HASH_TLEN_MASK 0xFF 44362306a36Sopenharmony_ci#define RXQ_CTRL_HASH_TYPE_IPV4 0x10000 44462306a36Sopenharmony_ci#define RXQ_CTRL_HASH_TYPE_IPV4_TCP 0x20000 44562306a36Sopenharmony_ci#define RXQ_CTRL_HASH_TYPE_IPV6 0x40000 44662306a36Sopenharmony_ci#define RXQ_CTRL_HASH_TYPE_IPV6_TCP 0x80000 44762306a36Sopenharmony_ci#define RXQ_CTRL_RSS_MODE_DISABLE 0 44862306a36Sopenharmony_ci#define RXQ_CTRL_RSS_MODE_SQSINT 0x4000000 44962306a36Sopenharmony_ci#define RXQ_CTRL_RSS_MODE_MQUESINT 0x8000000 45062306a36Sopenharmony_ci#define RXQ_CTRL_RSS_MODE_MQUEMINT 0xC000000 45162306a36Sopenharmony_ci#define RXQ_CTRL_NIP_QUEUE_SEL_TBL 0x10000000 45262306a36Sopenharmony_ci#define RXQ_CTRL_HASH_ENABLE 0x20000000 45362306a36Sopenharmony_ci#define RXQ_CTRL_CUT_THRU_EN 0x40000000 45462306a36Sopenharmony_ci#define RXQ_CTRL_EN 0x80000000 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_ci/* Rx jumbo packet threshold and rrd retirement timer */ 45762306a36Sopenharmony_ci#define REG_RXQ_JMBOSZ_RRDTIM 0x15A4 45862306a36Sopenharmony_ci/* 45962306a36Sopenharmony_ci * Jumbo packet threshold for non-VLAN packet, in QWORD (64-bit) unit. 46062306a36Sopenharmony_ci * When the packet length greater than or equal to this value, RXQ 46162306a36Sopenharmony_ci * shall start cut-through forwarding of the received packet. 46262306a36Sopenharmony_ci */ 46362306a36Sopenharmony_ci#define RXQ_JMBOSZ_TH_MASK 0x7ff 46462306a36Sopenharmony_ci#define RXQ_JMBOSZ_TH_SHIFT 0 /* RRD retirement timer. Decrement by 1 after every 512ns passes*/ 46562306a36Sopenharmony_ci#define RXQ_JMBO_LKAH_MASK 0xf 46662306a36Sopenharmony_ci#define RXQ_JMBO_LKAH_SHIFT 11 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/* RXF flow control register */ 46962306a36Sopenharmony_ci#define REG_RXQ_RXF_PAUSE_THRESH 0x15A8 47062306a36Sopenharmony_ci#define RXQ_RXF_PAUSE_TH_HI_SHIFT 0 47162306a36Sopenharmony_ci#define RXQ_RXF_PAUSE_TH_HI_MASK 0xfff 47262306a36Sopenharmony_ci#define RXQ_RXF_PAUSE_TH_LO_SHIFT 16 47362306a36Sopenharmony_ci#define RXQ_RXF_PAUSE_TH_LO_MASK 0xfff 47462306a36Sopenharmony_ci 47562306a36Sopenharmony_ci 47662306a36Sopenharmony_ci/* DMA Engine Control Register */ 47762306a36Sopenharmony_ci#define REG_DMA_CTRL 0x15C0 47862306a36Sopenharmony_ci#define DMA_CTRL_DMAR_IN_ORDER 0x1 47962306a36Sopenharmony_ci#define DMA_CTRL_DMAR_ENH_ORDER 0x2 48062306a36Sopenharmony_ci#define DMA_CTRL_DMAR_OUT_ORDER 0x4 48162306a36Sopenharmony_ci#define DMA_CTRL_RCB_VALUE 0x8 48262306a36Sopenharmony_ci#define DMA_CTRL_DMAR_BURST_LEN_SHIFT 4 48362306a36Sopenharmony_ci#define DMA_CTRL_DMAR_BURST_LEN_MASK 7 48462306a36Sopenharmony_ci#define DMA_CTRL_DMAW_BURST_LEN_SHIFT 7 48562306a36Sopenharmony_ci#define DMA_CTRL_DMAW_BURST_LEN_MASK 7 48662306a36Sopenharmony_ci#define DMA_CTRL_DMAR_REQ_PRI 0x400 48762306a36Sopenharmony_ci#define DMA_CTRL_DMAR_DLY_CNT_MASK 0x1F 48862306a36Sopenharmony_ci#define DMA_CTRL_DMAR_DLY_CNT_SHIFT 11 48962306a36Sopenharmony_ci#define DMA_CTRL_DMAW_DLY_CNT_MASK 0xF 49062306a36Sopenharmony_ci#define DMA_CTRL_DMAW_DLY_CNT_SHIFT 16 49162306a36Sopenharmony_ci#define DMA_CTRL_TXCMB_EN 0x100000 49262306a36Sopenharmony_ci#define DMA_CTRL_RXCMB_EN 0x200000 49362306a36Sopenharmony_ci 49462306a36Sopenharmony_ci 49562306a36Sopenharmony_ci/* CMB/SMB Control Register */ 49662306a36Sopenharmony_ci#define REG_SMB_STAT_TIMER 0x15C4 49762306a36Sopenharmony_ci#define REG_TRIG_RRD_THRESH 0x15CA 49862306a36Sopenharmony_ci#define REG_TRIG_TPD_THRESH 0x15C8 49962306a36Sopenharmony_ci#define REG_TRIG_TXTIMER 0x15CC 50062306a36Sopenharmony_ci#define REG_TRIG_RXTIMER 0x15CE 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_ci/* HOST RXF Page 1,2,3 address */ 50362306a36Sopenharmony_ci#define REG_HOST_RXF1_PAGE0_LO 0x15D0 50462306a36Sopenharmony_ci#define REG_HOST_RXF1_PAGE1_LO 0x15D4 50562306a36Sopenharmony_ci#define REG_HOST_RXF2_PAGE0_LO 0x15D8 50662306a36Sopenharmony_ci#define REG_HOST_RXF2_PAGE1_LO 0x15DC 50762306a36Sopenharmony_ci#define REG_HOST_RXF3_PAGE0_LO 0x15E0 50862306a36Sopenharmony_ci#define REG_HOST_RXF3_PAGE1_LO 0x15E4 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ci/* Mail box */ 51162306a36Sopenharmony_ci#define REG_MB_RXF1_RADDR 0x15B4 51262306a36Sopenharmony_ci#define REG_MB_RXF2_RADDR 0x15B8 51362306a36Sopenharmony_ci#define REG_MB_RXF3_RADDR 0x15BC 51462306a36Sopenharmony_ci#define REG_MB_TPD_PROD_IDX 0x15F0 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci/* RXF-Page 0-3 PageNo & Valid bit */ 51762306a36Sopenharmony_ci#define REG_HOST_RXF0_PAGE0_VLD 0x15F4 51862306a36Sopenharmony_ci#define HOST_RXF_VALID 1 51962306a36Sopenharmony_ci#define HOST_RXF_PAGENO_SHIFT 1 52062306a36Sopenharmony_ci#define HOST_RXF_PAGENO_MASK 0x7F 52162306a36Sopenharmony_ci#define REG_HOST_RXF0_PAGE1_VLD 0x15F5 52262306a36Sopenharmony_ci#define REG_HOST_RXF1_PAGE0_VLD 0x15F6 52362306a36Sopenharmony_ci#define REG_HOST_RXF1_PAGE1_VLD 0x15F7 52462306a36Sopenharmony_ci#define REG_HOST_RXF2_PAGE0_VLD 0x15F8 52562306a36Sopenharmony_ci#define REG_HOST_RXF2_PAGE1_VLD 0x15F9 52662306a36Sopenharmony_ci#define REG_HOST_RXF3_PAGE0_VLD 0x15FA 52762306a36Sopenharmony_ci#define REG_HOST_RXF3_PAGE1_VLD 0x15FB 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci/* Interrupt Status Register */ 53062306a36Sopenharmony_ci#define REG_ISR 0x1600 53162306a36Sopenharmony_ci#define ISR_SMB 1 53262306a36Sopenharmony_ci#define ISR_TIMER 2 /* Interrupt when Timer is counted down to zero */ 53362306a36Sopenharmony_ci/* 53462306a36Sopenharmony_ci * Software manual interrupt, for debug. Set when SW_MAN_INT_EN is set 53562306a36Sopenharmony_ci * in Table 51 Selene Master Control Register (Offset 0x1400). 53662306a36Sopenharmony_ci */ 53762306a36Sopenharmony_ci#define ISR_MANUAL 4 53862306a36Sopenharmony_ci#define ISR_HW_RXF_OV 8 /* RXF overflow interrupt */ 53962306a36Sopenharmony_ci#define ISR_HOST_RXF0_OV 0x10 54062306a36Sopenharmony_ci#define ISR_HOST_RXF1_OV 0x20 54162306a36Sopenharmony_ci#define ISR_HOST_RXF2_OV 0x40 54262306a36Sopenharmony_ci#define ISR_HOST_RXF3_OV 0x80 54362306a36Sopenharmony_ci#define ISR_TXF_UN 0x100 54462306a36Sopenharmony_ci#define ISR_RX0_PAGE_FULL 0x200 54562306a36Sopenharmony_ci#define ISR_DMAR_TO_RST 0x400 54662306a36Sopenharmony_ci#define ISR_DMAW_TO_RST 0x800 54762306a36Sopenharmony_ci#define ISR_GPHY 0x1000 54862306a36Sopenharmony_ci#define ISR_TX_CREDIT 0x2000 54962306a36Sopenharmony_ci#define ISR_GPHY_LPW 0x4000 /* GPHY low power state interrupt */ 55062306a36Sopenharmony_ci#define ISR_RX_PKT 0x10000 /* One packet received, triggered by RFD */ 55162306a36Sopenharmony_ci#define ISR_TX_PKT 0x20000 /* One packet transmitted, triggered by TPD */ 55262306a36Sopenharmony_ci#define ISR_TX_DMA 0x40000 55362306a36Sopenharmony_ci#define ISR_RX_PKT_1 0x80000 55462306a36Sopenharmony_ci#define ISR_RX_PKT_2 0x100000 55562306a36Sopenharmony_ci#define ISR_RX_PKT_3 0x200000 55662306a36Sopenharmony_ci#define ISR_MAC_RX 0x400000 55762306a36Sopenharmony_ci#define ISR_MAC_TX 0x800000 55862306a36Sopenharmony_ci#define ISR_UR_DETECTED 0x1000000 55962306a36Sopenharmony_ci#define ISR_FERR_DETECTED 0x2000000 56062306a36Sopenharmony_ci#define ISR_NFERR_DETECTED 0x4000000 56162306a36Sopenharmony_ci#define ISR_CERR_DETECTED 0x8000000 56262306a36Sopenharmony_ci#define ISR_PHY_LINKDOWN 0x10000000 56362306a36Sopenharmony_ci#define ISR_DIS_INT 0x80000000 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci/* Interrupt Mask Register */ 56762306a36Sopenharmony_ci#define REG_IMR 0x1604 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ci 57062306a36Sopenharmony_ci#define IMR_NORMAL_MASK (\ 57162306a36Sopenharmony_ci ISR_SMB |\ 57262306a36Sopenharmony_ci ISR_TXF_UN |\ 57362306a36Sopenharmony_ci ISR_HW_RXF_OV |\ 57462306a36Sopenharmony_ci ISR_HOST_RXF0_OV|\ 57562306a36Sopenharmony_ci ISR_MANUAL |\ 57662306a36Sopenharmony_ci ISR_GPHY |\ 57762306a36Sopenharmony_ci ISR_GPHY_LPW |\ 57862306a36Sopenharmony_ci ISR_DMAR_TO_RST |\ 57962306a36Sopenharmony_ci ISR_DMAW_TO_RST |\ 58062306a36Sopenharmony_ci ISR_PHY_LINKDOWN|\ 58162306a36Sopenharmony_ci ISR_RX_PKT |\ 58262306a36Sopenharmony_ci ISR_TX_PKT) 58362306a36Sopenharmony_ci 58462306a36Sopenharmony_ci#define ISR_TX_EVENT (ISR_TXF_UN | ISR_TX_PKT) 58562306a36Sopenharmony_ci#define ISR_RX_EVENT (ISR_HOST_RXF0_OV | ISR_HW_RXF_OV | ISR_RX_PKT) 58662306a36Sopenharmony_ci 58762306a36Sopenharmony_ci#define REG_MAC_RX_STATUS_BIN 0x1700 58862306a36Sopenharmony_ci#define REG_MAC_RX_STATUS_END 0x175c 58962306a36Sopenharmony_ci#define REG_MAC_TX_STATUS_BIN 0x1760 59062306a36Sopenharmony_ci#define REG_MAC_TX_STATUS_END 0x17c0 59162306a36Sopenharmony_ci 59262306a36Sopenharmony_ci/* Hardware Offset Register */ 59362306a36Sopenharmony_ci#define REG_HOST_RXF0_PAGEOFF 0x1800 59462306a36Sopenharmony_ci#define REG_TPD_CONS_IDX 0x1804 59562306a36Sopenharmony_ci#define REG_HOST_RXF1_PAGEOFF 0x1808 59662306a36Sopenharmony_ci#define REG_HOST_RXF2_PAGEOFF 0x180C 59762306a36Sopenharmony_ci#define REG_HOST_RXF3_PAGEOFF 0x1810 59862306a36Sopenharmony_ci 59962306a36Sopenharmony_ci/* RXF-Page 0-3 Offset DMA Address */ 60062306a36Sopenharmony_ci#define REG_HOST_RXF0_MB0_LO 0x1820 60162306a36Sopenharmony_ci#define REG_HOST_RXF0_MB1_LO 0x1824 60262306a36Sopenharmony_ci#define REG_HOST_RXF1_MB0_LO 0x1828 60362306a36Sopenharmony_ci#define REG_HOST_RXF1_MB1_LO 0x182C 60462306a36Sopenharmony_ci#define REG_HOST_RXF2_MB0_LO 0x1830 60562306a36Sopenharmony_ci#define REG_HOST_RXF2_MB1_LO 0x1834 60662306a36Sopenharmony_ci#define REG_HOST_RXF3_MB0_LO 0x1838 60762306a36Sopenharmony_ci#define REG_HOST_RXF3_MB1_LO 0x183C 60862306a36Sopenharmony_ci 60962306a36Sopenharmony_ci/* Tpd CMB DMA Address */ 61062306a36Sopenharmony_ci#define REG_HOST_TX_CMB_LO 0x1840 61162306a36Sopenharmony_ci#define REG_HOST_SMB_ADDR_LO 0x1844 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_ci/* DEBUG ADDR */ 61462306a36Sopenharmony_ci#define REG_DEBUG_DATA0 0x1900 61562306a36Sopenharmony_ci#define REG_DEBUG_DATA1 0x1904 61662306a36Sopenharmony_ci 61762306a36Sopenharmony_ci/***************************** MII definition ***************************************/ 61862306a36Sopenharmony_ci/* PHY Common Register */ 61962306a36Sopenharmony_ci#define MII_AT001_PSCR 0x10 62062306a36Sopenharmony_ci#define MII_AT001_PSSR 0x11 62162306a36Sopenharmony_ci#define MII_INT_CTRL 0x12 62262306a36Sopenharmony_ci#define MII_INT_STATUS 0x13 62362306a36Sopenharmony_ci#define MII_SMARTSPEED 0x14 62462306a36Sopenharmony_ci#define MII_LBRERROR 0x18 62562306a36Sopenharmony_ci#define MII_RESV2 0x1a 62662306a36Sopenharmony_ci 62762306a36Sopenharmony_ci#define MII_DBG_ADDR 0x1D 62862306a36Sopenharmony_ci#define MII_DBG_DATA 0x1E 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_ci/* Autoneg Advertisement Register */ 63162306a36Sopenharmony_ci#define MII_AR_DEFAULT_CAP_MASK 0 63262306a36Sopenharmony_ci 63362306a36Sopenharmony_ci/* 1000BASE-T Control Register */ 63462306a36Sopenharmony_ci#define MII_AT001_CR_1000T_SPEED_MASK \ 63562306a36Sopenharmony_ci (ADVERTISE_1000FULL | ADVERTISE_1000HALF) 63662306a36Sopenharmony_ci#define MII_AT001_CR_1000T_DEFAULT_CAP_MASK MII_AT001_CR_1000T_SPEED_MASK 63762306a36Sopenharmony_ci 63862306a36Sopenharmony_ci/* AT001 PHY Specific Control Register */ 63962306a36Sopenharmony_ci#define MII_AT001_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Function disabled */ 64062306a36Sopenharmony_ci#define MII_AT001_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */ 64162306a36Sopenharmony_ci#define MII_AT001_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ 64262306a36Sopenharmony_ci#define MII_AT001_PSCR_MAC_POWERDOWN 0x0008 64362306a36Sopenharmony_ci#define MII_AT001_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low, 64462306a36Sopenharmony_ci * 0=CLK125 toggling 64562306a36Sopenharmony_ci */ 64662306a36Sopenharmony_ci#define MII_AT001_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5 */ 64762306a36Sopenharmony_ci/* Manual MDI configuration */ 64862306a36Sopenharmony_ci#define MII_AT001_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ 64962306a36Sopenharmony_ci#define MII_AT001_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover, 65062306a36Sopenharmony_ci * 100BASE-TX/10BASE-T: 65162306a36Sopenharmony_ci * MDI Mode 65262306a36Sopenharmony_ci */ 65362306a36Sopenharmony_ci#define MII_AT001_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled 65462306a36Sopenharmony_ci * all speeds. 65562306a36Sopenharmony_ci */ 65662306a36Sopenharmony_ci#define MII_AT001_PSCR_10BT_EXT_DIST_ENABLE 0x0080 65762306a36Sopenharmony_ci/* 1=Enable Extended 10BASE-T distance 65862306a36Sopenharmony_ci * (Lower 10BASE-T RX Threshold) 65962306a36Sopenharmony_ci * 0=Normal 10BASE-T RX Threshold */ 66062306a36Sopenharmony_ci#define MII_AT001_PSCR_MII_5BIT_ENABLE 0x0100 66162306a36Sopenharmony_ci/* 1=5-Bit interface in 100BASE-TX 66262306a36Sopenharmony_ci * 0=MII interface in 100BASE-TX */ 66362306a36Sopenharmony_ci#define MII_AT001_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler disable */ 66462306a36Sopenharmony_ci#define MII_AT001_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ 66562306a36Sopenharmony_ci#define MII_AT001_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ 66662306a36Sopenharmony_ci#define MII_AT001_PSCR_POLARITY_REVERSAL_SHIFT 1 66762306a36Sopenharmony_ci#define MII_AT001_PSCR_AUTO_X_MODE_SHIFT 5 66862306a36Sopenharmony_ci#define MII_AT001_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7 66962306a36Sopenharmony_ci/* AT001 PHY Specific Status Register */ 67062306a36Sopenharmony_ci#define MII_AT001_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ 67162306a36Sopenharmony_ci#define MII_AT001_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ 67262306a36Sopenharmony_ci#define MII_AT001_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ 67362306a36Sopenharmony_ci#define MII_AT001_PSSR_10MBS 0x0000 /* 00=10Mbs */ 67462306a36Sopenharmony_ci#define MII_AT001_PSSR_100MBS 0x4000 /* 01=100Mbs */ 67562306a36Sopenharmony_ci#define MII_AT001_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_ci#endif /*_ATHL1E_HW_H_*/ 678