blob: 3459cefcab9b5437e5f13f4c51c6135068a0fc6f [file] [log] [blame]
developer69bcd592024-03-25 14:26:39 +08001 /* FILE NAME: an8855_reg.h
2 * PURPOSE:
3 * It provides AN8855 register definition.
4 * NOTES:
5 *
6 */
7
8#ifndef AN8855_REG_H
9#define AN8855_REG_H
10
11#define PORT_CTRL_BASE 0x10208000
12#define PORT_CTRL_PORT_OFFSET 0x200
13#define PORT_CTRL_REG(p, r) (PORT_CTRL_BASE + (p) * PORT_CTRL_PORT_OFFSET + (r))
14#define PCR(p) PORT_CTRL_REG(p, 0x04)
15
16#define PORT_MAC_CTRL_BASE 0x10210000
17#define PORT_MAC_CTRL_PORT_OFFSET 0x200
18#define PORT_MAC_CTRL_REG(p, r) (PORT_MAC_CTRL_BASE + (p) * PORT_MAC_CTRL_PORT_OFFSET + (r))
19#define PMCR(p) PORT_MAC_CTRL_REG(p, 0x00)
20
21/* Port debug count register */
22#define DBG_CNT_BASE 0x3018
23#define DBG_CNT_PORT_BASE 0x100
24#define DBG_CNT(p) (DBG_CNT_BASE + (p) * DBG_CNT_PORT_BASE)
25#define DIS_CLR (1 << 31)
26
27#define GMACCR (PORT_MAC_CTRL_BASE + 0x30e0)
28#define MTCC_LMT_S 8
29#define MAX_RX_JUMBO_S 4
30
31/* Values of MAX_RX_PKT_LEN */
32#define RX_PKT_LEN_1518 0
33#define RX_PKT_LEN_1536 1
34#define RX_PKT_LEN_1522 2
35#define RX_PKT_LEN_MAX_JUMBO 3
36
37/* Fields of PMCR */
38#define FORCE_MODE (1 << 31)
39#define IPG_CFG_S 20
40#define IPG_CFG_M 0x300000
41#define EXT_PHY (1 << 19)
42#define MAC_MODE (1 << 18)
43#define MAC_TX_EN (1 << 16)
44#define MAC_RX_EN (1 << 15)
45#define MAC_PRE (1 << 14)
46#define BKOFF_EN (1 << 12)
47#define BACKPR_EN (1 << 11)
48#define FORCE_EEE1G (1 << 7)
49#define FORCE_EEE100 (1 << 6)
50#define FORCE_RX_FC (1 << 5)
51#define FORCE_TX_FC (1 << 4)
52#define FORCE_SPD_S 28
53#define FORCE_SPD_M 0x70000000
54#define FORCE_DPX (1 << 25)
55#define FORCE_LINK (1 << 24)
56
57/* Fields of PMSR */
58#define EEE1G_STS (1 << 7)
59#define EEE100_STS (1 << 6)
60#define RX_FC_STS (1 << 5)
61#define TX_FC_STS (1 << 4)
62#define MAC_SPD_STS_S 28
63#define MAC_SPD_STS_M 0x70000000
64#define MAC_DPX_STS (1 << 25)
65#define MAC_LNK_STS (1 << 24)
66
67/* Values of MAC_SPD_STS */
68#define MAC_SPD_10 0
69#define MAC_SPD_100 1
70#define MAC_SPD_1000 2
71#define MAC_SPD_2500 3
72
73/* Values of IPG_CFG */
74#define IPG_96BIT 0
75#define IPG_96BIT_WITH_SHORT_IPG 1
76#define IPG_64BIT 2
77
78#define SGMII_REG_BASE 0x5000
79#define SGMII_REG_PORT_BASE 0x1000
80#define SGMII_REG(p, r) (SGMII_REG_BASE + (p) * SGMII_REG_PORT_BASE + (r))
81#define PCS_CONTROL_1(p) SGMII_REG(p, 0x00)
82#define SGMII_MODE(p) SGMII_REG(p, 0x20)
83#define QPHY_PWR_STATE_CTRL(p) SGMII_REG(p, 0xe8)
84#define PHYA_CTRL_SIGNAL3(p) SGMII_REG(p, 0x128)
85
86/* Fields of PCS_CONTROL_1 */
87#define SGMII_LINK_STATUS (1 << 18)
88#define SGMII_AN_ENABLE (1 << 12)
89#define SGMII_AN_RESTART (1 << 9)
90
91/* Fields of SGMII_MODE */
92#define SGMII_REMOTE_FAULT_DIS (1 << 8)
93#define SGMII_IF_MODE_FORCE_DUPLEX (1 << 4)
94#define SGMII_IF_MODE_FORCE_SPEED_S 0x2
95#define SGMII_IF_MODE_FORCE_SPEED_M 0x0c
96#define SGMII_IF_MODE_ADVERT_AN (1 << 1)
97
98/* Values of SGMII_IF_MODE_FORCE_SPEED */
99#define SGMII_IF_MODE_FORCE_SPEED_10 0
100#define SGMII_IF_MODE_FORCE_SPEED_100 1
101#define SGMII_IF_MODE_FORCE_SPEED_1000 2
102
103/* Fields of QPHY_PWR_STATE_CTRL */
104#define PHYA_PWD (1 << 4)
105
106/* Fields of PHYA_CTRL_SIGNAL3 */
107#define RG_TPHY_SPEED_S 2
108#define RG_TPHY_SPEED_M 0x0c
109
110/* Values of RG_TPHY_SPEED */
111#define RG_TPHY_SPEED_1000 0
112#define RG_TPHY_SPEED_2500 1
113
114#define SYS_CTRL 0x7000
115#define SW_PHY_RST (1 << 2)
116#define SW_SYS_RST (1 << 1)
117#define SW_REG_RST (1 << 0)
118
119#define PHY_IAC (0x1000e000)
120#define IAC_MAX_BUSY_TIME (1000)
121
122#define CLKGEN_CTRL 0x7500
123#define CLK_SKEW_OUT_S 8
124#define CLK_SKEW_OUT_M 0x300
125#define CLK_SKEW_IN_S 6
126#define CLK_SKEW_IN_M 0xc0
127#define RXCLK_NO_DELAY (1 << 5)
128#define TXCLK_NO_REVERSE (1 << 4)
129#define GP_MODE_S 1
130#define GP_MODE_M 0x06
131#define GP_CLK_EN (1 << 0)
132
133/* Values of GP_MODE */
134#define GP_MODE_RGMII 0
135#define GP_MODE_MII 1
136#define GP_MODE_REV_MII 2
137
138/* Values of CLK_SKEW_IN */
139#define CLK_SKEW_IN_NO_CHANGE 0
140#define CLK_SKEW_IN_DELAY_100PPS 1
141#define CLK_SKEW_IN_DELAY_200PPS 2
142#define CLK_SKEW_IN_REVERSE 3
143
144/* Values of CLK_SKEW_OUT */
145#define CLK_SKEW_OUT_NO_CHANGE 0
146#define CLK_SKEW_OUT_DELAY_100PPS 1
147#define CLK_SKEW_OUT_DELAY_200PPS 2
148#define CLK_SKEW_OUT_REVERSE 3
149
150#define HWSTRAP 0x7800
151#define XTAL_FSEL_S 7
152#define XTAL_FSEL_M (1 << 7)
153
154#define XTAL_40MHZ 0
155#define XTAL_25MHZ 1
156
157#define PLLGP_EN 0x7820
158#define EN_COREPLL (1 << 2)
159#define SW_CLKSW (1 << 1)
160#define SW_PLLGP (1 << 0)
161
162#define PLLGP_CR0 0x78a8
163#define RG_COREPLL_EN (1 << 22)
164#define RG_COREPLL_POSDIV_S 23
165#define RG_COREPLL_POSDIV_M 0x3800000
166#define RG_COREPLL_SDM_PCW_S 1
167#define RG_COREPLL_SDM_PCW_M 0x3ffffe
168#define RG_COREPLL_SDM_PCW_CHG (1 << 0)
169
170#define MHWSTRAP 0x7804
171#define TOP_SIG_SR 0x780c
172#define PAD_DUAL_SGMII_EN (1 << 1)
173
174/* RGMII and SGMII PLL clock */
175#define ANA_PLLGP_CR2 0x78b0
176#define ANA_PLLGP_CR5 0x78bc
177
178/* Efuse Register Define */
179#define GBE_EFUSE 0x7bc8
180#define GBE_SEL_EFUSE_EN (1 << 0)
181
182/* GPIO_PAD_0 */
183#define GPIO_MODE0 0x7c0c
184#define GPIO_MODE0_S 0
185#define GPIO_MODE0_M 0xf
186#define GPIO_0_INTERRUPT_MODE 0x1
187
188#define SMT0_IOLB 0x7f04
189#define SMT_IOLB_5_SMI_MDC_EN (1 << 5)
190
191#endif /* End of AN8855_REG_H */