1/***********************license start***************
2 * Copyright (c) 2003-2010  Cavium Inc. (support@cavium.com). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 *   * Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 *
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.
17
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
21 *     permission.
22
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
26 * countries.
27
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**************************************/
39
40
41/**
42 * @file
43 *
44 *  Helper utilities for qlm_jtag.
45 *
46 * <hr>$Revision: 41586 $<hr>
47 */
48
49#ifndef __CVMX_HELPER_JTAG_H__
50#define __CVMX_HELPER_JTAG_H__
51
52/**
53 * Initialize the internal QLM JTAG logic to allow programming
54 * of the JTAG chain by the cvmx_helper_qlm_jtag_*() functions.
55 * These functions should only be used at the direction of Cavium
56 * Networks. Programming incorrect values into the JTAG chain
57 * can cause chip damage.
58 */
59extern void cvmx_helper_qlm_jtag_init(void);
60
61/**
62 * Write up to 32bits into the QLM jtag chain. Bits are shifted
63 * into the MSB and out the LSB, so you should shift in the low
64 * order bits followed by the high order bits. The JTAG chain for
65 * CN52XX and CN56XX is 4 * 268 bits long, or 1072. The JTAG chain
66 * for CN63XX is 4 * 300 bits long, or 1200.
67 *
68 * @param qlm    QLM to shift value into
69 * @param bits   Number of bits to shift in (1-32).
70 * @param data   Data to shift in. Bit 0 enters the chain first, followed by
71 *               bit 1, etc.
72 *
73 * @return The low order bits of the JTAG chain that shifted out of the
74 *         circle.
75 */
76extern uint32_t cvmx_helper_qlm_jtag_shift(int qlm, int bits, uint32_t data);
77
78/**
79 * Shift long sequences of zeros into the QLM JTAG chain. It is
80 * common to need to shift more than 32 bits of zeros into the
81 * chain. This function is a convience wrapper around
82 * cvmx_helper_qlm_jtag_shift() to shift more than 32 bits of
83 * zeros at a time.
84 *
85 * @param qlm    QLM to shift zeros into
86 * @param bits
87 */
88extern void cvmx_helper_qlm_jtag_shift_zeros(int qlm, int bits);
89
90/**
91 * Program the QLM JTAG chain into all lanes of the QLM. You must
92 * have already shifted in the proper number of bits into the
93 * JTAG chain. Updating invalid values can possibly cause chip damage.
94 *
95 * @param qlm    QLM to program
96 */
97extern void cvmx_helper_qlm_jtag_update(int qlm);
98
99/**
100 * Load the QLM JTAG chain with data from all lanes of the QLM.
101 *
102 * @param qlm    QLM to program
103 */
104extern void cvmx_helper_qlm_jtag_capture(int qlm);
105
106#endif  /* __CVMX_HELPER_JTAG_H__ */
107