18c2ecf20Sopenharmony_ci/***********************license start***************
28c2ecf20Sopenharmony_ci * Author: Cavium Networks
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Contact: support@caviumnetworks.com
58c2ecf20Sopenharmony_ci * This file is part of the OCTEON SDK
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify
108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as
118c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
168c2ecf20Sopenharmony_ci * NONINFRINGEMENT.  See the GNU General Public License for more
178c2ecf20Sopenharmony_ci * details.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License
208c2ecf20Sopenharmony_ci * along with this file; if not, write to the Free Software
218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
228c2ecf20Sopenharmony_ci * or visit http://www.gnu.org/licenses/.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * This file may also be available under a different license from Cavium.
258c2ecf20Sopenharmony_ci * Contact Cavium Networks for more information
268c2ecf20Sopenharmony_ci ***********************license end**************************************/
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/**
298c2ecf20Sopenharmony_ci *
308c2ecf20Sopenharmony_ci * Helper functions to abstract board specific data about
318c2ecf20Sopenharmony_ci * network ports from the rest of the cvmx-helper files.
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#ifndef __CVMX_HELPER_BOARD_H__
358c2ecf20Sopenharmony_ci#define __CVMX_HELPER_BOARD_H__
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#include <asm/octeon/cvmx-helper.h>
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cienum cvmx_helper_board_usb_clock_types {
408c2ecf20Sopenharmony_ci	USB_CLOCK_TYPE_REF_12,
418c2ecf20Sopenharmony_ci	USB_CLOCK_TYPE_REF_24,
428c2ecf20Sopenharmony_ci	USB_CLOCK_TYPE_REF_48,
438c2ecf20Sopenharmony_ci	USB_CLOCK_TYPE_CRYSTAL_12,
448c2ecf20Sopenharmony_ci};
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_citypedef enum {
478c2ecf20Sopenharmony_ci	set_phy_link_flags_autoneg = 0x1,
488c2ecf20Sopenharmony_ci	set_phy_link_flags_flow_control_dont_touch = 0x0 << 1,
498c2ecf20Sopenharmony_ci	set_phy_link_flags_flow_control_enable = 0x1 << 1,
508c2ecf20Sopenharmony_ci	set_phy_link_flags_flow_control_disable = 0x2 << 1,
518c2ecf20Sopenharmony_ci	set_phy_link_flags_flow_control_mask = 0x3 << 1,	/* Mask for 2 bit wide flow control field */
528c2ecf20Sopenharmony_ci} cvmx_helper_board_set_phy_link_flags_types_t;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/*
558c2ecf20Sopenharmony_ci * Fake IPD port, the RGMII/MII interface may use different PHY, use
568c2ecf20Sopenharmony_ci * this macro to return appropriate MIX address to read the PHY.
578c2ecf20Sopenharmony_ci */
588c2ecf20Sopenharmony_ci#define CVMX_HELPER_BOARD_MGMT_IPD_PORT	    -10
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/**
618c2ecf20Sopenharmony_ci * Return the MII PHY address associated with the given IPD
628c2ecf20Sopenharmony_ci * port. A result of -1 means there isn't a MII capable PHY
638c2ecf20Sopenharmony_ci * connected to this port. On chips supporting multiple MII
648c2ecf20Sopenharmony_ci * busses the bus number is encoded in bits <15:8>.
658c2ecf20Sopenharmony_ci *
668c2ecf20Sopenharmony_ci * This function must be modifed for every new Octeon board.
678c2ecf20Sopenharmony_ci * Internally it uses switch statements based on the cvmx_sysinfo
688c2ecf20Sopenharmony_ci * data to determine board types and revisions. It relys on the
698c2ecf20Sopenharmony_ci * fact that every Octeon board receives a unique board type
708c2ecf20Sopenharmony_ci * enumeration from the bootloader.
718c2ecf20Sopenharmony_ci *
728c2ecf20Sopenharmony_ci * @ipd_port: Octeon IPD port to get the MII address for.
738c2ecf20Sopenharmony_ci *
748c2ecf20Sopenharmony_ci * Returns MII PHY address and bus number or -1.
758c2ecf20Sopenharmony_ci */
768c2ecf20Sopenharmony_ciextern int cvmx_helper_board_get_mii_address(int ipd_port);
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/**
798c2ecf20Sopenharmony_ci * This function is the board specific method of determining an
808c2ecf20Sopenharmony_ci * ethernet ports link speed. Most Octeon boards have Marvell PHYs
818c2ecf20Sopenharmony_ci * and are handled by the fall through case. This function must be
828c2ecf20Sopenharmony_ci * updated for boards that don't have the normal Marvell PHYs.
838c2ecf20Sopenharmony_ci *
848c2ecf20Sopenharmony_ci * This function must be modifed for every new Octeon board.
858c2ecf20Sopenharmony_ci * Internally it uses switch statements based on the cvmx_sysinfo
868c2ecf20Sopenharmony_ci * data to determine board types and revisions. It relys on the
878c2ecf20Sopenharmony_ci * fact that every Octeon board receives a unique board type
888c2ecf20Sopenharmony_ci * enumeration from the bootloader.
898c2ecf20Sopenharmony_ci *
908c2ecf20Sopenharmony_ci * @ipd_port: IPD input port associated with the port we want to get link
918c2ecf20Sopenharmony_ci *		   status for.
928c2ecf20Sopenharmony_ci *
938c2ecf20Sopenharmony_ci * Returns The ports link status. If the link isn't fully resolved, this must
948c2ecf20Sopenharmony_ci *	   return zero.
958c2ecf20Sopenharmony_ci */
968c2ecf20Sopenharmony_ciextern union cvmx_helper_link_info __cvmx_helper_board_link_get(int ipd_port);
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/**
998c2ecf20Sopenharmony_ci * This function is called by cvmx_helper_interface_probe() after it
1008c2ecf20Sopenharmony_ci * determines the number of ports Octeon can support on a specific
1018c2ecf20Sopenharmony_ci * interface. This function is the per board location to override
1028c2ecf20Sopenharmony_ci * this value. It is called with the number of ports Octeon might
1038c2ecf20Sopenharmony_ci * support and should return the number of actual ports on the
1048c2ecf20Sopenharmony_ci * board.
1058c2ecf20Sopenharmony_ci *
1068c2ecf20Sopenharmony_ci * This function must be modifed for every new Octeon board.
1078c2ecf20Sopenharmony_ci * Internally it uses switch statements based on the cvmx_sysinfo
1088c2ecf20Sopenharmony_ci * data to determine board types and revisions. It relys on the
1098c2ecf20Sopenharmony_ci * fact that every Octeon board receives a unique board type
1108c2ecf20Sopenharmony_ci * enumeration from the bootloader.
1118c2ecf20Sopenharmony_ci *
1128c2ecf20Sopenharmony_ci * @interface: Interface to probe
1138c2ecf20Sopenharmony_ci * @supported_ports:
1148c2ecf20Sopenharmony_ci *		    Number of ports Octeon supports.
1158c2ecf20Sopenharmony_ci *
1168c2ecf20Sopenharmony_ci * Returns Number of ports the actual board supports. Many times this will
1178c2ecf20Sopenharmony_ci *	   simple be "support_ports".
1188c2ecf20Sopenharmony_ci */
1198c2ecf20Sopenharmony_ciextern int __cvmx_helper_board_interface_probe(int interface,
1208c2ecf20Sopenharmony_ci					       int supported_ports);
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_cienum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void);
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#endif /* __CVMX_HELPER_BOARD_H__ */
125