1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) Marvell International Ltd. and its affiliates
4  */
5 
6 #ifndef _DDR3_LOGGING_CONFIG_H
7 #define _DDR3_LOGGING_CONFIG_H
8 
9 #ifdef SILENT_LIB
10 #define DEBUG_TRAINING_BIST_ENGINE(level, s)
11 #define DEBUG_TRAINING_IP(level, s)
12 #define DEBUG_CENTRALIZATION_ENGINE(level, s)
13 #define DEBUG_TRAINING_HW_ALG(level, s)
14 #define DEBUG_TRAINING_IP_ENGINE(level, s)
15 #define DEBUG_LEVELING(level, s)
16 #define DEBUG_PBS_ENGINE(level, s)
17 #define DEBUG_TRAINING_STATIC_IP(level, s)
18 #define DEBUG_TRAINING_ACCESS(level, s)
19 #else
20 #ifdef LIB_FUNCTIONAL_DEBUG_ONLY
21 #define DEBUG_TRAINING_BIST_ENGINE(level, s)
22 #define DEBUG_TRAINING_IP_ENGINE(level, s)
23 #define DEBUG_TRAINING_IP(level, s)		\
24 	if (level >= debug_training)		\
25 		printf s
26 #define DEBUG_CENTRALIZATION_ENGINE(level, s)	\
27 	if (level >= debug_centralization)	\
28 		printf s
29 #define DEBUG_TRAINING_HW_ALG(level, s)		\
30 	if (level >= debug_training_hw_alg)	\
31 		printf s
32 #define DEBUG_LEVELING(level, s)		\
33 	if (level >= debug_leveling)		\
34 		printf s
35 #define DEBUG_PBS_ENGINE(level, s)		\
36 	if (level >= debug_pbs)			\
37 		printf s
38 #define DEBUG_TRAINING_STATIC_IP(level, s)	\
39 	if (level >= debug_training_static)	\
40 		printf s
41 #define DEBUG_TRAINING_ACCESS(level, s)		\
42 	if (level >= debug_training_access)	\
43 		printf s
44 #else
45 #define DEBUG_TRAINING_BIST_ENGINE(level, s)	\
46 	if (level >= debug_training_bist)	\
47 		printf s
48 
49 #define DEBUG_TRAINING_IP_ENGINE(level, s)	\
50 	if (level >= debug_training_ip)		\
51 		printf s
52 #define DEBUG_TRAINING_IP(level, s)		\
53 	if (level >= debug_training)		\
54 		printf s
55 #define DEBUG_CENTRALIZATION_ENGINE(level, s)	\
56 	if (level >= debug_centralization)	\
57 		printf s
58 #define DEBUG_TRAINING_HW_ALG(level, s)		\
59 	if (level >= debug_training_hw_alg)	\
60 		printf s
61 #define DEBUG_LEVELING(level, s)		\
62 	if (level >= debug_leveling)		\
63 		printf s
64 #define DEBUG_PBS_ENGINE(level, s)		\
65 	if (level >= debug_pbs)			\
66 		printf s
67 #define DEBUG_TRAINING_STATIC_IP(level, s)	\
68 	if (level >= debug_training_static)	\
69 		printf s
70 #define DEBUG_TRAINING_ACCESS(level, s)		\
71 	if (level >= debug_training_access)	\
72 		printf s
73 #endif
74 #endif
75 
76 /* Logging defines */
77 #define DEBUG_LEVEL_TRACE	1
78 #define DEBUG_LEVEL_INFO	2
79 #define DEBUG_LEVEL_ERROR	3
80 
81 enum ddr_lib_debug_block {
82 	DEBUG_BLOCK_STATIC,
83 	DEBUG_BLOCK_TRAINING_MAIN,
84 	DEBUG_BLOCK_LEVELING,
85 	DEBUG_BLOCK_CENTRALIZATION,
86 	DEBUG_BLOCK_PBS,
87 	DEBUG_BLOCK_IP,
88 	DEBUG_BLOCK_BIST,
89 	DEBUG_BLOCK_ALG,
90 	DEBUG_BLOCK_DEVICE,
91 	DEBUG_BLOCK_ACCESS,
92 	DEBUG_STAGES_REG_DUMP,
93 	/* All excluding IP and REG_DUMP, should be enabled separatelly */
94 	DEBUG_BLOCK_ALL
95 };
96 
97 int ddr3_tip_print_log(u32 dev_num, u32 mem_addr);
98 int ddr3_tip_print_stability_log(u32 dev_num);
99 
100 #endif /* _DDR3_LOGGING_CONFIG_H */
101