![]() |
|
|||
0001 /***********************license start*************** 0002 * Author: Cavium Networks 0003 * 0004 * Contact: support@caviumnetworks.com 0005 * This file is part of the OCTEON SDK 0006 * 0007 * Copyright (c) 2003-2008 Cavium Networks 0008 * 0009 * This file is free software; you can redistribute it and/or modify 0010 * it under the terms of the GNU General Public License, Version 2, as 0011 * published by the Free Software Foundation. 0012 * 0013 * This file is distributed in the hope that it will be useful, but 0014 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 0015 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 0016 * NONINFRINGEMENT. See the GNU General Public License for more 0017 * details. 0018 * 0019 * You should have received a copy of the GNU General Public License 0020 * along with this file; if not, write to the Free Software 0021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0022 * or visit http://www.gnu.org/licenses/. 0023 * 0024 * This file may also be available under a different license from Cavium. 0025 * Contact Cavium Networks for more information 0026 ***********************license end**************************************/ 0027 0028 /* 0029 * 0030 * Helper functions for common, but complicated tasks. 0031 * 0032 */ 0033 0034 #ifndef __CVMX_HELPER_H__ 0035 #define __CVMX_HELPER_H__ 0036 0037 #include <asm/octeon/cvmx-config.h> 0038 #include <asm/octeon/cvmx-fpa.h> 0039 #include <asm/octeon/cvmx-wqe.h> 0040 0041 typedef enum { 0042 CVMX_HELPER_INTERFACE_MODE_DISABLED, 0043 CVMX_HELPER_INTERFACE_MODE_RGMII, 0044 CVMX_HELPER_INTERFACE_MODE_GMII, 0045 CVMX_HELPER_INTERFACE_MODE_SPI, 0046 CVMX_HELPER_INTERFACE_MODE_PCIE, 0047 CVMX_HELPER_INTERFACE_MODE_XAUI, 0048 CVMX_HELPER_INTERFACE_MODE_SGMII, 0049 CVMX_HELPER_INTERFACE_MODE_PICMG, 0050 CVMX_HELPER_INTERFACE_MODE_NPI, 0051 CVMX_HELPER_INTERFACE_MODE_LOOP, 0052 } cvmx_helper_interface_mode_t; 0053 0054 union cvmx_helper_link_info { 0055 uint64_t u64; 0056 struct { 0057 uint64_t reserved_20_63:44; 0058 uint64_t link_up:1; /**< Is the physical link up? */ 0059 uint64_t full_duplex:1; /**< 1 if the link is full duplex */ 0060 uint64_t speed:18; /**< Speed of the link in Mbps */ 0061 } s; 0062 }; 0063 0064 #include <asm/octeon/cvmx-helper-errata.h> 0065 #include <asm/octeon/cvmx-helper-loop.h> 0066 #include <asm/octeon/cvmx-helper-npi.h> 0067 #include <asm/octeon/cvmx-helper-rgmii.h> 0068 #include <asm/octeon/cvmx-helper-sgmii.h> 0069 #include <asm/octeon/cvmx-helper-spi.h> 0070 #include <asm/octeon/cvmx-helper-util.h> 0071 #include <asm/octeon/cvmx-helper-xaui.h> 0072 0073 /** 0074 * This function enables the IPD and also enables the packet interfaces. 0075 * The packet interfaces (RGMII and SPI) must be enabled after the 0076 * IPD. This should be called by the user program after any additional 0077 * IPD configuration changes are made if CVMX_HELPER_ENABLE_IPD 0078 * is not set in the executive-config.h file. 0079 * 0080 * Returns 0 on success 0081 * -1 on failure 0082 */ 0083 extern int cvmx_helper_ipd_and_packet_input_enable(void); 0084 0085 /** 0086 * Initialize the PIP, IPD, and PKO hardware to support 0087 * simple priority based queues for the ethernet ports. Each 0088 * port is configured with a number of priority queues based 0089 * on CVMX_PKO_QUEUES_PER_PORT_* where each queue is lower 0090 * priority than the previous. 0091 * 0092 * Returns Zero on success, non-zero on failure 0093 */ 0094 extern int cvmx_helper_initialize_packet_io_global(void); 0095 0096 /** 0097 * Returns the number of ports on the given interface. 0098 * The interface must be initialized before the port count 0099 * can be returned. 0100 * 0101 * @interface: Which interface to return port count for. 0102 * 0103 * Returns Port count for interface 0104 * -1 for uninitialized interface 0105 */ 0106 extern int cvmx_helper_ports_on_interface(int interface); 0107 0108 /** 0109 * Return the number of interfaces the chip has. Each interface 0110 * may have multiple ports. Most chips support two interfaces, 0111 * but the CNX0XX and CNX1XX are exceptions. These only support 0112 * one interface. 0113 * 0114 * Returns Number of interfaces on chip 0115 */ 0116 extern int cvmx_helper_get_number_of_interfaces(void); 0117 0118 /** 0119 * Get the operating mode of an interface. Depending on the Octeon 0120 * chip and configuration, this function returns an enumeration 0121 * of the type of packet I/O supported by an interface. 0122 * 0123 * @interface: Interface to probe 0124 * 0125 * Returns Mode of the interface. Unknown or unsupported interfaces return 0126 * DISABLED. 0127 */ 0128 extern cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int 0129 interface); 0130 0131 /** 0132 * Return the link state of an IPD/PKO port as returned by 0133 * auto negotiation. The result of this function may not match 0134 * Octeon's link config if auto negotiation has changed since 0135 * the last call to cvmx_helper_link_set(). 0136 * 0137 * @ipd_port: IPD/PKO port to query 0138 * 0139 * Returns Link state 0140 */ 0141 extern union cvmx_helper_link_info cvmx_helper_link_get(int ipd_port); 0142 0143 /** 0144 * Configure an IPD/PKO port for the specified link state. This 0145 * function does not influence auto negotiation at the PHY level. 0146 * The passed link state must always match the link state returned 0147 * by cvmx_helper_link_get(). 0148 * 0149 * @ipd_port: IPD/PKO port to configure 0150 * @link_info: The new link state 0151 * 0152 * Returns Zero on success, negative on failure 0153 */ 0154 extern int cvmx_helper_link_set(int ipd_port, 0155 union cvmx_helper_link_info link_info); 0156 0157 /** 0158 * This function probes an interface to determine the actual 0159 * number of hardware ports connected to it. It doesn't setup the 0160 * ports or enable them. The main goal here is to set the global 0161 * interface_port_count[interface] correctly. Hardware setup of the 0162 * ports will be performed later. 0163 * 0164 * @interface: Interface to probe 0165 * 0166 * Returns Zero on success, negative on failure 0167 */ 0168 extern int cvmx_helper_interface_probe(int interface); 0169 extern int cvmx_helper_interface_enumerate(int interface); 0170 0171 #endif /* __CVMX_HELPER_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |