1 /***********************license start***************
2 * Copyright (c) 2011 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
44 * Helper utilities for qlm.
46 * <hr>$Revision: 70030 $<hr>
50 #ifndef __CVMX_QLM_H__
51 #define __CVMX_QLM_H__
60 } __cvmx_qlm_jtag_field_t;
63 * Return the number of QLMs supported by the chip
65 * @return Number of QLMs
67 extern int cvmx_qlm_get_num(void);
70 * Return the qlm number based on the interface
72 * @param interface Interface to look up
74 extern int cvmx_qlm_interface(int interface);
77 * Return number of lanes for a given qlm
79 * @return Number of lanes
81 extern int cvmx_qlm_get_lanes(int qlm);
84 * Get the QLM JTAG fields based on Octeon model on the supported chips.
86 * @return qlm_jtag_field_t structure
88 extern const __cvmx_qlm_jtag_field_t *cvmx_qlm_jtag_get_field(void);
91 * Get the QLM JTAG length by going through qlm_jtag_field for each
92 * Octeon model that is supported
94 * @return return the length.
96 extern int cvmx_qlm_jtag_get_length(void);
99 * Initialize the QLM layer
101 extern void cvmx_qlm_init(void);
104 * Get a field in a QLM JTAG chain
106 * @param qlm QLM to get
107 * @param lane Lane in QLM to get
108 * @param name String name of field
110 * @return JTAG field value
112 extern uint64_t cvmx_qlm_jtag_get(int qlm, int lane, const char *name);
115 * Set a field in a QLM JTAG chain
117 * @param qlm QLM to set
118 * @param lane Lane in QLM to set, or -1 for all lanes
119 * @param name String name of field
120 * @param value Value of the field
122 extern void cvmx_qlm_jtag_set(int qlm, int lane, const char *name, uint64_t value);
125 * Errata G-16094: QLM Gen2 Equalizer Default Setting Change.
126 * CN68XX pass 1.x and CN66XX pass 1.x QLM tweak. This function tweaks the
127 * JTAG setting for a QLMs to run better at 5 and 6.25Ghz.
129 extern void __cvmx_qlm_speed_tweak(void);
132 * Errata G-16174: QLM Gen2 PCIe IDLE DAC change.
133 * CN68XX pass 1.x, CN66XX pass 1.x and CN63XX pass 1.0-2.2 QLM tweak.
134 * This function tweaks the JTAG setting for a QLMs for PCIe to run better.
136 extern void __cvmx_qlm_pcie_idle_dac_tweak(void);
138 #ifndef CVMX_BUILD_FOR_LINUX_HOST
140 * Get the speed (Gbaud) of the QLM in Mhz.
142 * @param qlm QLM to examine
144 * @return Speed in Mhz
146 extern int cvmx_qlm_get_gbaud_mhz(int qlm);
150 * Read QLM and return status based on CN66XX.
151 * @return Return 1 if QLM is SGMII
153 * 3 if QLM is PCIe gen2 / gen1
154 * 4 if QLM is SRIO 1x4 short / long
155 * 5 if QLM is SRIO 2x2 short / long
157 * 7 if QLM is PCIe 1x2 gen2 / gen1
158 * 8 if QLM is PCIe 2x1 gen2 / gen1
163 extern int cvmx_qlm_get_status(int qlm);
165 #endif /* __CVMX_QLM_H__ */