162306a36Sopenharmony_ci/***********************license start*************** 262306a36Sopenharmony_ci * Author: Cavium Networks 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Contact: support@caviumnetworks.com 562306a36Sopenharmony_ci * This file is part of the OCTEON SDK 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This file is free software; you can redistribute it and/or modify 1062306a36Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as 1162306a36Sopenharmony_ci * published by the Free Software Foundation. 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * This file is distributed in the hope that it will be useful, but 1462306a36Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 1562306a36Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 1662306a36Sopenharmony_ci * NONINFRINGEMENT. See the GNU General Public License for more 1762306a36Sopenharmony_ci * details. 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 2062306a36Sopenharmony_ci * along with this file; if not, write to the Free Software 2162306a36Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 2262306a36Sopenharmony_ci * or visit http://www.gnu.org/licenses/. 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * This file may also be available under a different license from Cavium. 2562306a36Sopenharmony_ci * Contact Cavium Networks for more information 2662306a36Sopenharmony_ci ***********************license end**************************************/ 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/** 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * Helper functions to abstract board specific data about 3162306a36Sopenharmony_ci * network ports from the rest of the cvmx-helper files. 3262306a36Sopenharmony_ci * 3362306a36Sopenharmony_ci */ 3462306a36Sopenharmony_ci#ifndef __CVMX_HELPER_BOARD_H__ 3562306a36Sopenharmony_ci#define __CVMX_HELPER_BOARD_H__ 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#include <asm/octeon/cvmx-helper.h> 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_cienum cvmx_helper_board_usb_clock_types { 4062306a36Sopenharmony_ci USB_CLOCK_TYPE_REF_12, 4162306a36Sopenharmony_ci USB_CLOCK_TYPE_REF_24, 4262306a36Sopenharmony_ci USB_CLOCK_TYPE_REF_48, 4362306a36Sopenharmony_ci USB_CLOCK_TYPE_CRYSTAL_12, 4462306a36Sopenharmony_ci}; 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_citypedef enum { 4762306a36Sopenharmony_ci set_phy_link_flags_autoneg = 0x1, 4862306a36Sopenharmony_ci set_phy_link_flags_flow_control_dont_touch = 0x0 << 1, 4962306a36Sopenharmony_ci set_phy_link_flags_flow_control_enable = 0x1 << 1, 5062306a36Sopenharmony_ci set_phy_link_flags_flow_control_disable = 0x2 << 1, 5162306a36Sopenharmony_ci set_phy_link_flags_flow_control_mask = 0x3 << 1, /* Mask for 2 bit wide flow control field */ 5262306a36Sopenharmony_ci} cvmx_helper_board_set_phy_link_flags_types_t; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci/* 5562306a36Sopenharmony_ci * Fake IPD port, the RGMII/MII interface may use different PHY, use 5662306a36Sopenharmony_ci * this macro to return appropriate MIX address to read the PHY. 5762306a36Sopenharmony_ci */ 5862306a36Sopenharmony_ci#define CVMX_HELPER_BOARD_MGMT_IPD_PORT -10 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci/** 6162306a36Sopenharmony_ci * Return the MII PHY address associated with the given IPD 6262306a36Sopenharmony_ci * port. A result of -1 means there isn't a MII capable PHY 6362306a36Sopenharmony_ci * connected to this port. On chips supporting multiple MII 6462306a36Sopenharmony_ci * busses the bus number is encoded in bits <15:8>. 6562306a36Sopenharmony_ci * 6662306a36Sopenharmony_ci * This function must be modified for every new Octeon board. 6762306a36Sopenharmony_ci * Internally it uses switch statements based on the cvmx_sysinfo 6862306a36Sopenharmony_ci * data to determine board types and revisions. It relies on the 6962306a36Sopenharmony_ci * fact that every Octeon board receives a unique board type 7062306a36Sopenharmony_ci * enumeration from the bootloader. 7162306a36Sopenharmony_ci * 7262306a36Sopenharmony_ci * @ipd_port: Octeon IPD port to get the MII address for. 7362306a36Sopenharmony_ci * 7462306a36Sopenharmony_ci * Returns MII PHY address and bus number or -1. 7562306a36Sopenharmony_ci */ 7662306a36Sopenharmony_ciextern int cvmx_helper_board_get_mii_address(int ipd_port); 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci/** 7962306a36Sopenharmony_ci * This function is the board specific method of determining an 8062306a36Sopenharmony_ci * ethernet ports link speed. Most Octeon boards have Marvell PHYs 8162306a36Sopenharmony_ci * and are handled by the fall through case. This function must be 8262306a36Sopenharmony_ci * updated for boards that don't have the normal Marvell PHYs. 8362306a36Sopenharmony_ci * 8462306a36Sopenharmony_ci * This function must be modified for every new Octeon board. 8562306a36Sopenharmony_ci * Internally it uses switch statements based on the cvmx_sysinfo 8662306a36Sopenharmony_ci * data to determine board types and revisions. It relies on the 8762306a36Sopenharmony_ci * fact that every Octeon board receives a unique board type 8862306a36Sopenharmony_ci * enumeration from the bootloader. 8962306a36Sopenharmony_ci * 9062306a36Sopenharmony_ci * @ipd_port: IPD input port associated with the port we want to get link 9162306a36Sopenharmony_ci * status for. 9262306a36Sopenharmony_ci * 9362306a36Sopenharmony_ci * Returns The ports link status. If the link isn't fully resolved, this must 9462306a36Sopenharmony_ci * return zero. 9562306a36Sopenharmony_ci */ 9662306a36Sopenharmony_ciextern union cvmx_helper_link_info __cvmx_helper_board_link_get(int ipd_port); 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci/** 9962306a36Sopenharmony_ci * This function is called by cvmx_helper_interface_probe() after it 10062306a36Sopenharmony_ci * determines the number of ports Octeon can support on a specific 10162306a36Sopenharmony_ci * interface. This function is the per board location to override 10262306a36Sopenharmony_ci * this value. It is called with the number of ports Octeon might 10362306a36Sopenharmony_ci * support and should return the number of actual ports on the 10462306a36Sopenharmony_ci * board. 10562306a36Sopenharmony_ci * 10662306a36Sopenharmony_ci * This function must be modified for every new Octeon board. 10762306a36Sopenharmony_ci * Internally it uses switch statements based on the cvmx_sysinfo 10862306a36Sopenharmony_ci * data to determine board types and revisions. It relies on the 10962306a36Sopenharmony_ci * fact that every Octeon board receives a unique board type 11062306a36Sopenharmony_ci * enumeration from the bootloader. 11162306a36Sopenharmony_ci * 11262306a36Sopenharmony_ci * @interface: Interface to probe 11362306a36Sopenharmony_ci * @supported_ports: 11462306a36Sopenharmony_ci * Number of ports Octeon supports. 11562306a36Sopenharmony_ci * 11662306a36Sopenharmony_ci * Returns Number of ports the actual board supports. Many times this will 11762306a36Sopenharmony_ci * simple be "support_ports". 11862306a36Sopenharmony_ci */ 11962306a36Sopenharmony_ciextern int __cvmx_helper_board_interface_probe(int interface, 12062306a36Sopenharmony_ci int supported_ports); 12162306a36Sopenharmony_ci 12262306a36Sopenharmony_cienum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void); 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci#endif /* __CVMX_HELPER_BOARD_H__ */ 125