cvmx-pcm-defs.h revision 215976
1254721Semaste/***********************license start***************
2254721Semaste * Copyright (c) 2003-2010  Cavium Networks (support@cavium.com). All rights
3254721Semaste * reserved.
4254721Semaste *
5254721Semaste *
6254721Semaste * Redistribution and use in source and binary forms, with or without
7254721Semaste * modification, are permitted provided that the following conditions are
8254721Semaste * met:
9254721Semaste *
10254721Semaste *   * Redistributions of source code must retain the above copyright
11254721Semaste *     notice, this list of conditions and the following disclaimer.
12254721Semaste *
13254721Semaste *   * Redistributions in binary form must reproduce the above
14254721Semaste *     copyright notice, this list of conditions and the following
15254721Semaste *     disclaimer in the documentation and/or other materials provided
16254721Semaste *     with the distribution.
17254721Semaste
18254721Semaste *   * Neither the name of Cavium Networks nor the names of
19254721Semaste *     its contributors may be used to endorse or promote products
20254721Semaste *     derived from this software without specific prior written
21254721Semaste *     permission.
22254721Semaste
23254721Semaste * This Software, including technical data, may be subject to U.S. export  control
24254721Semaste * laws, including the U.S. Export Administration Act and its  associated
25254721Semaste * regulations, and may be subject to export or import  regulations in other
26254721Semaste * countries.
27254721Semaste
28254721Semaste * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29254721Semaste * AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
30254721Semaste * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31254721Semaste * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32254721Semaste * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33254721Semaste * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34254721Semaste * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35254721Semaste * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36254721Semaste * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
37254721Semaste * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38254721Semaste ***********************license end**************************************/
39254721Semaste
40254721Semaste
41254721Semaste/**
42254721Semaste * cvmx-pcm-defs.h
43254721Semaste *
44254721Semaste * Configuration and status register (CSR) type definitions for
45254721Semaste * Octeon pcm.
46254721Semaste *
47254721Semaste * This file is auto generated. Do not edit.
48254721Semaste *
49254721Semaste * <hr>$Revision$<hr>
50254721Semaste *
51254721Semaste */
52254721Semaste#ifndef __CVMX_PCM_TYPEDEFS_H__
53254721Semaste#define __CVMX_PCM_TYPEDEFS_H__
54254721Semaste
55254721Semaste#if CVMX_ENABLE_CSR_ADDRESS_CHECKING
56254721Semastestatic inline uint64_t CVMX_PCM_CLKX_CFG(unsigned long offset)
57254721Semaste{
58254721Semaste	if (!(
59254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN30XX) && ((offset <= 1))) ||
60254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN31XX) && ((offset <= 1))) ||
61269024Semaste	      (OCTEON_IS_MODEL(OCTEON_CN50XX) && ((offset <= 1)))))
62254721Semaste		cvmx_warn("CVMX_PCM_CLKX_CFG(%lu) is invalid on this chip\n", offset);
63254721Semaste	return CVMX_ADD_IO_SEG(0x0001070000010000ull) + ((offset) & 1) * 16384;
64254721Semaste}
65254721Semaste#else
66254721Semaste#define CVMX_PCM_CLKX_CFG(offset) (CVMX_ADD_IO_SEG(0x0001070000010000ull) + ((offset) & 1) * 16384)
67269024Semaste#endif
68254721Semaste#if CVMX_ENABLE_CSR_ADDRESS_CHECKING
69254721Semastestatic inline uint64_t CVMX_PCM_CLKX_DBG(unsigned long offset)
70254721Semaste{
71254721Semaste	if (!(
72254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN30XX) && ((offset <= 1))) ||
73263363Semaste	      (OCTEON_IS_MODEL(OCTEON_CN31XX) && ((offset <= 1))) ||
74254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN50XX) && ((offset <= 1)))))
75254721Semaste		cvmx_warn("CVMX_PCM_CLKX_DBG(%lu) is invalid on this chip\n", offset);
76254721Semaste	return CVMX_ADD_IO_SEG(0x0001070000010038ull) + ((offset) & 1) * 16384;
77254721Semaste}
78254721Semaste#else
79254721Semaste#define CVMX_PCM_CLKX_DBG(offset) (CVMX_ADD_IO_SEG(0x0001070000010038ull) + ((offset) & 1) * 16384)
80254721Semaste#endif
81254721Semaste#if CVMX_ENABLE_CSR_ADDRESS_CHECKING
82263363Semastestatic inline uint64_t CVMX_PCM_CLKX_GEN(unsigned long offset)
83263363Semaste{
84263363Semaste	if (!(
85254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN30XX) && ((offset <= 1))) ||
86254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN31XX) && ((offset <= 1))) ||
87254721Semaste	      (OCTEON_IS_MODEL(OCTEON_CN50XX) && ((offset <= 1)))))
88254721Semaste		cvmx_warn("CVMX_PCM_CLKX_GEN(%lu) is invalid on this chip\n", offset);
89254721Semaste	return CVMX_ADD_IO_SEG(0x0001070000010008ull) + ((offset) & 1) * 16384;
90254721Semaste}
91254721Semaste#else
92254721Semaste#define CVMX_PCM_CLKX_GEN(offset) (CVMX_ADD_IO_SEG(0x0001070000010008ull) + ((offset) & 1) * 16384)
93254721Semaste#endif
94254721Semaste
95254721Semaste/**
96254721Semaste * cvmx_pcm_clk#_cfg
97254721Semaste */
98254721Semasteunion cvmx_pcm_clkx_cfg
99254721Semaste{
100254721Semaste	uint64_t u64;
101254721Semaste	struct cvmx_pcm_clkx_cfg_s
102254721Semaste	{
103254721Semaste#if __BYTE_ORDER == __BIG_ENDIAN
104254721Semaste	uint64_t fsyncgood                    : 1;  /**< FSYNC status
105254721Semaste                                                         If 1, the last frame had a correctly positioned
106254721Semaste                                                               fsync pulse
107254721Semaste                                                         If 0, none/extra fsync pulse seen on most recent
108254721Semaste                                                               frame
109254721Semaste                                                         NOTE: this is intended for startup. the FSYNCEXTRA
110254721Semaste                                                         and FSYNCMISSING interrupts are intended for
111254721Semaste                                                         detecting loss of sync during normal operation. */
112254721Semaste	uint64_t reserved_48_62               : 15;
113254721Semaste	uint64_t fsyncsamp                    : 16; /**< Number of ECLKs from internal BCLK edge to
114254721Semaste                                                         sample FSYNC
115254721Semaste                                                         NOTE: used to sync to the start of a frame and to
116254721Semaste                                                         check for FSYNC errors. */
117254721Semaste	uint64_t reserved_26_31               : 6;
118254721Semaste	uint64_t fsynclen                     : 5;  /**< Number of 1/2 BCLKs FSYNC is asserted for
119254721Semaste                                                         NOTE: only used when GEN==1 */
120254721Semaste	uint64_t fsyncloc                     : 5;  /**< FSYNC location, in 1/2 BCLKS before timeslot 0,
121254721Semaste                                                         bit 0.
122254721Semaste                                                         NOTE: also used to detect framing errors and
123254721Semaste                                                         therefore must have a correct value even if GEN==0 */
124254721Semaste	uint64_t numslots                     : 10; /**< Number of 8-bit slots in a frame
125254721Semaste                                                         NOTE: this, along with EXTRABIT and Fbclk
126254721Semaste                                                         determines FSYNC frequency when GEN == 1
127254721Semaste                                                         NOTE: also used to detect framing errors and
128254721Semaste                                                         therefore must have a correct value even if GEN==0 */
129254721Semaste	uint64_t extrabit                     : 1;  /**< If 0, no frame bit
130254721Semaste                                                         If 1, add one extra bit time for frame bit
131254721Semaste                                                         NOTE: if GEN == 1, then FSYNC will be delayed one
132254721Semaste                                                         extra bit time.
133254721Semaste                                                         NOTE: also used to detect framing errors and
134254721Semaste                                                         therefore must have a correct value even if GEN==0
135254721Semaste                                                         NOTE: the extra bit comes from the LSB/MSB of the
136254721Semaste                                                         first byte of the frame in the transmit memory
137254721Semaste                                                         region.  LSB vs MSB is determined from the setting
138254721Semaste                                                         of PCMn_TDM_CFG[LSBFIRST]. */
139254721Semaste	uint64_t bitlen                       : 2;  /**< Number of BCLKs in a bit time.
140254721Semaste                                                         0 : 1 BCLK
141254721Semaste                                                         1 : 2 BCLKs
142254721Semaste                                                         2 : 4 BCLKs
143254721Semaste                                                         3 : operation undefined */
144254721Semaste	uint64_t bclkpol                      : 1;  /**< If 0, BCLK rise edge is start of bit time
145254721Semaste                                                         If 1, BCLK fall edge is start of bit time
146254721Semaste                                                         NOTE: also used to detect framing errors and
147254721Semaste                                                         therefore must have a correct value even if GEN==0 */
148263368Semaste	uint64_t fsyncpol                     : 1;  /**< If 0, FSYNC idles low, asserts high
149269024Semaste                                                         If 1, FSYNC idles high, asserts low
150254721Semaste                                                         NOTE: also used to detect framing errors and
151254721Semaste                                                         therefore must have a correct value even if GEN==0 */
152254721Semaste	uint64_t ena                          : 1;  /**< If 0, Clock receiving logic is doing nothing
153254721Semaste                                                         1, Clock receiving logic is looking for sync */
154254721Semaste#else
155254721Semaste	uint64_t ena                          : 1;
156254721Semaste	uint64_t fsyncpol                     : 1;
157254721Semaste	uint64_t bclkpol                      : 1;
158254721Semaste	uint64_t bitlen                       : 2;
159254721Semaste	uint64_t extrabit                     : 1;
160254721Semaste	uint64_t numslots                     : 10;
161254721Semaste	uint64_t fsyncloc                     : 5;
162254721Semaste	uint64_t fsynclen                     : 5;
163254721Semaste	uint64_t reserved_26_31               : 6;
164254721Semaste	uint64_t fsyncsamp                    : 16;
165254721Semaste	uint64_t reserved_48_62               : 15;
166254721Semaste	uint64_t fsyncgood                    : 1;
167254721Semaste#endif
168254721Semaste	} s;
169254721Semaste	struct cvmx_pcm_clkx_cfg_s            cn30xx;
170254721Semaste	struct cvmx_pcm_clkx_cfg_s            cn31xx;
171263363Semaste	struct cvmx_pcm_clkx_cfg_s            cn50xx;
172263363Semaste};
173263363Semastetypedef union cvmx_pcm_clkx_cfg cvmx_pcm_clkx_cfg_t;
174254721Semaste
175254721Semaste/**
176254721Semaste * cvmx_pcm_clk#_dbg
177254721Semaste */
178254721Semasteunion cvmx_pcm_clkx_dbg
179254721Semaste{
180254721Semaste	uint64_t u64;
181254721Semaste	struct cvmx_pcm_clkx_dbg_s
182254721Semaste	{
183254721Semaste#if __BYTE_ORDER == __BIG_ENDIAN
184254721Semaste	uint64_t debuginfo                    : 64; /**< Miscellaneous debug information */
185254721Semaste#else
186254721Semaste	uint64_t debuginfo                    : 64;
187254721Semaste#endif
188254721Semaste	} s;
189254721Semaste	struct cvmx_pcm_clkx_dbg_s            cn30xx;
190254721Semaste	struct cvmx_pcm_clkx_dbg_s            cn31xx;
191254721Semaste	struct cvmx_pcm_clkx_dbg_s            cn50xx;
192254721Semaste};
193254721Semastetypedef union cvmx_pcm_clkx_dbg cvmx_pcm_clkx_dbg_t;
194254721Semaste
195254721Semaste/**
196254721Semaste * cvmx_pcm_clk#_gen
197254721Semaste */
198254721Semasteunion cvmx_pcm_clkx_gen
199254721Semaste{
200254721Semaste	uint64_t u64;
201254721Semaste	struct cvmx_pcm_clkx_gen_s
202254721Semaste	{
203254721Semaste#if __BYTE_ORDER == __BIG_ENDIAN
204254721Semaste	uint64_t deltasamp                    : 16; /**< Signed number of ECLKs to move sampled BCLK edge
205254721Semaste                                                         NOTE: the complete number of ECLKs to move is:
206254721Semaste                                                                   NUMSAMP + 2 + 1 + DELTASAMP
207254721Semaste                                                               NUMSAMP to compensate for sampling delay
208254721Semaste                                                               + 2 to compensate for dual-rank synchronizer
209254721Semaste                                                               + 1 for uncertainity
210254721Semaste                                                               + DELTASAMP to CMA/debugging */
211254721Semaste	uint64_t numsamp                      : 16; /**< Number of ECLK samples to detect BCLK change when
212254721Semaste                                                         receiving clock. */
213254721Semaste	uint64_t n                            : 32; /**< Determines BCLK frequency when generating clock
214254721Semaste                                                         NOTE: Fbclk = Feclk * N / 2^32
215254721Semaste                                                               N = (Fbclk / Feclk) * 2^32
216                                                         NOTE: writing N == 0 stops the clock generator, and
217                                                               causes bclk and fsync to be RECEIVED */
218#else
219	uint64_t n                            : 32;
220	uint64_t numsamp                      : 16;
221	uint64_t deltasamp                    : 16;
222#endif
223	} s;
224	struct cvmx_pcm_clkx_gen_s            cn30xx;
225	struct cvmx_pcm_clkx_gen_s            cn31xx;
226	struct cvmx_pcm_clkx_gen_s            cn50xx;
227};
228typedef union cvmx_pcm_clkx_gen cvmx_pcm_clkx_gen_t;
229
230#endif
231