xref: /OK3568_Linux_fs/kernel/drivers/rkflash/rkflash_debug.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun 
3*4882a593Smuzhiyun /* Copyright (c) 2018 Rockchip Electronics Co. Ltd. */
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #ifndef _RKFLASH_DEBUG_H
6*4882a593Smuzhiyun #define _RKFLASH_DEBUG_H
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #include <linux/kernel.h>
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun /*
11*4882a593Smuzhiyun  * Debug control center
12*4882a593Smuzhiyun  * 1. Set Printing-adding-macro to 1 to allow print code being compiled in.
13*4882a593Smuzhiyun  * 2. Set variable 'rkflash_debug' to control debug print to enable print.
14*4882a593Smuzhiyun  */
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /*
17*4882a593Smuzhiyun  * Printing-adding
18*4882a593Smuzhiyun  */
19*4882a593Smuzhiyun #define	PRINT_SWI_INFO		0
20*4882a593Smuzhiyun #define	PRINT_SWI_ERROR		1
21*4882a593Smuzhiyun #define PRINT_SWI_HEX		1
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #define	PRINT_SWI_CON_IO	1
24*4882a593Smuzhiyun #define	PRINT_SWI_BLK_IO	1
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /*
27*4882a593Smuzhiyun  * Print switch, set var rkflash_debug corresponding bit to 1 if needed.
28*4882a593Smuzhiyun  * I - info
29*4882a593Smuzhiyun  * IO - IO request about
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun #define	PRINT_BIT_CON_IO	BIT(0)
32*4882a593Smuzhiyun #define	PRINT_BIT_BLK_IO	BIT(4)
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun __printf(1, 2) int rkflash_print_info(const char *fmt, ...);
35*4882a593Smuzhiyun __printf(1, 2) int rkflash_print_error(const char *fmt, ...);
36*4882a593Smuzhiyun void rkflash_print_hex(const char *s, const void *buf, int w, size_t len);
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun __printf(1, 2) int rkflash_print_dio(const char *fmt, ...);
39*4882a593Smuzhiyun __printf(1, 2) int rkflash_print_bio(const char *fmt, ...);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #endif
42*4882a593Smuzhiyun 
43