18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* $Date: 2005/03/07 23:59:05 $ $RCSfile: fpga_defs.h,v $ $Revision: 1.4 $ */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci * FPGA specific definitions
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __CHELSIO_FPGA_DEFS_H__
98c2ecf20Sopenharmony_ci#define __CHELSIO_FPGA_DEFS_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define FPGA_PCIX_ADDR_VERSION               0xA08
128c2ecf20Sopenharmony_ci#define FPGA_PCIX_ADDR_STAT                  0xA0C
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* FPGA master interrupt Cause/Enable bits */
158c2ecf20Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_SGE_ERROR        0x1
168c2ecf20Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_SGE_DATA         0x2
178c2ecf20Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_TP               0x4
188c2ecf20Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_MC3              0x8
198c2ecf20Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_GMAC             0x10
208c2ecf20Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_PCIX             0x20
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* TP interrupt register addresses */
238c2ecf20Sopenharmony_ci#define FPGA_TP_ADDR_INTERRUPT_ENABLE        0xA10
248c2ecf20Sopenharmony_ci#define FPGA_TP_ADDR_INTERRUPT_CAUSE         0xA14
258c2ecf20Sopenharmony_ci#define FPGA_TP_ADDR_VERSION                 0xA18
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* TP interrupt Cause/Enable bits */
288c2ecf20Sopenharmony_ci#define FPGA_TP_INTERRUPT_MC4                0x1
298c2ecf20Sopenharmony_ci#define FPGA_TP_INTERRUPT_MC5                0x2
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/*
328c2ecf20Sopenharmony_ci * PM interrupt register addresses
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define FPGA_MC3_REG_INTRENABLE              0xA20
358c2ecf20Sopenharmony_ci#define FPGA_MC3_REG_INTRCAUSE               0xA24
368c2ecf20Sopenharmony_ci#define FPGA_MC3_REG_VERSION                 0xA28
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/*
398c2ecf20Sopenharmony_ci * GMAC interrupt register addresses
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ci#define FPGA_GMAC_ADDR_INTERRUPT_ENABLE      0xA30
428c2ecf20Sopenharmony_ci#define FPGA_GMAC_ADDR_INTERRUPT_CAUSE       0xA34
438c2ecf20Sopenharmony_ci#define FPGA_GMAC_ADDR_VERSION               0xA38
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* GMAC Cause/Enable bits */
468c2ecf20Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT0            0x1
478c2ecf20Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT1            0x2
488c2ecf20Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT2            0x4
498c2ecf20Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT3            0x8
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* MI0 registers */
528c2ecf20Sopenharmony_ci#define A_MI0_CLK 0xb00
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define S_MI0_CLK_DIV    0
558c2ecf20Sopenharmony_ci#define M_MI0_CLK_DIV    0xff
568c2ecf20Sopenharmony_ci#define V_MI0_CLK_DIV(x) ((x) << S_MI0_CLK_DIV)
578c2ecf20Sopenharmony_ci#define G_MI0_CLK_DIV(x) (((x) >> S_MI0_CLK_DIV) & M_MI0_CLK_DIV)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define S_MI0_CLK_CNT    8
608c2ecf20Sopenharmony_ci#define M_MI0_CLK_CNT    0xff
618c2ecf20Sopenharmony_ci#define V_MI0_CLK_CNT(x) ((x) << S_MI0_CLK_CNT)
628c2ecf20Sopenharmony_ci#define G_MI0_CLK_CNT(x) (((x) >> S_MI0_CLK_CNT) & M_MI0_CLK_CNT)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define A_MI0_CSR 0xb04
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define S_MI0_CSR_POLL    0
678c2ecf20Sopenharmony_ci#define V_MI0_CSR_POLL(x) ((x) << S_MI0_CSR_POLL)
688c2ecf20Sopenharmony_ci#define F_MI0_CSR_POLL    V_MI0_CSR_POLL(1U)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define S_MI0_PREAMBLE    1
718c2ecf20Sopenharmony_ci#define V_MI0_PREAMBLE(x) ((x) << S_MI0_PREAMBLE)
728c2ecf20Sopenharmony_ci#define F_MI0_PREAMBLE    V_MI0_PREAMBLE(1U)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#define S_MI0_INTR_ENABLE    2
758c2ecf20Sopenharmony_ci#define V_MI0_INTR_ENABLE(x) ((x) << S_MI0_INTR_ENABLE)
768c2ecf20Sopenharmony_ci#define F_MI0_INTR_ENABLE    V_MI0_INTR_ENABLE(1U)
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define S_MI0_BUSY    3
798c2ecf20Sopenharmony_ci#define V_MI0_BUSY(x) ((x) << S_MI0_BUSY)
808c2ecf20Sopenharmony_ci#define F_MI0_BUSY    V_MI0_BUSY(1U)
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#define S_MI0_MDIO    4
838c2ecf20Sopenharmony_ci#define V_MI0_MDIO(x) ((x) << S_MI0_MDIO)
848c2ecf20Sopenharmony_ci#define F_MI0_MDIO    V_MI0_MDIO(1U)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define A_MI0_ADDR 0xb08
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#define S_MI0_PHY_REG_ADDR    0
898c2ecf20Sopenharmony_ci#define M_MI0_PHY_REG_ADDR    0x1f
908c2ecf20Sopenharmony_ci#define V_MI0_PHY_REG_ADDR(x) ((x) << S_MI0_PHY_REG_ADDR)
918c2ecf20Sopenharmony_ci#define G_MI0_PHY_REG_ADDR(x) (((x) >> S_MI0_PHY_REG_ADDR) & M_MI0_PHY_REG_ADDR)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define S_MI0_PHY_ADDR    5
948c2ecf20Sopenharmony_ci#define M_MI0_PHY_ADDR    0x1f
958c2ecf20Sopenharmony_ci#define V_MI0_PHY_ADDR(x) ((x) << S_MI0_PHY_ADDR)
968c2ecf20Sopenharmony_ci#define G_MI0_PHY_ADDR(x) (((x) >> S_MI0_PHY_ADDR) & M_MI0_PHY_ADDR)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define A_MI0_DATA_EXT 0xb0c
998c2ecf20Sopenharmony_ci#define A_MI0_DATA_INT 0xb10
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* GMAC registers */
1028c2ecf20Sopenharmony_ci#define A_GMAC_MACID_LO	0x28
1038c2ecf20Sopenharmony_ci#define A_GMAC_MACID_HI	0x2c
1048c2ecf20Sopenharmony_ci#define A_GMAC_CSR	0x30
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define S_INTERFACE    0
1078c2ecf20Sopenharmony_ci#define M_INTERFACE    0x3
1088c2ecf20Sopenharmony_ci#define V_INTERFACE(x) ((x) << S_INTERFACE)
1098c2ecf20Sopenharmony_ci#define G_INTERFACE(x) (((x) >> S_INTERFACE) & M_INTERFACE)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#define S_MAC_TX_ENABLE    2
1128c2ecf20Sopenharmony_ci#define V_MAC_TX_ENABLE(x) ((x) << S_MAC_TX_ENABLE)
1138c2ecf20Sopenharmony_ci#define F_MAC_TX_ENABLE    V_MAC_TX_ENABLE(1U)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define S_MAC_RX_ENABLE    3
1168c2ecf20Sopenharmony_ci#define V_MAC_RX_ENABLE(x) ((x) << S_MAC_RX_ENABLE)
1178c2ecf20Sopenharmony_ci#define F_MAC_RX_ENABLE    V_MAC_RX_ENABLE(1U)
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define S_MAC_LB_ENABLE    4
1208c2ecf20Sopenharmony_ci#define V_MAC_LB_ENABLE(x) ((x) << S_MAC_LB_ENABLE)
1218c2ecf20Sopenharmony_ci#define F_MAC_LB_ENABLE    V_MAC_LB_ENABLE(1U)
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define S_MAC_SPEED    5
1248c2ecf20Sopenharmony_ci#define M_MAC_SPEED    0x3
1258c2ecf20Sopenharmony_ci#define V_MAC_SPEED(x) ((x) << S_MAC_SPEED)
1268c2ecf20Sopenharmony_ci#define G_MAC_SPEED(x) (((x) >> S_MAC_SPEED) & M_MAC_SPEED)
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci#define S_MAC_HD_FC_ENABLE    7
1298c2ecf20Sopenharmony_ci#define V_MAC_HD_FC_ENABLE(x) ((x) << S_MAC_HD_FC_ENABLE)
1308c2ecf20Sopenharmony_ci#define F_MAC_HD_FC_ENABLE    V_MAC_HD_FC_ENABLE(1U)
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define S_MAC_HALF_DUPLEX    8
1338c2ecf20Sopenharmony_ci#define V_MAC_HALF_DUPLEX(x) ((x) << S_MAC_HALF_DUPLEX)
1348c2ecf20Sopenharmony_ci#define F_MAC_HALF_DUPLEX    V_MAC_HALF_DUPLEX(1U)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci#define S_MAC_PROMISC    9
1378c2ecf20Sopenharmony_ci#define V_MAC_PROMISC(x) ((x) << S_MAC_PROMISC)
1388c2ecf20Sopenharmony_ci#define F_MAC_PROMISC    V_MAC_PROMISC(1U)
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define S_MAC_MC_ENABLE    10
1418c2ecf20Sopenharmony_ci#define V_MAC_MC_ENABLE(x) ((x) << S_MAC_MC_ENABLE)
1428c2ecf20Sopenharmony_ci#define F_MAC_MC_ENABLE    V_MAC_MC_ENABLE(1U)
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define S_MAC_RESET    11
1458c2ecf20Sopenharmony_ci#define V_MAC_RESET(x) ((x) << S_MAC_RESET)
1468c2ecf20Sopenharmony_ci#define F_MAC_RESET    V_MAC_RESET(1U)
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci#define S_MAC_RX_PAUSE_ENABLE    12
1498c2ecf20Sopenharmony_ci#define V_MAC_RX_PAUSE_ENABLE(x) ((x) << S_MAC_RX_PAUSE_ENABLE)
1508c2ecf20Sopenharmony_ci#define F_MAC_RX_PAUSE_ENABLE    V_MAC_RX_PAUSE_ENABLE(1U)
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci#define S_MAC_TX_PAUSE_ENABLE    13
1538c2ecf20Sopenharmony_ci#define V_MAC_TX_PAUSE_ENABLE(x) ((x) << S_MAC_TX_PAUSE_ENABLE)
1548c2ecf20Sopenharmony_ci#define F_MAC_TX_PAUSE_ENABLE    V_MAC_TX_PAUSE_ENABLE(1U)
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define S_MAC_LWM_ENABLE    14
1578c2ecf20Sopenharmony_ci#define V_MAC_LWM_ENABLE(x) ((x) << S_MAC_LWM_ENABLE)
1588c2ecf20Sopenharmony_ci#define F_MAC_LWM_ENABLE    V_MAC_LWM_ENABLE(1U)
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci#define S_MAC_MAGIC_PKT_ENABLE    15
1618c2ecf20Sopenharmony_ci#define V_MAC_MAGIC_PKT_ENABLE(x) ((x) << S_MAC_MAGIC_PKT_ENABLE)
1628c2ecf20Sopenharmony_ci#define F_MAC_MAGIC_PKT_ENABLE    V_MAC_MAGIC_PKT_ENABLE(1U)
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci#define S_MAC_ISL_ENABLE    16
1658c2ecf20Sopenharmony_ci#define V_MAC_ISL_ENABLE(x) ((x) << S_MAC_ISL_ENABLE)
1668c2ecf20Sopenharmony_ci#define F_MAC_ISL_ENABLE    V_MAC_ISL_ENABLE(1U)
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define S_MAC_JUMBO_ENABLE    17
1698c2ecf20Sopenharmony_ci#define V_MAC_JUMBO_ENABLE(x) ((x) << S_MAC_JUMBO_ENABLE)
1708c2ecf20Sopenharmony_ci#define F_MAC_JUMBO_ENABLE    V_MAC_JUMBO_ENABLE(1U)
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define S_MAC_RX_PAD_ENABLE    18
1738c2ecf20Sopenharmony_ci#define V_MAC_RX_PAD_ENABLE(x) ((x) << S_MAC_RX_PAD_ENABLE)
1748c2ecf20Sopenharmony_ci#define F_MAC_RX_PAD_ENABLE    V_MAC_RX_PAD_ENABLE(1U)
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci#define S_MAC_RX_CRC_ENABLE    19
1778c2ecf20Sopenharmony_ci#define V_MAC_RX_CRC_ENABLE(x) ((x) << S_MAC_RX_CRC_ENABLE)
1788c2ecf20Sopenharmony_ci#define F_MAC_RX_CRC_ENABLE    V_MAC_RX_CRC_ENABLE(1U)
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci#define A_GMAC_IFS 0x34
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci#define S_MAC_IFS2    0
1838c2ecf20Sopenharmony_ci#define M_MAC_IFS2    0x3f
1848c2ecf20Sopenharmony_ci#define V_MAC_IFS2(x) ((x) << S_MAC_IFS2)
1858c2ecf20Sopenharmony_ci#define G_MAC_IFS2(x) (((x) >> S_MAC_IFS2) & M_MAC_IFS2)
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci#define S_MAC_IFS1    8
1888c2ecf20Sopenharmony_ci#define M_MAC_IFS1    0x7f
1898c2ecf20Sopenharmony_ci#define V_MAC_IFS1(x) ((x) << S_MAC_IFS1)
1908c2ecf20Sopenharmony_ci#define G_MAC_IFS1(x) (((x) >> S_MAC_IFS1) & M_MAC_IFS1)
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci#define A_GMAC_JUMBO_FRAME_LEN 0x38
1938c2ecf20Sopenharmony_ci#define A_GMAC_LNK_DLY 0x3c
1948c2ecf20Sopenharmony_ci#define A_GMAC_PAUSETIME 0x40
1958c2ecf20Sopenharmony_ci#define A_GMAC_MCAST_LO 0x44
1968c2ecf20Sopenharmony_ci#define A_GMAC_MCAST_HI 0x48
1978c2ecf20Sopenharmony_ci#define A_GMAC_MCAST_MASK_LO 0x4c
1988c2ecf20Sopenharmony_ci#define A_GMAC_MCAST_MASK_HI 0x50
1998c2ecf20Sopenharmony_ci#define A_GMAC_RMT_CNT 0x54
2008c2ecf20Sopenharmony_ci#define A_GMAC_RMT_DATA 0x58
2018c2ecf20Sopenharmony_ci#define A_GMAC_BACKOFF_SEED 0x5c
2028c2ecf20Sopenharmony_ci#define A_GMAC_TXF_THRES 0x60
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci#define S_TXF_READ_THRESHOLD    0
2058c2ecf20Sopenharmony_ci#define M_TXF_READ_THRESHOLD    0xff
2068c2ecf20Sopenharmony_ci#define V_TXF_READ_THRESHOLD(x) ((x) << S_TXF_READ_THRESHOLD)
2078c2ecf20Sopenharmony_ci#define G_TXF_READ_THRESHOLD(x) (((x) >> S_TXF_READ_THRESHOLD) & M_TXF_READ_THRESHOLD)
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define S_TXF_WRITE_THRESHOLD    16
2108c2ecf20Sopenharmony_ci#define M_TXF_WRITE_THRESHOLD    0xff
2118c2ecf20Sopenharmony_ci#define V_TXF_WRITE_THRESHOLD(x) ((x) << S_TXF_WRITE_THRESHOLD)
2128c2ecf20Sopenharmony_ci#define G_TXF_WRITE_THRESHOLD(x) (((x) >> S_TXF_WRITE_THRESHOLD) & M_TXF_WRITE_THRESHOLD)
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci#define MAC_REG_BASE 0x600
2158c2ecf20Sopenharmony_ci#define MAC_REG_ADDR(idx, reg) (MAC_REG_BASE + (idx) * 128 + (reg))
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci#define MAC_REG_IDLO(idx)              MAC_REG_ADDR(idx, A_GMAC_MACID_LO)
2188c2ecf20Sopenharmony_ci#define MAC_REG_IDHI(idx)              MAC_REG_ADDR(idx, A_GMAC_MACID_HI)
2198c2ecf20Sopenharmony_ci#define MAC_REG_CSR(idx)               MAC_REG_ADDR(idx, A_GMAC_CSR)
2208c2ecf20Sopenharmony_ci#define MAC_REG_IFS(idx)               MAC_REG_ADDR(idx, A_GMAC_IFS)
2218c2ecf20Sopenharmony_ci#define MAC_REG_LARGEFRAMELENGTH(idx) MAC_REG_ADDR(idx, A_GMAC_JUMBO_FRAME_LEN)
2228c2ecf20Sopenharmony_ci#define MAC_REG_LINKDLY(idx)           MAC_REG_ADDR(idx, A_GMAC_LNK_DLY)
2238c2ecf20Sopenharmony_ci#define MAC_REG_PAUSETIME(idx)         MAC_REG_ADDR(idx, A_GMAC_PAUSETIME)
2248c2ecf20Sopenharmony_ci#define MAC_REG_CASTLO(idx)            MAC_REG_ADDR(idx, A_GMAC_MCAST_LO)
2258c2ecf20Sopenharmony_ci#define MAC_REG_MCASTHI(idx)           MAC_REG_ADDR(idx, A_GMAC_MCAST_HI)
2268c2ecf20Sopenharmony_ci#define MAC_REG_CASTMASKLO(idx)        MAC_REG_ADDR(idx, A_GMAC_MCAST_MASK_LO)
2278c2ecf20Sopenharmony_ci#define MAC_REG_MCASTMASKHI(idx)       MAC_REG_ADDR(idx, A_GMAC_MCAST_MASK_HI)
2288c2ecf20Sopenharmony_ci#define MAC_REG_RMCNT(idx)             MAC_REG_ADDR(idx, A_GMAC_RMT_CNT)
2298c2ecf20Sopenharmony_ci#define MAC_REG_RMDATA(idx)            MAC_REG_ADDR(idx, A_GMAC_RMT_DATA)
2308c2ecf20Sopenharmony_ci#define MAC_REG_GMRANDBACKOFFSEED(idx) MAC_REG_ADDR(idx, A_GMAC_BACKOFF_SEED)
2318c2ecf20Sopenharmony_ci#define MAC_REG_TXFTHRESHOLDS(idx)     MAC_REG_ADDR(idx, A_GMAC_TXF_THRES)
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci#endif
234