Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: arch/arm/mach-tegra/nv/include/nvrm_diag.h

Issue 3256004: [ARM] tegra: add nvos/nvrm/nvmap drivers (Closed) Base URL: ssh://git@gitrw.chromium.org/kernel.git
Patch Set: remove ap15 headers Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_boot.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_dma.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2009 NVIDIA Corporation.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * Neither the name of the NVIDIA Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 #ifndef INCLUDED_nvrm_diag_H
34 #define INCLUDED_nvrm_diag_H
35
36
37 #if defined(__cplusplus)
38 extern "C"
39 {
40 #endif
41
42 #include "nvrm_init.h"
43
44 #include "nvcommon.h"
45
46 /**
47 * All of the hardware modules. Multiple instances are handled by the
48 * NVRM_DIAG_MODULE macro.
49 */
50
51 typedef enum
52 {
53 NvRmDiagModuleID_Cache = 1,
54 NvRmDiagModuleID_Vcp,
55 NvRmDiagModuleID_Host1x,
56 NvRmDiagModuleID_Display,
57 NvRmDiagModuleID_Ide,
58 NvRmDiagModuleID_3d,
59 NvRmDiagModuleID_Isp,
60 NvRmDiagModuleID_Usb,
61 NvRmDiagModuleID_2d,
62 NvRmDiagModuleID_Vi,
63 NvRmDiagModuleID_Epp,
64 NvRmDiagModuleID_I2s,
65 NvRmDiagModuleID_Pwm,
66 NvRmDiagModuleID_Twc,
67 NvRmDiagModuleID_Hsmmc,
68 NvRmDiagModuleID_Sdio,
69 NvRmDiagModuleID_NandFlash,
70 NvRmDiagModuleID_I2c,
71 NvRmDiagModuleID_Spdif,
72 NvRmDiagModuleID_Gpio,
73 NvRmDiagModuleID_Uart,
74 NvRmDiagModuleID_Timer,
75 NvRmDiagModuleID_Rtc,
76 NvRmDiagModuleID_Ac97,
77 NvRmDiagModuleID_Coprocessor,
78 NvRmDiagModuleID_Cpu,
79 NvRmDiagModuleID_Bsev,
80 NvRmDiagModuleID_Bsea,
81 NvRmDiagModuleID_Vde,
82 NvRmDiagModuleID_Mpe,
83 NvRmDiagModuleID_Emc,
84 NvRmDiagModuleID_Sprom,
85 NvRmDiagModuleID_Tvdac,
86 NvRmDiagModuleID_Csi,
87 NvRmDiagModuleID_Hdmi,
88 NvRmDiagModuleID_MipiBaseband,
89 NvRmDiagModuleID_Tvo,
90 NvRmDiagModuleID_Dsi,
91 NvRmDiagModuleID_Dvc,
92 NvRmDiagModuleID_Sbc,
93 NvRmDiagModuleID_Xio,
94 NvRmDiagModuleID_Spi,
95 NvRmDiagModuleID_NorFlash,
96 NvRmDiagModuleID_Slc,
97 NvRmDiagModuleID_Fuse,
98 NvRmDiagModuleID_Pmc,
99 NvRmDiagModuleID_StatMon,
100 NvRmDiagModuleID_Kbc,
101 NvRmDiagModuleID_Vg,
102 NvRmDiagModuleID_ApbDma,
103 NvRmDiagModuleID_Mc,
104 NvRmDiagModuleID_SpdifIn,
105 NvRmDiagModuleID_Vfir,
106 NvRmDiagModuleID_Cve,
107 NvRmDiagModuleID_ViSensor,
108 NvRmDiagModuleID_SystemReset,
109 NvRmDiagModuleID_AvpUcq,
110 NvRmDiagModuleID_KFuse,
111 NvRmDiagModuleID_OneWire,
112 NvRmDiagModuleID_SyncNor,
113 NvRmDiagModuleID_Pcie,
114 NvRmDiagModuleID_Num,
115 NvRmDiagModuleID_Force32 = 0x7FFFFFFF
116 } NvRmDiagModuleID;
117
118 /**
119 * Create a diag module id with multiple instances.
120 */
121 #define NVRM_DIAG_MODULE( id, instance ) \
122 ((NvRmDiagModuleID)( (instance) << 16 | id ))
123
124 /**
125 * Get the module id.
126 */
127 #define NVRM_DIAG_MODULE_ID( id ) ((id) & 0xFFFF)
128
129 /**
130 * Get the module instance.
131 */
132 #define NVRM_DIAG_MODULE_INSTANCE( id ) (((id) >> 16) & 0xFFFF)
133
134 /**
135 * Enable/disable support for individual clock diagnostic lock
136 */
137 #define NVRM_DIAG_LOCK_SUPPORTED (0)
138
139 /**
140 * Append clock configuration flags with diagnostic lock flag
141 */
142 #define NvRmClockConfig_DiagLock ((NvRmClockConfigFlags_Num & (~0x01)) << 1)
143
144 /**
145 * Defines clock source types
146 */
147
148 typedef enum
149 {
150
151 /// Clock source with fixed frequency
152 NvRmDiagClockSourceType_Oscillator = 1,
153
154 /// PLL clock source
155 NvRmDiagClockSourceType_Pll,
156
157 /// Clock scaler derives its clock from oscillators, PLLs or other scalers
158 NvRmDiagClockSourceType_Scaler,
159 NvRmDiagClockSourceType_Num,
160 NvRmDiagClockSourceType_Force32 = 0x7FFFFFFF
161 } NvRmDiagClockSourceType;
162
163 /**
164 * Defines types of clock scalers. Scale coefficient for all clock scalers
165 * is specified as (m, n) pair of 32-bit values. The interpretation of the
166 * m, n values for each type is clarified below.
167 */
168
169 typedef enum
170 {
171
172 /// No clock scaler: m = n = 1 always
173 NvRmDiagClockScalerType_NoScaler = 1,
174
175 /// Clock divider with m = 1 always, and n = 31.1 format
176 /// with half-step lowest bit
177 NvRmDiagClockScalerType_Divider_1_N,
178
179 /// Clock divider with rational (m+1)/(n+1) coefficient; m and n are
180 /// integeres, scale 1:1 is applied if m >= n
181 NvRmDiagClockScalerType_Divider_M_N,
182
183 /// Clock divider with rational (m+1)/16 coefficient, i.e., n = 16 always;
184 /// m is integer, scale 1:1 is applied if m >= 15 ("keeps" m + 1 clocks
185 /// out of every 16)
186 NvRmDiagClockScalerType_Divider_M_16,
187
188 /// Clock doubler: scale 2:1 if m != 0, scale 1:1 if m = 0,
189 /// n = 1 always
190 NvRmDiagClockScalerType_Doubler,
191 NvRmDiagClockScalerType_Num,
192 NvRmDiagClockScalerType_Force32 = 0x7FFFFFFF
193 } NvRmDiagClockScalerType;
194
195 /**
196 * Defines RM thermal monitoring zones.
197 */
198
199 typedef enum
200 {
201
202 /// Specifies ambient temperature zone.
203 NvRmTmonZoneId_Ambient = 1,
204
205 /// Specifies SoC core temperature zone.
206 NvRmTmonZoneId_Core,
207 NvRmTmonZoneId_Num,
208 NvRmTmonZoneId_Force32 = 0x7FFFFFFF
209 } NvRmTmonZoneId;
210
211 /// Clock source opaque handle (TODO: replace forward idl declaration
212 /// of <enum> with forward declaration of <handle>, when it is supported
213 typedef struct NvRmClockSourceInfoRec* NvRmDiagClockSourceHandle;
214
215 /// Power rail opaque handle
216
217 typedef struct NvRmDiagPowerRailRec *NvRmDiagPowerRailHandle;
218
219 /**
220 * Enables diagnostic mode (disable is not allowed). Clock, voltage, etc.,
221 * will no longer be controlled by the Resource Manager. The NvRmDiag
222 * interfaces should be used instead.
223 *
224 * @param hDevice The RM device handle.
225 *
226 * @retval NvSuccess if diagnostic mode is successfully enabled.
227 * @retval NvError_InsufficientMemory if failed to allocate memory for
228 * diagnostic mode.
229 */
230
231 NvError NvRmDiagEnable(
232 NvRmDeviceHandle hDevice );
233
234 /**
235 * Lists modules present in the chip and available for diagnostic.
236 *
237 * @param pListSize Pointer to the list size. On entry specifies list size
238 * allocated by the client, on exit - actual number of Ids returned. If
239 * entry size is 0, maximum list size is returned.
240 * @param pIdList Pointer to the list of combined module Id/Instance values
241 * to be filled in by this function. Ignored if input list size is 0.
242 *
243 * @retval NvSuccess if the module list is successfully returned.
244 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
245 */
246
247 NvError NvRmDiagListModules(
248 NvU32 * pListSize,
249 NvRmDiagModuleID * pIdList );
250
251 /**
252 * Lists available SoC clock sources.
253 *
254 * @param pListSize Pointer to the list size. On entry specifies list size
255 * allocated by the client, on exit - actual number of source handles
256 * returned. If entry size is 0, maximum list size is returned.
257 * @param phSourceList Pointer to the list of source handles to be filled
258 * in by this function. Ignored if input list size is 0.
259 *
260 * @retval NvSuccess if the source list is successfully returned.
261 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
262 */
263
264 NvError NvRmDiagListClockSources(
265 NvU32 * pListSize,
266 NvRmDiagClockSourceHandle * phSourceList );
267
268 /**
269 * Lists clock sources for the specified module.
270 *
271 * @param id Combined Id and instance for the target module.
272 * @param pListSize Pointer to the list size. On entry specifies list size
273 * allocated by the client, on exit - actual number of source handles
274 * returned. If entry size is 0, maximum list size is returned.
275 * @param phSourceList Pointer to the list of source handles to be filled
276 * in by this function. Ignored if input list size is 0.
277 *
278 * @retval NvSuccess if the source list is successfully returned.
279 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
280 */
281
282 NvError NvRmDiagModuleListClockSources(
283 NvRmDiagModuleID id,
284 NvU32 * pListSize,
285 NvRmDiagClockSourceHandle * phSourceList );
286
287 /**
288 * Enables/Disables specified module clock.
289 *
290 * @param id Combined Id and instance for the target module.
291 * @param enable Requested clock state - enabled if true, disabled if false
292 *
293 * @retval NvSuccess if clock state changed successfully.
294 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
295 */
296
297 NvError NvRmDiagModuleClockEnable(
298 NvRmDiagModuleID id,
299 NvBool enable );
300
301 /**
302 * Configures the clock for the specified module.
303 *
304 * @param id Combined Id and instance for the target module.
305 * @param hSource The handle of the clock source to drive the given module.
306 * @param divider 31.1 format: lowest bit is half-step. No range checking.
307 * Half-step bit is ignored if module divider is not fractional. High
308 * bits are silently truncated if the value is out of h/w field range.
309 * @param Source1st If true, clock source is updated 1st, and the divider
310 * is modified after the chip specific delay. If false, the order of update
311 * is the reversed.
312 *
313 * @retval NvSuccess if clock state changed successfully.
314 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
315 */
316
317 NvError NvRmDiagModuleClockConfigure(
318 NvRmDiagModuleID id,
319 NvRmDiagClockSourceHandle hSource,
320 NvU32 divider,
321 NvBool Source1st );
322
323 /**
324 * Gets the name of the given clock source..
325 *
326 * @param hSource The target clock source handle.
327 *
328 * @return The 64-bit packed 8-character name of the given clock source. Zero
329 * will be returned if diagnostic mode is not enabled or the source is invalid.
330 */
331
332 NvU64 NvRmDiagClockSourceGetName(
333 NvRmDiagClockSourceHandle hSource );
334
335 /**
336 * Gets the type of the given clock source.
337 *
338 * @param hSource The target clock source handle.
339 *
340 * @return The type of the given clock source. Zero will be returned if
341 * diagnostic mode is not enabled or the source is invalid.
342 */
343
344 NvRmDiagClockSourceType NvRmDiagClockSourceGetType(
345 NvRmDiagClockSourceHandle hSource );
346
347 /**
348 * Gets the type of the scaler for the given clock source.
349 *
350 * @param hSource The target clock source handle.
351 *
352 * @return The type of the scaler for the given clock source. Zero will be
353 * be returned if diagnostic mode is not enabled or the source is invalid.
354 */
355
356 NvRmDiagClockScalerType NvRmDiagClockSourceGetScaler(
357 NvRmDiagClockSourceHandle hSource );
358
359 /**
360 * Lists input clock sources for the specified clock source.
361 * Primary oscillators have no input sources, and always return 0 as
362 * list size. Other sources (secondary sources with fixed frequency,
363 * PLLs and scalers) have 1 + input sources.
364 *
365 * @param hSource The target clock source handle.
366 * @param pListSize Pointer to the list size. On entry specifies list size
367 * allocated by the client, on exit - actual number of source handles
368 * returned. If entry size is 0, maximum list size is returned.
369 * @param phSourceList Pointer to the list of source handles to be filled
370 * in by this function. Ignored if input list size is 0.
371 *
372 * @retval NvSuccess if the source list is successfully returned.
373 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
374 */
375
376 NvError NvRmDiagClockSourceListSources(
377 NvRmDiagClockSourceHandle hSource,
378 NvU32 * pListSize,
379 NvRmDiagClockSourceHandle * phSourceList );
380
381 /**
382 * Gets the given oscillator frequency in kHz.
383 *
384 * @param hOscillator The targeted oscillator/fixed frequency source handle.
385 *
386 * @return The oscillator frequency in kHz. Zero will be returned if
387 * diagnostic mode is not enabled or the target source is invalid.
388 */
389
390 NvU32 NvRmDiagOscillatorGetFreq(
391 NvRmDiagClockSourceHandle hOscillator );
392
393 /**
394 * Configures given PLL. Switches PLL in bypass mode, changes PLL settings,
395 * waits for PLL stabilization, and switches back to PLL output.
396 *
397 * @param hPll The targeted PLL handle.
398 * @param M Input divider settings (32-bit integer value)
399 * @param N Feedback divider settings (32-bit integer value)
400 * @param P Post divider settings (32-bit integer value)
401 * If either M or N is zero PLL is left disabled and bypassed. Bsides that,
402 * no other M, N, P parameters validation. High bits are silently truncated
403 * if value is out of h/w field range.
404 *
405 * @retval NvSuccess if clock state changed successfully.
406 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
407 */
408
409 NvError NvRmDiagPllConfigure(
410 NvRmDiagClockSourceHandle hPll,
411 NvU32 M,
412 NvU32 N,
413 NvU32 P );
414
415 /**
416 * Configures specified clock scaler.
417 *
418 * @param hScaler The targeted Clock Scaler handle.
419 * @param hInput The handle of the input clock source to drive the
420 * targeted scaler.
421 * @param M The dividend in the scaler coefficient (M/N) - 31.1 format:
422 * lowest bit is half-step.
423 * @param N The divisor in the scaler coefficient (M/N) - 31.1 format:
424 * lowest bit is half-step.
425 * No range checking for M, N parameters. Half-step bit is ignored if
426 * the scaler is not fractional. High bits are silently truncated if
427 * the value is out of h/w field range.
428 *
429 * @retval NvSuccess if clock state changed successfully.
430 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
431 */
432
433 NvError NvRmDiagClockScalerConfigure(
434 NvRmDiagClockSourceHandle hScaler,
435 NvRmDiagClockSourceHandle hInput,
436 NvU32 M,
437 NvU32 N );
438
439 /**
440 * Resets module.
441 *
442 * @param id Combined Id and instance for the target module.
443 * @param KeepAsserted If true, reset will be kept asserted on exit.
444 * If false, reset is kept asserted for chip specific delay, and
445 * de-asserted on exit.
446 *
447 * @retval NvSuccess if module reset completed successfully.
448 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
449 */
450
451 NvError NvRmDiagModuleReset(
452 NvRmDiagModuleID id,
453 NvBool KeepAsserted );
454
455 /**
456 * Lists power rails.
457 *
458 * @param pListSize Pointer to the list size. On entry specifies list size
459 * allocated by the client, on exit - actual number of rail handles
460 * returned. If entry size is 0, maximum list size is returned.
461 * @param phSourceList Pointer to the list of power rail handles to be filled
462 * in by this function. Ignored if input list size is 0.
463 *
464 * @retval NvSuccess if the source list is successfully returned.
465 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
466 */
467
468 NvError NvRmDiagListPowerRails(
469 NvU32 * pListSize,
470 NvRmDiagPowerRailHandle * phRailList );
471
472 /**
473 * Gets the name of the given power rail.
474 *
475 * @param hRail The target power rail handle.
476 *
477 * @return The 64-bit packed 8-character name of the given rail. Zero will be
478 * returned if diagnostic mode is not enabled or the rail is invalid.
479 */
480
481 NvU64 NvRmDiagPowerRailGetName(
482 NvRmDiagPowerRailHandle hRail );
483
484 /**
485 * Lists power rails for the specified module.
486 *
487 * @param id Combined Id and instance for the target module.
488 * @param pListSize Pointer to the list size. On entry specifies list size
489 * allocated by the client, on exit - actual number of power rail handles
490 * returned. If entry size is 0, maximum list size is returned.
491 * @param phRailList Pointer to the list of source handles to be filled
492 * in by this function. Ignored if input list size is 0.
493 *
494 * @retval NvSuccess if the power rail list is successfully returned.
495 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
496 */
497
498 NvError NvRmDiagModuleListPowerRails(
499 NvRmDiagModuleID id,
500 NvU32 * pListSize,
501 NvRmDiagPowerRailHandle * phRailList );
502
503 /**
504 * Configures power rail voltage.
505 *
506 * @param hRail The target power rail handle.
507 * @param VoltageMV The requested voltage level in millivolts.
508 *
509 * @retval NvSuccess if the power rail is successfully configured.
510 * @retval NvError_NotInitialized if diagnostic mode is not enabled.
511 */
512
513 NvError NvRmDiagConfigurePowerRail(
514 NvRmDiagPowerRailHandle hRail,
515 NvU32 VoltageMV );
516
517 /**
518 * Verifies support for individual clock diagnostic lock (if supported
519 * clock frequency can be locked when diagnostic mode is disabled).
520 *
521 * @retval NV_TRUE if individual clock diagnostic lock is supported.
522 * @retval NV_FALSE if individual clock diagnostic lock is not supported.
523 */
524
525 NvBool NvRmDiagIsLockSupported(
526 void );
527
528 /**
529 * Gets temperature in the specified thermal zone (used for
530 * thermal profiling, does not require diagnostic mode to be enabled)
531 *
532 * @param hRmDeviceHandle The RM device handle.
533 * @param ZoneId The targeted thermal zone ID.
534 * @param pTemperatureC Output storage pointer for zone temperature
535 * (in degrees C).
536 *
537 * @retval NvSuccess if temperature is returned successfully.
538 * @retval NvError_Busy if attempt to access temperature monitoring
539 * device failed.
540 * @retval NvError_NotSupported if the specified zone is not monitored.
541 */
542
543 NvError NvRmDiagGetTemperature(
544 NvRmDeviceHandle hRmDeviceHandle,
545 NvRmTmonZoneId ZoneId,
546 NvS32 * pTemperatureC );
547
548 #if defined(__cplusplus)
549 }
550 #endif
551
552 #endif
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_boot.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_dma.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698