xref: /openbmc/linux/drivers/net/ethernet/intel/igc/igc_regs.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
1146740f9SSasha Neftin /* SPDX-License-Identifier: GPL-2.0 */
2146740f9SSasha Neftin /* Copyright (c)  2018 Intel Corporation */
3146740f9SSasha Neftin 
4146740f9SSasha Neftin #ifndef _IGC_REGS_H_
5146740f9SSasha Neftin #define _IGC_REGS_H_
6146740f9SSasha Neftin 
7146740f9SSasha Neftin /* General Register Descriptions */
8146740f9SSasha Neftin #define IGC_CTRL		0x00000  /* Device Control - RW */
9146740f9SSasha Neftin #define IGC_STATUS		0x00008  /* Device Status - RO */
10c0071c7aSSasha Neftin #define IGC_EECD		0x00010  /* EEPROM/Flash Control - RW */
11146740f9SSasha Neftin #define IGC_CTRL_EXT		0x00018  /* Extended Device Control - RW */
12146740f9SSasha Neftin #define IGC_MDIC		0x00020  /* MDI Control - RW */
13146740f9SSasha Neftin #define IGC_CONNSW		0x00034  /* Copper/Fiber switch control - RW */
148d744963SMuhammad Husaini Zulkifli #define IGC_VET			0x00038  /* VLAN Ether Type - RW */
15bcb3244cSSasha Neftin #define IGC_I225_PHPM		0x00E14  /* I225 PHY Power Management */
1694f794d1SSasha Neftin #define IGC_GPHY_VERSION	0x0001E  /* I225 gPHY Firmware Version */
17146740f9SSasha Neftin 
18146740f9SSasha Neftin /* Internal Packet Buffer Size Registers */
19146740f9SSasha Neftin #define IGC_RXPBS		0x02404  /* Rx Packet Buffer Size - RW */
20146740f9SSasha Neftin #define IGC_TXPBS		0x03404  /* Tx Packet Buffer Size - RW */
21146740f9SSasha Neftin 
22146740f9SSasha Neftin /* NVM  Register Descriptions */
23146740f9SSasha Neftin #define IGC_EERD		0x12014  /* EEprom mode read - RW */
24146740f9SSasha Neftin #define IGC_EEWR		0x12018  /* EEprom mode write - RW */
25146740f9SSasha Neftin 
26146740f9SSasha Neftin /* Flow Control Register Descriptions */
27146740f9SSasha Neftin #define IGC_FCAL		0x00028  /* FC Address Low - RW */
28146740f9SSasha Neftin #define IGC_FCAH		0x0002C  /* FC Address High - RW */
29146740f9SSasha Neftin #define IGC_FCT			0x00030  /* FC Type - RW */
30146740f9SSasha Neftin #define IGC_FCTTV		0x00170  /* FC Transmit Timer - RW */
31146740f9SSasha Neftin #define IGC_FCRTL		0x02160  /* FC Receive Threshold Low - RW */
32146740f9SSasha Neftin #define IGC_FCRTH		0x02168  /* FC Receive Threshold High - RW */
33146740f9SSasha Neftin #define IGC_FCRTV		0x02460  /* FC Refresh Timer Value - RW */
34146740f9SSasha Neftin 
35146740f9SSasha Neftin /* Semaphore registers */
36146740f9SSasha Neftin #define IGC_SW_FW_SYNC		0x05B5C  /* SW-FW Synchronization - RW */
37146740f9SSasha Neftin #define IGC_SWSM		0x05B50  /* SW Semaphore */
38146740f9SSasha Neftin #define IGC_FWSM		0x05B54  /* FW Semaphore */
39146740f9SSasha Neftin 
405586838fSSasha Neftin /* Function Active and Power State to MNG */
415586838fSSasha Neftin #define IGC_FACTPS		0x05B30
425586838fSSasha Neftin 
43146740f9SSasha Neftin /* Interrupt Register Description */
44f026d8caSVitaly Lifshits #define IGC_EICR		0x01580  /* Ext. Interrupt Cause read - W0 */
45146740f9SSasha Neftin #define IGC_EICS		0x01520  /* Ext. Interrupt Cause Set - W0 */
46146740f9SSasha Neftin #define IGC_EIMS		0x01524  /* Ext. Interrupt Mask Set/Read - RW */
47146740f9SSasha Neftin #define IGC_EIMC		0x01528  /* Ext. Interrupt Mask Clear - WO */
48146740f9SSasha Neftin #define IGC_EIAC		0x0152C  /* Ext. Interrupt Auto Clear - RW */
49146740f9SSasha Neftin #define IGC_EIAM		0x01530  /* Ext. Interrupt Auto Mask - RW */
50146740f9SSasha Neftin #define IGC_ICR			0x01500  /* Intr Cause Read - RC/W1C */
51146740f9SSasha Neftin #define IGC_ICS			0x01504  /* Intr Cause Set - WO */
52146740f9SSasha Neftin #define IGC_IMS			0x01508  /* Intr Mask Set/Read - RW */
53146740f9SSasha Neftin #define IGC_IMC			0x0150C  /* Intr Mask Clear - WO */
54146740f9SSasha Neftin #define IGC_IAM			0x01510  /* Intr Ack Auto Mask- RW */
55146740f9SSasha Neftin /* Intr Throttle - RW */
56146740f9SSasha Neftin #define IGC_EITR(_n)		(0x01680 + (0x4 * (_n)))
57146740f9SSasha Neftin /* Interrupt Vector Allocation - RW */
58146740f9SSasha Neftin #define IGC_IVAR0		0x01700
59146740f9SSasha Neftin #define IGC_IVAR_MISC		0x01740  /* IVAR for "other" causes - RW */
60146740f9SSasha Neftin #define IGC_GPIE		0x01514  /* General Purpose Intr Enable - RW */
61146740f9SSasha Neftin 
622121c271SSasha Neftin /* RSS registers */
632121c271SSasha Neftin #define IGC_MRQC		0x05818 /* Multiple Receive Control - RW */
642121c271SSasha Neftin 
656245c848SSasha Neftin /* Filtering Registers */
666245c848SSasha Neftin #define IGC_ETQF(_n)		(0x05CB0 + (4 * (_n))) /* EType Queue Fltr */
676574631bSKurt Kanzenbach #define IGC_FHFT(_n)		(0x09000 + (256 * (_n))) /* Flexible Host Filter */
686574631bSKurt Kanzenbach #define IGC_FHFT_EXT(_n)	(0x09A00 + (256 * (_n))) /* Flexible Host Filter Extended */
696574631bSKurt Kanzenbach #define IGC_FHFTSL		0x05804 /* Flex Filter indirect table select */
706245c848SSasha Neftin 
716245c848SSasha Neftin /* ETQF register bit definitions */
726245c848SSasha Neftin #define IGC_ETQF_FILTER_ENABLE	BIT(26)
736245c848SSasha Neftin #define IGC_ETQF_QUEUE_ENABLE	BIT(31)
746245c848SSasha Neftin #define IGC_ETQF_QUEUE_SHIFT	16
756245c848SSasha Neftin #define IGC_ETQF_QUEUE_MASK	0x00070000
766245c848SSasha Neftin #define IGC_ETQF_ETYPE_MASK	0x0000FFFF
776245c848SSasha Neftin 
786574631bSKurt Kanzenbach /* FHFT register bit definitions */
796574631bSKurt Kanzenbach #define IGC_FHFT_LENGTH_MASK	GENMASK(7, 0)
806574631bSKurt Kanzenbach #define IGC_FHFT_QUEUE_SHIFT	8
816574631bSKurt Kanzenbach #define IGC_FHFT_QUEUE_MASK	GENMASK(10, 8)
826574631bSKurt Kanzenbach #define IGC_FHFT_PRIO_SHIFT	16
836574631bSKurt Kanzenbach #define IGC_FHFT_PRIO_MASK	GENMASK(18, 16)
846574631bSKurt Kanzenbach #define IGC_FHFT_IMM_INT	BIT(24)
856574631bSKurt Kanzenbach #define IGC_FHFT_DROP		BIT(25)
866574631bSKurt Kanzenbach 
876574631bSKurt Kanzenbach /* FHFTSL register bit definitions */
886574631bSKurt Kanzenbach #define IGC_FHFTSL_FTSL_SHIFT	0
896574631bSKurt Kanzenbach #define IGC_FHFTSL_FTSL_MASK	GENMASK(1, 0)
906574631bSKurt Kanzenbach 
918c5ad0daSSasha Neftin /* Redirection Table - RW Array */
928c5ad0daSSasha Neftin #define IGC_RETA(_i)		(0x05C00 + ((_i) * 4))
932121c271SSasha Neftin /* RSS Random Key - RW Array */
942121c271SSasha Neftin #define IGC_RSSRK(_i)		(0x05C80 + ((_i) * 4))
958c5ad0daSSasha Neftin 
96146740f9SSasha Neftin /* Receive Register Descriptions */
97146740f9SSasha Neftin #define IGC_RCTL		0x00100  /* Rx Control - RW */
98146740f9SSasha Neftin #define IGC_SRRCTL(_n)		(0x0C00C + ((_n) * 0x40))
99146740f9SSasha Neftin #define IGC_PSRTYPE(_i)		(0x05480 + ((_i) * 4))
100146740f9SSasha Neftin #define IGC_RDBAL(_n)		(0x0C000 + ((_n) * 0x40))
101146740f9SSasha Neftin #define IGC_RDBAH(_n)		(0x0C004 + ((_n) * 0x40))
102146740f9SSasha Neftin #define IGC_RDLEN(_n)		(0x0C008 + ((_n) * 0x40))
103146740f9SSasha Neftin #define IGC_RDH(_n)		(0x0C010 + ((_n) * 0x40))
104146740f9SSasha Neftin #define IGC_RDT(_n)		(0x0C018 + ((_n) * 0x40))
105146740f9SSasha Neftin #define IGC_RXDCTL(_n)		(0x0C028 + ((_n) * 0x40))
106146740f9SSasha Neftin #define IGC_RQDPC(_n)		(0x0C030 + ((_n) * 0x40))
107146740f9SSasha Neftin #define IGC_RXCSUM		0x05000  /* Rx Checksum Control - RW */
108146740f9SSasha Neftin #define IGC_RLPML		0x05004  /* Rx Long Packet Max Length */
109146740f9SSasha Neftin #define IGC_RFCTL		0x05008  /* Receive Filter Control*/
110c0071c7aSSasha Neftin #define IGC_MTA			0x05200  /* Multicast Table Array - RW Array */
111f026d8caSVitaly Lifshits #define IGC_RA			0x05400  /* Receive Address - RW Array */
112c0071c7aSSasha Neftin #define IGC_UTA			0x0A000  /* Unicast Table Array - RW */
113146740f9SSasha Neftin #define IGC_RAL(_n)		(0x05400 + ((_n) * 0x08))
114146740f9SSasha Neftin #define IGC_RAH(_n)		(0x05404 + ((_n) * 0x08))
115bbfaa141SAndre Guedes #define IGC_VLANPQF		0x055B0  /* VLAN Priority Queue Filter - RW */
116146740f9SSasha Neftin 
117146740f9SSasha Neftin /* Transmit Register Descriptions */
118146740f9SSasha Neftin #define IGC_TCTL		0x00400  /* Tx Control - RW */
119146740f9SSasha Neftin #define IGC_TIPG		0x00410  /* Tx Inter-packet gap - RW */
120146740f9SSasha Neftin #define IGC_TDBAL(_n)		(0x0E000 + ((_n) * 0x40))
121146740f9SSasha Neftin #define IGC_TDBAH(_n)		(0x0E004 + ((_n) * 0x40))
122146740f9SSasha Neftin #define IGC_TDLEN(_n)		(0x0E008 + ((_n) * 0x40))
123146740f9SSasha Neftin #define IGC_TDH(_n)		(0x0E010 + ((_n) * 0x40))
124146740f9SSasha Neftin #define IGC_TDT(_n)		(0x0E018 + ((_n) * 0x40))
125146740f9SSasha Neftin #define IGC_TXDCTL(_n)		(0x0E028 + ((_n) * 0x40))
126146740f9SSasha Neftin 
127146740f9SSasha Neftin /* MMD Register Descriptions */
128146740f9SSasha Neftin #define IGC_MMDAC		13 /* MMD Access Control */
129146740f9SSasha Neftin #define IGC_MMDAAD		14 /* MMD Access Address/Data */
130146740f9SSasha Neftin 
131146740f9SSasha Neftin /* Statistics Register Descriptions */
132146740f9SSasha Neftin #define IGC_CRCERRS	0x04000  /* CRC Error Count - R/clr */
133146740f9SSasha Neftin #define IGC_ALGNERRC	0x04004  /* Alignment Error Count - R/clr */
134146740f9SSasha Neftin #define IGC_RXERRC	0x0400C  /* Receive Error Count - R/clr */
135146740f9SSasha Neftin #define IGC_MPC		0x04010  /* Missed Packet Count - R/clr */
136146740f9SSasha Neftin #define IGC_SCC		0x04014  /* Single Collision Count - R/clr */
137146740f9SSasha Neftin #define IGC_ECOL	0x04018  /* Excessive Collision Count - R/clr */
138146740f9SSasha Neftin #define IGC_MCC		0x0401C  /* Multiple Collision Count - R/clr */
139146740f9SSasha Neftin #define IGC_LATECOL	0x04020  /* Late Collision Count - R/clr */
140146740f9SSasha Neftin #define IGC_COLC	0x04028  /* Collision Count - R/clr */
14151c657b4SSasha Neftin #define IGC_RERC	0x0402C  /* Receive Error Count - R/clr */
142146740f9SSasha Neftin #define IGC_DC		0x04030  /* Defer Count - R/clr */
143146740f9SSasha Neftin #define IGC_TNCRS	0x04034  /* Tx-No CRS - R/clr */
144480b7a5aSSasha Neftin #define IGC_HTDPMC	0x0403C  /* Host Transmit Discarded by MAC - R/clr */
145146740f9SSasha Neftin #define IGC_RLEC	0x04040  /* Receive Length Error Count - R/clr */
146146740f9SSasha Neftin #define IGC_XONRXC	0x04048  /* XON Rx Count - R/clr */
147146740f9SSasha Neftin #define IGC_XONTXC	0x0404C  /* XON Tx Count - R/clr */
148146740f9SSasha Neftin #define IGC_XOFFRXC	0x04050  /* XOFF Rx Count - R/clr */
149146740f9SSasha Neftin #define IGC_XOFFTXC	0x04054  /* XOFF Tx Count - R/clr */
150146740f9SSasha Neftin #define IGC_FCRUC	0x04058  /* Flow Control Rx Unsupported Count- R/clr */
151146740f9SSasha Neftin #define IGC_PRC64	0x0405C  /* Packets Rx (64 bytes) - R/clr */
152146740f9SSasha Neftin #define IGC_PRC127	0x04060  /* Packets Rx (65-127 bytes) - R/clr */
153146740f9SSasha Neftin #define IGC_PRC255	0x04064  /* Packets Rx (128-255 bytes) - R/clr */
154146740f9SSasha Neftin #define IGC_PRC511	0x04068  /* Packets Rx (255-511 bytes) - R/clr */
155146740f9SSasha Neftin #define IGC_PRC1023	0x0406C  /* Packets Rx (512-1023 bytes) - R/clr */
156146740f9SSasha Neftin #define IGC_PRC1522	0x04070  /* Packets Rx (1024-1522 bytes) - R/clr */
157146740f9SSasha Neftin #define IGC_GPRC	0x04074  /* Good Packets Rx Count - R/clr */
158146740f9SSasha Neftin #define IGC_BPRC	0x04078  /* Broadcast Packets Rx Count - R/clr */
159146740f9SSasha Neftin #define IGC_MPRC	0x0407C  /* Multicast Packets Rx Count - R/clr */
160146740f9SSasha Neftin #define IGC_GPTC	0x04080  /* Good Packets Tx Count - R/clr */
161146740f9SSasha Neftin #define IGC_GORCL	0x04088  /* Good Octets Rx Count Low - R/clr */
162146740f9SSasha Neftin #define IGC_GORCH	0x0408C  /* Good Octets Rx Count High - R/clr */
163146740f9SSasha Neftin #define IGC_GOTCL	0x04090  /* Good Octets Tx Count Low - R/clr */
164146740f9SSasha Neftin #define IGC_GOTCH	0x04094  /* Good Octets Tx Count High - R/clr */
165146740f9SSasha Neftin #define IGC_RNBC	0x040A0  /* Rx No Buffers Count - R/clr */
166146740f9SSasha Neftin #define IGC_RUC		0x040A4  /* Rx Undersize Count - R/clr */
167146740f9SSasha Neftin #define IGC_RFC		0x040A8  /* Rx Fragment Count - R/clr */
168146740f9SSasha Neftin #define IGC_ROC		0x040AC  /* Rx Oversize Count - R/clr */
169146740f9SSasha Neftin #define IGC_RJC		0x040B0  /* Rx Jabber Count - R/clr */
170146740f9SSasha Neftin #define IGC_MGTPRC	0x040B4  /* Management Packets Rx Count - R/clr */
171146740f9SSasha Neftin #define IGC_MGTPDC	0x040B8  /* Management Packets Dropped Count - R/clr */
172146740f9SSasha Neftin #define IGC_MGTPTC	0x040BC  /* Management Packets Tx Count - R/clr */
173146740f9SSasha Neftin #define IGC_TORL	0x040C0  /* Total Octets Rx Low - R/clr */
174146740f9SSasha Neftin #define IGC_TORH	0x040C4  /* Total Octets Rx High - R/clr */
175146740f9SSasha Neftin #define IGC_TOTL	0x040C8  /* Total Octets Tx Low - R/clr */
176146740f9SSasha Neftin #define IGC_TOTH	0x040CC  /* Total Octets Tx High - R/clr */
177146740f9SSasha Neftin #define IGC_TPR		0x040D0  /* Total Packets Rx - R/clr */
178146740f9SSasha Neftin #define IGC_TPT		0x040D4  /* Total Packets Tx - R/clr */
179146740f9SSasha Neftin #define IGC_PTC64	0x040D8  /* Packets Tx (64 bytes) - R/clr */
180146740f9SSasha Neftin #define IGC_PTC127	0x040DC  /* Packets Tx (65-127 bytes) - R/clr */
181146740f9SSasha Neftin #define IGC_PTC255	0x040E0  /* Packets Tx (128-255 bytes) - R/clr */
182146740f9SSasha Neftin #define IGC_PTC511	0x040E4  /* Packets Tx (256-511 bytes) - R/clr */
183146740f9SSasha Neftin #define IGC_PTC1023	0x040E8  /* Packets Tx (512-1023 bytes) - R/clr */
184146740f9SSasha Neftin #define IGC_PTC1522	0x040EC  /* Packets Tx (1024-1522 Bytes) - R/clr */
185146740f9SSasha Neftin #define IGC_MPTC	0x040F0  /* Multicast Packets Tx Count - R/clr */
186146740f9SSasha Neftin #define IGC_BPTC	0x040F4  /* Broadcast Packets Tx Count - R/clr */
187146740f9SSasha Neftin #define IGC_TSCTC	0x040F8  /* TCP Segmentation Context Tx - R/clr */
188146740f9SSasha Neftin #define IGC_IAC		0x04100  /* Interrupt Assertion Count */
189146740f9SSasha Neftin #define IGC_RPTHC	0x04104  /* Rx Packets To Host */
190900d1e8bSSasha Neftin #define IGC_TLPIC	0x04148  /* EEE Tx LPI Count */
191900d1e8bSSasha Neftin #define IGC_RLPIC	0x0414C  /* EEE Rx LPI Count */
192146740f9SSasha Neftin #define IGC_HGPTC	0x04118  /* Host Good Packets Tx Count */
193146740f9SSasha Neftin #define IGC_RXDMTC	0x04120  /* Rx Descriptor Minimum Threshold Count */
194146740f9SSasha Neftin #define IGC_HGORCL	0x04128  /* Host Good Octets Received Count Low */
195146740f9SSasha Neftin #define IGC_HGORCH	0x0412C  /* Host Good Octets Received Count High */
196146740f9SSasha Neftin #define IGC_HGOTCL	0x04130  /* Host Good Octets Transmit Count Low */
197146740f9SSasha Neftin #define IGC_HGOTCH	0x04134  /* Host Good Octets Transmit Count High */
198146740f9SSasha Neftin #define IGC_LENERRS	0x04138  /* Length Errors Count */
199146740f9SSasha Neftin 
2005f295805SVinicius Costa Gomes /* Time sync registers */
2015f295805SVinicius Costa Gomes #define IGC_TSICR	0x0B66C  /* Time Sync Interrupt Cause */
2025f295805SVinicius Costa Gomes #define IGC_TSIM	0x0B674  /* Time Sync Interrupt Mask Register */
2035f295805SVinicius Costa Gomes #define IGC_TSAUXC	0x0B640  /* Timesync Auxiliary Control register */
2045f295805SVinicius Costa Gomes #define IGC_TSYNCRXCTL	0x0B620  /* Rx Time Sync Control register - RW */
2055f295805SVinicius Costa Gomes #define IGC_TSYNCTXCTL	0x0B614  /* Tx Time Sync Control register - RW */
2065f295805SVinicius Costa Gomes #define IGC_TSYNCRXCFG	0x05F50  /* Time Sync Rx Configuration - RW */
2075f295805SVinicius Costa Gomes #define IGC_TSSDP	0x0003C  /* Time Sync SDP Configuration Register - RW */
20887938851SEderson de Souza #define IGC_TRGTTIML0	0x0B644 /* Target Time Register 0 Low  - RW */
20987938851SEderson de Souza #define IGC_TRGTTIMH0	0x0B648 /* Target Time Register 0 High - RW */
21087938851SEderson de Souza #define IGC_TRGTTIML1	0x0B64C /* Target Time Register 1 Low  - RW */
21187938851SEderson de Souza #define IGC_TRGTTIMH1	0x0B650 /* Target Time Register 1 High - RW */
21287938851SEderson de Souza #define IGC_FREQOUT0	0x0B654 /* Frequency Out 0 Control Register - RW */
21387938851SEderson de Souza #define IGC_FREQOUT1	0x0B658 /* Frequency Out 1 Control Register - RW */
21487938851SEderson de Souza #define IGC_AUXSTMPL0	0x0B65C /* Auxiliary Time Stamp 0 Register Low  - RO */
21587938851SEderson de Souza #define IGC_AUXSTMPH0	0x0B660 /* Auxiliary Time Stamp 0 Register High - RO */
21687938851SEderson de Souza #define IGC_AUXSTMPL1	0x0B664 /* Auxiliary Time Stamp 1 Register Low  - RO */
21787938851SEderson de Souza #define IGC_AUXSTMPH1	0x0B668 /* Auxiliary Time Stamp 1 Register High - RO */
2185f295805SVinicius Costa Gomes 
2195f295805SVinicius Costa Gomes #define IGC_IMIR(_i)	(0x05A80 + ((_i) * 4))  /* Immediate Interrupt */
2205f295805SVinicius Costa Gomes #define IGC_IMIREXT(_i)	(0x05AA0 + ((_i) * 4))  /* Immediate INTR Ext*/
2215f295805SVinicius Costa Gomes 
2225f295805SVinicius Costa Gomes #define IGC_FTQF(_n)	(0x059E0 + (4 * (_n)))  /* 5-tuple Queue Fltr */
22381b05520SVinicius Costa Gomes 
224ec50a9d4SVinicius Costa Gomes /* Transmit Scheduling Registers */
225ec50a9d4SVinicius Costa Gomes #define IGC_TQAVCTRL		0x3570
226ec50a9d4SVinicius Costa Gomes #define IGC_TXQCTL(_n)		(0x3344 + 0x4 * (_n))
227790835fcSMuhammad Husaini Zulkifli #define IGC_GTXOFFSET		0x3310
228ec50a9d4SVinicius Costa Gomes #define IGC_BASET_L		0x3314
229ec50a9d4SVinicius Costa Gomes #define IGC_BASET_H		0x3318
230ec50a9d4SVinicius Costa Gomes #define IGC_QBVCYCLET		0x331C
231ec50a9d4SVinicius Costa Gomes #define IGC_QBVCYCLET_S		0x3320
232ec50a9d4SVinicius Costa Gomes 
233ec50a9d4SVinicius Costa Gomes #define IGC_STQT(_n)		(0x3324 + 0x4 * (_n))
234ec50a9d4SVinicius Costa Gomes #define IGC_ENDQT(_n)		(0x3334 + 0x4 * (_n))
235ec50a9d4SVinicius Costa Gomes #define IGC_DTXMXPKTSZ		0x355C
236ec50a9d4SVinicius Costa Gomes 
2371ab011b0SAravindhan Gunasekaran #define IGC_TQAVCC(_n)		(0x3004 + ((_n) * 0x40))
2381ab011b0SAravindhan Gunasekaran #define IGC_TQAVHC(_n)		(0x300C + ((_n) * 0x40))
2391ab011b0SAravindhan Gunasekaran 
2405f295805SVinicius Costa Gomes /* System Time Registers */
2415f295805SVinicius Costa Gomes #define IGC_SYSTIML	0x0B600  /* System time register Low - RO */
2425f295805SVinicius Costa Gomes #define IGC_SYSTIMH	0x0B604  /* System time register High - RO */
2435f295805SVinicius Costa Gomes #define IGC_SYSTIMR	0x0B6F8  /* System time register Residue */
2445f295805SVinicius Costa Gomes #define IGC_TIMINCA	0x0B608  /* Increment attributes register - RW */
2455f295805SVinicius Costa Gomes 
246*3ed247e7SVinicius Costa Gomes /* TX Timestamp Low */
247*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPL_0		0x0B618
248*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPL_1		0x0B698
249*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPL_2		0x0B6B8
250*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPL_3		0x0B6D8
251*3ed247e7SVinicius Costa Gomes 
252*3ed247e7SVinicius Costa Gomes /* TX Timestamp High */
253*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPH_0		0x0B61C
254*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPH_1		0x0B69C
255*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPH_2		0x0B6BC
256*3ed247e7SVinicius Costa Gomes #define IGC_TXSTMPH_3		0x0B6DC
257*3ed247e7SVinicius Costa Gomes 
2585f295805SVinicius Costa Gomes #define IGC_TXSTMPL	0x0B618  /* Tx timestamp value Low - RO */
2595f295805SVinicius Costa Gomes #define IGC_TXSTMPH	0x0B61C  /* Tx timestamp value High - RO */
2605f295805SVinicius Costa Gomes 
261a90ec848SVinicius Costa Gomes #define IGC_TIMADJ	0x0B60C  /* Time Adjustment Offset Register */
262a90ec848SVinicius Costa Gomes 
263a90ec848SVinicius Costa Gomes /* PCIe Registers */
264a90ec848SVinicius Costa Gomes #define IGC_PTM_CTRL		0x12540  /* PTM Control */
265a90ec848SVinicius Costa Gomes #define IGC_PTM_STAT		0x12544  /* PTM Status */
266a90ec848SVinicius Costa Gomes #define IGC_PTM_CYCLE_CTRL	0x1254C  /* PTM Cycle Control */
267a90ec848SVinicius Costa Gomes 
268a90ec848SVinicius Costa Gomes /* PTM Time registers */
269a90ec848SVinicius Costa Gomes #define IGC_PTM_T1_TIM0_L	0x12558  /* T1 on Timer 0 Low */
270a90ec848SVinicius Costa Gomes #define IGC_PTM_T1_TIM0_H	0x1255C  /* T1 on Timer 0 High */
271a90ec848SVinicius Costa Gomes 
272a90ec848SVinicius Costa Gomes #define IGC_PTM_CURR_T2_L	0x1258C  /* Current T2 Low */
273a90ec848SVinicius Costa Gomes #define IGC_PTM_CURR_T2_H	0x12590  /* Current T2 High */
274a90ec848SVinicius Costa Gomes #define IGC_PTM_PREV_T2_L	0x12584  /* Previous T2 Low */
275a90ec848SVinicius Costa Gomes #define IGC_PTM_PREV_T2_H	0x12588  /* Previous T2 High */
276a90ec848SVinicius Costa Gomes #define IGC_PTM_PREV_T4M1	0x12578  /* T4 Minus T1 on previous PTM Cycle */
277a90ec848SVinicius Costa Gomes #define IGC_PTM_CURR_T4M1	0x1257C  /* T4 Minus T1 on this PTM Cycle */
278a90ec848SVinicius Costa Gomes #define IGC_PTM_PREV_T3M2	0x12580  /* T3 Minus T2 on previous PTM Cycle */
279a90ec848SVinicius Costa Gomes #define IGC_PTM_TDELAY		0x12594  /* PTM PCIe Link Delay */
280a90ec848SVinicius Costa Gomes 
281a90ec848SVinicius Costa Gomes #define IGC_PCIE_DIG_DELAY	0x12550  /* PCIe Digital Delay */
282a90ec848SVinicius Costa Gomes #define IGC_PCIE_PHY_DELAY	0x12554  /* PCIe PHY Delay */
283a90ec848SVinicius Costa Gomes 
28413b5b7fdSSasha Neftin /* Management registers */
28513b5b7fdSSasha Neftin #define IGC_MANC	0x05820  /* Management Control - RW */
28613b5b7fdSSasha Neftin 
287ab405612SSasha Neftin /* Shadow Ram Write Register - RW */
288ab405612SSasha Neftin #define IGC_SRWR	0x12018
289ab405612SSasha Neftin 
2909513d2a5SSasha Neftin /* Wake Up registers */
2919513d2a5SSasha Neftin #define IGC_WUC		0x05800  /* Wakeup Control - RW */
2929513d2a5SSasha Neftin #define IGC_WUFC	0x05808  /* Wakeup Filter Control - RW */
2939513d2a5SSasha Neftin #define IGC_WUS		0x05810  /* Wakeup Status - R/W1C */
2949513d2a5SSasha Neftin #define IGC_WUPL	0x05900  /* Wakeup Packet Length - RW */
2956574631bSKurt Kanzenbach #define IGC_WUFC_EXT	0x0580C  /* Wakeup Filter Control Register Extended - RW */
2969513d2a5SSasha Neftin 
2979513d2a5SSasha Neftin /* Wake Up packet memory */
2989513d2a5SSasha Neftin #define IGC_WUPM_REG(_i)	(0x05A00 + ((_i) * 4))
2999513d2a5SSasha Neftin 
30093ec439aSSasha Neftin /* Energy Efficient Ethernet "EEE" registers */
30193ec439aSSasha Neftin #define IGC_EEER	0x0E30 /* Energy Efficient Ethernet "EEE"*/
30293ec439aSSasha Neftin #define IGC_IPCNFG	0x0E38 /* Internal PHY Configuration */
30393ec439aSSasha Neftin #define IGC_EEE_SU	0x0E34 /* EEE Setup */
30493ec439aSSasha Neftin 
305707abf06SSasha Neftin /* LTR registers */
306707abf06SSasha Neftin #define IGC_LTRC	0x01A0 /* Latency Tolerance Reporting Control */
307707abf06SSasha Neftin #define IGC_LTRMINV	0x5BB0 /* LTR Minimum Value */
308707abf06SSasha Neftin #define IGC_LTRMAXV	0x5BB4 /* LTR Maximum Value */
309707abf06SSasha Neftin 
310146740f9SSasha Neftin /* forward declaration */
311146740f9SSasha Neftin struct igc_hw;
312146740f9SSasha Neftin u32 igc_rd32(struct igc_hw *hw, u32 reg);
313146740f9SSasha Neftin 
314146740f9SSasha Neftin /* write operations, indexed using DWORDS */
315146740f9SSasha Neftin #define wr32(reg, val) \
316146740f9SSasha Neftin do { \
317146740f9SSasha Neftin 	u8 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \
3187c1ddceeSLennert Buytenhek 	if (!IGC_REMOVED(hw_addr)) \
319146740f9SSasha Neftin 		writel((val), &hw_addr[(reg)]); \
320146740f9SSasha Neftin } while (0)
321146740f9SSasha Neftin 
322146740f9SSasha Neftin #define rd32(reg) (igc_rd32(hw, reg))
323146740f9SSasha Neftin 
324146740f9SSasha Neftin #define wrfl() ((void)rd32(IGC_STATUS))
325146740f9SSasha Neftin 
326146740f9SSasha Neftin #define array_wr32(reg, offset, value) \
327146740f9SSasha Neftin 	wr32((reg) + ((offset) << 2), (value))
328146740f9SSasha Neftin 
329146740f9SSasha Neftin #define array_rd32(reg, offset) (igc_rd32(hw, (reg) + ((offset) << 2)))
330146740f9SSasha Neftin 
3317c1ddceeSLennert Buytenhek #define IGC_REMOVED(h) unlikely(!(h))
3327c1ddceeSLennert Buytenhek 
333146740f9SSasha Neftin #endif
334