162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Marvell 88SE64xx/88SE94xx const head file 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2007 Red Hat, Inc. 662306a36Sopenharmony_ci * Copyright 2008 Marvell. <kewei@marvell.com> 762306a36Sopenharmony_ci * Copyright 2009-2011 Marvell. <yuxiangl@marvell.com> 862306a36Sopenharmony_ci*/ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef _MV_DEFS_H_ 1162306a36Sopenharmony_ci#define _MV_DEFS_H_ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1300 0x1300 1462306a36Sopenharmony_ci#define PCI_DEVICE_ID_ARECA_1320 0x1320 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_cienum chip_flavors { 1762306a36Sopenharmony_ci chip_6320, 1862306a36Sopenharmony_ci chip_6440, 1962306a36Sopenharmony_ci chip_6485, 2062306a36Sopenharmony_ci chip_9480, 2162306a36Sopenharmony_ci chip_9180, 2262306a36Sopenharmony_ci chip_9445, 2362306a36Sopenharmony_ci chip_9485, 2462306a36Sopenharmony_ci chip_1300, 2562306a36Sopenharmony_ci chip_1320 2662306a36Sopenharmony_ci}; 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* driver compile-time configuration */ 2962306a36Sopenharmony_cienum driver_configuration { 3062306a36Sopenharmony_ci MVS_TX_RING_SZ = 1024, /* TX ring size (12-bit) */ 3162306a36Sopenharmony_ci MVS_RX_RING_SZ = 1024, /* RX ring size (12-bit) */ 3262306a36Sopenharmony_ci /* software requires power-of-2 3362306a36Sopenharmony_ci ring size */ 3462306a36Sopenharmony_ci MVS_SOC_SLOTS = 64, 3562306a36Sopenharmony_ci MVS_SOC_TX_RING_SZ = MVS_SOC_SLOTS * 2, 3662306a36Sopenharmony_ci MVS_SOC_RX_RING_SZ = MVS_SOC_SLOTS * 2, 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci MVS_SLOT_BUF_SZ = 8192, /* cmd tbl + IU + status + PRD */ 3962306a36Sopenharmony_ci MVS_SSP_CMD_SZ = 64, /* SSP command table buffer size */ 4062306a36Sopenharmony_ci MVS_ATA_CMD_SZ = 96, /* SATA command table buffer size */ 4162306a36Sopenharmony_ci MVS_OAF_SZ = 64, /* Open address frame buffer size */ 4262306a36Sopenharmony_ci MVS_QUEUE_SIZE = 64, /* Support Queue depth */ 4362306a36Sopenharmony_ci MVS_RSVD_SLOTS = 4, 4462306a36Sopenharmony_ci MVS_SOC_CAN_QUEUE = MVS_SOC_SLOTS - 2, 4562306a36Sopenharmony_ci}; 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* unchangeable hardware details */ 4862306a36Sopenharmony_cienum hardware_details { 4962306a36Sopenharmony_ci MVS_MAX_PHYS = 8, /* max. possible phys */ 5062306a36Sopenharmony_ci MVS_MAX_PORTS = 8, /* max. possible ports */ 5162306a36Sopenharmony_ci MVS_SOC_PHYS = 4, /* soc phys */ 5262306a36Sopenharmony_ci MVS_SOC_PORTS = 4, /* soc phys */ 5362306a36Sopenharmony_ci MVS_MAX_DEVICES = 1024, /* max supported device */ 5462306a36Sopenharmony_ci}; 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci/* peripheral registers (BAR2) */ 5762306a36Sopenharmony_cienum peripheral_registers { 5862306a36Sopenharmony_ci SPI_CTL = 0x10, /* EEPROM control */ 5962306a36Sopenharmony_ci SPI_CMD = 0x14, /* EEPROM command */ 6062306a36Sopenharmony_ci SPI_DATA = 0x18, /* EEPROM data */ 6162306a36Sopenharmony_ci}; 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_cienum peripheral_register_bits { 6462306a36Sopenharmony_ci TWSI_RDY = (1U << 7), /* EEPROM interface ready */ 6562306a36Sopenharmony_ci TWSI_RD = (1U << 4), /* EEPROM read access */ 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci SPI_ADDR_MASK = 0x3ffff, /* bits 17:0 */ 6862306a36Sopenharmony_ci}; 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_cienum hw_register_bits { 7162306a36Sopenharmony_ci /* MVS_GBL_CTL */ 7262306a36Sopenharmony_ci INT_EN = (1U << 1), /* Global int enable */ 7362306a36Sopenharmony_ci HBA_RST = (1U << 0), /* HBA reset */ 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci /* MVS_GBL_INT_STAT */ 7662306a36Sopenharmony_ci INT_XOR = (1U << 4), /* XOR engine event */ 7762306a36Sopenharmony_ci INT_SAS_SATA = (1U << 0), /* SAS/SATA event */ 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci /* MVS_GBL_PORT_TYPE */ /* shl for ports 1-3 */ 8062306a36Sopenharmony_ci SATA_TARGET = (1U << 16), /* port0 SATA target enable */ 8162306a36Sopenharmony_ci MODE_AUTO_DET_PORT7 = (1U << 15), /* port0 SAS/SATA autodetect */ 8262306a36Sopenharmony_ci MODE_AUTO_DET_PORT6 = (1U << 14), 8362306a36Sopenharmony_ci MODE_AUTO_DET_PORT5 = (1U << 13), 8462306a36Sopenharmony_ci MODE_AUTO_DET_PORT4 = (1U << 12), 8562306a36Sopenharmony_ci MODE_AUTO_DET_PORT3 = (1U << 11), 8662306a36Sopenharmony_ci MODE_AUTO_DET_PORT2 = (1U << 10), 8762306a36Sopenharmony_ci MODE_AUTO_DET_PORT1 = (1U << 9), 8862306a36Sopenharmony_ci MODE_AUTO_DET_PORT0 = (1U << 8), 8962306a36Sopenharmony_ci MODE_AUTO_DET_EN = MODE_AUTO_DET_PORT0 | MODE_AUTO_DET_PORT1 | 9062306a36Sopenharmony_ci MODE_AUTO_DET_PORT2 | MODE_AUTO_DET_PORT3 | 9162306a36Sopenharmony_ci MODE_AUTO_DET_PORT4 | MODE_AUTO_DET_PORT5 | 9262306a36Sopenharmony_ci MODE_AUTO_DET_PORT6 | MODE_AUTO_DET_PORT7, 9362306a36Sopenharmony_ci MODE_SAS_PORT7_MASK = (1U << 7), /* port0 SAS(1), SATA(0) mode */ 9462306a36Sopenharmony_ci MODE_SAS_PORT6_MASK = (1U << 6), 9562306a36Sopenharmony_ci MODE_SAS_PORT5_MASK = (1U << 5), 9662306a36Sopenharmony_ci MODE_SAS_PORT4_MASK = (1U << 4), 9762306a36Sopenharmony_ci MODE_SAS_PORT3_MASK = (1U << 3), 9862306a36Sopenharmony_ci MODE_SAS_PORT2_MASK = (1U << 2), 9962306a36Sopenharmony_ci MODE_SAS_PORT1_MASK = (1U << 1), 10062306a36Sopenharmony_ci MODE_SAS_PORT0_MASK = (1U << 0), 10162306a36Sopenharmony_ci MODE_SAS_SATA = MODE_SAS_PORT0_MASK | MODE_SAS_PORT1_MASK | 10262306a36Sopenharmony_ci MODE_SAS_PORT2_MASK | MODE_SAS_PORT3_MASK | 10362306a36Sopenharmony_ci MODE_SAS_PORT4_MASK | MODE_SAS_PORT5_MASK | 10462306a36Sopenharmony_ci MODE_SAS_PORT6_MASK | MODE_SAS_PORT7_MASK, 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci /* SAS_MODE value may be 10762306a36Sopenharmony_ci * dictated (in hw) by values 10862306a36Sopenharmony_ci * of SATA_TARGET & AUTO_DET 10962306a36Sopenharmony_ci */ 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci /* MVS_TX_CFG */ 11262306a36Sopenharmony_ci TX_EN = (1U << 16), /* Enable TX */ 11362306a36Sopenharmony_ci TX_RING_SZ_MASK = 0xfff, /* TX ring size, bits 11:0 */ 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci /* MVS_RX_CFG */ 11662306a36Sopenharmony_ci RX_EN = (1U << 16), /* Enable RX */ 11762306a36Sopenharmony_ci RX_RING_SZ_MASK = 0xfff, /* RX ring size, bits 11:0 */ 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci /* MVS_INT_COAL */ 12062306a36Sopenharmony_ci COAL_EN = (1U << 16), /* Enable int coalescing */ 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_ci /* MVS_INT_STAT, MVS_INT_MASK */ 12362306a36Sopenharmony_ci CINT_I2C = (1U << 31), /* I2C event */ 12462306a36Sopenharmony_ci CINT_SW0 = (1U << 30), /* software event 0 */ 12562306a36Sopenharmony_ci CINT_SW1 = (1U << 29), /* software event 1 */ 12662306a36Sopenharmony_ci CINT_PRD_BC = (1U << 28), /* PRD BC err for read cmd */ 12762306a36Sopenharmony_ci CINT_DMA_PCIE = (1U << 27), /* DMA to PCIE timeout */ 12862306a36Sopenharmony_ci CINT_MEM = (1U << 26), /* int mem parity err */ 12962306a36Sopenharmony_ci CINT_I2C_SLAVE = (1U << 25), /* slave I2C event */ 13062306a36Sopenharmony_ci CINT_NON_SPEC_NCQ_ERROR = (1U << 25), /* Non specific NCQ error */ 13162306a36Sopenharmony_ci CINT_SRS = (1U << 3), /* SRS event */ 13262306a36Sopenharmony_ci CINT_CI_STOP = (1U << 1), /* cmd issue stopped */ 13362306a36Sopenharmony_ci CINT_DONE = (1U << 0), /* cmd completion */ 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci /* shl for ports 1-3 */ 13662306a36Sopenharmony_ci CINT_PORT_STOPPED = (1U << 16), /* port0 stopped */ 13762306a36Sopenharmony_ci CINT_PORT = (1U << 8), /* port0 event */ 13862306a36Sopenharmony_ci CINT_PORT_MASK_OFFSET = 8, 13962306a36Sopenharmony_ci CINT_PORT_MASK = (0xFF << CINT_PORT_MASK_OFFSET), 14062306a36Sopenharmony_ci CINT_PHY_MASK_OFFSET = 4, 14162306a36Sopenharmony_ci CINT_PHY_MASK = (0x0F << CINT_PHY_MASK_OFFSET), 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci /* TX (delivery) ring bits */ 14462306a36Sopenharmony_ci TXQ_CMD_SHIFT = 29, 14562306a36Sopenharmony_ci TXQ_CMD_SSP = 1, /* SSP protocol */ 14662306a36Sopenharmony_ci TXQ_CMD_SMP = 2, /* SMP protocol */ 14762306a36Sopenharmony_ci TXQ_CMD_STP = 3, /* STP/SATA protocol */ 14862306a36Sopenharmony_ci TXQ_CMD_SSP_FREE_LIST = 4, /* add to SSP target free list */ 14962306a36Sopenharmony_ci TXQ_CMD_SLOT_RESET = 7, /* reset command slot */ 15062306a36Sopenharmony_ci TXQ_MODE_I = (1U << 28), /* mode: 0=target,1=initiator */ 15162306a36Sopenharmony_ci TXQ_MODE_TARGET = 0, 15262306a36Sopenharmony_ci TXQ_MODE_INITIATOR = 1, 15362306a36Sopenharmony_ci TXQ_PRIO_HI = (1U << 27), /* priority: 0=normal, 1=high */ 15462306a36Sopenharmony_ci TXQ_PRI_NORMAL = 0, 15562306a36Sopenharmony_ci TXQ_PRI_HIGH = 1, 15662306a36Sopenharmony_ci TXQ_SRS_SHIFT = 20, /* SATA register set */ 15762306a36Sopenharmony_ci TXQ_SRS_MASK = 0x7f, 15862306a36Sopenharmony_ci TXQ_PHY_SHIFT = 12, /* PHY bitmap */ 15962306a36Sopenharmony_ci TXQ_PHY_MASK = 0xff, 16062306a36Sopenharmony_ci TXQ_SLOT_MASK = 0xfff, /* slot number */ 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci /* RX (completion) ring bits */ 16362306a36Sopenharmony_ci RXQ_GOOD = (1U << 23), /* Response good */ 16462306a36Sopenharmony_ci RXQ_SLOT_RESET = (1U << 21), /* Slot reset complete */ 16562306a36Sopenharmony_ci RXQ_CMD_RX = (1U << 20), /* target cmd received */ 16662306a36Sopenharmony_ci RXQ_ATTN = (1U << 19), /* attention */ 16762306a36Sopenharmony_ci RXQ_RSP = (1U << 18), /* response frame xfer'd */ 16862306a36Sopenharmony_ci RXQ_ERR = (1U << 17), /* err info rec xfer'd */ 16962306a36Sopenharmony_ci RXQ_DONE = (1U << 16), /* cmd complete */ 17062306a36Sopenharmony_ci RXQ_SLOT_MASK = 0xfff, /* slot number */ 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci /* mvs_cmd_hdr bits */ 17362306a36Sopenharmony_ci MCH_PRD_LEN_SHIFT = 16, /* 16-bit PRD table len */ 17462306a36Sopenharmony_ci MCH_SSP_FR_TYPE_SHIFT = 13, /* SSP frame type */ 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci /* SSP initiator only */ 17762306a36Sopenharmony_ci MCH_SSP_FR_CMD = 0x0, /* COMMAND frame */ 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci /* SSP initiator or target */ 18062306a36Sopenharmony_ci MCH_SSP_FR_TASK = 0x1, /* TASK frame */ 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci /* SSP target only */ 18362306a36Sopenharmony_ci MCH_SSP_FR_XFER_RDY = 0x4, /* XFER_RDY frame */ 18462306a36Sopenharmony_ci MCH_SSP_FR_RESP = 0x5, /* RESPONSE frame */ 18562306a36Sopenharmony_ci MCH_SSP_FR_READ = 0x6, /* Read DATA frame(s) */ 18662306a36Sopenharmony_ci MCH_SSP_FR_READ_RESP = 0x7, /* ditto, plus RESPONSE */ 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci MCH_SSP_MODE_PASSTHRU = 1, 18962306a36Sopenharmony_ci MCH_SSP_MODE_NORMAL = 0, 19062306a36Sopenharmony_ci MCH_PASSTHRU = (1U << 12), /* pass-through (SSP) */ 19162306a36Sopenharmony_ci MCH_FBURST = (1U << 11), /* first burst (SSP) */ 19262306a36Sopenharmony_ci MCH_CHK_LEN = (1U << 10), /* chk xfer len (SSP) */ 19362306a36Sopenharmony_ci MCH_RETRY = (1U << 9), /* tport layer retry (SSP) */ 19462306a36Sopenharmony_ci MCH_PROTECTION = (1U << 8), /* protection info rec (SSP) */ 19562306a36Sopenharmony_ci MCH_RESET = (1U << 7), /* Reset (STP/SATA) */ 19662306a36Sopenharmony_ci MCH_FPDMA = (1U << 6), /* First party DMA (STP/SATA) */ 19762306a36Sopenharmony_ci MCH_ATAPI = (1U << 5), /* ATAPI (STP/SATA) */ 19862306a36Sopenharmony_ci MCH_BIST = (1U << 4), /* BIST activate (STP/SATA) */ 19962306a36Sopenharmony_ci MCH_PMP_MASK = 0xf, /* PMP from cmd FIS (STP/SATA)*/ 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci CCTL_RST = (1U << 5), /* port logic reset */ 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci /* 0(LSB first), 1(MSB first) */ 20462306a36Sopenharmony_ci CCTL_ENDIAN_DATA = (1U << 3), /* PRD data */ 20562306a36Sopenharmony_ci CCTL_ENDIAN_RSP = (1U << 2), /* response frame */ 20662306a36Sopenharmony_ci CCTL_ENDIAN_OPEN = (1U << 1), /* open address frame */ 20762306a36Sopenharmony_ci CCTL_ENDIAN_CMD = (1U << 0), /* command table */ 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci /* MVS_Px_SER_CTLSTAT (per-phy control) */ 21062306a36Sopenharmony_ci PHY_SSP_RST = (1U << 3), /* reset SSP link layer */ 21162306a36Sopenharmony_ci PHY_BCAST_CHG = (1U << 2), /* broadcast(change) notif */ 21262306a36Sopenharmony_ci PHY_RST_HARD = (1U << 1), /* hard reset + phy reset */ 21362306a36Sopenharmony_ci PHY_RST = (1U << 0), /* phy reset */ 21462306a36Sopenharmony_ci PHY_READY_MASK = (1U << 20), 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci /* MVS_Px_INT_STAT, MVS_Px_INT_MASK (per-phy events) */ 21762306a36Sopenharmony_ci PHYEV_DEC_ERR = (1U << 24), /* Phy Decoding Error */ 21862306a36Sopenharmony_ci PHYEV_DCDR_ERR = (1U << 23), /* STP Deocder Error */ 21962306a36Sopenharmony_ci PHYEV_CRC_ERR = (1U << 22), /* STP CRC Error */ 22062306a36Sopenharmony_ci PHYEV_UNASSOC_FIS = (1U << 19), /* unassociated FIS rx'd */ 22162306a36Sopenharmony_ci PHYEV_AN = (1U << 18), /* SATA async notification */ 22262306a36Sopenharmony_ci PHYEV_BIST_ACT = (1U << 17), /* BIST activate FIS */ 22362306a36Sopenharmony_ci PHYEV_SIG_FIS = (1U << 16), /* signature FIS */ 22462306a36Sopenharmony_ci PHYEV_POOF = (1U << 12), /* phy ready from 1 -> 0 */ 22562306a36Sopenharmony_ci PHYEV_IU_BIG = (1U << 11), /* IU too long err */ 22662306a36Sopenharmony_ci PHYEV_IU_SMALL = (1U << 10), /* IU too short err */ 22762306a36Sopenharmony_ci PHYEV_UNK_TAG = (1U << 9), /* unknown tag */ 22862306a36Sopenharmony_ci PHYEV_BROAD_CH = (1U << 8), /* broadcast(CHANGE) */ 22962306a36Sopenharmony_ci PHYEV_COMWAKE = (1U << 7), /* COMWAKE rx'd */ 23062306a36Sopenharmony_ci PHYEV_PORT_SEL = (1U << 6), /* port selector present */ 23162306a36Sopenharmony_ci PHYEV_HARD_RST = (1U << 5), /* hard reset rx'd */ 23262306a36Sopenharmony_ci PHYEV_ID_TMOUT = (1U << 4), /* identify timeout */ 23362306a36Sopenharmony_ci PHYEV_ID_FAIL = (1U << 3), /* identify failed */ 23462306a36Sopenharmony_ci PHYEV_ID_DONE = (1U << 2), /* identify done */ 23562306a36Sopenharmony_ci PHYEV_HARD_RST_DONE = (1U << 1), /* hard reset done */ 23662306a36Sopenharmony_ci PHYEV_RDY_CH = (1U << 0), /* phy ready changed state */ 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci /* MVS_PCS */ 23962306a36Sopenharmony_ci PCS_EN_SATA_REG_SHIFT = (16), /* Enable SATA Register Set */ 24062306a36Sopenharmony_ci PCS_EN_PORT_XMT_SHIFT = (12), /* Enable Port Transmit */ 24162306a36Sopenharmony_ci PCS_EN_PORT_XMT_SHIFT2 = (8), /* For 6485 */ 24262306a36Sopenharmony_ci PCS_SATA_RETRY = (1U << 8), /* retry ctl FIS on R_ERR */ 24362306a36Sopenharmony_ci PCS_RSP_RX_EN = (1U << 7), /* raw response rx */ 24462306a36Sopenharmony_ci PCS_SATA_RETRY_2 = (1U << 6), /* For 9180 */ 24562306a36Sopenharmony_ci PCS_SELF_CLEAR = (1U << 5), /* self-clearing int mode */ 24662306a36Sopenharmony_ci PCS_FIS_RX_EN = (1U << 4), /* FIS rx enable */ 24762306a36Sopenharmony_ci PCS_CMD_STOP_ERR = (1U << 3), /* cmd stop-on-err enable */ 24862306a36Sopenharmony_ci PCS_CMD_RST = (1U << 1), /* reset cmd issue */ 24962306a36Sopenharmony_ci PCS_CMD_EN = (1U << 0), /* enable cmd issue */ 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci /* Port n Attached Device Info */ 25262306a36Sopenharmony_ci PORT_DEV_SSP_TRGT = (1U << 19), 25362306a36Sopenharmony_ci PORT_DEV_SMP_TRGT = (1U << 18), 25462306a36Sopenharmony_ci PORT_DEV_STP_TRGT = (1U << 17), 25562306a36Sopenharmony_ci PORT_DEV_SSP_INIT = (1U << 11), 25662306a36Sopenharmony_ci PORT_DEV_SMP_INIT = (1U << 10), 25762306a36Sopenharmony_ci PORT_DEV_STP_INIT = (1U << 9), 25862306a36Sopenharmony_ci PORT_PHY_ID_MASK = (0xFFU << 24), 25962306a36Sopenharmony_ci PORT_SSP_TRGT_MASK = (0x1U << 19), 26062306a36Sopenharmony_ci PORT_SSP_INIT_MASK = (0x1U << 11), 26162306a36Sopenharmony_ci PORT_DEV_TRGT_MASK = (0x7U << 17), 26262306a36Sopenharmony_ci PORT_DEV_INIT_MASK = (0x7U << 9), 26362306a36Sopenharmony_ci PORT_DEV_TYPE_MASK = (0x7U << 0), 26462306a36Sopenharmony_ci 26562306a36Sopenharmony_ci /* Port n PHY Status */ 26662306a36Sopenharmony_ci PHY_RDY = (1U << 2), 26762306a36Sopenharmony_ci PHY_DW_SYNC = (1U << 1), 26862306a36Sopenharmony_ci PHY_OOB_DTCTD = (1U << 0), 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci /* VSR */ 27162306a36Sopenharmony_ci /* PHYMODE 6 (CDB) */ 27262306a36Sopenharmony_ci PHY_MODE6_LATECLK = (1U << 29), /* Lock Clock */ 27362306a36Sopenharmony_ci PHY_MODE6_DTL_SPEED = (1U << 27), /* Digital Loop Speed */ 27462306a36Sopenharmony_ci PHY_MODE6_FC_ORDER = (1U << 26), /* Fibre Channel Mode Order*/ 27562306a36Sopenharmony_ci PHY_MODE6_MUCNT_EN = (1U << 24), /* u Count Enable */ 27662306a36Sopenharmony_ci PHY_MODE6_SEL_MUCNT_LEN = (1U << 22), /* Training Length Select */ 27762306a36Sopenharmony_ci PHY_MODE6_SELMUPI = (1U << 20), /* Phase Multi Select (init) */ 27862306a36Sopenharmony_ci PHY_MODE6_SELMUPF = (1U << 18), /* Phase Multi Select (final) */ 27962306a36Sopenharmony_ci PHY_MODE6_SELMUFF = (1U << 16), /* Freq Loop Multi Sel(final) */ 28062306a36Sopenharmony_ci PHY_MODE6_SELMUFI = (1U << 14), /* Freq Loop Multi Sel(init) */ 28162306a36Sopenharmony_ci PHY_MODE6_FREEZE_LOOP = (1U << 12), /* Freeze Rx CDR Loop */ 28262306a36Sopenharmony_ci PHY_MODE6_INT_RXFOFFS = (1U << 3), /* Rx CDR Freq Loop Enable */ 28362306a36Sopenharmony_ci PHY_MODE6_FRC_RXFOFFS = (1U << 2), /* Initial Rx CDR Offset */ 28462306a36Sopenharmony_ci PHY_MODE6_STAU_0D8 = (1U << 1), /* Rx CDR Freq Loop Saturate */ 28562306a36Sopenharmony_ci PHY_MODE6_RXSAT_DIS = (1U << 0), /* Saturate Ctl */ 28662306a36Sopenharmony_ci}; 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci/* SAS/SATA configuration port registers, aka phy registers */ 28962306a36Sopenharmony_cienum sas_sata_config_port_regs { 29062306a36Sopenharmony_ci PHYR_IDENTIFY = 0x00, /* info for IDENTIFY frame */ 29162306a36Sopenharmony_ci PHYR_ADDR_LO = 0x04, /* my SAS address (low) */ 29262306a36Sopenharmony_ci PHYR_ADDR_HI = 0x08, /* my SAS address (high) */ 29362306a36Sopenharmony_ci PHYR_ATT_DEV_INFO = 0x0C, /* attached device info */ 29462306a36Sopenharmony_ci PHYR_ATT_ADDR_LO = 0x10, /* attached dev SAS addr (low) */ 29562306a36Sopenharmony_ci PHYR_ATT_ADDR_HI = 0x14, /* attached dev SAS addr (high) */ 29662306a36Sopenharmony_ci PHYR_SATA_CTL = 0x18, /* SATA control */ 29762306a36Sopenharmony_ci PHYR_PHY_STAT = 0x1C, /* PHY status */ 29862306a36Sopenharmony_ci PHYR_SATA_SIG0 = 0x20, /*port SATA signature FIS(Byte 0-3) */ 29962306a36Sopenharmony_ci PHYR_SATA_SIG1 = 0x24, /*port SATA signature FIS(Byte 4-7) */ 30062306a36Sopenharmony_ci PHYR_SATA_SIG2 = 0x28, /*port SATA signature FIS(Byte 8-11) */ 30162306a36Sopenharmony_ci PHYR_SATA_SIG3 = 0x2c, /*port SATA signature FIS(Byte 12-15) */ 30262306a36Sopenharmony_ci PHYR_R_ERR_COUNT = 0x30, /* port R_ERR count register */ 30362306a36Sopenharmony_ci PHYR_CRC_ERR_COUNT = 0x34, /* port CRC error count register */ 30462306a36Sopenharmony_ci PHYR_WIDE_PORT = 0x38, /* wide port participating */ 30562306a36Sopenharmony_ci PHYR_CURRENT0 = 0x80, /* current connection info 0 */ 30662306a36Sopenharmony_ci PHYR_CURRENT1 = 0x84, /* current connection info 1 */ 30762306a36Sopenharmony_ci PHYR_CURRENT2 = 0x88, /* current connection info 2 */ 30862306a36Sopenharmony_ci CONFIG_ID_FRAME0 = 0x100, /* Port device ID frame register 0 */ 30962306a36Sopenharmony_ci CONFIG_ID_FRAME1 = 0x104, /* Port device ID frame register 1 */ 31062306a36Sopenharmony_ci CONFIG_ID_FRAME2 = 0x108, /* Port device ID frame register 2 */ 31162306a36Sopenharmony_ci CONFIG_ID_FRAME3 = 0x10c, /* Port device ID frame register 3 */ 31262306a36Sopenharmony_ci CONFIG_ID_FRAME4 = 0x110, /* Port device ID frame register 4 */ 31362306a36Sopenharmony_ci CONFIG_ID_FRAME5 = 0x114, /* Port device ID frame register 5 */ 31462306a36Sopenharmony_ci CONFIG_ID_FRAME6 = 0x118, /* Port device ID frame register 6 */ 31562306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME0 = 0x11c, /* attached ID frame register 0 */ 31662306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME1 = 0x120, /* attached ID frame register 1 */ 31762306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME2 = 0x124, /* attached ID frame register 2 */ 31862306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME3 = 0x128, /* attached ID frame register 3 */ 31962306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME4 = 0x12c, /* attached ID frame register 4 */ 32062306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME5 = 0x130, /* attached ID frame register 5 */ 32162306a36Sopenharmony_ci CONFIG_ATT_ID_FRAME6 = 0x134, /* attached ID frame register 6 */ 32262306a36Sopenharmony_ci}; 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_cienum sas_cmd_port_registers { 32562306a36Sopenharmony_ci CMD_CMRST_OOB_DET = 0x100, /* COMRESET OOB detect register */ 32662306a36Sopenharmony_ci CMD_CMWK_OOB_DET = 0x104, /* COMWAKE OOB detect register */ 32762306a36Sopenharmony_ci CMD_CMSAS_OOB_DET = 0x108, /* COMSAS OOB detect register */ 32862306a36Sopenharmony_ci CMD_BRST_OOB_DET = 0x10c, /* burst OOB detect register */ 32962306a36Sopenharmony_ci CMD_OOB_SPACE = 0x110, /* OOB space control register */ 33062306a36Sopenharmony_ci CMD_OOB_BURST = 0x114, /* OOB burst control register */ 33162306a36Sopenharmony_ci CMD_PHY_TIMER = 0x118, /* PHY timer control register */ 33262306a36Sopenharmony_ci CMD_PHY_CONFIG0 = 0x11c, /* PHY config register 0 */ 33362306a36Sopenharmony_ci CMD_PHY_CONFIG1 = 0x120, /* PHY config register 1 */ 33462306a36Sopenharmony_ci CMD_SAS_CTL0 = 0x124, /* SAS control register 0 */ 33562306a36Sopenharmony_ci CMD_SAS_CTL1 = 0x128, /* SAS control register 1 */ 33662306a36Sopenharmony_ci CMD_SAS_CTL2 = 0x12c, /* SAS control register 2 */ 33762306a36Sopenharmony_ci CMD_SAS_CTL3 = 0x130, /* SAS control register 3 */ 33862306a36Sopenharmony_ci CMD_ID_TEST = 0x134, /* ID test register */ 33962306a36Sopenharmony_ci CMD_PL_TIMER = 0x138, /* PL timer register */ 34062306a36Sopenharmony_ci CMD_WD_TIMER = 0x13c, /* WD timer register */ 34162306a36Sopenharmony_ci CMD_PORT_SEL_COUNT = 0x140, /* port selector count register */ 34262306a36Sopenharmony_ci CMD_APP_MEM_CTL = 0x144, /* Application Memory Control */ 34362306a36Sopenharmony_ci CMD_XOR_MEM_CTL = 0x148, /* XOR Block Memory Control */ 34462306a36Sopenharmony_ci CMD_DMA_MEM_CTL = 0x14c, /* DMA Block Memory Control */ 34562306a36Sopenharmony_ci CMD_PORT_MEM_CTL0 = 0x150, /* Port Memory Control 0 */ 34662306a36Sopenharmony_ci CMD_PORT_MEM_CTL1 = 0x154, /* Port Memory Control 1 */ 34762306a36Sopenharmony_ci CMD_SATA_PORT_MEM_CTL0 = 0x158, /* SATA Port Memory Control 0 */ 34862306a36Sopenharmony_ci CMD_SATA_PORT_MEM_CTL1 = 0x15c, /* SATA Port Memory Control 1 */ 34962306a36Sopenharmony_ci CMD_XOR_MEM_BIST_CTL = 0x160, /* XOR Memory BIST Control */ 35062306a36Sopenharmony_ci CMD_XOR_MEM_BIST_STAT = 0x164, /* XOR Memroy BIST Status */ 35162306a36Sopenharmony_ci CMD_DMA_MEM_BIST_CTL = 0x168, /* DMA Memory BIST Control */ 35262306a36Sopenharmony_ci CMD_DMA_MEM_BIST_STAT = 0x16c, /* DMA Memory BIST Status */ 35362306a36Sopenharmony_ci CMD_PORT_MEM_BIST_CTL = 0x170, /* Port Memory BIST Control */ 35462306a36Sopenharmony_ci CMD_PORT_MEM_BIST_STAT0 = 0x174, /* Port Memory BIST Status 0 */ 35562306a36Sopenharmony_ci CMD_PORT_MEM_BIST_STAT1 = 0x178, /* Port Memory BIST Status 1 */ 35662306a36Sopenharmony_ci CMD_STP_MEM_BIST_CTL = 0x17c, /* STP Memory BIST Control */ 35762306a36Sopenharmony_ci CMD_STP_MEM_BIST_STAT0 = 0x180, /* STP Memory BIST Status 0 */ 35862306a36Sopenharmony_ci CMD_STP_MEM_BIST_STAT1 = 0x184, /* STP Memory BIST Status 1 */ 35962306a36Sopenharmony_ci CMD_RESET_COUNT = 0x188, /* Reset Count */ 36062306a36Sopenharmony_ci CMD_MONTR_DATA_SEL = 0x18C, /* Monitor Data/Select */ 36162306a36Sopenharmony_ci CMD_PLL_PHY_CONFIG = 0x190, /* PLL/PHY Configuration */ 36262306a36Sopenharmony_ci CMD_PHY_CTL = 0x194, /* PHY Control and Status */ 36362306a36Sopenharmony_ci CMD_PHY_TEST_COUNT0 = 0x198, /* Phy Test Count 0 */ 36462306a36Sopenharmony_ci CMD_PHY_TEST_COUNT1 = 0x19C, /* Phy Test Count 1 */ 36562306a36Sopenharmony_ci CMD_PHY_TEST_COUNT2 = 0x1A0, /* Phy Test Count 2 */ 36662306a36Sopenharmony_ci CMD_APP_ERR_CONFIG = 0x1A4, /* Application Error Configuration */ 36762306a36Sopenharmony_ci CMD_PND_FIFO_CTL0 = 0x1A8, /* Pending FIFO Control 0 */ 36862306a36Sopenharmony_ci CMD_HOST_CTL = 0x1AC, /* Host Control Status */ 36962306a36Sopenharmony_ci CMD_HOST_WR_DATA = 0x1B0, /* Host Write Data */ 37062306a36Sopenharmony_ci CMD_HOST_RD_DATA = 0x1B4, /* Host Read Data */ 37162306a36Sopenharmony_ci CMD_PHY_MODE_21 = 0x1B8, /* Phy Mode 21 */ 37262306a36Sopenharmony_ci CMD_SL_MODE0 = 0x1BC, /* SL Mode 0 */ 37362306a36Sopenharmony_ci CMD_SL_MODE1 = 0x1C0, /* SL Mode 1 */ 37462306a36Sopenharmony_ci CMD_PND_FIFO_CTL1 = 0x1C4, /* Pending FIFO Control 1 */ 37562306a36Sopenharmony_ci CMD_PORT_LAYER_TIMER1 = 0x1E0, /* Port Layer Timer 1 */ 37662306a36Sopenharmony_ci CMD_LINK_TIMER = 0x1E4, /* Link Timer */ 37762306a36Sopenharmony_ci}; 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_cienum mvs_info_flags { 38062306a36Sopenharmony_ci MVF_PHY_PWR_FIX = (1U << 1), /* bug workaround */ 38162306a36Sopenharmony_ci MVF_FLAG_SOC = (1U << 2), /* SoC integrated controllers */ 38262306a36Sopenharmony_ci}; 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_cienum mvs_event_flags { 38562306a36Sopenharmony_ci PHY_PLUG_EVENT = (3U), 38662306a36Sopenharmony_ci PHY_PLUG_IN = (1U << 0), /* phy plug in */ 38762306a36Sopenharmony_ci PHY_PLUG_OUT = (1U << 1), /* phy plug out */ 38862306a36Sopenharmony_ci EXP_BRCT_CHG = (1U << 2), /* broadcast change */ 38962306a36Sopenharmony_ci}; 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_cienum mvs_port_type { 39262306a36Sopenharmony_ci PORT_TGT_MASK = (1U << 5), 39362306a36Sopenharmony_ci PORT_INIT_PORT = (1U << 4), 39462306a36Sopenharmony_ci PORT_TGT_PORT = (1U << 3), 39562306a36Sopenharmony_ci PORT_INIT_TGT_PORT = (PORT_INIT_PORT | PORT_TGT_PORT), 39662306a36Sopenharmony_ci PORT_TYPE_SAS = (1U << 1), 39762306a36Sopenharmony_ci PORT_TYPE_SATA = (1U << 0), 39862306a36Sopenharmony_ci}; 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci/* Command Table Format */ 40162306a36Sopenharmony_cienum ct_format { 40262306a36Sopenharmony_ci /* SSP */ 40362306a36Sopenharmony_ci SSP_F_H = 0x00, 40462306a36Sopenharmony_ci SSP_F_IU = 0x18, 40562306a36Sopenharmony_ci SSP_F_MAX = 0x4D, 40662306a36Sopenharmony_ci /* STP */ 40762306a36Sopenharmony_ci STP_CMD_FIS = 0x00, 40862306a36Sopenharmony_ci STP_ATAPI_CMD = 0x40, 40962306a36Sopenharmony_ci STP_F_MAX = 0x10, 41062306a36Sopenharmony_ci /* SMP */ 41162306a36Sopenharmony_ci SMP_F_T = 0x00, 41262306a36Sopenharmony_ci SMP_F_DEP = 0x01, 41362306a36Sopenharmony_ci SMP_F_MAX = 0x101, 41462306a36Sopenharmony_ci}; 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_cienum status_buffer { 41762306a36Sopenharmony_ci SB_EIR_OFF = 0x00, /* Error Information Record */ 41862306a36Sopenharmony_ci SB_RFB_OFF = 0x08, /* Response Frame Buffer */ 41962306a36Sopenharmony_ci SB_RFB_MAX = 0x400, /* RFB size*/ 42062306a36Sopenharmony_ci}; 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_cienum error_info_rec { 42362306a36Sopenharmony_ci CMD_ISS_STPD = (1U << 31), /* Cmd Issue Stopped */ 42462306a36Sopenharmony_ci CMD_PI_ERR = (1U << 30), /* Protection info error. see flags2 */ 42562306a36Sopenharmony_ci RSP_OVER = (1U << 29), /* rsp buffer overflow */ 42662306a36Sopenharmony_ci RETRY_LIM = (1U << 28), /* FIS/frame retry limit exceeded */ 42762306a36Sopenharmony_ci UNK_FIS = (1U << 27), /* unknown FIS */ 42862306a36Sopenharmony_ci DMA_TERM = (1U << 26), /* DMA terminate primitive rx'd */ 42962306a36Sopenharmony_ci SYNC_ERR = (1U << 25), /* SYNC rx'd during frame xmit */ 43062306a36Sopenharmony_ci TFILE_ERR = (1U << 24), /* SATA taskfile Error bit set */ 43162306a36Sopenharmony_ci R_ERR = (1U << 23), /* SATA returned R_ERR prim */ 43262306a36Sopenharmony_ci RD_OFS = (1U << 20), /* Read DATA frame invalid offset */ 43362306a36Sopenharmony_ci XFER_RDY_OFS = (1U << 19), /* XFER_RDY offset error */ 43462306a36Sopenharmony_ci UNEXP_XFER_RDY = (1U << 18), /* unexpected XFER_RDY error */ 43562306a36Sopenharmony_ci DATA_OVER_UNDER = (1U << 16), /* data overflow/underflow */ 43662306a36Sopenharmony_ci INTERLOCK = (1U << 15), /* interlock error */ 43762306a36Sopenharmony_ci NAK = (1U << 14), /* NAK rx'd */ 43862306a36Sopenharmony_ci ACK_NAK_TO = (1U << 13), /* ACK/NAK timeout */ 43962306a36Sopenharmony_ci CXN_CLOSED = (1U << 12), /* cxn closed w/out ack/nak */ 44062306a36Sopenharmony_ci OPEN_TO = (1U << 11), /* I_T nexus lost, open cxn timeout */ 44162306a36Sopenharmony_ci PATH_BLOCKED = (1U << 10), /* I_T nexus lost, pathway blocked */ 44262306a36Sopenharmony_ci NO_DEST = (1U << 9), /* I_T nexus lost, no destination */ 44362306a36Sopenharmony_ci STP_RES_BSY = (1U << 8), /* STP resources busy */ 44462306a36Sopenharmony_ci BREAK = (1U << 7), /* break received */ 44562306a36Sopenharmony_ci BAD_DEST = (1U << 6), /* bad destination */ 44662306a36Sopenharmony_ci BAD_PROTO = (1U << 5), /* protocol not supported */ 44762306a36Sopenharmony_ci BAD_RATE = (1U << 4), /* cxn rate not supported */ 44862306a36Sopenharmony_ci WRONG_DEST = (1U << 3), /* wrong destination error */ 44962306a36Sopenharmony_ci CREDIT_TO = (1U << 2), /* credit timeout */ 45062306a36Sopenharmony_ci WDOG_TO = (1U << 1), /* watchdog timeout */ 45162306a36Sopenharmony_ci BUF_PAR = (1U << 0), /* buffer parity error */ 45262306a36Sopenharmony_ci}; 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_cienum error_info_rec_2 { 45562306a36Sopenharmony_ci SLOT_BSY_ERR = (1U << 31), /* Slot Busy Error */ 45662306a36Sopenharmony_ci GRD_CHK_ERR = (1U << 14), /* Guard Check Error */ 45762306a36Sopenharmony_ci APP_CHK_ERR = (1U << 13), /* Application Check error */ 45862306a36Sopenharmony_ci REF_CHK_ERR = (1U << 12), /* Reference Check Error */ 45962306a36Sopenharmony_ci USR_BLK_NM = (1U << 0), /* User Block Number */ 46062306a36Sopenharmony_ci}; 46162306a36Sopenharmony_ci 46262306a36Sopenharmony_cienum pci_cfg_register_bits { 46362306a36Sopenharmony_ci PCTL_PWR_OFF = (0xFU << 24), 46462306a36Sopenharmony_ci PCTL_COM_ON = (0xFU << 20), 46562306a36Sopenharmony_ci PCTL_LINK_RST = (0xFU << 16), 46662306a36Sopenharmony_ci PCTL_LINK_OFFS = (16), 46762306a36Sopenharmony_ci PCTL_PHY_DSBL = (0xFU << 12), 46862306a36Sopenharmony_ci PCTL_PHY_DSBL_OFFS = (12), 46962306a36Sopenharmony_ci PRD_REQ_SIZE = (0x4000), 47062306a36Sopenharmony_ci PRD_REQ_MASK = (0x00007000), 47162306a36Sopenharmony_ci PLS_NEG_LINK_WD = (0x3FU << 4), 47262306a36Sopenharmony_ci PLS_NEG_LINK_WD_OFFS = 4, 47362306a36Sopenharmony_ci PLS_LINK_SPD = (0x0FU << 0), 47462306a36Sopenharmony_ci PLS_LINK_SPD_OFFS = 0, 47562306a36Sopenharmony_ci}; 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_cienum open_frame_protocol { 47862306a36Sopenharmony_ci PROTOCOL_SMP = 0x0, 47962306a36Sopenharmony_ci PROTOCOL_SSP = 0x1, 48062306a36Sopenharmony_ci PROTOCOL_STP = 0x2, 48162306a36Sopenharmony_ci}; 48262306a36Sopenharmony_ci 48362306a36Sopenharmony_ci/* define for response frame datapres field */ 48462306a36Sopenharmony_cienum datapres_field { 48562306a36Sopenharmony_ci NO_DATA = 0, 48662306a36Sopenharmony_ci RESPONSE_DATA = 1, 48762306a36Sopenharmony_ci SENSE_DATA = 2, 48862306a36Sopenharmony_ci}; 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci#endif 491