162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* $Date: 2005/03/07 23:59:05 $ $RCSfile: fpga_defs.h,v $ $Revision: 1.4 $ */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci/*
562306a36Sopenharmony_ci * FPGA specific definitions
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __CHELSIO_FPGA_DEFS_H__
962306a36Sopenharmony_ci#define __CHELSIO_FPGA_DEFS_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define FPGA_PCIX_ADDR_VERSION               0xA08
1262306a36Sopenharmony_ci#define FPGA_PCIX_ADDR_STAT                  0xA0C
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* FPGA master interrupt Cause/Enable bits */
1562306a36Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_SGE_ERROR        0x1
1662306a36Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_SGE_DATA         0x2
1762306a36Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_TP               0x4
1862306a36Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_MC3              0x8
1962306a36Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_GMAC             0x10
2062306a36Sopenharmony_ci#define FPGA_PCIX_INTERRUPT_PCIX             0x20
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* TP interrupt register addresses */
2362306a36Sopenharmony_ci#define FPGA_TP_ADDR_INTERRUPT_ENABLE        0xA10
2462306a36Sopenharmony_ci#define FPGA_TP_ADDR_INTERRUPT_CAUSE         0xA14
2562306a36Sopenharmony_ci#define FPGA_TP_ADDR_VERSION                 0xA18
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* TP interrupt Cause/Enable bits */
2862306a36Sopenharmony_ci#define FPGA_TP_INTERRUPT_MC4                0x1
2962306a36Sopenharmony_ci#define FPGA_TP_INTERRUPT_MC5                0x2
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/*
3262306a36Sopenharmony_ci * PM interrupt register addresses
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci#define FPGA_MC3_REG_INTRENABLE              0xA20
3562306a36Sopenharmony_ci#define FPGA_MC3_REG_INTRCAUSE               0xA24
3662306a36Sopenharmony_ci#define FPGA_MC3_REG_VERSION                 0xA28
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/*
3962306a36Sopenharmony_ci * GMAC interrupt register addresses
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci#define FPGA_GMAC_ADDR_INTERRUPT_ENABLE      0xA30
4262306a36Sopenharmony_ci#define FPGA_GMAC_ADDR_INTERRUPT_CAUSE       0xA34
4362306a36Sopenharmony_ci#define FPGA_GMAC_ADDR_VERSION               0xA38
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/* GMAC Cause/Enable bits */
4662306a36Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT0            0x1
4762306a36Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT1            0x2
4862306a36Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT2            0x4
4962306a36Sopenharmony_ci#define FPGA_GMAC_INTERRUPT_PORT3            0x8
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* MI0 registers */
5262306a36Sopenharmony_ci#define A_MI0_CLK 0xb00
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define S_MI0_CLK_DIV    0
5562306a36Sopenharmony_ci#define M_MI0_CLK_DIV    0xff
5662306a36Sopenharmony_ci#define V_MI0_CLK_DIV(x) ((x) << S_MI0_CLK_DIV)
5762306a36Sopenharmony_ci#define G_MI0_CLK_DIV(x) (((x) >> S_MI0_CLK_DIV) & M_MI0_CLK_DIV)
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define S_MI0_CLK_CNT    8
6062306a36Sopenharmony_ci#define M_MI0_CLK_CNT    0xff
6162306a36Sopenharmony_ci#define V_MI0_CLK_CNT(x) ((x) << S_MI0_CLK_CNT)
6262306a36Sopenharmony_ci#define G_MI0_CLK_CNT(x) (((x) >> S_MI0_CLK_CNT) & M_MI0_CLK_CNT)
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#define A_MI0_CSR 0xb04
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci#define S_MI0_CSR_POLL    0
6762306a36Sopenharmony_ci#define V_MI0_CSR_POLL(x) ((x) << S_MI0_CSR_POLL)
6862306a36Sopenharmony_ci#define F_MI0_CSR_POLL    V_MI0_CSR_POLL(1U)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define S_MI0_PREAMBLE    1
7162306a36Sopenharmony_ci#define V_MI0_PREAMBLE(x) ((x) << S_MI0_PREAMBLE)
7262306a36Sopenharmony_ci#define F_MI0_PREAMBLE    V_MI0_PREAMBLE(1U)
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci#define S_MI0_INTR_ENABLE    2
7562306a36Sopenharmony_ci#define V_MI0_INTR_ENABLE(x) ((x) << S_MI0_INTR_ENABLE)
7662306a36Sopenharmony_ci#define F_MI0_INTR_ENABLE    V_MI0_INTR_ENABLE(1U)
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define S_MI0_BUSY    3
7962306a36Sopenharmony_ci#define V_MI0_BUSY(x) ((x) << S_MI0_BUSY)
8062306a36Sopenharmony_ci#define F_MI0_BUSY    V_MI0_BUSY(1U)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define S_MI0_MDIO    4
8362306a36Sopenharmony_ci#define V_MI0_MDIO(x) ((x) << S_MI0_MDIO)
8462306a36Sopenharmony_ci#define F_MI0_MDIO    V_MI0_MDIO(1U)
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#define A_MI0_ADDR 0xb08
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci#define S_MI0_PHY_REG_ADDR    0
8962306a36Sopenharmony_ci#define M_MI0_PHY_REG_ADDR    0x1f
9062306a36Sopenharmony_ci#define V_MI0_PHY_REG_ADDR(x) ((x) << S_MI0_PHY_REG_ADDR)
9162306a36Sopenharmony_ci#define G_MI0_PHY_REG_ADDR(x) (((x) >> S_MI0_PHY_REG_ADDR) & M_MI0_PHY_REG_ADDR)
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#define S_MI0_PHY_ADDR    5
9462306a36Sopenharmony_ci#define M_MI0_PHY_ADDR    0x1f
9562306a36Sopenharmony_ci#define V_MI0_PHY_ADDR(x) ((x) << S_MI0_PHY_ADDR)
9662306a36Sopenharmony_ci#define G_MI0_PHY_ADDR(x) (((x) >> S_MI0_PHY_ADDR) & M_MI0_PHY_ADDR)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci#define A_MI0_DATA_EXT 0xb0c
9962306a36Sopenharmony_ci#define A_MI0_DATA_INT 0xb10
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci/* GMAC registers */
10262306a36Sopenharmony_ci#define A_GMAC_MACID_LO	0x28
10362306a36Sopenharmony_ci#define A_GMAC_MACID_HI	0x2c
10462306a36Sopenharmony_ci#define A_GMAC_CSR	0x30
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define S_INTERFACE    0
10762306a36Sopenharmony_ci#define M_INTERFACE    0x3
10862306a36Sopenharmony_ci#define V_INTERFACE(x) ((x) << S_INTERFACE)
10962306a36Sopenharmony_ci#define G_INTERFACE(x) (((x) >> S_INTERFACE) & M_INTERFACE)
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define S_MAC_TX_ENABLE    2
11262306a36Sopenharmony_ci#define V_MAC_TX_ENABLE(x) ((x) << S_MAC_TX_ENABLE)
11362306a36Sopenharmony_ci#define F_MAC_TX_ENABLE    V_MAC_TX_ENABLE(1U)
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define S_MAC_RX_ENABLE    3
11662306a36Sopenharmony_ci#define V_MAC_RX_ENABLE(x) ((x) << S_MAC_RX_ENABLE)
11762306a36Sopenharmony_ci#define F_MAC_RX_ENABLE    V_MAC_RX_ENABLE(1U)
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci#define S_MAC_LB_ENABLE    4
12062306a36Sopenharmony_ci#define V_MAC_LB_ENABLE(x) ((x) << S_MAC_LB_ENABLE)
12162306a36Sopenharmony_ci#define F_MAC_LB_ENABLE    V_MAC_LB_ENABLE(1U)
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define S_MAC_SPEED    5
12462306a36Sopenharmony_ci#define M_MAC_SPEED    0x3
12562306a36Sopenharmony_ci#define V_MAC_SPEED(x) ((x) << S_MAC_SPEED)
12662306a36Sopenharmony_ci#define G_MAC_SPEED(x) (((x) >> S_MAC_SPEED) & M_MAC_SPEED)
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci#define S_MAC_HD_FC_ENABLE    7
12962306a36Sopenharmony_ci#define V_MAC_HD_FC_ENABLE(x) ((x) << S_MAC_HD_FC_ENABLE)
13062306a36Sopenharmony_ci#define F_MAC_HD_FC_ENABLE    V_MAC_HD_FC_ENABLE(1U)
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci#define S_MAC_HALF_DUPLEX    8
13362306a36Sopenharmony_ci#define V_MAC_HALF_DUPLEX(x) ((x) << S_MAC_HALF_DUPLEX)
13462306a36Sopenharmony_ci#define F_MAC_HALF_DUPLEX    V_MAC_HALF_DUPLEX(1U)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define S_MAC_PROMISC    9
13762306a36Sopenharmony_ci#define V_MAC_PROMISC(x) ((x) << S_MAC_PROMISC)
13862306a36Sopenharmony_ci#define F_MAC_PROMISC    V_MAC_PROMISC(1U)
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#define S_MAC_MC_ENABLE    10
14162306a36Sopenharmony_ci#define V_MAC_MC_ENABLE(x) ((x) << S_MAC_MC_ENABLE)
14262306a36Sopenharmony_ci#define F_MAC_MC_ENABLE    V_MAC_MC_ENABLE(1U)
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci#define S_MAC_RESET    11
14562306a36Sopenharmony_ci#define V_MAC_RESET(x) ((x) << S_MAC_RESET)
14662306a36Sopenharmony_ci#define F_MAC_RESET    V_MAC_RESET(1U)
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci#define S_MAC_RX_PAUSE_ENABLE    12
14962306a36Sopenharmony_ci#define V_MAC_RX_PAUSE_ENABLE(x) ((x) << S_MAC_RX_PAUSE_ENABLE)
15062306a36Sopenharmony_ci#define F_MAC_RX_PAUSE_ENABLE    V_MAC_RX_PAUSE_ENABLE(1U)
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci#define S_MAC_TX_PAUSE_ENABLE    13
15362306a36Sopenharmony_ci#define V_MAC_TX_PAUSE_ENABLE(x) ((x) << S_MAC_TX_PAUSE_ENABLE)
15462306a36Sopenharmony_ci#define F_MAC_TX_PAUSE_ENABLE    V_MAC_TX_PAUSE_ENABLE(1U)
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci#define S_MAC_LWM_ENABLE    14
15762306a36Sopenharmony_ci#define V_MAC_LWM_ENABLE(x) ((x) << S_MAC_LWM_ENABLE)
15862306a36Sopenharmony_ci#define F_MAC_LWM_ENABLE    V_MAC_LWM_ENABLE(1U)
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#define S_MAC_MAGIC_PKT_ENABLE    15
16162306a36Sopenharmony_ci#define V_MAC_MAGIC_PKT_ENABLE(x) ((x) << S_MAC_MAGIC_PKT_ENABLE)
16262306a36Sopenharmony_ci#define F_MAC_MAGIC_PKT_ENABLE    V_MAC_MAGIC_PKT_ENABLE(1U)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci#define S_MAC_ISL_ENABLE    16
16562306a36Sopenharmony_ci#define V_MAC_ISL_ENABLE(x) ((x) << S_MAC_ISL_ENABLE)
16662306a36Sopenharmony_ci#define F_MAC_ISL_ENABLE    V_MAC_ISL_ENABLE(1U)
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci#define S_MAC_JUMBO_ENABLE    17
16962306a36Sopenharmony_ci#define V_MAC_JUMBO_ENABLE(x) ((x) << S_MAC_JUMBO_ENABLE)
17062306a36Sopenharmony_ci#define F_MAC_JUMBO_ENABLE    V_MAC_JUMBO_ENABLE(1U)
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define S_MAC_RX_PAD_ENABLE    18
17362306a36Sopenharmony_ci#define V_MAC_RX_PAD_ENABLE(x) ((x) << S_MAC_RX_PAD_ENABLE)
17462306a36Sopenharmony_ci#define F_MAC_RX_PAD_ENABLE    V_MAC_RX_PAD_ENABLE(1U)
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci#define S_MAC_RX_CRC_ENABLE    19
17762306a36Sopenharmony_ci#define V_MAC_RX_CRC_ENABLE(x) ((x) << S_MAC_RX_CRC_ENABLE)
17862306a36Sopenharmony_ci#define F_MAC_RX_CRC_ENABLE    V_MAC_RX_CRC_ENABLE(1U)
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci#define A_GMAC_IFS 0x34
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci#define S_MAC_IFS2    0
18362306a36Sopenharmony_ci#define M_MAC_IFS2    0x3f
18462306a36Sopenharmony_ci#define V_MAC_IFS2(x) ((x) << S_MAC_IFS2)
18562306a36Sopenharmony_ci#define G_MAC_IFS2(x) (((x) >> S_MAC_IFS2) & M_MAC_IFS2)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define S_MAC_IFS1    8
18862306a36Sopenharmony_ci#define M_MAC_IFS1    0x7f
18962306a36Sopenharmony_ci#define V_MAC_IFS1(x) ((x) << S_MAC_IFS1)
19062306a36Sopenharmony_ci#define G_MAC_IFS1(x) (((x) >> S_MAC_IFS1) & M_MAC_IFS1)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci#define A_GMAC_JUMBO_FRAME_LEN 0x38
19362306a36Sopenharmony_ci#define A_GMAC_LNK_DLY 0x3c
19462306a36Sopenharmony_ci#define A_GMAC_PAUSETIME 0x40
19562306a36Sopenharmony_ci#define A_GMAC_MCAST_LO 0x44
19662306a36Sopenharmony_ci#define A_GMAC_MCAST_HI 0x48
19762306a36Sopenharmony_ci#define A_GMAC_MCAST_MASK_LO 0x4c
19862306a36Sopenharmony_ci#define A_GMAC_MCAST_MASK_HI 0x50
19962306a36Sopenharmony_ci#define A_GMAC_RMT_CNT 0x54
20062306a36Sopenharmony_ci#define A_GMAC_RMT_DATA 0x58
20162306a36Sopenharmony_ci#define A_GMAC_BACKOFF_SEED 0x5c
20262306a36Sopenharmony_ci#define A_GMAC_TXF_THRES 0x60
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci#define S_TXF_READ_THRESHOLD    0
20562306a36Sopenharmony_ci#define M_TXF_READ_THRESHOLD    0xff
20662306a36Sopenharmony_ci#define V_TXF_READ_THRESHOLD(x) ((x) << S_TXF_READ_THRESHOLD)
20762306a36Sopenharmony_ci#define G_TXF_READ_THRESHOLD(x) (((x) >> S_TXF_READ_THRESHOLD) & M_TXF_READ_THRESHOLD)
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci#define S_TXF_WRITE_THRESHOLD    16
21062306a36Sopenharmony_ci#define M_TXF_WRITE_THRESHOLD    0xff
21162306a36Sopenharmony_ci#define V_TXF_WRITE_THRESHOLD(x) ((x) << S_TXF_WRITE_THRESHOLD)
21262306a36Sopenharmony_ci#define G_TXF_WRITE_THRESHOLD(x) (((x) >> S_TXF_WRITE_THRESHOLD) & M_TXF_WRITE_THRESHOLD)
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci#define MAC_REG_BASE 0x600
21562306a36Sopenharmony_ci#define MAC_REG_ADDR(idx, reg) (MAC_REG_BASE + (idx) * 128 + (reg))
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci#define MAC_REG_IDLO(idx)              MAC_REG_ADDR(idx, A_GMAC_MACID_LO)
21862306a36Sopenharmony_ci#define MAC_REG_IDHI(idx)              MAC_REG_ADDR(idx, A_GMAC_MACID_HI)
21962306a36Sopenharmony_ci#define MAC_REG_CSR(idx)               MAC_REG_ADDR(idx, A_GMAC_CSR)
22062306a36Sopenharmony_ci#define MAC_REG_IFS(idx)               MAC_REG_ADDR(idx, A_GMAC_IFS)
22162306a36Sopenharmony_ci#define MAC_REG_LARGEFRAMELENGTH(idx) MAC_REG_ADDR(idx, A_GMAC_JUMBO_FRAME_LEN)
22262306a36Sopenharmony_ci#define MAC_REG_LINKDLY(idx)           MAC_REG_ADDR(idx, A_GMAC_LNK_DLY)
22362306a36Sopenharmony_ci#define MAC_REG_PAUSETIME(idx)         MAC_REG_ADDR(idx, A_GMAC_PAUSETIME)
22462306a36Sopenharmony_ci#define MAC_REG_CASTLO(idx)            MAC_REG_ADDR(idx, A_GMAC_MCAST_LO)
22562306a36Sopenharmony_ci#define MAC_REG_MCASTHI(idx)           MAC_REG_ADDR(idx, A_GMAC_MCAST_HI)
22662306a36Sopenharmony_ci#define MAC_REG_CASTMASKLO(idx)        MAC_REG_ADDR(idx, A_GMAC_MCAST_MASK_LO)
22762306a36Sopenharmony_ci#define MAC_REG_MCASTMASKHI(idx)       MAC_REG_ADDR(idx, A_GMAC_MCAST_MASK_HI)
22862306a36Sopenharmony_ci#define MAC_REG_RMCNT(idx)             MAC_REG_ADDR(idx, A_GMAC_RMT_CNT)
22962306a36Sopenharmony_ci#define MAC_REG_RMDATA(idx)            MAC_REG_ADDR(idx, A_GMAC_RMT_DATA)
23062306a36Sopenharmony_ci#define MAC_REG_GMRANDBACKOFFSEED(idx) MAC_REG_ADDR(idx, A_GMAC_BACKOFF_SEED)
23162306a36Sopenharmony_ci#define MAC_REG_TXFTHRESHOLDS(idx)     MAC_REG_ADDR(idx, A_GMAC_TXF_THRES)
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci#endif
234