162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* atlx_hw.h -- common hardware definitions for Attansic network drivers 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 562306a36Sopenharmony_ci * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com> 662306a36Sopenharmony_ci * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com> 762306a36Sopenharmony_ci * Copyright(c) 2007 Atheros Corporation. All rights reserved. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Derived from Intel e1000 driver 1062306a36Sopenharmony_ci * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#ifndef ATLX_H 1462306a36Sopenharmony_ci#define ATLX_H 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci#include <linux/module.h> 1762306a36Sopenharmony_ci#include <linux/types.h> 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define ATLX_ERR_PHY 2 2062306a36Sopenharmony_ci#define ATLX_ERR_PHY_SPEED 7 2162306a36Sopenharmony_ci#define ATLX_ERR_PHY_RES 8 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define SPEED_0 0xffff 2462306a36Sopenharmony_ci#define SPEED_10 10 2562306a36Sopenharmony_ci#define SPEED_100 100 2662306a36Sopenharmony_ci#define SPEED_1000 1000 2762306a36Sopenharmony_ci#define HALF_DUPLEX 1 2862306a36Sopenharmony_ci#define FULL_DUPLEX 2 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define MEDIA_TYPE_AUTO_SENSOR 0 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/* register definitions */ 3362306a36Sopenharmony_ci#define REG_PM_CTRLSTAT 0x44 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci#define REG_PCIE_CAP_LIST 0x58 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#define REG_VPD_CAP 0x6C 3862306a36Sopenharmony_ci#define VPD_CAP_ID_MASK 0xFF 3962306a36Sopenharmony_ci#define VPD_CAP_ID_SHIFT 0 4062306a36Sopenharmony_ci#define VPD_CAP_NEXT_PTR_MASK 0xFF 4162306a36Sopenharmony_ci#define VPD_CAP_NEXT_PTR_SHIFT 8 4262306a36Sopenharmony_ci#define VPD_CAP_VPD_ADDR_MASK 0x7FFF 4362306a36Sopenharmony_ci#define VPD_CAP_VPD_ADDR_SHIFT 16 4462306a36Sopenharmony_ci#define VPD_CAP_VPD_FLAG 0x80000000 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define REG_VPD_DATA 0x70 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define REG_SPI_FLASH_CTRL 0x200 4962306a36Sopenharmony_ci#define SPI_FLASH_CTRL_STS_NON_RDY 0x1 5062306a36Sopenharmony_ci#define SPI_FLASH_CTRL_STS_WEN 0x2 5162306a36Sopenharmony_ci#define SPI_FLASH_CTRL_STS_WPEN 0x80 5262306a36Sopenharmony_ci#define SPI_FLASH_CTRL_DEV_STS_MASK 0xFF 5362306a36Sopenharmony_ci#define SPI_FLASH_CTRL_DEV_STS_SHIFT 0 5462306a36Sopenharmony_ci#define SPI_FLASH_CTRL_INS_MASK 0x7 5562306a36Sopenharmony_ci#define SPI_FLASH_CTRL_INS_SHIFT 8 5662306a36Sopenharmony_ci#define SPI_FLASH_CTRL_START 0x800 5762306a36Sopenharmony_ci#define SPI_FLASH_CTRL_EN_VPD 0x2000 5862306a36Sopenharmony_ci#define SPI_FLASH_CTRL_LDSTART 0x8000 5962306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HI_MASK 0x3 6062306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HI_SHIFT 16 6162306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HOLD_MASK 0x3 6262306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HOLD_SHIFT 18 6362306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_LO_MASK 0x3 6462306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_LO_SHIFT 20 6562306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_HI_MASK 0x3 6662306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_HI_SHIFT 22 6762306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_SETUP_MASK 0x3 6862306a36Sopenharmony_ci#define SPI_FLASH_CTRL_CS_SETUP_SHIFT 24 6962306a36Sopenharmony_ci#define SPI_FLASH_CTRL_EROM_PGSZ_MASK 0x3 7062306a36Sopenharmony_ci#define SPI_FLASH_CTRL_EROM_PGSZ_SHIFT 26 7162306a36Sopenharmony_ci#define SPI_FLASH_CTRL_WAIT_READY 0x10000000 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define REG_SPI_ADDR 0x204 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#define REG_SPI_DATA 0x208 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci#define REG_SPI_FLASH_CONFIG 0x20C 7862306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_ADDR_MASK 0xFFFFFF 7962306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_ADDR_SHIFT 0 8062306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_VPD_ADDR_MASK 0x3 8162306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_VPD_ADDR_SHIFT 24 8262306a36Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_EXIST 0x4000000 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_PROGRAM 0x210 8562306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_SC_ERASE 0x211 8662306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_CHIP_ERASE 0x212 8762306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_RDID 0x213 8862306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_WREN 0x214 8962306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_RDSR 0x215 9062306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_WRSR 0x216 9162306a36Sopenharmony_ci#define REG_SPI_FLASH_OP_READ 0x217 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define REG_TWSI_CTRL 0x218 9462306a36Sopenharmony_ci#define TWSI_CTRL_LD_OFFSET_MASK 0xFF 9562306a36Sopenharmony_ci#define TWSI_CTRL_LD_OFFSET_SHIFT 0 9662306a36Sopenharmony_ci#define TWSI_CTRL_LD_SLV_ADDR_MASK 0x7 9762306a36Sopenharmony_ci#define TWSI_CTRL_LD_SLV_ADDR_SHIFT 8 9862306a36Sopenharmony_ci#define TWSI_CTRL_SW_LDSTART 0x800 9962306a36Sopenharmony_ci#define TWSI_CTRL_HW_LDSTART 0x1000 10062306a36Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR_MASK 0x7F 10162306a36Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR_SHIFT 15 10262306a36Sopenharmony_ci#define TWSI_CTRL_LD_EXIST 0x400000 10362306a36Sopenharmony_ci#define TWSI_CTRL_READ_FREQ_SEL_MASK 0x3 10462306a36Sopenharmony_ci#define TWSI_CTRL_READ_FREQ_SEL_SHIFT 23 10562306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_100K 0 10662306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_200K 1 10762306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_300K 2 10862306a36Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_400K 3 10962306a36Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR /* FIXME: define or remove */ 11062306a36Sopenharmony_ci#define TWSI_CTRL_WRITE_FREQ_SEL_MASK 0x3 11162306a36Sopenharmony_ci#define TWSI_CTRL_WRITE_FREQ_SEL_SHIFT 24 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci#define REG_PCIE_DEV_MISC_CTRL 0x21C 11462306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_EXT_PIPE 0x2 11562306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_RETRY_BUFDIS 0x1 11662306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SPIROM_EXIST 0x4 11762306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SERDES_ENDIAN 0x8 11862306a36Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SERDES_SEL_DIN 0x10 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci#define REG_PCIE_PHYMISC 0x1000 12162306a36Sopenharmony_ci#define PCIE_PHYMISC_FORCE_RCV_DET 0x4 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci#define REG_PCIE_DLL_TX_CTRL1 0x1104 12462306a36Sopenharmony_ci#define PCIE_DLL_TX_CTRL1_SEL_NOR_CLK 0x400 12562306a36Sopenharmony_ci#define PCIE_DLL_TX_CTRL1_DEF 0x568 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci#define REG_LTSSM_TEST_MODE 0x12FC 12862306a36Sopenharmony_ci#define LTSSM_TEST_MODE_DEF 0x6500 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci/* Master Control Register */ 13162306a36Sopenharmony_ci#define REG_MASTER_CTRL 0x1400 13262306a36Sopenharmony_ci#define MASTER_CTRL_SOFT_RST 0x1 13362306a36Sopenharmony_ci#define MASTER_CTRL_MTIMER_EN 0x2 13462306a36Sopenharmony_ci#define MASTER_CTRL_ITIMER_EN 0x4 13562306a36Sopenharmony_ci#define MASTER_CTRL_MANUAL_INT 0x8 13662306a36Sopenharmony_ci#define MASTER_CTRL_REV_NUM_SHIFT 16 13762306a36Sopenharmony_ci#define MASTER_CTRL_REV_NUM_MASK 0xFF 13862306a36Sopenharmony_ci#define MASTER_CTRL_DEV_ID_SHIFT 24 13962306a36Sopenharmony_ci#define MASTER_CTRL_DEV_ID_MASK 0xFF 14062306a36Sopenharmony_ci 14162306a36Sopenharmony_ci/* Timer Initial Value Register */ 14262306a36Sopenharmony_ci#define REG_MANUAL_TIMER_INIT 0x1404 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci/* IRQ Moderator Timer Initial Value Register */ 14562306a36Sopenharmony_ci#define REG_IRQ_MODU_TIMER_INIT 0x1408 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci#define REG_PHY_ENABLE 0x140C 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci/* IRQ Anti-Lost Timer Initial Value Register */ 15062306a36Sopenharmony_ci#define REG_CMBDISDMA_TIMER 0x140E 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci/* Block IDLE Status Register */ 15362306a36Sopenharmony_ci#define REG_IDLE_STATUS 0x1410 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci/* MDIO Control Register */ 15662306a36Sopenharmony_ci#define REG_MDIO_CTRL 0x1414 15762306a36Sopenharmony_ci#define MDIO_DATA_MASK 0xFFFF 15862306a36Sopenharmony_ci#define MDIO_DATA_SHIFT 0 15962306a36Sopenharmony_ci#define MDIO_REG_ADDR_MASK 0x1F 16062306a36Sopenharmony_ci#define MDIO_REG_ADDR_SHIFT 16 16162306a36Sopenharmony_ci#define MDIO_RW 0x200000 16262306a36Sopenharmony_ci#define MDIO_SUP_PREAMBLE 0x400000 16362306a36Sopenharmony_ci#define MDIO_START 0x800000 16462306a36Sopenharmony_ci#define MDIO_CLK_SEL_SHIFT 24 16562306a36Sopenharmony_ci#define MDIO_CLK_25_4 0 16662306a36Sopenharmony_ci#define MDIO_CLK_25_6 2 16762306a36Sopenharmony_ci#define MDIO_CLK_25_8 3 16862306a36Sopenharmony_ci#define MDIO_CLK_25_10 4 16962306a36Sopenharmony_ci#define MDIO_CLK_25_14 5 17062306a36Sopenharmony_ci#define MDIO_CLK_25_20 6 17162306a36Sopenharmony_ci#define MDIO_CLK_25_28 7 17262306a36Sopenharmony_ci#define MDIO_BUSY 0x8000000 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci/* MII PHY Status Register */ 17562306a36Sopenharmony_ci#define REG_PHY_STATUS 0x1418 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* BIST Control and Status Register0 (for the Packet Memory) */ 17862306a36Sopenharmony_ci#define REG_BIST0_CTRL 0x141C 17962306a36Sopenharmony_ci#define BIST0_NOW 0x1 18062306a36Sopenharmony_ci#define BIST0_SRAM_FAIL 0x2 18162306a36Sopenharmony_ci#define BIST0_FUSE_FLAG 0x4 18262306a36Sopenharmony_ci#define REG_BIST1_CTRL 0x1420 18362306a36Sopenharmony_ci#define BIST1_NOW 0x1 18462306a36Sopenharmony_ci#define BIST1_SRAM_FAIL 0x2 18562306a36Sopenharmony_ci#define BIST1_FUSE_FLAG 0x4 18662306a36Sopenharmony_ci 18762306a36Sopenharmony_ci/* SerDes Lock Detect Control and Status Register */ 18862306a36Sopenharmony_ci#define REG_SERDES_LOCK 0x1424 18962306a36Sopenharmony_ci#define SERDES_LOCK_DETECT 1 19062306a36Sopenharmony_ci#define SERDES_LOCK_DETECT_EN 2 19162306a36Sopenharmony_ci 19262306a36Sopenharmony_ci/* MAC Control Register */ 19362306a36Sopenharmony_ci#define REG_MAC_CTRL 0x1480 19462306a36Sopenharmony_ci#define MAC_CTRL_TX_EN 1 19562306a36Sopenharmony_ci#define MAC_CTRL_RX_EN 2 19662306a36Sopenharmony_ci#define MAC_CTRL_TX_FLOW 4 19762306a36Sopenharmony_ci#define MAC_CTRL_RX_FLOW 8 19862306a36Sopenharmony_ci#define MAC_CTRL_LOOPBACK 0x10 19962306a36Sopenharmony_ci#define MAC_CTRL_DUPLX 0x20 20062306a36Sopenharmony_ci#define MAC_CTRL_ADD_CRC 0x40 20162306a36Sopenharmony_ci#define MAC_CTRL_PAD 0x80 20262306a36Sopenharmony_ci#define MAC_CTRL_LENCHK 0x100 20362306a36Sopenharmony_ci#define MAC_CTRL_HUGE_EN 0x200 20462306a36Sopenharmony_ci#define MAC_CTRL_PRMLEN_SHIFT 10 20562306a36Sopenharmony_ci#define MAC_CTRL_PRMLEN_MASK 0xF 20662306a36Sopenharmony_ci#define MAC_CTRL_RMV_VLAN 0x4000 20762306a36Sopenharmony_ci#define MAC_CTRL_PROMIS_EN 0x8000 20862306a36Sopenharmony_ci#define MAC_CTRL_MC_ALL_EN 0x2000000 20962306a36Sopenharmony_ci#define MAC_CTRL_BC_EN 0x4000000 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci/* MAC IPG/IFG Control Register */ 21262306a36Sopenharmony_ci#define REG_MAC_IPG_IFG 0x1484 21362306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGT_SHIFT 0 21462306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGT_MASK 0x7F 21562306a36Sopenharmony_ci#define MAC_IPG_IFG_MIFG_SHIFT 8 21662306a36Sopenharmony_ci#define MAC_IPG_IFG_MIFG_MASK 0xFF 21762306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR1_SHIFT 16 21862306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR1_MASK 0x7F 21962306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR2_SHIFT 24 22062306a36Sopenharmony_ci#define MAC_IPG_IFG_IPGR2_MASK 0x7F 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci/* MAC STATION ADDRESS */ 22362306a36Sopenharmony_ci#define REG_MAC_STA_ADDR 0x1488 22462306a36Sopenharmony_ci 22562306a36Sopenharmony_ci/* Hash table for multicast address */ 22662306a36Sopenharmony_ci#define REG_RX_HASH_TABLE 0x1490 22762306a36Sopenharmony_ci 22862306a36Sopenharmony_ci/* MAC Half-Duplex Control Register */ 22962306a36Sopenharmony_ci#define REG_MAC_HALF_DUPLX_CTRL 0x1498 23062306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_LCOL_SHIFT 0 23162306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_LCOL_MASK 0x3FF 23262306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_RETRY_SHIFT 12 23362306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_RETRY_MASK 0xF 23462306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_EXC_DEF_EN 0x10000 23562306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_NO_BACK_C 0x20000 23662306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_NO_BACK_P 0x40000 23762306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBE 0x80000 23862306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBT_SHIFT 20 23962306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBT_MASK 0xF 24062306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_JAMIPG_SHIFT 24 24162306a36Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_JAMIPG_MASK 0xF 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci/* Maximum Frame Length Control Register */ 24462306a36Sopenharmony_ci#define REG_MTU 0x149C 24562306a36Sopenharmony_ci 24662306a36Sopenharmony_ci/* Wake-On-Lan control register */ 24762306a36Sopenharmony_ci#define REG_WOL_CTRL 0x14A0 24862306a36Sopenharmony_ci#define WOL_PATTERN_EN 0x1 24962306a36Sopenharmony_ci#define WOL_PATTERN_PME_EN 0x2 25062306a36Sopenharmony_ci#define WOL_MAGIC_EN 0x4 25162306a36Sopenharmony_ci#define WOL_MAGIC_PME_EN 0x8 25262306a36Sopenharmony_ci#define WOL_LINK_CHG_EN 0x10 25362306a36Sopenharmony_ci#define WOL_LINK_CHG_PME_EN 0x20 25462306a36Sopenharmony_ci#define WOL_PATTERN_ST 0x100 25562306a36Sopenharmony_ci#define WOL_MAGIC_ST 0x200 25662306a36Sopenharmony_ci#define WOL_LINKCHG_ST 0x400 25762306a36Sopenharmony_ci#define WOL_PT0_EN 0x10000 25862306a36Sopenharmony_ci#define WOL_PT1_EN 0x20000 25962306a36Sopenharmony_ci#define WOL_PT2_EN 0x40000 26062306a36Sopenharmony_ci#define WOL_PT3_EN 0x80000 26162306a36Sopenharmony_ci#define WOL_PT4_EN 0x100000 26262306a36Sopenharmony_ci#define WOL_PT0_MATCH 0x1000000 26362306a36Sopenharmony_ci#define WOL_PT1_MATCH 0x2000000 26462306a36Sopenharmony_ci#define WOL_PT2_MATCH 0x4000000 26562306a36Sopenharmony_ci#define WOL_PT3_MATCH 0x8000000 26662306a36Sopenharmony_ci#define WOL_PT4_MATCH 0x10000000 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci/* Internal SRAM Partition Register, high 32 bits */ 26962306a36Sopenharmony_ci#define REG_SRAM_RFD_ADDR 0x1500 27062306a36Sopenharmony_ci 27162306a36Sopenharmony_ci/* Descriptor Control register, high 32 bits */ 27262306a36Sopenharmony_ci#define REG_DESC_BASE_ADDR_HI 0x1540 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci/* Interrupt Status Register */ 27562306a36Sopenharmony_ci#define REG_ISR 0x1600 27662306a36Sopenharmony_ci#define ISR_UR_DETECTED 0x1000000 27762306a36Sopenharmony_ci#define ISR_FERR_DETECTED 0x2000000 27862306a36Sopenharmony_ci#define ISR_NFERR_DETECTED 0x4000000 27962306a36Sopenharmony_ci#define ISR_CERR_DETECTED 0x8000000 28062306a36Sopenharmony_ci#define ISR_PHY_LINKDOWN 0x10000000 28162306a36Sopenharmony_ci#define ISR_DIS_INT 0x80000000 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci/* Interrupt Mask Register */ 28462306a36Sopenharmony_ci#define REG_IMR 0x1604 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_ci#define REG_RFD_RRD_IDX 0x1800 28762306a36Sopenharmony_ci#define REG_TPD_IDX 0x1804 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_ci/* MII definitions */ 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_ci/* PHY Common Register */ 29262306a36Sopenharmony_ci#define MII_ATLX_CR 0x09 29362306a36Sopenharmony_ci#define MII_ATLX_SR 0x0A 29462306a36Sopenharmony_ci#define MII_ATLX_ESR 0x0F 29562306a36Sopenharmony_ci#define MII_ATLX_PSCR 0x10 29662306a36Sopenharmony_ci#define MII_ATLX_PSSR 0x11 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci/* PHY Control Register */ 29962306a36Sopenharmony_ci#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 30062306a36Sopenharmony_ci * 00=10 30162306a36Sopenharmony_ci */ 30262306a36Sopenharmony_ci#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ 30362306a36Sopenharmony_ci#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ 30462306a36Sopenharmony_ci#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ 30562306a36Sopenharmony_ci#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ 30662306a36Sopenharmony_ci#define MII_CR_POWER_DOWN 0x0800 /* Power down */ 30762306a36Sopenharmony_ci#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ 30862306a36Sopenharmony_ci#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 30962306a36Sopenharmony_ci * 00=10 31062306a36Sopenharmony_ci */ 31162306a36Sopenharmony_ci#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ 31262306a36Sopenharmony_ci#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ 31362306a36Sopenharmony_ci#define MII_CR_SPEED_MASK 0x2040 31462306a36Sopenharmony_ci#define MII_CR_SPEED_1000 0x0040 31562306a36Sopenharmony_ci#define MII_CR_SPEED_100 0x2000 31662306a36Sopenharmony_ci#define MII_CR_SPEED_10 0x0000 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci/* PHY Status Register */ 31962306a36Sopenharmony_ci#define MII_SR_EXTENDED_CAPS 0x0001 /* Ext register capabilities */ 32062306a36Sopenharmony_ci#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ 32162306a36Sopenharmony_ci#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ 32262306a36Sopenharmony_ci#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ 32362306a36Sopenharmony_ci#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ 32462306a36Sopenharmony_ci#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ 32562306a36Sopenharmony_ci#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */ 32662306a36Sopenharmony_ci#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext stat info in Reg 0x0F */ 32762306a36Sopenharmony_ci#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ 32862306a36Sopenharmony_ci#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ 32962306a36Sopenharmony_ci#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ 33062306a36Sopenharmony_ci#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ 33162306a36Sopenharmony_ci#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ 33262306a36Sopenharmony_ci#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ 33362306a36Sopenharmony_ci#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci/* Link partner ability register */ 33662306a36Sopenharmony_ci#define MII_LPA_SLCT 0x001f /* Same as advertise selector */ 33762306a36Sopenharmony_ci#define MII_LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ 33862306a36Sopenharmony_ci#define MII_LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ 33962306a36Sopenharmony_ci#define MII_LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ 34062306a36Sopenharmony_ci#define MII_LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ 34162306a36Sopenharmony_ci#define MII_LPA_100BASE4 0x0200 /* 100BASE-T4 */ 34262306a36Sopenharmony_ci#define MII_LPA_PAUSE 0x0400 /* PAUSE */ 34362306a36Sopenharmony_ci#define MII_LPA_ASYPAUSE 0x0800 /* Asymmetrical PAUSE */ 34462306a36Sopenharmony_ci#define MII_LPA_RFAULT 0x2000 /* Link partner faulted */ 34562306a36Sopenharmony_ci#define MII_LPA_LPACK 0x4000 /* Link partner acked us */ 34662306a36Sopenharmony_ci#define MII_LPA_NPAGE 0x8000 /* Next page bit */ 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci/* Autoneg Advertisement Register */ 34962306a36Sopenharmony_ci#define MII_AR_SELECTOR_FIELD 0x0001 /* IEEE 802.3 CSMA/CD */ 35062306a36Sopenharmony_ci#define MII_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ 35162306a36Sopenharmony_ci#define MII_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ 35262306a36Sopenharmony_ci#define MII_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ 35362306a36Sopenharmony_ci#define MII_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ 35462306a36Sopenharmony_ci#define MII_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ 35562306a36Sopenharmony_ci#define MII_AR_PAUSE 0x0400 /* Pause operation desired */ 35662306a36Sopenharmony_ci#define MII_AR_ASM_DIR 0x0800 /* Asymmetric Pause Dir bit */ 35762306a36Sopenharmony_ci#define MII_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ 35862306a36Sopenharmony_ci#define MII_AR_NEXT_PAGE 0x8000 /* Next Page ability support */ 35962306a36Sopenharmony_ci#define MII_AR_SPEED_MASK 0x01E0 36062306a36Sopenharmony_ci#define MII_AR_DEFAULT_CAP_MASK 0x0DE0 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci/* 1000BASE-T Control Register */ 36362306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_HD_CAPS 0x0100 /* Adv 1000T HD cap */ 36462306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_FD_CAPS 0x0200 /* Adv 1000T FD cap */ 36562306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device, 36662306a36Sopenharmony_ci * 0=DTE device */ 36762306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_MS_VALUE 0x0800 /* 1=Config PHY as Master, 36862306a36Sopenharmony_ci * 0=Configure PHY as Slave */ 36962306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_MS_ENABLE 0x1000 /* 1=Man Master/Slave config, 37062306a36Sopenharmony_ci * 0=Auto Master/Slave config 37162306a36Sopenharmony_ci */ 37262306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ 37362306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ 37462306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_2 0x4000 /* Master Xmit Jitter test */ 37562306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_3 0x6000 /* Slave Xmit Jitter test */ 37662306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_4 0x8000 /* Xmitter Distortion test */ 37762306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_SPEED_MASK 0x0300 37862306a36Sopenharmony_ci#define MII_ATLX_CR_1000T_DEFAULT_CAP_MASK 0x0300 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci/* 1000BASE-T Status Register */ 38162306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ 38262306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ 38362306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ 38462306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ 38562306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master 38662306a36Sopenharmony_ci * 0=Slave 38762306a36Sopenharmony_ci */ 38862306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config 38962306a36Sopenharmony_ci * fault */ 39062306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_REMOTE_RX_STATUS_SHIFT 12 39162306a36Sopenharmony_ci#define MII_ATLX_SR_1000T_LOCAL_RX_STATUS_SHIFT 13 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci/* Extended Status Register */ 39462306a36Sopenharmony_ci#define MII_ATLX_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */ 39562306a36Sopenharmony_ci#define MII_ATLX_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */ 39662306a36Sopenharmony_ci#define MII_ATLX_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */ 39762306a36Sopenharmony_ci#define MII_ATLX_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */ 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_ci/* ATLX PHY Specific Control Register */ 40062306a36Sopenharmony_ci#define MII_ATLX_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Func disabled */ 40162306a36Sopenharmony_ci#define MII_ATLX_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enbld */ 40262306a36Sopenharmony_ci#define MII_ATLX_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ 40362306a36Sopenharmony_ci#define MII_ATLX_PSCR_MAC_POWERDOWN 0x0008 40462306a36Sopenharmony_ci#define MII_ATLX_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low 40562306a36Sopenharmony_ci * 0=CLK125 toggling 40662306a36Sopenharmony_ci */ 40762306a36Sopenharmony_ci#define MII_ATLX_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5, 40862306a36Sopenharmony_ci * Manual MDI configuration 40962306a36Sopenharmony_ci */ 41062306a36Sopenharmony_ci#define MII_ATLX_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ 41162306a36Sopenharmony_ci#define MII_ATLX_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover 41262306a36Sopenharmony_ci * 100BASE-TX/10BASE-T: MDI 41362306a36Sopenharmony_ci * Mode */ 41462306a36Sopenharmony_ci#define MII_ATLX_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled 41562306a36Sopenharmony_ci * all speeds. 41662306a36Sopenharmony_ci */ 41762306a36Sopenharmony_ci#define MII_ATLX_PSCR_10BT_EXT_DIST_ENABLE 0x0080 /* 1=Enable Extended 41862306a36Sopenharmony_ci * 10BASE-T distance 41962306a36Sopenharmony_ci * (Lower 10BASE-T RX 42062306a36Sopenharmony_ci * Threshold) 42162306a36Sopenharmony_ci * 0=Normal 10BASE-T RX 42262306a36Sopenharmony_ci * Threshold 42362306a36Sopenharmony_ci */ 42462306a36Sopenharmony_ci#define MII_ATLX_PSCR_MII_5BIT_ENABLE 0x0100 /* 1=5-Bit interface in 42562306a36Sopenharmony_ci * 100BASE-TX 42662306a36Sopenharmony_ci * 0=MII interface in 42762306a36Sopenharmony_ci * 100BASE-TX 42862306a36Sopenharmony_ci */ 42962306a36Sopenharmony_ci#define MII_ATLX_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler dsbl */ 43062306a36Sopenharmony_ci#define MII_ATLX_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ 43162306a36Sopenharmony_ci#define MII_ATLX_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ 43262306a36Sopenharmony_ci#define MII_ATLX_PSCR_POLARITY_REVERSAL_SHIFT 1 43362306a36Sopenharmony_ci#define MII_ATLX_PSCR_AUTO_X_MODE_SHIFT 5 43462306a36Sopenharmony_ci#define MII_ATLX_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci/* ATLX PHY Specific Status Register */ 43762306a36Sopenharmony_ci#define MII_ATLX_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ 43862306a36Sopenharmony_ci#define MII_ATLX_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ 43962306a36Sopenharmony_ci#define MII_ATLX_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ 44062306a36Sopenharmony_ci#define MII_ATLX_PSSR_10MBS 0x0000 /* 00=10Mbs */ 44162306a36Sopenharmony_ci#define MII_ATLX_PSSR_100MBS 0x4000 /* 01=100Mbs */ 44262306a36Sopenharmony_ci#define MII_ATLX_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci#define MII_DBG_ADDR 0x1D 44562306a36Sopenharmony_ci#define MII_DBG_DATA 0x1E 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_ci/* PCI Command Register Bit Definitions */ 44862306a36Sopenharmony_ci#define PCI_REG_COMMAND 0x04 /* PCI Command Register */ 44962306a36Sopenharmony_ci#define CMD_IO_SPACE 0x0001 45062306a36Sopenharmony_ci#define CMD_MEMORY_SPACE 0x0002 45162306a36Sopenharmony_ci#define CMD_BUS_MASTER 0x0004 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_ci/* Wake Up Filter Control */ 45462306a36Sopenharmony_ci#define ATLX_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ 45562306a36Sopenharmony_ci#define ATLX_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ 45662306a36Sopenharmony_ci#define ATLX_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ 45762306a36Sopenharmony_ci#define ATLX_WUFC_MC 0x00000008 /* Multicast Wakeup Enable */ 45862306a36Sopenharmony_ci#define ATLX_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 45962306a36Sopenharmony_ci 46062306a36Sopenharmony_ci#define ADVERTISE_10_HALF 0x0001 46162306a36Sopenharmony_ci#define ADVERTISE_10_FULL 0x0002 46262306a36Sopenharmony_ci#define ADVERTISE_100_HALF 0x0004 46362306a36Sopenharmony_ci#define ADVERTISE_100_FULL 0x0008 46462306a36Sopenharmony_ci#define ADVERTISE_1000_HALF 0x0010 46562306a36Sopenharmony_ci#define ADVERTISE_1000_FULL 0x0020 46662306a36Sopenharmony_ci#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */ 46762306a36Sopenharmony_ci#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */ 46862306a36Sopenharmony_ci 46962306a36Sopenharmony_ci#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ 47062306a36Sopenharmony_ci#define PHY_FORCE_TIME 20 /* 2.0 Seconds */ 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ci/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */ 47362306a36Sopenharmony_ci#define EEPROM_SUM 0xBABA 47462306a36Sopenharmony_ci 47562306a36Sopenharmony_cistruct atlx_spi_flash_dev { 47662306a36Sopenharmony_ci const char *manu_name; /* manufacturer id */ 47762306a36Sopenharmony_ci /* op-code */ 47862306a36Sopenharmony_ci u8 cmd_wrsr; 47962306a36Sopenharmony_ci u8 cmd_read; 48062306a36Sopenharmony_ci u8 cmd_program; 48162306a36Sopenharmony_ci u8 cmd_wren; 48262306a36Sopenharmony_ci u8 cmd_wrdi; 48362306a36Sopenharmony_ci u8 cmd_rdsr; 48462306a36Sopenharmony_ci u8 cmd_rdid; 48562306a36Sopenharmony_ci u8 cmd_sector_erase; 48662306a36Sopenharmony_ci u8 cmd_chip_erase; 48762306a36Sopenharmony_ci}; 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci#endif /* ATLX_H */ 490