4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1, (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1, (the "License").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 #ifndef __ECORE_PHY_API_H__
37 #define __ECORE_PHY_API_H__
40 * @brief Phy core write
45 * @param addr - nvm offset
46 * @param p_phy_result_buf - result buffer
47 * @param data_hi - low 32 bit of data to write
48 * @param data_lo - high 32 bit of data to write
50 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
52 int ecore_phy_core_write(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
53 u32 port
, u32 addr
, u32 data_lo
, u32 data_hi
,
54 char *p_phy_result_buf
);
57 * @brief Phy core read
62 * @param addr - nvm offset
63 * @param p_phy_result_buf - result buffer
65 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
67 int ecore_phy_core_read(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
68 u32 port
, u32 addr
, char *p_phy_result_buf
);
71 * @brief Phy raw write
77 * @param addr - nvm offset
78 * @param p_phy_result_buf - result buffer
79 * @param data_hi - low 32 bit of data to write
80 * @param data_lo - high 32 bit of data to write
82 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
84 int ecore_phy_raw_write(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
85 u32 port
, u32 lane
, u32 addr
, u32 data_lo
,
86 u32 data_hi
, char *p_phy_result_buf
);
95 * @param addr - nvm offset
96 * @param p_phy_result_buf - result buffer
98 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
100 int ecore_phy_raw_read(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
101 u32 port
, u32 lane
, u32 addr
, char *p_phy_result_buf
);
104 * @brief Phy mac status
109 * @param p_phy_result_buf - result buffer
111 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
113 int ecore_phy_mac_stat(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
114 u32 port
, char *p_phy_result_buf
);
121 * @param p_phy_result_buf - result buffer
123 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
125 int ecore_phy_info(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
126 char *p_phy_result_buf
);
134 * @param addr - I2C address
135 * @param offset - EEPROM offset
136 * @param size - number of bytes to write
137 * @param val - byte array to write (1, 2 or 4 bytes)
138 * @param p_phy_result_buf - result buffer
140 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
142 int ecore_phy_sfp_write(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
143 u32 port
, u32 addr
, u32 offset
, u32 size
,
144 u32 val
, char *p_phy_result_buf
);
152 * @param addr - I2C address
153 * @param offset - EEPROM offset
154 * @param size - number of bytes to read
155 * @param p_phy_result_buf - result buffer
157 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
159 int ecore_phy_sfp_read(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
160 u32 port
, u32 addr
, u32 offset
, u32 size
,
161 char *p_phy_result_buf
);
169 * @param p_phy_result_buf - result buffer
171 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
173 int ecore_phy_sfp_decode(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
174 u32 port
, char *p_phy_result_buf
);
177 * @brief Sfp get inserted
182 * @param p_phy_result_buf - result buffer
184 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
186 int ecore_phy_sfp_get_inserted(struct ecore_hwfn
*p_hwfn
,
187 struct ecore_ptt
*p_ptt
,
188 u32 port
, char *p_phy_result_buf
);
191 * @brief Sfp get txdisable
196 * @param p_phy_result_buf - result buffer
198 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
200 int ecore_phy_sfp_get_txdisable(struct ecore_hwfn
*p_hwfn
,
201 struct ecore_ptt
*p_ptt
,
202 u32 port
, char *p_phy_result_buf
);
205 * @brief Sfp set txdisable
210 * @param txdisable - tx disable value to set
211 * @param p_phy_result_buf - result buffer
213 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
215 int ecore_phy_sfp_set_txdisable(struct ecore_hwfn
*p_hwfn
,
216 struct ecore_ptt
*p_ptt
,
217 u32 port
, u8 txdisable
,
218 char *p_phy_result_buf
);
221 * @brief Sfp get txreset
226 * @param p_phy_result_buf - result buffer
228 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
230 int ecore_phy_sfp_get_txreset(struct ecore_hwfn
*p_hwfn
,
231 struct ecore_ptt
*p_ptt
,
232 u32 port
, char *p_phy_result_buf
);
235 * @brief Sfp get rxlos
240 * @param p_phy_result_buf - result buffer
242 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
244 int ecore_phy_sfp_get_rxlos(struct ecore_hwfn
*p_hwfn
,
245 struct ecore_ptt
*p_ptt
,
246 u32 port
, char *p_phy_result_buf
);
249 * @brief Sfp get eeprom
254 * @param p_phy_result_buf - result buffer
256 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
258 int ecore_phy_sfp_get_eeprom(struct ecore_hwfn
*p_hwfn
,
259 struct ecore_ptt
*p_ptt
,
260 u32 port
, char *p_phy_result_buf
);
267 * @param gpio - gpio number
268 * @param gpio_val - value to write to gpio
269 * @param p_phy_result_buf - result buffer
271 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
273 int ecore_phy_gpio_write(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
274 u16 gpio
, u16 gpio_val
, char *p_phy_result_buf
);
281 * @param gpio - gpio number
282 * @param p_phy_result_buf - result buffer
284 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
286 int ecore_phy_gpio_read(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
287 u16 gpio
, char *p_phy_result_buf
);
290 * @brief Gpio get information
294 * @param gpio - gpio number
295 * @param p_phy_result_buf - result buffer
297 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
299 int ecore_phy_gpio_info(struct ecore_hwfn
*p_hwfn
,
300 struct ecore_ptt
*p_ptt
,
301 u16 gpio
, char *p_phy_result_buf
);
304 * @brief Ext-Phy Read operation
308 * @param port - port number
309 * @param devad - device address
310 * @param reg - register
311 * @param p_phy_result_buf - result buffer
313 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
315 int ecore_phy_extphy_read(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
316 u16 port
, u16 devad
, u16 reg
, char *p_phy_result_buf
);
319 * @brief Ext-Phy Write operation
323 * @param port - port number
324 * @param devad - device address
325 * @param reg - register
326 * @param val - value to be written
327 * @param p_phy_result_buf - result buffer
329 * @return enum _ecore_status_t - ECORE_SUCCESS - operation was successful.
331 int ecore_phy_extphy_write(struct ecore_hwfn
*p_hwfn
, struct ecore_ptt
*p_ptt
,
332 u16 port
, u16 devad
, u16 reg
, u16 val
,
333 char *p_phy_result_buf
);