1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*******************************************************************************
3   MMC Header file
4 
5   Copyright (C) 2011  STMicroelectronics Ltd
6 
7 
8   Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
9 *******************************************************************************/
10 
11 #ifndef __MMC_H__
12 #define __MMC_H__
13 
14 /* MMC control register */
15 /* When set, all counter are reset */
16 #define MMC_CNTRL_COUNTER_RESET		0x1
17 /* When set, do not roll over zero after reaching the max value*/
18 #define MMC_CNTRL_COUNTER_STOP_ROLLOVER	0x2
19 #define MMC_CNTRL_RESET_ON_READ		0x4	/* Reset after reading */
20 #define MMC_CNTRL_COUNTER_FREEZER	0x8	/* Freeze counter values to the
21 						 * current value.*/
22 #define MMC_CNTRL_PRESET		0x10
23 #define MMC_CNTRL_FULL_HALF_PRESET	0x20
24 
25 #define MMC_GMAC4_OFFSET		0x700
26 #define MMC_GMAC3_X_OFFSET		0x100
27 
28 struct stmmac_counters {
29 	unsigned int mmc_tx_octetcount_gb;
30 	unsigned int mmc_tx_framecount_gb;
31 	unsigned int mmc_tx_broadcastframe_g;
32 	unsigned int mmc_tx_multicastframe_g;
33 	unsigned int mmc_tx_64_octets_gb;
34 	unsigned int mmc_tx_65_to_127_octets_gb;
35 	unsigned int mmc_tx_128_to_255_octets_gb;
36 	unsigned int mmc_tx_256_to_511_octets_gb;
37 	unsigned int mmc_tx_512_to_1023_octets_gb;
38 	unsigned int mmc_tx_1024_to_max_octets_gb;
39 	unsigned int mmc_tx_unicast_gb;
40 	unsigned int mmc_tx_multicast_gb;
41 	unsigned int mmc_tx_broadcast_gb;
42 	unsigned int mmc_tx_underflow_error;
43 	unsigned int mmc_tx_singlecol_g;
44 	unsigned int mmc_tx_multicol_g;
45 	unsigned int mmc_tx_deferred;
46 	unsigned int mmc_tx_latecol;
47 	unsigned int mmc_tx_exesscol;
48 	unsigned int mmc_tx_carrier_error;
49 	unsigned int mmc_tx_octetcount_g;
50 	unsigned int mmc_tx_framecount_g;
51 	unsigned int mmc_tx_excessdef;
52 	unsigned int mmc_tx_pause_frame;
53 	unsigned int mmc_tx_vlan_frame_g;
54 
55 	/* MMC RX counter registers */
56 	unsigned int mmc_rx_framecount_gb;
57 	unsigned int mmc_rx_octetcount_gb;
58 	unsigned int mmc_rx_octetcount_g;
59 	unsigned int mmc_rx_broadcastframe_g;
60 	unsigned int mmc_rx_multicastframe_g;
61 	unsigned int mmc_rx_crc_error;
62 	unsigned int mmc_rx_align_error;
63 	unsigned int mmc_rx_run_error;
64 	unsigned int mmc_rx_jabber_error;
65 	unsigned int mmc_rx_undersize_g;
66 	unsigned int mmc_rx_oversize_g;
67 	unsigned int mmc_rx_64_octets_gb;
68 	unsigned int mmc_rx_65_to_127_octets_gb;
69 	unsigned int mmc_rx_128_to_255_octets_gb;
70 	unsigned int mmc_rx_256_to_511_octets_gb;
71 	unsigned int mmc_rx_512_to_1023_octets_gb;
72 	unsigned int mmc_rx_1024_to_max_octets_gb;
73 	unsigned int mmc_rx_unicast_g;
74 	unsigned int mmc_rx_length_error;
75 	unsigned int mmc_rx_autofrangetype;
76 	unsigned int mmc_rx_pause_frames;
77 	unsigned int mmc_rx_fifo_overflow;
78 	unsigned int mmc_rx_vlan_frames_gb;
79 	unsigned int mmc_rx_watchdog_error;
80 	/* IPC */
81 	unsigned int mmc_rx_ipc_intr_mask;
82 	unsigned int mmc_rx_ipc_intr;
83 	/* IPv4 */
84 	unsigned int mmc_rx_ipv4_gd;
85 	unsigned int mmc_rx_ipv4_hderr;
86 	unsigned int mmc_rx_ipv4_nopay;
87 	unsigned int mmc_rx_ipv4_frag;
88 	unsigned int mmc_rx_ipv4_udsbl;
89 
90 	unsigned int mmc_rx_ipv4_gd_octets;
91 	unsigned int mmc_rx_ipv4_hderr_octets;
92 	unsigned int mmc_rx_ipv4_nopay_octets;
93 	unsigned int mmc_rx_ipv4_frag_octets;
94 	unsigned int mmc_rx_ipv4_udsbl_octets;
95 
96 	/* IPV6 */
97 	unsigned int mmc_rx_ipv6_gd_octets;
98 	unsigned int mmc_rx_ipv6_hderr_octets;
99 	unsigned int mmc_rx_ipv6_nopay_octets;
100 
101 	unsigned int mmc_rx_ipv6_gd;
102 	unsigned int mmc_rx_ipv6_hderr;
103 	unsigned int mmc_rx_ipv6_nopay;
104 
105 	/* Protocols */
106 	unsigned int mmc_rx_udp_gd;
107 	unsigned int mmc_rx_udp_err;
108 	unsigned int mmc_rx_tcp_gd;
109 	unsigned int mmc_rx_tcp_err;
110 	unsigned int mmc_rx_icmp_gd;
111 	unsigned int mmc_rx_icmp_err;
112 
113 	unsigned int mmc_rx_udp_gd_octets;
114 	unsigned int mmc_rx_udp_err_octets;
115 	unsigned int mmc_rx_tcp_gd_octets;
116 	unsigned int mmc_rx_tcp_err_octets;
117 	unsigned int mmc_rx_icmp_gd_octets;
118 	unsigned int mmc_rx_icmp_err_octets;
119 };
120 
121 #endif /* __MMC_H__ */
122