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