cvmx-helper-jtag.h revision 232812
144963Sjb/***********************license start***************
244963Sjb * Copyright (c) 2003-2010  Cavium Inc. (support@cavium.com). All rights
344963Sjb * reserved.
444963Sjb *
544963Sjb *
644963Sjb * Redistribution and use in source and binary forms, with or without
744963Sjb * modification, are permitted provided that the following conditions are
844963Sjb * met:
944963Sjb *
1044963Sjb *   * Redistributions of source code must retain the above copyright
1144963Sjb *     notice, this list of conditions and the following disclaimer.
1244963Sjb *
1344963Sjb *   * Redistributions in binary form must reproduce the above
1444963Sjb *     copyright notice, this list of conditions and the following
1544963Sjb *     disclaimer in the documentation and/or other materials provided
1644963Sjb *     with the distribution.
1744963Sjb
1844963Sjb *   * Neither the name of Cavium Inc. nor the names of
1944963Sjb *     its contributors may be used to endorse or promote products
2044963Sjb *     derived from this software without specific prior written
2144963Sjb *     permission.
2244963Sjb
2344963Sjb * This Software, including technical data, may be subject to U.S. export  control
2444963Sjb * laws, including the U.S. Export Administration Act and its  associated
2544963Sjb * regulations, and may be subject to export or import  regulations in other
2644963Sjb * countries.
2744963Sjb
2844963Sjb * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
2944963Sjb * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
3044963Sjb * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
3144963Sjb * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
3250476Speter * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
3344963Sjb * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34174112Sdeischen * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35174112Sdeischen * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
3644963Sjb * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
3744963Sjb * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
3844963Sjb ***********************license end**************************************/
39174112Sdeischen
40103388Smini
4144963Sjb/**
42156611Sdeischen * @file
43156611Sdeischen *
44156611Sdeischen *  Helper utilities for qlm_jtag.
4575369Sdeischen *
4671581Sdeischen * <hr>$Revision: 41586 $<hr>
4744963Sjb */
4871581Sdeischen
4953812Salfred#ifndef __CVMX_HELPER_JTAG_H__
5044963Sjb#define __CVMX_HELPER_JTAG_H__
51113658Sdeischen
52113658Sdeischen/**
53113658Sdeischen * Initialize the internal QLM JTAG logic to allow programming
54113658Sdeischen * of the JTAG chain by the cvmx_helper_qlm_jtag_*() functions.
55113658Sdeischen * These functions should only be used at the direction of Cavium
5644963Sjb * Networks. Programming incorrect values into the JTAG chain
5759892Sjasone * can cause chip damage.
5844963Sjb */
5944963Sjbextern void cvmx_helper_qlm_jtag_init(void);
60113658Sdeischen
61113658Sdeischen/**
6259892Sjasone * Write up to 32bits into the QLM jtag chain. Bits are shifted
6359892Sjasone * into the MSB and out the LSB, so you should shift in the low
6444963Sjb * order bits followed by the high order bits. The JTAG chain for
6544963Sjb * CN52XX and CN56XX is 4 * 268 bits long, or 1072. The JTAG chain
66113658Sdeischen * for CN63XX is 4 * 300 bits long, or 1200.
67113658Sdeischen *
6844963Sjb * @param qlm    QLM to shift value into
69113658Sdeischen * @param bits   Number of bits to shift in (1-32).
70113658Sdeischen * @param data   Data to shift in. Bit 0 enters the chain first, followed by
7144963Sjb *               bit 1, etc.
72113658Sdeischen *
73113661Sdeischen * @return The low order bits of the JTAG chain that shifted out of the
74113661Sdeischen *         circle.
75113661Sdeischen */
76113661Sdeischenextern uint32_t cvmx_helper_qlm_jtag_shift(int qlm, int bits, uint32_t data);
77113661Sdeischen
78113661Sdeischen/**
79113661Sdeischen * Shift long sequences of zeros into the QLM JTAG chain. It is
80113786Sdeischen * common to need to shift more than 32 bits of zeros into the
8144963Sjb * chain. This function is a convience wrapper around
82113658Sdeischen * cvmx_helper_qlm_jtag_shift() to shift more than 32 bits of
83113658Sdeischen * zeros at a time.
84113658Sdeischen *
85113658Sdeischen * @param qlm    QLM to shift zeros into
86113658Sdeischen * @param bits
8744963Sjb */
88113658Sdeischenextern void cvmx_helper_qlm_jtag_shift_zeros(int qlm, int bits);
89113658Sdeischen
90113658Sdeischen/**
91113658Sdeischen * Program the QLM JTAG chain into all lanes of the QLM. You must
92113658Sdeischen * have already shifted in the proper number of bits into the
93113658Sdeischen * JTAG chain. Updating invalid values can possibly cause chip damage.
9444963Sjb *
9544963Sjb * @param qlm    QLM to program
9644963Sjb */
9744963Sjbextern void cvmx_helper_qlm_jtag_update(int qlm);
9855194Sdeischen
99113658Sdeischen/**
10044963Sjb * Load the QLM JTAG chain with data from all lanes of the QLM.
101113658Sdeischen *
10244963Sjb * @param qlm    QLM to program
10344963Sjb */
10444963Sjbextern void cvmx_helper_qlm_jtag_capture(int qlm);
10567097Sdeischen
106113658Sdeischen#endif  /* __CVMX_HELPER_JTAG_H__ */
10744963Sjb