1215976Sjmallett/***********************license start***************
2232812Sjmallett * Copyright (c) 2003-2010  Cavium Inc. (support@cavium.com). All rights
3215976Sjmallett * reserved.
4215976Sjmallett *
5215976Sjmallett *
6215976Sjmallett * Redistribution and use in source and binary forms, with or without
7215976Sjmallett * modification, are permitted provided that the following conditions are
8215976Sjmallett * met:
9215976Sjmallett *
10215976Sjmallett *   * Redistributions of source code must retain the above copyright
11215976Sjmallett *     notice, this list of conditions and the following disclaimer.
12215976Sjmallett *
13215976Sjmallett *   * Redistributions in binary form must reproduce the above
14215976Sjmallett *     copyright notice, this list of conditions and the following
15215976Sjmallett *     disclaimer in the documentation and/or other materials provided
16215976Sjmallett *     with the distribution.
17215976Sjmallett
18232812Sjmallett *   * Neither the name of Cavium Inc. nor the names of
19215976Sjmallett *     its contributors may be used to endorse or promote products
20215976Sjmallett *     derived from this software without specific prior written
21215976Sjmallett *     permission.
22215976Sjmallett
23215976Sjmallett * This Software, including technical data, may be subject to U.S. export  control
24215976Sjmallett * laws, including the U.S. Export Administration Act and its  associated
25215976Sjmallett * regulations, and may be subject to export or import  regulations in other
26215976Sjmallett * countries.
27215976Sjmallett
28215976Sjmallett * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29232812Sjmallett * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30215976Sjmallett * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31215976Sjmallett * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32215976Sjmallett * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33215976Sjmallett * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34215976Sjmallett * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35215976Sjmallett * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36215976Sjmallett * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
37215976Sjmallett * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38215976Sjmallett ***********************license end**************************************/
39215976Sjmallett
40215976Sjmallett
41215976Sjmallett/**
42215976Sjmallett * @file
43215976Sjmallett *
44215976Sjmallett *  Helper utilities for qlm_jtag.
45215976Sjmallett *
46215976Sjmallett * <hr>$Revision: 41586 $<hr>
47215976Sjmallett */
48215976Sjmallett
49215976Sjmallett#ifndef __CVMX_HELPER_JTAG_H__
50215976Sjmallett#define __CVMX_HELPER_JTAG_H__
51215976Sjmallett
52215976Sjmallett/**
53215976Sjmallett * Initialize the internal QLM JTAG logic to allow programming
54215976Sjmallett * of the JTAG chain by the cvmx_helper_qlm_jtag_*() functions.
55215976Sjmallett * These functions should only be used at the direction of Cavium
56215976Sjmallett * Networks. Programming incorrect values into the JTAG chain
57215976Sjmallett * can cause chip damage.
58215976Sjmallett */
59215976Sjmallettextern void cvmx_helper_qlm_jtag_init(void);
60215976Sjmallett
61215976Sjmallett/**
62215976Sjmallett * Write up to 32bits into the QLM jtag chain. Bits are shifted
63215976Sjmallett * into the MSB and out the LSB, so you should shift in the low
64215976Sjmallett * order bits followed by the high order bits. The JTAG chain for
65215976Sjmallett * CN52XX and CN56XX is 4 * 268 bits long, or 1072. The JTAG chain
66215976Sjmallett * for CN63XX is 4 * 300 bits long, or 1200.
67215976Sjmallett *
68215976Sjmallett * @param qlm    QLM to shift value into
69215976Sjmallett * @param bits   Number of bits to shift in (1-32).
70215976Sjmallett * @param data   Data to shift in. Bit 0 enters the chain first, followed by
71215976Sjmallett *               bit 1, etc.
72215976Sjmallett *
73215976Sjmallett * @return The low order bits of the JTAG chain that shifted out of the
74215976Sjmallett *         circle.
75215976Sjmallett */
76215976Sjmallettextern uint32_t cvmx_helper_qlm_jtag_shift(int qlm, int bits, uint32_t data);
77215976Sjmallett
78215976Sjmallett/**
79215976Sjmallett * Shift long sequences of zeros into the QLM JTAG chain. It is
80215976Sjmallett * common to need to shift more than 32 bits of zeros into the
81215976Sjmallett * chain. This function is a convience wrapper around
82215976Sjmallett * cvmx_helper_qlm_jtag_shift() to shift more than 32 bits of
83215976Sjmallett * zeros at a time.
84215976Sjmallett *
85215976Sjmallett * @param qlm    QLM to shift zeros into
86215976Sjmallett * @param bits
87215976Sjmallett */
88215976Sjmallettextern void cvmx_helper_qlm_jtag_shift_zeros(int qlm, int bits);
89215976Sjmallett
90215976Sjmallett/**
91215976Sjmallett * Program the QLM JTAG chain into all lanes of the QLM. You must
92215976Sjmallett * have already shifted in the proper number of bits into the
93215976Sjmallett * JTAG chain. Updating invalid values can possibly cause chip damage.
94215976Sjmallett *
95215976Sjmallett * @param qlm    QLM to program
96215976Sjmallett */
97215976Sjmallettextern void cvmx_helper_qlm_jtag_update(int qlm);
98215976Sjmallett
99215976Sjmallett/**
100215976Sjmallett * Load the QLM JTAG chain with data from all lanes of the QLM.
101215976Sjmallett *
102215976Sjmallett * @param qlm    QLM to program
103215976Sjmallett */
104215976Sjmallettextern void cvmx_helper_qlm_jtag_capture(int qlm);
105215976Sjmallett
106215976Sjmallett#endif  /* __CVMX_HELPER_JTAG_H__ */
107