blob: 500b5d5409692d58a864ef66b4b9f41ad7dc0f53 [file] [log] [blame]
Aaron Williams3bda89d2020-12-11 17:05:24 +01001/* 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
12int __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 */
21void __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 */
31void __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 */
41void __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 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010051 * Return: Number of ports on the interface. Zero to disable.
Aaron Williams3bda89d2020-12-11 17:05:24 +010052 */
53int __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 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010063 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010064 */
65int __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 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010073 * Return: Link state
Aaron Williams3bda89d2020-12-11 17:05:24 +010074 */
75cvmx_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 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010088 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010089 */
90int __cvmx_helper_ilk_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
91
92void __cvmx_helper_ilk_show_stats(void);
93#endif