18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* atlx_hw.h -- common hardware definitions for Attansic network drivers 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved. 58c2ecf20Sopenharmony_ci * Copyright(c) 2006 - 2007 Chris Snook <csnook@redhat.com> 68c2ecf20Sopenharmony_ci * Copyright(c) 2006 - 2008 Jay Cliburn <jcliburn@gmail.com> 78c2ecf20Sopenharmony_ci * Copyright(c) 2007 Atheros Corporation. All rights reserved. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Derived from Intel e1000 driver 108c2ecf20Sopenharmony_ci * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef ATLX_H 148c2ecf20Sopenharmony_ci#define ATLX_H 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <linux/module.h> 178c2ecf20Sopenharmony_ci#include <linux/types.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define ATLX_ERR_PHY 2 208c2ecf20Sopenharmony_ci#define ATLX_ERR_PHY_SPEED 7 218c2ecf20Sopenharmony_ci#define ATLX_ERR_PHY_RES 8 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define SPEED_0 0xffff 248c2ecf20Sopenharmony_ci#define SPEED_10 10 258c2ecf20Sopenharmony_ci#define SPEED_100 100 268c2ecf20Sopenharmony_ci#define SPEED_1000 1000 278c2ecf20Sopenharmony_ci#define HALF_DUPLEX 1 288c2ecf20Sopenharmony_ci#define FULL_DUPLEX 2 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define MEDIA_TYPE_AUTO_SENSOR 0 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* register definitions */ 338c2ecf20Sopenharmony_ci#define REG_PM_CTRLSTAT 0x44 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define REG_PCIE_CAP_LIST 0x58 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define REG_VPD_CAP 0x6C 388c2ecf20Sopenharmony_ci#define VPD_CAP_ID_MASK 0xFF 398c2ecf20Sopenharmony_ci#define VPD_CAP_ID_SHIFT 0 408c2ecf20Sopenharmony_ci#define VPD_CAP_NEXT_PTR_MASK 0xFF 418c2ecf20Sopenharmony_ci#define VPD_CAP_NEXT_PTR_SHIFT 8 428c2ecf20Sopenharmony_ci#define VPD_CAP_VPD_ADDR_MASK 0x7FFF 438c2ecf20Sopenharmony_ci#define VPD_CAP_VPD_ADDR_SHIFT 16 448c2ecf20Sopenharmony_ci#define VPD_CAP_VPD_FLAG 0x80000000 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define REG_VPD_DATA 0x70 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_CTRL 0x200 498c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_STS_NON_RDY 0x1 508c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_STS_WEN 0x2 518c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_STS_WPEN 0x80 528c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_DEV_STS_MASK 0xFF 538c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_DEV_STS_SHIFT 0 548c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_INS_MASK 0x7 558c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_INS_SHIFT 8 568c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_START 0x800 578c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_EN_VPD 0x2000 588c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_LDSTART 0x8000 598c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HI_MASK 0x3 608c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HI_SHIFT 16 618c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HOLD_MASK 0x3 628c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CS_HOLD_SHIFT 18 638c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_LO_MASK 0x3 648c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_LO_SHIFT 20 658c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_HI_MASK 0x3 668c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CLK_HI_SHIFT 22 678c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CS_SETUP_MASK 0x3 688c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_CS_SETUP_SHIFT 24 698c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_EROM_PGSZ_MASK 0x3 708c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_EROM_PGSZ_SHIFT 26 718c2ecf20Sopenharmony_ci#define SPI_FLASH_CTRL_WAIT_READY 0x10000000 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci#define REG_SPI_ADDR 0x204 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define REG_SPI_DATA 0x208 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_CONFIG 0x20C 788c2ecf20Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_ADDR_MASK 0xFFFFFF 798c2ecf20Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_ADDR_SHIFT 0 808c2ecf20Sopenharmony_ci#define SPI_FLASH_CONFIG_VPD_ADDR_MASK 0x3 818c2ecf20Sopenharmony_ci#define SPI_FLASH_CONFIG_VPD_ADDR_SHIFT 24 828c2ecf20Sopenharmony_ci#define SPI_FLASH_CONFIG_LD_EXIST 0x4000000 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_PROGRAM 0x210 858c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_SC_ERASE 0x211 868c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_CHIP_ERASE 0x212 878c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_RDID 0x213 888c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_WREN 0x214 898c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_RDSR 0x215 908c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_WRSR 0x216 918c2ecf20Sopenharmony_ci#define REG_SPI_FLASH_OP_READ 0x217 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci#define REG_TWSI_CTRL 0x218 948c2ecf20Sopenharmony_ci#define TWSI_CTRL_LD_OFFSET_MASK 0xFF 958c2ecf20Sopenharmony_ci#define TWSI_CTRL_LD_OFFSET_SHIFT 0 968c2ecf20Sopenharmony_ci#define TWSI_CTRL_LD_SLV_ADDR_MASK 0x7 978c2ecf20Sopenharmony_ci#define TWSI_CTRL_LD_SLV_ADDR_SHIFT 8 988c2ecf20Sopenharmony_ci#define TWSI_CTRL_SW_LDSTART 0x800 998c2ecf20Sopenharmony_ci#define TWSI_CTRL_HW_LDSTART 0x1000 1008c2ecf20Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR_MASK 0x7F 1018c2ecf20Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR_SHIFT 15 1028c2ecf20Sopenharmony_ci#define TWSI_CTRL_LD_EXIST 0x400000 1038c2ecf20Sopenharmony_ci#define TWSI_CTRL_READ_FREQ_SEL_MASK 0x3 1048c2ecf20Sopenharmony_ci#define TWSI_CTRL_READ_FREQ_SEL_SHIFT 23 1058c2ecf20Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_100K 0 1068c2ecf20Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_200K 1 1078c2ecf20Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_300K 2 1088c2ecf20Sopenharmony_ci#define TWSI_CTRL_FREQ_SEL_400K 3 1098c2ecf20Sopenharmony_ci#define TWSI_CTRL_SMB_SLV_ADDR /* FIXME: define or remove */ 1108c2ecf20Sopenharmony_ci#define TWSI_CTRL_WRITE_FREQ_SEL_MASK 0x3 1118c2ecf20Sopenharmony_ci#define TWSI_CTRL_WRITE_FREQ_SEL_SHIFT 24 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define REG_PCIE_DEV_MISC_CTRL 0x21C 1148c2ecf20Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_EXT_PIPE 0x2 1158c2ecf20Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_RETRY_BUFDIS 0x1 1168c2ecf20Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SPIROM_EXIST 0x4 1178c2ecf20Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SERDES_ENDIAN 0x8 1188c2ecf20Sopenharmony_ci#define PCIE_DEV_MISC_CTRL_SERDES_SEL_DIN 0x10 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#define REG_PCIE_PHYMISC 0x1000 1218c2ecf20Sopenharmony_ci#define PCIE_PHYMISC_FORCE_RCV_DET 0x4 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci#define REG_PCIE_DLL_TX_CTRL1 0x1104 1248c2ecf20Sopenharmony_ci#define PCIE_DLL_TX_CTRL1_SEL_NOR_CLK 0x400 1258c2ecf20Sopenharmony_ci#define PCIE_DLL_TX_CTRL1_DEF 0x568 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci#define REG_LTSSM_TEST_MODE 0x12FC 1288c2ecf20Sopenharmony_ci#define LTSSM_TEST_MODE_DEF 0x6500 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* Master Control Register */ 1318c2ecf20Sopenharmony_ci#define REG_MASTER_CTRL 0x1400 1328c2ecf20Sopenharmony_ci#define MASTER_CTRL_SOFT_RST 0x1 1338c2ecf20Sopenharmony_ci#define MASTER_CTRL_MTIMER_EN 0x2 1348c2ecf20Sopenharmony_ci#define MASTER_CTRL_ITIMER_EN 0x4 1358c2ecf20Sopenharmony_ci#define MASTER_CTRL_MANUAL_INT 0x8 1368c2ecf20Sopenharmony_ci#define MASTER_CTRL_REV_NUM_SHIFT 16 1378c2ecf20Sopenharmony_ci#define MASTER_CTRL_REV_NUM_MASK 0xFF 1388c2ecf20Sopenharmony_ci#define MASTER_CTRL_DEV_ID_SHIFT 24 1398c2ecf20Sopenharmony_ci#define MASTER_CTRL_DEV_ID_MASK 0xFF 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci/* Timer Initial Value Register */ 1428c2ecf20Sopenharmony_ci#define REG_MANUAL_TIMER_INIT 0x1404 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* IRQ Moderator Timer Initial Value Register */ 1458c2ecf20Sopenharmony_ci#define REG_IRQ_MODU_TIMER_INIT 0x1408 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ci#define REG_PHY_ENABLE 0x140C 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci/* IRQ Anti-Lost Timer Initial Value Register */ 1508c2ecf20Sopenharmony_ci#define REG_CMBDISDMA_TIMER 0x140E 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci/* Block IDLE Status Register */ 1538c2ecf20Sopenharmony_ci#define REG_IDLE_STATUS 0x1410 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/* MDIO Control Register */ 1568c2ecf20Sopenharmony_ci#define REG_MDIO_CTRL 0x1414 1578c2ecf20Sopenharmony_ci#define MDIO_DATA_MASK 0xFFFF 1588c2ecf20Sopenharmony_ci#define MDIO_DATA_SHIFT 0 1598c2ecf20Sopenharmony_ci#define MDIO_REG_ADDR_MASK 0x1F 1608c2ecf20Sopenharmony_ci#define MDIO_REG_ADDR_SHIFT 16 1618c2ecf20Sopenharmony_ci#define MDIO_RW 0x200000 1628c2ecf20Sopenharmony_ci#define MDIO_SUP_PREAMBLE 0x400000 1638c2ecf20Sopenharmony_ci#define MDIO_START 0x800000 1648c2ecf20Sopenharmony_ci#define MDIO_CLK_SEL_SHIFT 24 1658c2ecf20Sopenharmony_ci#define MDIO_CLK_25_4 0 1668c2ecf20Sopenharmony_ci#define MDIO_CLK_25_6 2 1678c2ecf20Sopenharmony_ci#define MDIO_CLK_25_8 3 1688c2ecf20Sopenharmony_ci#define MDIO_CLK_25_10 4 1698c2ecf20Sopenharmony_ci#define MDIO_CLK_25_14 5 1708c2ecf20Sopenharmony_ci#define MDIO_CLK_25_20 6 1718c2ecf20Sopenharmony_ci#define MDIO_CLK_25_28 7 1728c2ecf20Sopenharmony_ci#define MDIO_BUSY 0x8000000 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/* MII PHY Status Register */ 1758c2ecf20Sopenharmony_ci#define REG_PHY_STATUS 0x1418 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* BIST Control and Status Register0 (for the Packet Memory) */ 1788c2ecf20Sopenharmony_ci#define REG_BIST0_CTRL 0x141C 1798c2ecf20Sopenharmony_ci#define BIST0_NOW 0x1 1808c2ecf20Sopenharmony_ci#define BIST0_SRAM_FAIL 0x2 1818c2ecf20Sopenharmony_ci#define BIST0_FUSE_FLAG 0x4 1828c2ecf20Sopenharmony_ci#define REG_BIST1_CTRL 0x1420 1838c2ecf20Sopenharmony_ci#define BIST1_NOW 0x1 1848c2ecf20Sopenharmony_ci#define BIST1_SRAM_FAIL 0x2 1858c2ecf20Sopenharmony_ci#define BIST1_FUSE_FLAG 0x4 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci/* SerDes Lock Detect Control and Status Register */ 1888c2ecf20Sopenharmony_ci#define REG_SERDES_LOCK 0x1424 1898c2ecf20Sopenharmony_ci#define SERDES_LOCK_DETECT 1 1908c2ecf20Sopenharmony_ci#define SERDES_LOCK_DETECT_EN 2 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci/* MAC Control Register */ 1938c2ecf20Sopenharmony_ci#define REG_MAC_CTRL 0x1480 1948c2ecf20Sopenharmony_ci#define MAC_CTRL_TX_EN 1 1958c2ecf20Sopenharmony_ci#define MAC_CTRL_RX_EN 2 1968c2ecf20Sopenharmony_ci#define MAC_CTRL_TX_FLOW 4 1978c2ecf20Sopenharmony_ci#define MAC_CTRL_RX_FLOW 8 1988c2ecf20Sopenharmony_ci#define MAC_CTRL_LOOPBACK 0x10 1998c2ecf20Sopenharmony_ci#define MAC_CTRL_DUPLX 0x20 2008c2ecf20Sopenharmony_ci#define MAC_CTRL_ADD_CRC 0x40 2018c2ecf20Sopenharmony_ci#define MAC_CTRL_PAD 0x80 2028c2ecf20Sopenharmony_ci#define MAC_CTRL_LENCHK 0x100 2038c2ecf20Sopenharmony_ci#define MAC_CTRL_HUGE_EN 0x200 2048c2ecf20Sopenharmony_ci#define MAC_CTRL_PRMLEN_SHIFT 10 2058c2ecf20Sopenharmony_ci#define MAC_CTRL_PRMLEN_MASK 0xF 2068c2ecf20Sopenharmony_ci#define MAC_CTRL_RMV_VLAN 0x4000 2078c2ecf20Sopenharmony_ci#define MAC_CTRL_PROMIS_EN 0x8000 2088c2ecf20Sopenharmony_ci#define MAC_CTRL_MC_ALL_EN 0x2000000 2098c2ecf20Sopenharmony_ci#define MAC_CTRL_BC_EN 0x4000000 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci/* MAC IPG/IFG Control Register */ 2128c2ecf20Sopenharmony_ci#define REG_MAC_IPG_IFG 0x1484 2138c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_IPGT_SHIFT 0 2148c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_IPGT_MASK 0x7F 2158c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_MIFG_SHIFT 8 2168c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_MIFG_MASK 0xFF 2178c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_IPGR1_SHIFT 16 2188c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_IPGR1_MASK 0x7F 2198c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_IPGR2_SHIFT 24 2208c2ecf20Sopenharmony_ci#define MAC_IPG_IFG_IPGR2_MASK 0x7F 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci/* MAC STATION ADDRESS */ 2238c2ecf20Sopenharmony_ci#define REG_MAC_STA_ADDR 0x1488 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/* Hash table for multicast address */ 2268c2ecf20Sopenharmony_ci#define REG_RX_HASH_TABLE 0x1490 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci/* MAC Half-Duplex Control Register */ 2298c2ecf20Sopenharmony_ci#define REG_MAC_HALF_DUPLX_CTRL 0x1498 2308c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_LCOL_SHIFT 0 2318c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_LCOL_MASK 0x3FF 2328c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_RETRY_SHIFT 12 2338c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_RETRY_MASK 0xF 2348c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_EXC_DEF_EN 0x10000 2358c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_NO_BACK_C 0x20000 2368c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_NO_BACK_P 0x40000 2378c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBE 0x80000 2388c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBT_SHIFT 20 2398c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_ABEBT_MASK 0xF 2408c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_JAMIPG_SHIFT 24 2418c2ecf20Sopenharmony_ci#define MAC_HALF_DUPLX_CTRL_JAMIPG_MASK 0xF 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci/* Maximum Frame Length Control Register */ 2448c2ecf20Sopenharmony_ci#define REG_MTU 0x149C 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci/* Wake-On-Lan control register */ 2478c2ecf20Sopenharmony_ci#define REG_WOL_CTRL 0x14A0 2488c2ecf20Sopenharmony_ci#define WOL_PATTERN_EN 0x1 2498c2ecf20Sopenharmony_ci#define WOL_PATTERN_PME_EN 0x2 2508c2ecf20Sopenharmony_ci#define WOL_MAGIC_EN 0x4 2518c2ecf20Sopenharmony_ci#define WOL_MAGIC_PME_EN 0x8 2528c2ecf20Sopenharmony_ci#define WOL_LINK_CHG_EN 0x10 2538c2ecf20Sopenharmony_ci#define WOL_LINK_CHG_PME_EN 0x20 2548c2ecf20Sopenharmony_ci#define WOL_PATTERN_ST 0x100 2558c2ecf20Sopenharmony_ci#define WOL_MAGIC_ST 0x200 2568c2ecf20Sopenharmony_ci#define WOL_LINKCHG_ST 0x400 2578c2ecf20Sopenharmony_ci#define WOL_PT0_EN 0x10000 2588c2ecf20Sopenharmony_ci#define WOL_PT1_EN 0x20000 2598c2ecf20Sopenharmony_ci#define WOL_PT2_EN 0x40000 2608c2ecf20Sopenharmony_ci#define WOL_PT3_EN 0x80000 2618c2ecf20Sopenharmony_ci#define WOL_PT4_EN 0x100000 2628c2ecf20Sopenharmony_ci#define WOL_PT0_MATCH 0x1000000 2638c2ecf20Sopenharmony_ci#define WOL_PT1_MATCH 0x2000000 2648c2ecf20Sopenharmony_ci#define WOL_PT2_MATCH 0x4000000 2658c2ecf20Sopenharmony_ci#define WOL_PT3_MATCH 0x8000000 2668c2ecf20Sopenharmony_ci#define WOL_PT4_MATCH 0x10000000 2678c2ecf20Sopenharmony_ci 2688c2ecf20Sopenharmony_ci/* Internal SRAM Partition Register, high 32 bits */ 2698c2ecf20Sopenharmony_ci#define REG_SRAM_RFD_ADDR 0x1500 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci/* Descriptor Control register, high 32 bits */ 2728c2ecf20Sopenharmony_ci#define REG_DESC_BASE_ADDR_HI 0x1540 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci/* Interrupt Status Register */ 2758c2ecf20Sopenharmony_ci#define REG_ISR 0x1600 2768c2ecf20Sopenharmony_ci#define ISR_UR_DETECTED 0x1000000 2778c2ecf20Sopenharmony_ci#define ISR_FERR_DETECTED 0x2000000 2788c2ecf20Sopenharmony_ci#define ISR_NFERR_DETECTED 0x4000000 2798c2ecf20Sopenharmony_ci#define ISR_CERR_DETECTED 0x8000000 2808c2ecf20Sopenharmony_ci#define ISR_PHY_LINKDOWN 0x10000000 2818c2ecf20Sopenharmony_ci#define ISR_DIS_INT 0x80000000 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* Interrupt Mask Register */ 2848c2ecf20Sopenharmony_ci#define REG_IMR 0x1604 2858c2ecf20Sopenharmony_ci 2868c2ecf20Sopenharmony_ci#define REG_RFD_RRD_IDX 0x1800 2878c2ecf20Sopenharmony_ci#define REG_TPD_IDX 0x1804 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/* MII definitions */ 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci/* PHY Common Register */ 2928c2ecf20Sopenharmony_ci#define MII_ATLX_CR 0x09 2938c2ecf20Sopenharmony_ci#define MII_ATLX_SR 0x0A 2948c2ecf20Sopenharmony_ci#define MII_ATLX_ESR 0x0F 2958c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR 0x10 2968c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR 0x11 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_ci/* PHY Control Register */ 2998c2ecf20Sopenharmony_ci#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 3008c2ecf20Sopenharmony_ci * 00=10 3018c2ecf20Sopenharmony_ci */ 3028c2ecf20Sopenharmony_ci#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ 3038c2ecf20Sopenharmony_ci#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ 3048c2ecf20Sopenharmony_ci#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ 3058c2ecf20Sopenharmony_ci#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ 3068c2ecf20Sopenharmony_ci#define MII_CR_POWER_DOWN 0x0800 /* Power down */ 3078c2ecf20Sopenharmony_ci#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ 3088c2ecf20Sopenharmony_ci#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 3098c2ecf20Sopenharmony_ci * 00=10 3108c2ecf20Sopenharmony_ci */ 3118c2ecf20Sopenharmony_ci#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ 3128c2ecf20Sopenharmony_ci#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ 3138c2ecf20Sopenharmony_ci#define MII_CR_SPEED_MASK 0x2040 3148c2ecf20Sopenharmony_ci#define MII_CR_SPEED_1000 0x0040 3158c2ecf20Sopenharmony_ci#define MII_CR_SPEED_100 0x2000 3168c2ecf20Sopenharmony_ci#define MII_CR_SPEED_10 0x0000 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci/* PHY Status Register */ 3198c2ecf20Sopenharmony_ci#define MII_SR_EXTENDED_CAPS 0x0001 /* Ext register capabilities */ 3208c2ecf20Sopenharmony_ci#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ 3218c2ecf20Sopenharmony_ci#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ 3228c2ecf20Sopenharmony_ci#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ 3238c2ecf20Sopenharmony_ci#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ 3248c2ecf20Sopenharmony_ci#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ 3258c2ecf20Sopenharmony_ci#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */ 3268c2ecf20Sopenharmony_ci#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext stat info in Reg 0x0F */ 3278c2ecf20Sopenharmony_ci#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ 3288c2ecf20Sopenharmony_ci#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ 3298c2ecf20Sopenharmony_ci#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ 3308c2ecf20Sopenharmony_ci#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ 3318c2ecf20Sopenharmony_ci#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ 3328c2ecf20Sopenharmony_ci#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ 3338c2ecf20Sopenharmony_ci#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci/* Link partner ability register */ 3368c2ecf20Sopenharmony_ci#define MII_LPA_SLCT 0x001f /* Same as advertise selector */ 3378c2ecf20Sopenharmony_ci#define MII_LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */ 3388c2ecf20Sopenharmony_ci#define MII_LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */ 3398c2ecf20Sopenharmony_ci#define MII_LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */ 3408c2ecf20Sopenharmony_ci#define MII_LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */ 3418c2ecf20Sopenharmony_ci#define MII_LPA_100BASE4 0x0200 /* 100BASE-T4 */ 3428c2ecf20Sopenharmony_ci#define MII_LPA_PAUSE 0x0400 /* PAUSE */ 3438c2ecf20Sopenharmony_ci#define MII_LPA_ASYPAUSE 0x0800 /* Asymmetrical PAUSE */ 3448c2ecf20Sopenharmony_ci#define MII_LPA_RFAULT 0x2000 /* Link partner faulted */ 3458c2ecf20Sopenharmony_ci#define MII_LPA_LPACK 0x4000 /* Link partner acked us */ 3468c2ecf20Sopenharmony_ci#define MII_LPA_NPAGE 0x8000 /* Next page bit */ 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci/* Autoneg Advertisement Register */ 3498c2ecf20Sopenharmony_ci#define MII_AR_SELECTOR_FIELD 0x0001 /* IEEE 802.3 CSMA/CD */ 3508c2ecf20Sopenharmony_ci#define MII_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ 3518c2ecf20Sopenharmony_ci#define MII_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ 3528c2ecf20Sopenharmony_ci#define MII_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ 3538c2ecf20Sopenharmony_ci#define MII_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ 3548c2ecf20Sopenharmony_ci#define MII_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ 3558c2ecf20Sopenharmony_ci#define MII_AR_PAUSE 0x0400 /* Pause operation desired */ 3568c2ecf20Sopenharmony_ci#define MII_AR_ASM_DIR 0x0800 /* Asymmetric Pause Dir bit */ 3578c2ecf20Sopenharmony_ci#define MII_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ 3588c2ecf20Sopenharmony_ci#define MII_AR_NEXT_PAGE 0x8000 /* Next Page ability support */ 3598c2ecf20Sopenharmony_ci#define MII_AR_SPEED_MASK 0x01E0 3608c2ecf20Sopenharmony_ci#define MII_AR_DEFAULT_CAP_MASK 0x0DE0 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci/* 1000BASE-T Control Register */ 3638c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_HD_CAPS 0x0100 /* Adv 1000T HD cap */ 3648c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_FD_CAPS 0x0200 /* Adv 1000T FD cap */ 3658c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device, 3668c2ecf20Sopenharmony_ci * 0=DTE device */ 3678c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_MS_VALUE 0x0800 /* 1=Config PHY as Master, 3688c2ecf20Sopenharmony_ci * 0=Configure PHY as Slave */ 3698c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_MS_ENABLE 0x1000 /* 1=Man Master/Slave config, 3708c2ecf20Sopenharmony_ci * 0=Auto Master/Slave config 3718c2ecf20Sopenharmony_ci */ 3728c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ 3738c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ 3748c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_2 0x4000 /* Master Xmit Jitter test */ 3758c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_3 0x6000 /* Slave Xmit Jitter test */ 3768c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_TEST_MODE_4 0x8000 /* Xmitter Distortion test */ 3778c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_SPEED_MASK 0x0300 3788c2ecf20Sopenharmony_ci#define MII_ATLX_CR_1000T_DEFAULT_CAP_MASK 0x0300 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_ci/* 1000BASE-T Status Register */ 3818c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ 3828c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ 3838c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ 3848c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ 3858c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master 3868c2ecf20Sopenharmony_ci * 0=Slave 3878c2ecf20Sopenharmony_ci */ 3888c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config 3898c2ecf20Sopenharmony_ci * fault */ 3908c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_REMOTE_RX_STATUS_SHIFT 12 3918c2ecf20Sopenharmony_ci#define MII_ATLX_SR_1000T_LOCAL_RX_STATUS_SHIFT 13 3928c2ecf20Sopenharmony_ci 3938c2ecf20Sopenharmony_ci/* Extended Status Register */ 3948c2ecf20Sopenharmony_ci#define MII_ATLX_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */ 3958c2ecf20Sopenharmony_ci#define MII_ATLX_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */ 3968c2ecf20Sopenharmony_ci#define MII_ATLX_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */ 3978c2ecf20Sopenharmony_ci#define MII_ATLX_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */ 3988c2ecf20Sopenharmony_ci 3998c2ecf20Sopenharmony_ci/* ATLX PHY Specific Control Register */ 4008c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_JABBER_DISABLE 0x0001 /* 1=Jabber Func disabled */ 4018c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enbld */ 4028c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_SQE_TEST 0x0004 /* 1=SQE Test enabled */ 4038c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_MAC_POWERDOWN 0x0008 4048c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_CLK125_DISABLE 0x0010 /* 1=CLK125 low 4058c2ecf20Sopenharmony_ci * 0=CLK125 toggling 4068c2ecf20Sopenharmony_ci */ 4078c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_MDI_MANUAL_MODE 0x0000 /* MDI Crossover Mode bits 6:5, 4088c2ecf20Sopenharmony_ci * Manual MDI configuration 4098c2ecf20Sopenharmony_ci */ 4108c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_MDIX_MANUAL_MODE 0x0020 /* Manual MDIX configuration */ 4118c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_AUTO_X_1000T 0x0040 /* 1000BASE-T: Auto crossover 4128c2ecf20Sopenharmony_ci * 100BASE-TX/10BASE-T: MDI 4138c2ecf20Sopenharmony_ci * Mode */ 4148c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_AUTO_X_MODE 0x0060 /* Auto crossover enabled 4158c2ecf20Sopenharmony_ci * all speeds. 4168c2ecf20Sopenharmony_ci */ 4178c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_10BT_EXT_DIST_ENABLE 0x0080 /* 1=Enable Extended 4188c2ecf20Sopenharmony_ci * 10BASE-T distance 4198c2ecf20Sopenharmony_ci * (Lower 10BASE-T RX 4208c2ecf20Sopenharmony_ci * Threshold) 4218c2ecf20Sopenharmony_ci * 0=Normal 10BASE-T RX 4228c2ecf20Sopenharmony_ci * Threshold 4238c2ecf20Sopenharmony_ci */ 4248c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_MII_5BIT_ENABLE 0x0100 /* 1=5-Bit interface in 4258c2ecf20Sopenharmony_ci * 100BASE-TX 4268c2ecf20Sopenharmony_ci * 0=MII interface in 4278c2ecf20Sopenharmony_ci * 100BASE-TX 4288c2ecf20Sopenharmony_ci */ 4298c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_SCRAMBLER_DISABLE 0x0200 /* 1=Scrambler dsbl */ 4308c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_FORCE_LINK_GOOD 0x0400 /* 1=Force link good */ 4318c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ 4328c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_POLARITY_REVERSAL_SHIFT 1 4338c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_AUTO_X_MODE_SHIFT 5 4348c2ecf20Sopenharmony_ci#define MII_ATLX_PSCR_10BT_EXT_DIST_ENABLE_SHIFT 7 4358c2ecf20Sopenharmony_ci 4368c2ecf20Sopenharmony_ci/* ATLX PHY Specific Status Register */ 4378c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR_SPD_DPLX_RESOLVED 0x0800 /* 1=Speed & Duplex resolved */ 4388c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR_DPLX 0x2000 /* 1=Duplex 0=Half Duplex */ 4398c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR_SPEED 0xC000 /* Speed, bits 14:15 */ 4408c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR_10MBS 0x0000 /* 00=10Mbs */ 4418c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR_100MBS 0x4000 /* 01=100Mbs */ 4428c2ecf20Sopenharmony_ci#define MII_ATLX_PSSR_1000MBS 0x8000 /* 10=1000Mbs */ 4438c2ecf20Sopenharmony_ci 4448c2ecf20Sopenharmony_ci#define MII_DBG_ADDR 0x1D 4458c2ecf20Sopenharmony_ci#define MII_DBG_DATA 0x1E 4468c2ecf20Sopenharmony_ci 4478c2ecf20Sopenharmony_ci/* PCI Command Register Bit Definitions */ 4488c2ecf20Sopenharmony_ci#define PCI_REG_COMMAND 0x04 /* PCI Command Register */ 4498c2ecf20Sopenharmony_ci#define CMD_IO_SPACE 0x0001 4508c2ecf20Sopenharmony_ci#define CMD_MEMORY_SPACE 0x0002 4518c2ecf20Sopenharmony_ci#define CMD_BUS_MASTER 0x0004 4528c2ecf20Sopenharmony_ci 4538c2ecf20Sopenharmony_ci/* Wake Up Filter Control */ 4548c2ecf20Sopenharmony_ci#define ATLX_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ 4558c2ecf20Sopenharmony_ci#define ATLX_WUFC_MAG 0x00000002 /* Magic Packet Wakeup Enable */ 4568c2ecf20Sopenharmony_ci#define ATLX_WUFC_EX 0x00000004 /* Directed Exact Wakeup Enable */ 4578c2ecf20Sopenharmony_ci#define ATLX_WUFC_MC 0x00000008 /* Multicast Wakeup Enable */ 4588c2ecf20Sopenharmony_ci#define ATLX_WUFC_BC 0x00000010 /* Broadcast Wakeup Enable */ 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci#define ADVERTISE_10_HALF 0x0001 4618c2ecf20Sopenharmony_ci#define ADVERTISE_10_FULL 0x0002 4628c2ecf20Sopenharmony_ci#define ADVERTISE_100_HALF 0x0004 4638c2ecf20Sopenharmony_ci#define ADVERTISE_100_FULL 0x0008 4648c2ecf20Sopenharmony_ci#define ADVERTISE_1000_HALF 0x0010 4658c2ecf20Sopenharmony_ci#define ADVERTISE_1000_FULL 0x0020 4668c2ecf20Sopenharmony_ci#define AUTONEG_ADVERTISE_10_100_ALL 0x000F /* All 10/100 speeds */ 4678c2ecf20Sopenharmony_ci#define AUTONEG_ADVERTISE_10_ALL 0x0003 /* 10Mbps Full & Half speeds */ 4688c2ecf20Sopenharmony_ci 4698c2ecf20Sopenharmony_ci#define PHY_AUTO_NEG_TIME 45 /* 4.5 Seconds */ 4708c2ecf20Sopenharmony_ci#define PHY_FORCE_TIME 20 /* 2.0 Seconds */ 4718c2ecf20Sopenharmony_ci 4728c2ecf20Sopenharmony_ci/* For checksumming, the sum of all words in the EEPROM should equal 0xBABA */ 4738c2ecf20Sopenharmony_ci#define EEPROM_SUM 0xBABA 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_cistruct atlx_spi_flash_dev { 4768c2ecf20Sopenharmony_ci const char *manu_name; /* manufacturer id */ 4778c2ecf20Sopenharmony_ci /* op-code */ 4788c2ecf20Sopenharmony_ci u8 cmd_wrsr; 4798c2ecf20Sopenharmony_ci u8 cmd_read; 4808c2ecf20Sopenharmony_ci u8 cmd_program; 4818c2ecf20Sopenharmony_ci u8 cmd_wren; 4828c2ecf20Sopenharmony_ci u8 cmd_wrdi; 4838c2ecf20Sopenharmony_ci u8 cmd_rdsr; 4848c2ecf20Sopenharmony_ci u8 cmd_rdid; 4858c2ecf20Sopenharmony_ci u8 cmd_sector_erase; 4868c2ecf20Sopenharmony_ci u8 cmd_chip_erase; 4878c2ecf20Sopenharmony_ci}; 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci#endif /* ATLX_H */ 490