cvmx-qlm.h revision 232809
11659Skevinw/***********************license start*************** 22362Sohair * Copyright (c) 2011 Cavium Inc. (support@cavium.com). All rights 31659Skevinw * reserved. 41659Skevinw * 51659Skevinw * 61659Skevinw * Redistribution and use in source and binary forms, with or without 71659Skevinw * modification, are permitted provided that the following conditions are 81659Skevinw * met: 91659Skevinw * 101659Skevinw * * Redistributions of source code must retain the above copyright 111659Skevinw * notice, this list of conditions and the following disclaimer. 121659Skevinw * 131659Skevinw * * Redistributions in binary form must reproduce the above 141659Skevinw * copyright notice, this list of conditions and the following 151659Skevinw * disclaimer in the documentation and/or other materials provided 161659Skevinw * with the distribution. 171659Skevinw 181659Skevinw * * Neither the name of Cavium Inc. nor the names of 192362Sohair * its contributors may be used to endorse or promote products 202362Sohair * derived from this software without specific prior written 212362Sohair * permission. 221659Skevinw 231659Skevinw * This Software, including technical data, may be subject to U.S. export control 241659Skevinw * laws, including the U.S. Export Administration Act and its associated 251659Skevinw * regulations, and may be subject to export or import regulations in other 261659Skevinw * countries. 271659Skevinw 281659Skevinw * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 291659Skevinw * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 301659Skevinw * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 311659Skevinw * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 321659Skevinw * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 331659Skevinw * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 341659Skevinw * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 351659Skevinw * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 361659Skevinw * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 371659Skevinw * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 381659Skevinw ***********************license end**************************************/ 391659Skevinw 401659Skevinw 411659Skevinw/** 421659Skevinw * @file 431659Skevinw * 441659Skevinw * Helper utilities for qlm. 451659Skevinw * 461659Skevinw * <hr>$Revision: 70030 $<hr> 471659Skevinw */ 481659Skevinw 491659Skevinw 501659Skevinw#ifndef __CVMX_QLM_H__ 511659Skevinw#define __CVMX_QLM_H__ 521659Skevinw 531659Skevinw#include "cvmx.h" 541659Skevinw 551659Skevinwtypedef struct 561659Skevinw{ 571659Skevinw const char *name; 581659Skevinw int stop_bit; 591659Skevinw int start_bit; 601659Skevinw} __cvmx_qlm_jtag_field_t; 611659Skevinw 621659Skevinw/** 631659Skevinw * Return the number of QLMs supported by the chip 641659Skevinw * 651659Skevinw * @return Number of QLMs 661659Skevinw */ 671659Skevinwextern int cvmx_qlm_get_num(void); 681659Skevinw 691659Skevinw/** 701659Skevinw * Return the qlm number based on the interface 711659Skevinw * 721659Skevinw * @param interface Interface to look up 731659Skevinw */ 741659Skevinwextern int cvmx_qlm_interface(int interface); 751659Skevinw 761659Skevinw/** 771659Skevinw * Return number of lanes for a given qlm 781659Skevinw * 791659Skevinw * @return Number of lanes 801659Skevinw */ 811659Skevinwextern int cvmx_qlm_get_lanes(int qlm); 821659Skevinw 831659Skevinw/** 841659Skevinw * Get the QLM JTAG fields based on Octeon model on the supported chips. 851659Skevinw * 861659Skevinw * @return qlm_jtag_field_t structure 871659Skevinw */ 881659Skevinwextern const __cvmx_qlm_jtag_field_t *cvmx_qlm_jtag_get_field(void); 891659Skevinw 901659Skevinw/** 911659Skevinw * Get the QLM JTAG length by going through qlm_jtag_field for each 921659Skevinw * Octeon model that is supported 931659Skevinw * 941659Skevinw * @return return the length. 951659Skevinw */ 961659Skevinwextern int cvmx_qlm_jtag_get_length(void); 971659Skevinw 981659Skevinw/** 991659Skevinw * Initialize the QLM layer 1001659Skevinw */ 1011659Skevinwextern void cvmx_qlm_init(void); 1021659Skevinw 1031659Skevinw/** 1041659Skevinw * Get a field in a QLM JTAG chain 1051659Skevinw * 1061659Skevinw * @param qlm QLM to get 1071659Skevinw * @param lane Lane in QLM to get 1081659Skevinw * @param name String name of field 1091659Skevinw * 1101659Skevinw * @return JTAG field value 1111659Skevinw */ 1121659Skevinwextern uint64_t cvmx_qlm_jtag_get(int qlm, int lane, const char *name); 1131659Skevinw 1141659Skevinw/** 1151659Skevinw * Set a field in a QLM JTAG chain 1161659Skevinw * 1171659Skevinw * @param qlm QLM to set 1181659Skevinw * @param lane Lane in QLM to set, or -1 for all lanes 1191659Skevinw * @param name String name of field 1201659Skevinw * @param value Value of the field 1211659Skevinw */ 1221659Skevinwextern void cvmx_qlm_jtag_set(int qlm, int lane, const char *name, uint64_t value); 1231659Skevinw 1241659Skevinw/** 1251659Skevinw * Errata G-16094: QLM Gen2 Equalizer Default Setting Change. 1261659Skevinw * CN68XX pass 1.x and CN66XX pass 1.x QLM tweak. This function tweaks the 1271659Skevinw * JTAG setting for a QLMs to run better at 5 and 6.25Ghz. 1281659Skevinw */ 1291659Skevinwextern void __cvmx_qlm_speed_tweak(void); 1301659Skevinw 1311659Skevinw/** 1321659Skevinw * Errata G-16174: QLM Gen2 PCIe IDLE DAC change. 1331659Skevinw * CN68XX pass 1.x, CN66XX pass 1.x and CN63XX pass 1.0-2.2 QLM tweak. 1341659Skevinw * This function tweaks the JTAG setting for a QLMs for PCIe to run better. 1351659Skevinw */ 1361659Skevinwextern void __cvmx_qlm_pcie_idle_dac_tweak(void); 1371659Skevinw 1381659Skevinw#ifndef CVMX_BUILD_FOR_LINUX_HOST 1391659Skevinw/** 1401659Skevinw * Get the speed (Gbaud) of the QLM in Mhz. 1411659Skevinw * 1421659Skevinw * @param qlm QLM to examine 1431659Skevinw * 1441659Skevinw * @return Speed in Mhz 1451659Skevinw */ 1461659Skevinwextern int cvmx_qlm_get_gbaud_mhz(int qlm); 1471659Skevinw#endif 1481659Skevinw 1491659Skevinw/* 1501659Skevinw * Read QLM and return status based on CN66XX. 1511659Skevinw * @return Return 1 if QLM is SGMII 1521659Skevinw * 2 if QLM is XAUI 1531659Skevinw * 3 if QLM is PCIe gen2 / gen1 1541659Skevinw * 4 if QLM is SRIO 1x4 short / long 1551659Skevinw * 5 if QLM is SRIO 2x2 short / long 1561659Skevinw * 6 is reserved 1571659Skevinw * 7 if QLM is PCIe 1x2 gen2 / gen1 1581659Skevinw * 8 if QLM is PCIe 2x1 gen2 / gen1 1591659Skevinw * 9 if QLM is ILK 1601659Skevinw * 10 if QLM is RXAUI 1611659Skevinw * -1 otherwise 1621659Skevinw */ 1631659Skevinwextern int cvmx_qlm_get_status(int qlm); 1641659Skevinw 1651659Skevinw#endif /* __CVMX_QLM_H__ */ 1661659Skevinw