1*4882a593Smuzhiyun /***********************license start*************** 2*4882a593Smuzhiyun * Author: Cavium Networks 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Contact: support@caviumnetworks.com 5*4882a593Smuzhiyun * This file is part of the OCTEON SDK 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright (c) 2003-2008 Cavium Networks 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * This file is free software; you can redistribute it and/or modify 10*4882a593Smuzhiyun * it under the terms of the GNU General Public License, Version 2, as 11*4882a593Smuzhiyun * published by the Free Software Foundation. 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * This file is distributed in the hope that it will be useful, but 14*4882a593Smuzhiyun * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 15*4882a593Smuzhiyun * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 16*4882a593Smuzhiyun * NONINFRINGEMENT. See the GNU General Public License for more 17*4882a593Smuzhiyun * details. 18*4882a593Smuzhiyun * 19*4882a593Smuzhiyun * You should have received a copy of the GNU General Public License 20*4882a593Smuzhiyun * along with this file; if not, write to the Free Software 21*4882a593Smuzhiyun * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22*4882a593Smuzhiyun * or visit http://www.gnu.org/licenses/. 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * This file may also be available under a different license from Cavium. 25*4882a593Smuzhiyun * Contact Cavium Networks for more information 26*4882a593Smuzhiyun ***********************license end**************************************/ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /** 29*4882a593Smuzhiyun * 30*4882a593Smuzhiyun * Helper functions to abstract board specific data about 31*4882a593Smuzhiyun * network ports from the rest of the cvmx-helper files. 32*4882a593Smuzhiyun * 33*4882a593Smuzhiyun */ 34*4882a593Smuzhiyun #ifndef __CVMX_HELPER_BOARD_H__ 35*4882a593Smuzhiyun #define __CVMX_HELPER_BOARD_H__ 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun #include <asm/octeon/cvmx-helper.h> 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun enum cvmx_helper_board_usb_clock_types { 40*4882a593Smuzhiyun USB_CLOCK_TYPE_REF_12, 41*4882a593Smuzhiyun USB_CLOCK_TYPE_REF_24, 42*4882a593Smuzhiyun USB_CLOCK_TYPE_REF_48, 43*4882a593Smuzhiyun USB_CLOCK_TYPE_CRYSTAL_12, 44*4882a593Smuzhiyun }; 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun typedef enum { 47*4882a593Smuzhiyun set_phy_link_flags_autoneg = 0x1, 48*4882a593Smuzhiyun set_phy_link_flags_flow_control_dont_touch = 0x0 << 1, 49*4882a593Smuzhiyun set_phy_link_flags_flow_control_enable = 0x1 << 1, 50*4882a593Smuzhiyun set_phy_link_flags_flow_control_disable = 0x2 << 1, 51*4882a593Smuzhiyun set_phy_link_flags_flow_control_mask = 0x3 << 1, /* Mask for 2 bit wide flow control field */ 52*4882a593Smuzhiyun } cvmx_helper_board_set_phy_link_flags_types_t; 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun /* 55*4882a593Smuzhiyun * Fake IPD port, the RGMII/MII interface may use different PHY, use 56*4882a593Smuzhiyun * this macro to return appropriate MIX address to read the PHY. 57*4882a593Smuzhiyun */ 58*4882a593Smuzhiyun #define CVMX_HELPER_BOARD_MGMT_IPD_PORT -10 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun /** 61*4882a593Smuzhiyun * Return the MII PHY address associated with the given IPD 62*4882a593Smuzhiyun * port. A result of -1 means there isn't a MII capable PHY 63*4882a593Smuzhiyun * connected to this port. On chips supporting multiple MII 64*4882a593Smuzhiyun * busses the bus number is encoded in bits <15:8>. 65*4882a593Smuzhiyun * 66*4882a593Smuzhiyun * This function must be modifed for every new Octeon board. 67*4882a593Smuzhiyun * Internally it uses switch statements based on the cvmx_sysinfo 68*4882a593Smuzhiyun * data to determine board types and revisions. It relys on the 69*4882a593Smuzhiyun * fact that every Octeon board receives a unique board type 70*4882a593Smuzhiyun * enumeration from the bootloader. 71*4882a593Smuzhiyun * 72*4882a593Smuzhiyun * @ipd_port: Octeon IPD port to get the MII address for. 73*4882a593Smuzhiyun * 74*4882a593Smuzhiyun * Returns MII PHY address and bus number or -1. 75*4882a593Smuzhiyun */ 76*4882a593Smuzhiyun extern int cvmx_helper_board_get_mii_address(int ipd_port); 77*4882a593Smuzhiyun 78*4882a593Smuzhiyun /** 79*4882a593Smuzhiyun * This function is the board specific method of determining an 80*4882a593Smuzhiyun * ethernet ports link speed. Most Octeon boards have Marvell PHYs 81*4882a593Smuzhiyun * and are handled by the fall through case. This function must be 82*4882a593Smuzhiyun * updated for boards that don't have the normal Marvell PHYs. 83*4882a593Smuzhiyun * 84*4882a593Smuzhiyun * This function must be modifed for every new Octeon board. 85*4882a593Smuzhiyun * Internally it uses switch statements based on the cvmx_sysinfo 86*4882a593Smuzhiyun * data to determine board types and revisions. It relys on the 87*4882a593Smuzhiyun * fact that every Octeon board receives a unique board type 88*4882a593Smuzhiyun * enumeration from the bootloader. 89*4882a593Smuzhiyun * 90*4882a593Smuzhiyun * @ipd_port: IPD input port associated with the port we want to get link 91*4882a593Smuzhiyun * status for. 92*4882a593Smuzhiyun * 93*4882a593Smuzhiyun * Returns The ports link status. If the link isn't fully resolved, this must 94*4882a593Smuzhiyun * return zero. 95*4882a593Smuzhiyun */ 96*4882a593Smuzhiyun extern union cvmx_helper_link_info __cvmx_helper_board_link_get(int ipd_port); 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun /** 99*4882a593Smuzhiyun * This function is called by cvmx_helper_interface_probe() after it 100*4882a593Smuzhiyun * determines the number of ports Octeon can support on a specific 101*4882a593Smuzhiyun * interface. This function is the per board location to override 102*4882a593Smuzhiyun * this value. It is called with the number of ports Octeon might 103*4882a593Smuzhiyun * support and should return the number of actual ports on the 104*4882a593Smuzhiyun * board. 105*4882a593Smuzhiyun * 106*4882a593Smuzhiyun * This function must be modifed for every new Octeon board. 107*4882a593Smuzhiyun * Internally it uses switch statements based on the cvmx_sysinfo 108*4882a593Smuzhiyun * data to determine board types and revisions. It relys on the 109*4882a593Smuzhiyun * fact that every Octeon board receives a unique board type 110*4882a593Smuzhiyun * enumeration from the bootloader. 111*4882a593Smuzhiyun * 112*4882a593Smuzhiyun * @interface: Interface to probe 113*4882a593Smuzhiyun * @supported_ports: 114*4882a593Smuzhiyun * Number of ports Octeon supports. 115*4882a593Smuzhiyun * 116*4882a593Smuzhiyun * Returns Number of ports the actual board supports. Many times this will 117*4882a593Smuzhiyun * simple be "support_ports". 118*4882a593Smuzhiyun */ 119*4882a593Smuzhiyun extern int __cvmx_helper_board_interface_probe(int interface, 120*4882a593Smuzhiyun int supported_ports); 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void); 123*4882a593Smuzhiyun 124*4882a593Smuzhiyun #endif /* __CVMX_HELPER_BOARD_H__ */ 125