1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2020 Marvell International Ltd. 4 * 5 * Functions for AGL (RGMII) initialization, configuration, 6 * and monitoring. 7 */ 8 9 #ifndef __CVMX_HELPER_AGL_H__ 10 #define __CVMX_HELPER_AGL_H__ 11 12 int __cvmx_helper_agl_enumerate(int interface); 13 14 int cvmx_helper_agl_get_port(int xiface); 15 16 /** 17 * @INTERNAL 18 * Probe a RGMII interface and determine the number of ports 19 * connected to it. The RGMII interface should still be down 20 * after this call. 21 * 22 * @param interface Interface to probe 23 * 24 * @return Number of ports on the interface. Zero to disable. 25 */ 26 int __cvmx_helper_agl_probe(int interface); 27 28 /** 29 * @INTERNAL 30 * Bringup and enable a RGMII interface. After this call packet 31 * I/O should be fully functional. This is called with IPD 32 * enabled but PKO disabled. 33 * 34 * @param interface Interface to bring up 35 * 36 * @return Zero on success, negative on failure 37 */ 38 int __cvmx_helper_agl_enable(int interface); 39 40 /** 41 * @INTERNAL 42 * Return the link state of an IPD/PKO port as returned by 43 * auto negotiation. The result of this function may not match 44 * Octeon's link config if auto negotiation has changed since 45 * the last call to cvmx_helper_link_set(). 46 * 47 * @param ipd_port IPD/PKO port to query 48 * 49 * @return Link state 50 */ 51 cvmx_helper_link_info_t __cvmx_helper_agl_link_get(int ipd_port); 52 53 /** 54 * @INTERNAL 55 * Configure an IPD/PKO port for the specified link state. This 56 * function does not influence auto negotiation at the PHY level. 57 * The passed link state must always match the link state returned 58 * by cvmx_helper_link_get(). It is normally best to use 59 * cvmx_helper_link_autoconf() instead. 60 * 61 * @param ipd_port IPD/PKO port to configure 62 * @param link_info The new link state 63 * 64 * @return Zero on success, negative on failure 65 */ 66 int __cvmx_helper_agl_link_set(int ipd_port, cvmx_helper_link_info_t link_info); 67 68 #endif /* __CVMX_HELPER_AGL_H__ */ 69