1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2020 Marvell International Ltd. 4 * 5 * Functions for ILK initialization, configuration, 6 * and monitoring. 7 */ 8 9 #ifndef __CVMX_HELPER_ILK_H__ 10 #define __CVMX_HELPER_ILK_H__ 11 12 int __cvmx_helper_ilk_enumerate(int interface); 13 14 /** 15 * @INTERNAL 16 * Clear all calendar entries to the xoff state. This 17 * means no data is sent or received. 18 * 19 * @param interface Interface whose calendar are to be initialized. 20 */ 21 void __cvmx_ilk_clear_cal(int interface); 22 23 /** 24 * @INTERNAL 25 * Setup the channel's tx calendar entry. 26 * 27 * @param interface Interface channel belongs to 28 * @param channel Channel whose calendar entry is to be updated 29 * @param bpid Bpid assigned to the channel 30 */ 31 void __cvmx_ilk_write_tx_cal_entry(int interface, int channel, unsigned char bpid); 32 33 /** 34 * @INTERNAL 35 * Setup the channel's rx calendar entry. 36 * 37 * @param interface Interface channel belongs to 38 * @param channel Channel whose calendar entry is to be updated 39 * @param pipe PKO assigned to the channel 40 */ 41 void __cvmx_ilk_write_rx_cal_entry(int interface, int channel, unsigned char pipe); 42 43 /** 44 * @INTERNAL 45 * Probe a ILK interface and determine the number of ports 46 * connected to it. The ILK interface should still be down after 47 * this call. 48 * 49 * @param xiface Interface to probe 50 * 51 * @return Number of ports on the interface. Zero to disable. 52 */ 53 int __cvmx_helper_ilk_probe(int xiface); 54 55 /** 56 * @INTERNAL 57 * Bringup and enable a ILK interface. After this call packet 58 * I/O should be fully functional. This is called with IPD 59 * enabled but PKO disabled. 60 * 61 * @param xiface Interface to bring up 62 * 63 * @return Zero on success, negative on failure 64 */ 65 int __cvmx_helper_ilk_enable(int xiface); 66 67 /** 68 * @INTERNAL 69 * Return the link state of an IPD/PKO port as returned by ILK link status. 70 * 71 * @param ipd_port IPD/PKO port to query 72 * 73 * @return Link state 74 */ 75 cvmx_helper_link_info_t __cvmx_helper_ilk_link_get(int ipd_port); 76 77 /** 78 * @INTERNAL 79 * Configure an IPD/PKO port for the specified link state. This 80 * function does not influence auto negotiation at the PHY level. 81 * The passed link state must always match the link state returned 82 * by cvmx_helper_link_get(). It is normally best to use 83 * cvmx_helper_link_autoconf() instead. 84 * 85 * @param ipd_port IPD/PKO port to configure 86 * @param link_info The new link state 87 * 88 * @return Zero on success, negative on failure 89 */ 90 int __cvmx_helper_ilk_link_set(int ipd_port, cvmx_helper_link_info_t link_info); 91 92 void __cvmx_helper_ilk_show_stats(void); 93 #endif 94