mediatek: mt7622: add Linux 5.10 support
[openwrt/staging/rmilecki.git] / target / linux / mediatek / files-5.10 / drivers / net / phy / rtk / rtl8367c / include / interrupt.h
1 /*
2 * Copyright (C) 2013 Realtek Semiconductor Corp.
3 * All Rights Reserved.
4 *
5 * Unless you and Realtek execute a separate written software license
6 * agreement governing use of this software, this software is licensed
7 * to you under the terms of the GNU General Public License version 2,
8 * available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9 *
10 * Purpose : RTL8367/RTL8367C switch high-level API
11 *
12 * Feature : The file includes Interrupt module high-layer API defination
13 *
14 */
15
16 #ifndef __RTK_API_INTERRUPT_H__
17 #define __RTK_API_INTERRUPT_H__
18
19
20 /*
21 * Data Type Declaration
22 */
23 #define RTK_MAX_NUM_OF_INTERRUPT_TYPE 1
24
25
26 typedef struct rtk_int_status_s
27 {
28 rtk_uint16 value[RTK_MAX_NUM_OF_INTERRUPT_TYPE];
29 } rtk_int_status_t;
30
31 typedef struct rtk_int_info_s
32 {
33 rtk_portmask_t portMask;
34 rtk_uint32 meterMask;
35 rtk_uint32 systemLearnOver;
36 }rtk_int_info_t;
37
38 typedef enum rtk_int_type_e
39 {
40 INT_TYPE_LINK_STATUS = 0,
41 INT_TYPE_METER_EXCEED,
42 INT_TYPE_LEARN_LIMIT,
43 INT_TYPE_LINK_SPEED,
44 INT_TYPE_CONGEST,
45 INT_TYPE_GREEN_FEATURE,
46 INT_TYPE_LOOP_DETECT,
47 INT_TYPE_8051,
48 INT_TYPE_CABLE_DIAG,
49 INT_TYPE_ACL,
50 INT_TYPE_RESERVED, /* Unused */
51 INT_TYPE_SLIENT,
52 INT_TYPE_END
53 }rtk_int_type_t;
54
55 typedef enum rtk_int_advType_e
56 {
57 ADV_L2_LEARN_PORT_MASK = 0,
58 ADV_SPEED_CHANGE_PORT_MASK,
59 ADV_SPECIAL_CONGESTION_PORT_MASK,
60 ADV_PORT_LINKDOWN_PORT_MASK,
61 ADV_PORT_LINKUP_PORT_MASK,
62 ADV_METER_EXCEED_MASK,
63 ADV_RLDP_LOOPED,
64 ADV_RLDP_RELEASED,
65 ADV_END,
66 } rtk_int_advType_t;
67
68 typedef enum rtk_int_polarity_e
69 {
70 INT_POLAR_HIGH = 0,
71 INT_POLAR_LOW,
72 INT_POLAR_END
73 } rtk_int_polarity_t;
74
75 /* Function Name:
76 * rtk_int_polarity_set
77 * Description:
78 * Set interrupt polarity configuration.
79 * Input:
80 * type - Interruptpolarity type.
81 * Output:
82 * None
83 * Return:
84 * RT_ERR_OK - OK
85 * RT_ERR_FAILED - Failed
86 * RT_ERR_SMI - SMI access error
87 * RT_ERR_INPUT - Invalid input parameters.
88 * Note:
89 * The API can set interrupt polarity configuration.
90 */
91 extern rtk_api_ret_t rtk_int_polarity_set(rtk_int_polarity_t type);
92
93 /* Function Name:
94 * rtk_int_polarity_get
95 * Description:
96 * Get interrupt polarity configuration.
97 * Input:
98 * None
99 * Output:
100 * pType - Interruptpolarity type.
101 * Return:
102 * RT_ERR_OK - OK
103 * RT_ERR_FAILED - Failed
104 * RT_ERR_SMI - SMI access error
105 * Note:
106 * The API can get interrupt polarity configuration.
107 */
108 extern rtk_api_ret_t rtk_int_polarity_get(rtk_int_polarity_t *pType);
109
110 /* Function Name:
111 * rtk_int_control_set
112 * Description:
113 * Set interrupt trigger status configuration.
114 * Input:
115 * type - Interrupt type.
116 * enable - Interrupt status.
117 * Output:
118 * None
119 * Return:
120 * RT_ERR_OK - OK
121 * RT_ERR_FAILED - Failed
122 * RT_ERR_SMI - SMI access error
123 * RT_ERR_INPUT - Invalid input parameters.
124 * RT_ERR_ENABLE - Invalid enable input.
125 * Note:
126 * The API can set interrupt status configuration.
127 * The interrupt trigger status is shown in the following:
128 * - INT_TYPE_LINK_STATUS
129 * - INT_TYPE_METER_EXCEED
130 * - INT_TYPE_LEARN_LIMIT
131 * - INT_TYPE_LINK_SPEED
132 * - INT_TYPE_CONGEST
133 * - INT_TYPE_GREEN_FEATURE
134 * - INT_TYPE_LOOP_DETECT
135 * - INT_TYPE_8051,
136 * - INT_TYPE_CABLE_DIAG,
137 * - INT_TYPE_ACL,
138 * - INT_TYPE_SLIENT
139 */
140 extern rtk_api_ret_t rtk_int_control_set(rtk_int_type_t type, rtk_enable_t enable);
141
142 /* Function Name:
143 * rtk_int_control_get
144 * Description:
145 * Get interrupt trigger status configuration.
146 * Input:
147 * type - Interrupt type.
148 * Output:
149 * pEnable - Interrupt status.
150 * Return:
151 * RT_ERR_OK - OK
152 * RT_ERR_FAILED - Failed
153 * RT_ERR_SMI - SMI access error
154 * RT_ERR_INPUT - Invalid input parameters.
155 * Note:
156 * The API can get interrupt status configuration.
157 * The interrupt trigger status is shown in the following:
158 * - INT_TYPE_LINK_STATUS
159 * - INT_TYPE_METER_EXCEED
160 * - INT_TYPE_LEARN_LIMIT
161 * - INT_TYPE_LINK_SPEED
162 * - INT_TYPE_CONGEST
163 * - INT_TYPE_GREEN_FEATURE
164 * - INT_TYPE_LOOP_DETECT
165 * - INT_TYPE_8051,
166 * - INT_TYPE_CABLE_DIAG,
167 * - INT_TYPE_ACL,
168 * - INT_TYPE_SLIENT
169 */
170 extern rtk_api_ret_t rtk_int_control_get(rtk_int_type_t type, rtk_enable_t* pEnable);
171
172 /* Function Name:
173 * rtk_int_status_set
174 * Description:
175 * Set interrupt trigger status to clean.
176 * Input:
177 * None
178 * Output:
179 * pStatusMask - Interrupt status bit mask.
180 * Return:
181 * RT_ERR_OK - OK
182 * RT_ERR_FAILED - Failed
183 * RT_ERR_SMI - SMI access error
184 * RT_ERR_INPUT - Invalid input parameters.
185 * Note:
186 * The API can clean interrupt trigger status when interrupt happened.
187 * The interrupt trigger status is shown in the following:
188 * - INT_TYPE_LINK_STATUS (value[0] (Bit0))
189 * - INT_TYPE_METER_EXCEED (value[0] (Bit1))
190 * - INT_TYPE_LEARN_LIMIT (value[0] (Bit2))
191 * - INT_TYPE_LINK_SPEED (value[0] (Bit3))
192 * - INT_TYPE_CONGEST (value[0] (Bit4))
193 * - INT_TYPE_GREEN_FEATURE (value[0] (Bit5))
194 * - INT_TYPE_LOOP_DETECT (value[0] (Bit6))
195 * - INT_TYPE_8051 (value[0] (Bit7))
196 * - INT_TYPE_CABLE_DIAG (value[0] (Bit8))
197 * - INT_TYPE_ACL (value[0] (Bit9))
198 * - INT_TYPE_SLIENT (value[0] (Bit11))
199 * The status will be cleared after execute this API.
200 */
201 extern rtk_api_ret_t rtk_int_status_set(rtk_int_status_t *pStatusMask);
202
203 /* Function Name:
204 * rtk_int_status_get
205 * Description:
206 * Get interrupt trigger status.
207 * Input:
208 * None
209 * Output:
210 * pStatusMask - Interrupt status bit mask.
211 * Return:
212 * RT_ERR_OK - OK
213 * RT_ERR_FAILED - Failed
214 * RT_ERR_SMI - SMI access error
215 * RT_ERR_INPUT - Invalid input parameters.
216 * Note:
217 * The API can get interrupt trigger status when interrupt happened.
218 * The interrupt trigger status is shown in the following:
219 * - INT_TYPE_LINK_STATUS (value[0] (Bit0))
220 * - INT_TYPE_METER_EXCEED (value[0] (Bit1))
221 * - INT_TYPE_LEARN_LIMIT (value[0] (Bit2))
222 * - INT_TYPE_LINK_SPEED (value[0] (Bit3))
223 * - INT_TYPE_CONGEST (value[0] (Bit4))
224 * - INT_TYPE_GREEN_FEATURE (value[0] (Bit5))
225 * - INT_TYPE_LOOP_DETECT (value[0] (Bit6))
226 * - INT_TYPE_8051 (value[0] (Bit7))
227 * - INT_TYPE_CABLE_DIAG (value[0] (Bit8))
228 * - INT_TYPE_ACL (value[0] (Bit9))
229 * - INT_TYPE_SLIENT (value[0] (Bit11))
230 *
231 */
232 extern rtk_api_ret_t rtk_int_status_get(rtk_int_status_t* pStatusMask);
233
234 /* Function Name:
235 * rtk_int_advanceInfo_get
236 * Description:
237 * Get interrupt advanced information.
238 * Input:
239 * adv_type - Advanced interrupt type.
240 * Output:
241 * info - Information per type.
242 * Return:
243 * RT_ERR_OK - OK
244 * RT_ERR_FAILED - Failed
245 * RT_ERR_SMI - SMI access error
246 * RT_ERR_INPUT - Invalid input parameters.
247 * Note:
248 * This API can get advanced information when interrupt happened.
249 * The status will be cleared after execute this API.
250 */
251 extern rtk_api_ret_t rtk_int_advanceInfo_get(rtk_int_advType_t adv_type, rtk_int_info_t* info);
252
253
254 #endif /* __RTK_API_INTERRUPT_H__ */