2 * Synopsys DesignWare Multimedia Card Interface driver
4 * Copyright (C) 2014 Fuzhou Rockchip Electronics Co.Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #ifndef __RK_SDMMC_DBG_H
13 #define __RK_SDMMC_DBG_H
15 #include <linux/of_gpio.h>
16 #include <linux/of_i2c.h>
17 #include <linux/types.h>
18 #include <linux/bitops.h>
21 #define DRIVER_NAME "rk_sdmmc"
22 #define DRIVER_PREFIX DRIVER_NAME ": "
23 #define DRIVER_VER "Dw-mci-rockchip"
27 MMC_DBG_BOOT = BIT(0),
28 MMC_DBG_ERROR= BIT(1),
29 MMC_DBG_WARN = BIT(2),
30 MMC_DBG_INFO = BIT(3),
33 MMC_DBG_SW_VOL = BIT(6),
38 extern u32 mmc_debug_level;
39 extern char dbg_flag[];
41 #define MMC_DBG_FUNC_CONFIG 1
42 #if MMC_DBG_FUNC_CONFIG
43 #define MMC_DBG_BOOT_FUNC(mmc_host,fmt, arg...) \
45 if(mmc_debug_level & MMC_DBG_BOOT) { \
46 if(NULL != strpbrk(dbg_flag,mmc_hostname(mmc_host))) { \
47 printk(DRIVER_PREFIX "BOOT " fmt "\n", ##arg);\
51 #define MMC_DBG_ERR_FUNC(mmc_host,fmt, arg...) \
53 if(mmc_debug_level & MMC_DBG_ERROR) { \
54 if(strstr(dbg_flag,mmc_hostname(mmc_host))) { \
55 printk(DRIVER_PREFIX "ERROR " fmt "\n", ##arg);\
59 #define MMC_DBG_WARN_FUNC(mmc_host,fmt, arg...) \
61 if(mmc_debug_level & MMC_DBG_WARN) { \
62 if(strstr(dbg_flag,mmc_hostname(mmc_host))) { \
63 printk(DRIVER_PREFIX "WARN " fmt "\n", ##arg);\
67 #define MMC_DBG_INFO_FUNC(mmc_host,fmt, arg...) \
69 if(mmc_debug_level & MMC_DBG_INFO) { \
70 if(strstr(dbg_flag,mmc_hostname(mmc_host))) { \
71 printk(DRIVER_PREFIX "INFO " fmt "\n", ##arg);\
75 #define MMC_DBG_CMD_FUNC(mmc_host,fmt, arg...) \
77 if(mmc_debug_level & MMC_DBG_CMD) { \
78 if(strstr(dbg_flag,mmc_hostname(mmc_host))) { \
79 printk(DRIVER_PREFIX "CMD " fmt "\n", ##arg);\
83 #define MMC_DBG_SW_VOL_FUNC(mmc_host,fmt, arg...) \
85 if(mmc_debug_level & MMC_DBG_SW_VOL) { \
86 if(strstr(dbg_flag,mmc_hostname(mmc_host))) { \
87 printk(DRIVER_PREFIX "SW-VOL " fmt "\n", ##arg);\
92 #define MMC_DBG_BOOT_FUNC(mmc_host,fmt, arg...) {printk(DRIVER_PREFIX "BOOT " fmt "\n", ##arg);}
93 #define MMC_DBG_ERR_FUNC(mmc_host,fmt, arg...)
94 #define MMC_DBG_WARN_FUNC(mmc_host,fmt, arg...)
95 #define MMC_DBG_INFO_FUNC(mmc_host,fmt, arg...)
96 #define MMC_DBG_CMD_FUNC(mmc_host,fmt, arg...)
97 #define MMC_DBG_SW_VOL_FUNC(mmc_host,fmt, arg...)
100 #if defined(CONFIG_DYNAMIC_DEBUG)
101 #define mmc_debug(level, fmt, arg...) \
103 if (unlikely(level & mmc_debug_level)) \
104 dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \
107 #define mmc_debug(level, fmt, arg...) \
109 if (unlikely(level & mmc_debug_level)) \
110 printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \