mci_writel(host, CMDARG, cmd->arg);
wmb();
- MMC_DBG_INFO_FUNC("%d..%s start cmd=%d, arg=0x%x[%s]",__LINE__, __FUNCTION__,cmd->opcode, cmd->arg,mmc_hostname(host->mmc));
+ MMC_DBG_INFO_FUNC(host->mmc,"%d..%s start cmd=%d, arg=0x%x[%s]",__LINE__, __FUNCTION__,cmd->opcode, cmd->arg,mmc_hostname(host->mmc));
//dw_mci_regs_printk(host);
mci_writel(host, CMD, cmd_flags | SDMMC_CMD_START|SDMMC_CMD_USE_HOLD_REG); //always use SDMMC_CMD_USE_HOLD_REG
struct mmc_data *data = host->data;
dev_vdbg(host->dev, "DMA complete\n");
- MMC_DBG_CMD_FUNC(" DMA complete cmd=%d(arg=0x%x), blocks=%d,blksz=%d[%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc," DMA complete cmd=%d(arg=0x%x), blocks=%d,blksz=%d[%s]", \
host->cmd->opcode,host->cmd->arg,data->blocks,data->blksz,mmc_hostname(host->mmc));
host->dma_ops->cleanup(host);
host->dir_status = DW_MCI_SEND_STATUS;
}
- MMC_DBG_INFO_FUNC(" dw_mci_submit_data,blocks=%d,blksz=%d [%s]",\
+ MMC_DBG_INFO_FUNC(host->mmc," dw_mci_submit_data,blocks=%d,blksz=%d [%s]",\
data->blocks, data->blksz, mmc_hostname(host->mmc));
if (dw_mci_submit_data_dma(host, data)) {
host->current_speed = clock;
if(slot->ctype != slot->pre_ctype)
- MMC_DBG_BOOT_FUNC("Bus speed=%dHz,Bus width=%s.[%s]", \
+ MMC_DBG_BOOT_FUNC(host->mmc, "Bus speed=%dHz,Bus width=%s.[%s]", \
div ? ((host->bus_hz / div) >> 1):host->bus_hz, \
(slot->ctype == SDMMC_CTYPE_4BIT)?"4bits":"8bits", mmc_hostname(host->mmc));
slot->pre_ctype = slot->ctype;
unsigned long time_loop;
unsigned int status;
- MMC_DBG_INFO_FUNC("dw_mci_wait_unbusy, status=0x%x ", mci_readl(host, STATUS));
+ MMC_DBG_INFO_FUNC(host->mmc, "dw_mci_wait_unbusy, status=0x%x ", mci_readl(host, STATUS));
if(host->mmc->restrict_caps & RESTRICT_CARD_TYPE_EMMC)
timeout = SDMMC_DATA_TIMEOUT_EMMC;
struct mmc_request *mrq = slot->mrq;
struct mmc_command *cmd;
- MMC_DBG_INFO_FUNC(" Begin to start the new request. cmd=%d(arg=0x%x)[%s]", \
+ MMC_DBG_INFO_FUNC(host->mmc, " Begin to start the new request. cmd=%d(arg=0x%x)[%s]", \
mrq->cmd->opcode, mrq->cmd->arg, mmc_hostname(host->mmc));
cmd = mrq->sbc ? mrq->sbc : mrq->cmd;
spin_unlock_bh(&host->lock);
mrq->cmd->error = -ENOMEDIUM;
- MMC_DBG_CMD_FUNC("dw_mci_reqeust--reqeuest done, cmd=%d [%s]",mrq->cmd->opcode, mmc_hostname(host->mmc));
+ MMC_DBG_CMD_FUNC(host->mmc, "dw_mci_reqeust--reqeuest done, cmd=%d [%s]",mrq->cmd->opcode, mmc_hostname(host->mmc));
mmc_request_done(mmc, mrq);
return;
}
- MMC_DBG_CMD_FUNC("======>\n pull a new request from MMC-frame to dw_mci_queue. cmd=%d(arg=0x%x)[%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc, "======>\n pull a new request from MMC-frame to dw_mci_queue. cmd=%d(arg=0x%x)[%s]", \
mrq->cmd->opcode, mrq->cmd->arg, mmc_hostname(host->mmc));
dw_mci_queue_request(host, slot, mrq);
dw_mci_deal_data_end(host, mrq);
if(mrq->cmd)
- MMC_DBG_CMD_FUNC(" reqeust end--reqeuest done, cmd=%d, cmderr=%d, host->state=%d [%s]",\
+ MMC_DBG_CMD_FUNC(host->mmc, " reqeust end--reqeuest done, cmd=%d, cmderr=%d, host->state=%d [%s]",\
mrq->cmd->opcode,mrq->cmd->error, host->state,mmc_hostname(host->mmc));
if(mrq->data)
- MMC_DBG_CMD_FUNC(" reqeust end--reqeuest done, cmd=%d, dataerr=%d, host->state=%d [%s]",\
+ MMC_DBG_CMD_FUNC(host->mmc, " reqeust end--reqeuest done, cmd=%d, dataerr=%d, host->state=%d [%s]",\
mrq->cmd->opcode,mrq->data->error, host->state, mmc_hostname(host->mmc));
host->cur_slot->mrq = NULL;
dev_vdbg(host->dev, "list not empty: %s is next\n",
mmc_hostname(slot->mmc));
host->state = STATE_SENDING_CMD;
- MMC_DBG_CMD_FUNC(" list is not empty. run the request in list. [%s]", mmc_hostname(host->mmc));
+ MMC_DBG_CMD_FUNC(host->mmc, " list is not empty. run the request in list. [%s]", mmc_hostname(host->mmc));
dw_mci_start_request(host, slot);
} else {
dev_vdbg(host->dev, "list empty\n");
cmd->resp[1] = mci_readl(host, RESP2);
cmd->resp[0] = mci_readl(host, RESP3);
- MMC_DBG_INFO_FUNC(" command complete [%s], \ncmd=%d,resp[3]=0x%x, resp[2]=0x%x,resp[1]=0x%x,resp[0]=0x%x", \
+ MMC_DBG_INFO_FUNC(host->mmc," command complete [%s], \ncmd=%d,resp[3]=0x%x, resp[2]=0x%x,resp[1]=0x%x,resp[0]=0x%x", \
mmc_hostname(host->mmc), cmd->opcode,cmd->resp[3], cmd->resp[2], cmd->resp[1], cmd->resp[0]);
} else {
cmd->resp[0] = mci_readl(host, RESP0);
cmd->resp[1] = 0;
cmd->resp[2] = 0;
cmd->resp[3] = 0;
- MMC_DBG_INFO_FUNC(" command complete [%s], cmd=%d,resp[0]=0x%x",\
+ MMC_DBG_INFO_FUNC(host->mmc, " command complete [%s], cmd=%d,resp[0]=0x%x",\
mmc_hostname(host->mmc),cmd->opcode, cmd->resp[0]);
}
}
cmd->error = -EIO;
else
cmd->error = 0;
- MMC_DBG_CMD_FUNC(" command complete, cmd=%d,cmdError=0x%x [%s]",cmd->opcode, cmd->error,mmc_hostname(host->mmc));
+ MMC_DBG_CMD_FUNC(host->mmc, " command complete, cmd=%d,cmdError=0x%x [%s]",cmd->opcode, cmd->error,mmc_hostname(host->mmc));
if (cmd->error) {
if(MMC_SEND_STATUS != cmd->opcode)
- MMC_DBG_ERR_FUNC(" command complete, cmd=%d,cmdError=0x%x [%s]",\
+ MMC_DBG_ERR_FUNC(host->mmc, " command complete, cmd=%d,cmdError=0x%x [%s]",\
cmd->opcode, cmd->error,mmc_hostname(host->mmc));
/* newer ip versions need a delay between retries */
state = STATE_DATA_ERROR;
break;
}
- MMC_DBG_CMD_FUNC("Pre-state[%d]-->NowState[%d]: STATE_SENDING_DATA, wait for EVENT_XFER_COMPLETE.[%s]",\
+ MMC_DBG_CMD_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: STATE_SENDING_DATA, wait for EVENT_XFER_COMPLETE.[%s]",\
prev_state,state, mmc_hostname(host->mmc));
if (!test_and_clear_bit(EVENT_XFER_COMPLETE,
&host->pending_events))
break;
- MMC_DBG_INFO_FUNC("Pre-state[%d]-->NowState[%d]: STATE_SENDING_DATA, wait for EVENT_DATA_COMPLETE. [%s]",\
+ MMC_DBG_INFO_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: STATE_SENDING_DATA, wait for EVENT_DATA_COMPLETE. [%s]",\
prev_state,state,mmc_hostname(host->mmc));
set_bit(EVENT_XFER_COMPLETE, &host->completed_events);
break;
dw_mci_deal_data_end(host, host->mrq);
- MMC_DBG_INFO_FUNC("Pre-state[%d]-->NowState[%d]: STATE_DATA_BUSY, after EVENT_DATA_COMPLETE. [%s]", \
+ MMC_DBG_INFO_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: STATE_DATA_BUSY, after EVENT_DATA_COMPLETE. [%s]", \
prev_state,state,mmc_hostname(host->mmc));
host->data = NULL;
if (status & DW_MCI_DATA_ERROR_FLAGS) {
if((SDMMC_CTYPE_1BIT != slot->ctype)&&(MMC_SEND_EXT_CSD == host->mrq->cmd->opcode))
- MMC_DBG_ERR_FUNC("Pre-state[%d]-->NowState[%d]: DW_MCI_DATA_ERROR_FLAGS,datastatus=0x%x [%s]",\
+ MMC_DBG_ERR_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: DW_MCI_DATA_ERROR_FLAGS,datastatus=0x%x [%s]",\
prev_state,state, status, mmc_hostname(host->mmc));
if (status & SDMMC_INT_DRTO) {
}
if (!data->stop) {
- MMC_DBG_CMD_FUNC("Pre-state[%d]-->NowState[%d]: no stop and no dataerr, exit. [%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: no stop and no dataerr, exit. [%s]", \
prev_state,state,mmc_hostname(host->mmc));
dw_mci_request_end(host, host->mrq);
goto unlock;
}
- MMC_DBG_CMD_FUNC("Pre-state[%d]-->NowState[%d]: begin to stop . [%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: begin to stop . [%s]", \
prev_state,state,mmc_hostname(host->mmc));
if (host->mrq->sbc && !data->error) {
data->stop->error = 0;
- MMC_DBG_CMD_FUNC("Pre-state[%d]-->NowState[%d]: have stop and sbc, exit. [%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: have stop and sbc, exit. [%s]", \
prev_state,state,mmc_hostname(host->mmc));
dw_mci_request_end(host, host->mrq);
}
#endif
/* fall through */
- MMC_DBG_CMD_FUNC("Pre-state[%d]-->NowState[%d]: begin to STATE_SENDING_STOP . [%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: begin to STATE_SENDING_STOP . [%s]", \
prev_state,state,mmc_hostname(host->mmc));
case STATE_SENDING_STOP:
if (!test_and_clear_bit(EVENT_CMD_COMPLETE,
&host->pending_events))
break;
- MMC_DBG_CMD_FUNC("Pre-state[%d]-->NowState[%d]: begin to send cmd12 . [%s]", \
+ MMC_DBG_CMD_FUNC(host->mmc, "Pre-state[%d]-->NowState[%d]: begin to send cmd12 . [%s]", \
prev_state,state,mmc_hostname(host->mmc));
/* CMD error in data command */
if (pending & SDMMC_INT_DATA_OVER) {
mci_writel(host, RINTSTS, SDMMC_INT_DATA_OVER);
- MMC_DBG_CMD_FUNC("SDMMC_INT_DATA_OVER, INT-pending=0x%x. [%s]",pending,mmc_hostname(host->mmc));
+ MMC_DBG_CMD_FUNC(host->mmc, "SDMMC_INT_DATA_OVER, INT-pending=0x%x. [%s]",pending,mmc_hostname(host->mmc));
if (!host->data_status)
host->data_status = pending;
smp_wmb();
}
if (pending & SDMMC_INT_CMD_DONE) {
- MMC_DBG_CMD_FUNC("SDMMC_INT_CMD_DONE, INT-pending=0x%x. [%s]",pending,mmc_hostname(host->mmc));
+ MMC_DBG_CMD_FUNC(host->mmc, "SDMMC_INT_CMD_DONE, INT-pending=0x%x. [%s]",pending,mmc_hostname(host->mmc));
mci_writel(host, RINTSTS, SDMMC_INT_CMD_DONE);
dw_mci_cmd_interrupt(host, pending);
}
while (present != slot->last_detect_state) {
dev_dbg(&slot->mmc->class_dev, "card %s\n",
present ? "inserted" : "removed");
- MMC_DBG_BOOT_FUNC("card %s, devname=%s \n",
+ MMC_DBG_BOOT_FUNC(mmc, "card %s, devname=%s \n",
present ? "inserted" : "removed", mmc_hostname(mmc));
spin_lock_bh(&host->lock);
if (mrq->stop)
mrq->stop->error = -ENOMEDIUM;
- MMC_DBG_CMD_FUNC("dw_mci_work--reqeuest done, cmd=%d [%s]",mrq->cmd->opcode, mmc_hostname(mmc));
+ MMC_DBG_CMD_FUNC(host->mmc, "dw_mci_work--reqeuest done, cmd=%d [%s]",mrq->cmd->opcode, mmc_hostname(mmc));
spin_unlock(&host->lock);
mmc_request_done(slot->mmc, mrq);
goto err_workqueue;
}
+
if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO)
dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");
* the Free Software Foundation; either version 2 of the License, or\r
* (at your option) any later version.\r
*/\r
-\r
-\r
#include "rk_sdmmc_of.h"\r
\r
-u32 mmc_debug_level= MMC_DBG_ERROR;//MMC_DBG_ALL;//set the value refer to file rk_sdmmc_of.h\r
-\r
+u32 mmc_debug_level= MMC_DBG_INFO;//MMC_DBG_CMD//set the value refer to file rk_sdmmc_of.h\r
+char dbg_flag[]="mmc0mmc1mmc2"; \r
\r
static void rockchip_mmc_of_dump(struct rk_sdmmc_of *rk_mmc_property)\r
{ \r
- MMC_DBG_BOOT_FUNC("=========rockchip mmc dts dump info start== 2014-03-14 15:51 ======");\r
- /* \r
- MMC_DBG_BOOT_FUNC("mmc,caps: 0x%x",rk_mmc_property->mmc_caps);\r
- MMC_DBG_BOOT_FUNC("mmc,ocr: 0x%x",rk_mmc_property->mmc_ocr);\r
- MMC_DBG_BOOT_FUNC("mmc,int: 0x%x",rk_mmc_property->mmc_int_type);\r
- MMC_DBG_BOOT_FUNC("mmc,emmc_is_selected: 0x%x",rk_mmc_property->emmc_is_selected);\r
- MMC_DBG_BOOT_FUNC("mmc,use_dma: %d %d",rk_mmc_property->mmc_dma_is_used[0],\r
+ printk("=========rockchip mmc dts dump info start== 2014-03-14 20:39 ======");\r
+ mmc_debug(MMC_DBG_BOOT,"mmc,caps: 0x%x\n",rk_mmc_property->mmc_caps);\r
+ mmc_debug(MMC_DBG_BOOT,"mmc,ocr: 0x%x\n",rk_mmc_property->mmc_ocr);\r
+ mmc_debug(MMC_DBG_BOOT,"mmc,int: 0x%x\n",rk_mmc_property->mmc_int_type);\r
+ mmc_debug(MMC_DBG_BOOT,"mmc,emmc_is_selected: 0x%x\n",rk_mmc_property->emmc_is_selected);\r
+ mmc_debug(MMC_DBG_BOOT,"mmc,use_dma: %d %d\n",rk_mmc_property->mmc_dma_is_used[0],\r
rk_mmc_property->mmc_dma_is_used[1]);\r
- MMC_DBG_BOOT_FUNC("mmc,dma_ch: %d",rk_mmc_property->mmc_dma_chn);\r
- MMC_DBG_BOOT_FUNC("=========rockchip mmc dts dump info end================");\r
- */ \r
+ mmc_debug(MMC_DBG_BOOT,"mmc,dma_ch: %d\n",rk_mmc_property->mmc_dma_chn);\r
+ mmc_debug(MMC_DBG_BOOT,"=========rockchip mmc dts dump info end================\n");\r
}\r
\r
\r
of_property_read_u32(np, "mmc,int", &rk_mmc_property->mmc_int_type);\r
of_property_read_u32(np, "mmc,emmc_is_selected", &rk_mmc_property->emmc_is_selected);\r
of_property_read_u32_array(np, "mmc,use_dma", rk_mmc_property->mmc_dma_is_used,2);\r
+\r
if((&rk_mmc_property->mmc_dma_is_used[0] == MMC_USE_DMA))\r
{ \r
if(rk_mmc_property->mmc_dma_is_used[1] == 0)\r
of_property_read_u32(np, "mmc,dma_ch", &rk_mmc_property->mmc_dma_chn);\r
\r
}else{\r
- MMC_DBG_WARN_FUNC("Device Tree configure mmc drivers to use pio!\n");\r
+ mmc_debug(MMC_DBG_WARN,"Device Tree configure mmc drivers to use pio!\n");\r
}\r
+ \r
rockchip_mmc_of_dump(rk_mmc_property);\r
return ;\r
\r
MMC_DBG_ALL = 0xFF,\r
\r
};\r
-extern u32 mmc_debug_level;\r
\r
-#define MMC_DBG_BOOT_FUNC(fmt, arg...) \\r
- if(mmc_debug_level >= MMC_DBG_BOOT){ printk(DRIVER_PREFIX "BOOT " fmt "\n", ##arg);}\r
-#define MMC_DBG_ERR_FUNC(fmt, arg...) \\r
- if(mmc_debug_level >= MMC_DBG_ERROR){ printk(DRIVER_PREFIX "ERROR " fmt "\n", ##arg);}\r
-#define MMC_DBG_WARN_FUNC(fmt, arg...) \\r
- if(mmc_debug_level >= MMC_DBG_WARN){ printk(DRIVER_PREFIX "WARNING " fmt "\n", ##arg);} \r
-#define MMC_DBG_INFO_FUNC(fmt, arg...) \\r
- if(mmc_debug_level >= MMC_DBG_INFO){ printk(DRIVER_PREFIX "INFO " fmt "\n", ##arg);} \r
-#define MMC_DBG_CMD_FUNC(fmt, arg...) \\r
- if(mmc_debug_level >= MMC_DBG_CMD){ printk(DRIVER_PREFIX "CMD " fmt "\n", ##arg);}\r
- \r
+extern u32 mmc_debug_level;\r
+extern char dbg_flag[];\r
\r
+#define MMC_DBG_BOOT_FUNC(mmc_host,fmt, arg...) \\r
+ do { \\r
+ if(mmc_debug_level >= MMC_DBG_NONE) { \\r
+ if(NULL != strpbrk(dbg_flag,mmc_hostname(mmc_host))) { \\r
+ printk(DRIVER_PREFIX "BOOT " fmt "\n", ##arg);\\r
+ } \\r
+ } \\r
+ }while(0)\r
+#define MMC_DBG_ERR_FUNC(mmc_host,fmt, arg...) \\r
+ do{ \\r
+ if(mmc_debug_level >= MMC_DBG_NONE) { \\r
+ if(NULL != strpbrk(dbg_flag,mmc_hostname(mmc_host))) { \\r
+ printk(DRIVER_PREFIX "ERROR " fmt "\n", ##arg);\\r
+ } \\r
+ } \\r
+ }while(0)\r
+#define MMC_DBG_WARN_FUNC(mmc_host,fmt, arg...) \\r
+ do { \\r
+ if(mmc_debug_level >= MMC_DBG_NONE) { \\r
+ if(NULL != strpbrk(dbg_flag,mmc_hostname(mmc_host))) { \\r
+ printk(DRIVER_PREFIX "WARN " fmt "\n", ##arg);\\r
+ } \\r
+ } \\r
+ }while(0)\r
+#define MMC_DBG_INFO_FUNC(mmc_host,fmt, arg...) \\r
+ do { \\r
+ if(mmc_debug_level >= MMC_DBG_NONE) { \\r
+ if(NULL != strpbrk(dbg_flag,mmc_hostname(mmc_host))) { \\r
+ printk(DRIVER_PREFIX "INFO " fmt "\n", ##arg);\\r
+ } \\r
+ } \\r
+ }while(0)\r
+#define MMC_DBG_CMD_FUNC(mmc_host,fmt, arg...) \\r
+ do { \\r
+ if(mmc_debug_level >= MMC_DBG_NONE) { \\r
+ if(NULL != strpbrk(dbg_flag,mmc_hostname(mmc_host))) { \\r
+ printk(DRIVER_PREFIX "CMD " fmt "\n", ##arg);\\r
+ } \\r
+ } \\r
+ }while(0)\r
\r
#if defined(CONFIG_DYNAMIC_DEBUG)\r
- #define MMC_DBG_DEBUG_FUNC(level, fmt, arg...) \\r
- do { \\r
- if (unlikely(level & mmc_debug_level)) \\r
- dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \\r
- } while (0)\r
+ #define mmc_debug(level, fmt, arg...) \\r
+ do { \\r
+ if (unlikely(level & mmc_debug_level)) \\r
+ dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \\r
+ } while (0)\r
#else\r
- #define MMC_DBG_DEBUG_FUNC(level, fmt, arg...) \\r
- do { \\r
- if (unlikely(level & mmc_debug_level)) \\r
- if(mmc_debug_level >= MMC_DBG_DBG){ printk(DRIVER_PREFIX fmt "\n"), ##arg);} \\r
- } while (0)\r
+ #define mmc_debug(level, fmt, arg...) \\r
+ do { \\r
+ if (unlikely(level & mmc_debug_level)) \\r
+ printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \\r
+ ##arg); \\r
+ } while (0)\r
#endif\r
\r
struct rk_sdmmc_of\r