From 0494c89c0a70e7773946b2ab93e6c4d643ebf286 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:11 +0200 Subject: staging: mt7621-mmc: Remove whitespace errors in dbg.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The whitespace errors in the file dbg.c are fixed by using the cleanfile script. Indentations with whitespaces are not changed in this patch. Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 190 +++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 95 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 4dc115b53993..3f204d7480c9 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -32,7 +32,7 @@ * have been modified by MediaTek Inc. All revisions are subject to any receiver's * applicable license agreements with MediaTek Inc. */ - + #include #include #include @@ -78,151 +78,151 @@ msdc_mode drv_mode[4]={ u32 gpt_enable = 0; u32 sdio_pro_enable = 0; /* make sure gpt is enabled */ u32 sdio_pro_time = 0; /* no more than 30s */ -struct sdio_profile sdio_perfomance = {0}; +struct sdio_profile sdio_perfomance = {0}; #if 0 /* --- chhung */ void msdc_init_gpt(void) { - GPT_CONFIG config; - + GPT_CONFIG config; + config.num = GPT6; config.mode = GPT_FREE_RUN; config.clkSrc = GPT_CLK_SRC_SYS; config.clkDiv = GPT_CLK_DIV_1; /* 13MHz GPT6 */ - + if (GPT_Config(config) == FALSE ) - return; - - GPT_Start(GPT6); + return; + + GPT_Start(GPT6); } #endif /* end of --- */ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32) { - u32 ret = 0; - + u32 ret = 0; + if (new_H32 == old_H32) { ret = new_L32 - old_L32; } else if(new_H32 == (old_H32 + 1)) { - if (new_L32 > old_L32) { - printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); + if (new_L32 > old_L32) { + printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); } - ret = (0xffffffff - old_L32); - ret += new_L32; + ret = (0xffffffff - old_L32); + ret += new_L32; } else { - printk("msdc old_H<0x%x> new_H<0x%x>\n", old_H32, new_H32); + printk("msdc old_H<0x%x> new_H<0x%x>\n", old_H32, new_H32); } - return ret; + return ret; } void msdc_sdio_profile(struct sdio_profile* result) { struct cmd_profile* cmd; - u32 i; - + u32 i; + printk("sdio === performance dump ===\n"); - printk("sdio === total execute tick<%d> time<%dms> Tx<%dB> Rx<%dB>\n", - result->total_tc, result->total_tc / TICKS_ONE_MS, - result->total_tx_bytes, result->total_rx_bytes); + printk("sdio === total execute tick<%d> time<%dms> Tx<%dB> Rx<%dB>\n", + result->total_tc, result->total_tc / TICKS_ONE_MS, + result->total_tx_bytes, result->total_rx_bytes); /* CMD52 Dump */ - cmd = &result->cmd52_rx; - printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); - cmd = &result->cmd52_tx; - printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); - + cmd = &result->cmd52_rx; + printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); + cmd = &result->cmd52_tx; + printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); + /* CMD53 Rx bytes + block mode */ for (i=0; i<512; i++) { cmd = &result->cmd53_rx_byte[i]; if (cmd->count) { - printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } for (i=0; i<100; i++) { cmd = &result->cmd53_rx_blk[i]; if (cmd->count) { - printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } } /* CMD53 Tx bytes + block mode */ for (i=0; i<512; i++) { cmd = &result->cmd53_tx_byte[i]; if (cmd->count) { - printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } for (i=0; i<100; i++) { cmd = &result->cmd53_tx_blk[i]; if (cmd->count) { - printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - - printk("sdio === performance dump done ===\n"); + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + + printk("sdio === performance dump done ===\n"); } //========= sdio command table =========== void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) { - struct sdio_profile* result = &sdio_perfomance; - struct cmd_profile* cmd; - u32 block; + struct sdio_profile* result = &sdio_perfomance; + struct cmd_profile* cmd; + u32 block; if (sdio_pro_enable == 0) { return; } if (opcode == 52) { - cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; + cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; } else if (opcode == 53) { if (sizes < 512) { - cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; + cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; } else { - block = sizes / 512; + block = sizes / 512; if (block >= 99) { - printk("cmd53 error blocks\n"); - while(1); + printk("cmd53 error blocks\n"); + while(1); } - cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; - } + cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; + } } else { - return; + return; } - + /* update the members */ if (ticks > cmd->max_tc){ - cmd->max_tc = ticks; + cmd->max_tc = ticks; } if (cmd->min_tc == 0 || ticks < cmd->min_tc) { - cmd->min_tc = ticks; + cmd->min_tc = ticks; } cmd->tot_tc += ticks; - cmd->tot_bytes += sizes; - cmd->count ++; - + cmd->tot_bytes += sizes; + cmd->count ++; + if (bRx) { - result->total_rx_bytes += sizes; + result->total_rx_bytes += sizes; } else { - result->total_tx_bytes += sizes; + result->total_tx_bytes += sizes; } - result->total_tc += ticks; - + result->total_tc += ticks; + /* dump when total_tc > 30s */ if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { - msdc_sdio_profile(result); - memset(result, 0 , sizeof(struct sdio_profile)); + msdc_sdio_profile(result); + memset(result, 0 , sizeof(struct sdio_profile)); } } @@ -254,28 +254,28 @@ static int msdc_debug_proc_read(struct seq_file *s, void *p) return 0; } -static ssize_t msdc_debug_proc_write(struct file *file, +static ssize_t msdc_debug_proc_write(struct file *file, const char __user *buf, size_t count, loff_t *data) { int ret; - - int cmd, p1, p2; + + int cmd, p1, p2; int id, zone; - int mode, size; - + int mode, size; + if (count == 0)return -1; if(count > 255)count = 255; ret = copy_from_user(cmd_buf, buf, count); if (ret < 0)return -1; - + cmd_buf[count] = '\0'; printk("msdc Write %s\n", cmd_buf); sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2); - + if(cmd == SD_TOOL_ZONE) { - id = p1; zone = p2; zone &= 0x3ff; + id = p1; zone = p2; zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); if(id >=0 && id<=3){ sd_debug_zone[id] = zone; @@ -288,35 +288,35 @@ static ssize_t msdc_debug_proc_write(struct file *file, printk("msdc host_id error when set debug zone\n"); } } else if (cmd == SD_TOOL_DMA_SIZE) { - id = p1>>4; mode = (p1&0xf); size = p2; + id = p1>>4; mode = (p1&0xf); size = p2; if(id >=0 && id<=3){ drv_mode[id] = mode; - dma_size[id] = p2; + dma_size[id] = p2; } else if(id == 4){ drv_mode[0] = drv_mode[1] = mode; drv_mode[2] = drv_mode[3] = mode; - dma_size[0] = dma_size[1] = p2; + dma_size[0] = dma_size[1] = p2; dma_size[2] = dma_size[3] = p2; } else{ printk("msdc host_id error when select mode\n"); - } + } } else if (cmd == SD_TOOL_SDIO_PROFILE) { if (p1 == 1) { /* enable profile */ if (gpt_enable == 0) { // msdc_init_gpt(); /* --- by chhung */ gpt_enable = 1; - } + } sdio_pro_enable = 1; - if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; - sdio_pro_time = p2 ; + if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; + sdio_pro_time = p2 ; } else if (p1 == 0) { /* todo */ sdio_pro_enable = 0; - } + } } - + return count; } @@ -326,21 +326,21 @@ static int msdc_debug_show(struct inode *inode, struct file *file) } static const struct file_operations msdc_debug_fops = { - .owner = THIS_MODULE, - .open = msdc_debug_show, - .read = seq_read, - .write = msdc_debug_proc_write, - .llseek = seq_lseek, - .release = single_release, + .owner = THIS_MODULE, + .open = msdc_debug_show, + .read = seq_read, + .write = msdc_debug_proc_write, + .llseek = seq_lseek, + .release = single_release, }; -int msdc_debug_proc_init(void) -{ +int msdc_debug_proc_init(void) +{ struct proc_dir_entry *de = proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); if (!de || IS_ERR(de)) - printk("!! Create MSDC debug PROC fail !!\n"); - + printk("!! Create MSDC debug PROC fail !!\n"); + return 0 ; } EXPORT_SYMBOL_GPL(msdc_debug_proc_init); -- cgit v1.2.3-59-g8ed1b From cbb45abdd50f35cf4f8bc3551a43060ec7611dfe Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:15 +0200 Subject: staging: mt7621-mmc: Fix indent for dbg.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the indentaions in the file dbg.c Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 258 +++++++++++++++++++-------------------- 1 file changed, 129 insertions(+), 129 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 3f204d7480c9..1c5ceee577f9 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -83,147 +83,147 @@ struct sdio_profile sdio_perfomance = {0}; #if 0 /* --- chhung */ void msdc_init_gpt(void) { - GPT_CONFIG config; + GPT_CONFIG config; - config.num = GPT6; - config.mode = GPT_FREE_RUN; - config.clkSrc = GPT_CLK_SRC_SYS; - config.clkDiv = GPT_CLK_DIV_1; /* 13MHz GPT6 */ + config.num = GPT6; + config.mode = GPT_FREE_RUN; + config.clkSrc = GPT_CLK_SRC_SYS; + config.clkDiv = GPT_CLK_DIV_1; /* 13MHz GPT6 */ - if (GPT_Config(config) == FALSE ) - return; + if (GPT_Config(config) == FALSE ) + return; - GPT_Start(GPT6); + GPT_Start(GPT6); } #endif /* end of --- */ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32) { - u32 ret = 0; - - if (new_H32 == old_H32) { - ret = new_L32 - old_L32; - } else if(new_H32 == (old_H32 + 1)) { - if (new_L32 > old_L32) { - printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); - } - ret = (0xffffffff - old_L32); - ret += new_L32; - } else { - printk("msdc old_H<0x%x> new_H<0x%x>\n", old_H32, new_H32); - } - - return ret; + u32 ret = 0; + + if (new_H32 == old_H32) { + ret = new_L32 - old_L32; + } else if(new_H32 == (old_H32 + 1)) { + if (new_L32 > old_L32) { + printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); + } + ret = (0xffffffff - old_L32); + ret += new_L32; + } else { + printk("msdc old_H<0x%x> new_H<0x%x>\n", old_H32, new_H32); + } + + return ret; } void msdc_sdio_profile(struct sdio_profile* result) { - struct cmd_profile* cmd; - u32 i; - - printk("sdio === performance dump ===\n"); - printk("sdio === total execute tick<%d> time<%dms> Tx<%dB> Rx<%dB>\n", - result->total_tc, result->total_tc / TICKS_ONE_MS, - result->total_tx_bytes, result->total_rx_bytes); - - /* CMD52 Dump */ - cmd = &result->cmd52_rx; - printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); - cmd = &result->cmd52_tx; - printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); - - /* CMD53 Rx bytes + block mode */ - for (i=0; i<512; i++) { - cmd = &result->cmd53_rx_byte[i]; - if (cmd->count) { - printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - for (i=0; i<100; i++) { - cmd = &result->cmd53_rx_blk[i]; - if (cmd->count) { - printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - - /* CMD53 Tx bytes + block mode */ - for (i=0; i<512; i++) { - cmd = &result->cmd53_tx_byte[i]; - if (cmd->count) { - printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - for (i=0; i<100; i++) { - cmd = &result->cmd53_tx_blk[i]; - if (cmd->count) { - printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); - } - } - - printk("sdio === performance dump done ===\n"); + struct cmd_profile* cmd; + u32 i; + + printk("sdio === performance dump ===\n"); + printk("sdio === total execute tick<%d> time<%dms> Tx<%dB> Rx<%dB>\n", + result->total_tc, result->total_tc / TICKS_ONE_MS, + result->total_tx_bytes, result->total_rx_bytes); + + /* CMD52 Dump */ + cmd = &result->cmd52_rx; + printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); + cmd = &result->cmd52_tx; + printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); + + /* CMD53 Rx bytes + block mode */ + for (i=0; i<512; i++) { + cmd = &result->cmd53_rx_byte[i]; + if (cmd->count) { + printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + for (i=0; i<100; i++) { + cmd = &result->cmd53_rx_blk[i]; + if (cmd->count) { + printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + + /* CMD53 Tx bytes + block mode */ + for (i=0; i<512; i++) { + cmd = &result->cmd53_tx_byte[i]; + if (cmd->count) { + printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + for (i=0; i<100; i++) { + cmd = &result->cmd53_tx_blk[i]; + if (cmd->count) { + printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, + cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, + cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + } + } + + printk("sdio === performance dump done ===\n"); } //========= sdio command table =========== void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) { - struct sdio_profile* result = &sdio_perfomance; - struct cmd_profile* cmd; - u32 block; - - if (sdio_pro_enable == 0) { - return; - } - - if (opcode == 52) { - cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; - } else if (opcode == 53) { - if (sizes < 512) { - cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; - } else { - block = sizes / 512; - if (block >= 99) { - printk("cmd53 error blocks\n"); - while(1); - } - cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; - } - } else { - return; - } - - /* update the members */ - if (ticks > cmd->max_tc){ - cmd->max_tc = ticks; - } - if (cmd->min_tc == 0 || ticks < cmd->min_tc) { - cmd->min_tc = ticks; - } - cmd->tot_tc += ticks; - cmd->tot_bytes += sizes; - cmd->count ++; - - if (bRx) { - result->total_rx_bytes += sizes; - } else { - result->total_tx_bytes += sizes; - } - result->total_tc += ticks; - - /* dump when total_tc > 30s */ - if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { - msdc_sdio_profile(result); - memset(result, 0 , sizeof(struct sdio_profile)); - } + struct sdio_profile* result = &sdio_perfomance; + struct cmd_profile* cmd; + u32 block; + + if (sdio_pro_enable == 0) { + return; + } + + if (opcode == 52) { + cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; + } else if (opcode == 53) { + if (sizes < 512) { + cmd = bRx ? &result->cmd53_rx_byte[sizes] : &result->cmd53_tx_byte[sizes]; + } else { + block = sizes / 512; + if (block >= 99) { + printk("cmd53 error blocks\n"); + while(1); + } + cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; + } + } else { + return; + } + + /* update the members */ + if (ticks > cmd->max_tc){ + cmd->max_tc = ticks; + } + if (cmd->min_tc == 0 || ticks < cmd->min_tc) { + cmd->min_tc = ticks; + } + cmd->tot_tc += ticks; + cmd->tot_bytes += sizes; + cmd->count ++; + + if (bRx) { + result->total_rx_bytes += sizes; + } else { + result->total_tx_bytes += sizes; + } + result->total_tc += ticks; + + /* dump when total_tc > 30s */ + if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { + msdc_sdio_profile(result); + memset(result, 0 , sizeof(struct sdio_profile)); + } } //========== driver proc interface =========== @@ -255,7 +255,7 @@ static int msdc_debug_proc_read(struct seq_file *s, void *p) } static ssize_t msdc_debug_proc_write(struct file *file, - const char __user *buf, size_t count, loff_t *data) + const char __user *buf, size_t count, loff_t *data) { int ret; @@ -336,12 +336,12 @@ static const struct file_operations msdc_debug_fops = { int msdc_debug_proc_init(void) { - struct proc_dir_entry *de = proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); + struct proc_dir_entry *de = proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); - if (!de || IS_ERR(de)) - printk("!! Create MSDC debug PROC fail !!\n"); + if (!de || IS_ERR(de)) + printk("!! Create MSDC debug PROC fail !!\n"); - return 0 ; + return 0 ; } EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif -- cgit v1.2.3-59-g8ed1b From 63a97a70b1e2ef9a22a07199796e097a35bd2ac9 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:20 +0200 Subject: staging: mt7621-mmc: Fix spacing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes checkpatch errors, warnings, checks: SPACING, LEADING_SPACE, LINE_SPACING Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/board.h | 3 +- drivers/staging/mt7621-mmc/dbg.c | 67 ++++----- drivers/staging/mt7621-mmc/dbg.h | 16 +-- drivers/staging/mt7621-mmc/mt6575_sd.h | 61 ++++---- drivers/staging/mt7621-mmc/sd.c | 245 ++++++++++++++++----------------- 5 files changed, 197 insertions(+), 195 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index e8a7a1137653..496357d1ce4d 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -57,7 +57,6 @@ typedef void (*pm_callback_t)(pm_message_t state, void *data); #define MSDC_UHS1 (1 << 8) /* uhs-1 mode support */ #define MSDC_DDR (1 << 9) /* ddr mode support */ - #define MSDC_SMPL_RISING (0) #define MSDC_SMPL_FALLING (1) @@ -118,6 +117,7 @@ struct mt3326_gps_hardware { int (*ext_power_on)(int); int (*ext_power_off)(int); }; + extern struct mt3326_gps_hardware mt3326_gps_hw; /* NAND driver */ @@ -131,6 +131,7 @@ struct mt6575_nand_host_hw { unsigned int nand_ecc_bytes; unsigned int nand_ecc_mode; }; + extern struct mt6575_nand_host_hw mt6575_nand_hw; #endif /* __ARCH_ARM_MACH_BOARD_H */ diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 1c5ceee577f9..215b2fc8c899 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -51,7 +51,7 @@ static char cmd_buf[256]; /* for debug zone */ -unsigned int sd_debug_zone[4]={ +unsigned int sd_debug_zone[4] = { 0, 0, 0, @@ -59,20 +59,21 @@ unsigned int sd_debug_zone[4]={ }; /* mode select */ -u32 dma_size[4]={ +u32 dma_size[4] = { 512, 512, 512, 512 }; -msdc_mode drv_mode[4]={ + +msdc_mode drv_mode[4] = { MODE_SIZE_DEP, /* using DMA or not depend on the size */ MODE_SIZE_DEP, MODE_SIZE_DEP, MODE_SIZE_DEP }; -#if defined (MT6575_SD_DEBUG) +#if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) u32 gpt_enable = 0; @@ -90,7 +91,7 @@ void msdc_init_gpt(void) config.clkSrc = GPT_CLK_SRC_SYS; config.clkDiv = GPT_CLK_DIV_1; /* 13MHz GPT6 */ - if (GPT_Config(config) == FALSE ) + if (GPT_Config(config) == FALSE) return; GPT_Start(GPT6); @@ -103,7 +104,7 @@ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32) if (new_H32 == old_H32) { ret = new_L32 - old_L32; - } else if(new_H32 == (old_H32 + 1)) { + } else if (new_H32 == (old_H32 + 1)) { if (new_L32 > old_L32) { printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); } @@ -129,44 +130,44 @@ void msdc_sdio_profile(struct sdio_profile* result) /* CMD52 Dump */ cmd = &result->cmd52_rx; printk("sdio === CMD52 Rx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count); cmd = &result->cmd52_tx; printk("sdio === CMD52 Tx <%d>times tick<%d> Max<%d> Min<%d> Aver<%d>\n", cmd->count, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count); + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count); /* CMD53 Rx bytes + block mode */ - for (i=0; i<512; i++) { + for (i = 0; i < 512; i++) { cmd = &result->cmd53_rx_byte[i]; if (cmd->count) { printk("sdio<%6d><%3dB>_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); } } - for (i=0; i<100; i++) { + for (i = 0; i < 100; i++) { cmd = &result->cmd53_rx_blk[i]; if (cmd->count) { printk("sdio<%6d><%3d>B_Rx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); } } /* CMD53 Tx bytes + block mode */ - for (i=0; i<512; i++) { + for (i = 0; i < 512; i++) { cmd = &result->cmd53_tx_byte[i]; if (cmd->count) { printk("sdio<%6d><%3dB>_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); } } - for (i=0; i<100; i++) { + for (i = 0; i < 100; i++) { cmd = &result->cmd53_tx_blk[i]; if (cmd->count) { printk("sdio<%6d><%3d>B_Tx_<%9d><%9d><%6d><%6d>_<%9dB><%2dM>\n", cmd->count, i, cmd->tot_tc, - cmd->max_tc, cmd->min_tc, cmd->tot_tc/cmd->count, - cmd->tot_bytes, (cmd->tot_bytes/10)*13 / (cmd->tot_tc/10)); + cmd->max_tc, cmd->min_tc, cmd->tot_tc / cmd->count, + cmd->tot_bytes, (cmd->tot_bytes / 10) * 13 / (cmd->tot_tc / 10)); } } @@ -193,7 +194,7 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) block = sizes / 512; if (block >= 99) { printk("cmd53 error blocks\n"); - while(1); + while (1); } cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; } @@ -202,7 +203,7 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) } /* update the members */ - if (ticks > cmd->max_tc){ + if (ticks > cmd->max_tc) { cmd->max_tc = ticks; } if (cmd->min_tc == 0 || ticks < cmd->min_tc) { @@ -210,7 +211,7 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) } cmd->tot_tc += ticks; cmd->tot_bytes += sizes; - cmd->count ++; + cmd->count++; if (bRx) { result->total_rx_bytes += sizes; @@ -222,7 +223,7 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) /* dump when total_tc > 30s */ if (result->total_tc >= sdio_pro_time * TICKS_ONE_MS * 1000) { msdc_sdio_profile(result); - memset(result, 0 , sizeof(struct sdio_profile)); + memset(result, 0, sizeof(struct sdio_profile)); } } @@ -264,7 +265,7 @@ static ssize_t msdc_debug_proc_write(struct file *file, int mode, size; if (count == 0)return -1; - if(count > 255)count = 255; + if (count > 255)count = 255; ret = copy_from_user(cmd_buf, buf, count); if (ret < 0)return -1; @@ -274,13 +275,13 @@ static ssize_t msdc_debug_proc_write(struct file *file, sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2); - if(cmd == SD_TOOL_ZONE) { + if (cmd == SD_TOOL_ZONE) { id = p1; zone = p2; zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); - if(id >=0 && id<=3){ + if (id >= 0 && id <= 3) { sd_debug_zone[id] = zone; } - else if(id == 4){ + else if (id == 4) { sd_debug_zone[0] = sd_debug_zone[1] = zone; sd_debug_zone[2] = sd_debug_zone[3] = zone; } @@ -288,12 +289,12 @@ static ssize_t msdc_debug_proc_write(struct file *file, printk("msdc host_id error when set debug zone\n"); } } else if (cmd == SD_TOOL_DMA_SIZE) { - id = p1>>4; mode = (p1&0xf); size = p2; - if(id >=0 && id<=3){ + id = p1 >> 4; mode = (p1 & 0xf); size = p2; + if (id >= 0 && id <= 3) { drv_mode[id] = mode; dma_size[id] = p2; } - else if(id == 4){ + else if (id == 4) { drv_mode[0] = drv_mode[1] = mode; drv_mode[2] = drv_mode[3] = mode; dma_size[0] = dma_size[1] = p2; @@ -310,7 +311,7 @@ static ssize_t msdc_debug_proc_write(struct file *file, } sdio_pro_enable = 1; if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; - sdio_pro_time = p2 ; + sdio_pro_time = p2; } else if (p1 == 0) { /* todo */ sdio_pro_enable = 0; @@ -341,7 +342,7 @@ int msdc_debug_proc_init(void) if (!de || IS_ERR(de)) printk("!! Create MSDC debug PROC fail !!\n"); - return 0 ; + return 0; } EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index e7bc544823ed..f4d32dd9a3f4 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -104,9 +104,9 @@ extern unsigned int sd_debug_zone[4]; do { \ if (x) { \ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ - while(1); \ + while (1); \ } \ -}while(0) +} while (0) #endif /* end of +++ */ #define N_MSG(evt, fmt, args...) @@ -122,8 +122,8 @@ do { \ #define ERR_MSG(fmt, args...) \ do { \ printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while(0); + host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ +} while (0); #if 1 //defined CONFIG_MTK_MMC_CD_POLL @@ -133,15 +133,15 @@ do { \ #define INIT_MSG(fmt, args...) \ do { \ printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \ - host->id, ##args , __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while(0); + host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ +} while (0); /* PID in ISR in not corrent */ #define IRQ_MSG(fmt, args...) \ do { \ printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ - host->id, ##args , __FUNCTION__, __LINE__); \ -} while(0); + host->id, ##args, __FUNCTION__, __LINE__); \ +} while (0); #endif int msdc_debug_proc_init(void); diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index 78a4b6754a60..bd555ebf85d3 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -88,15 +88,15 @@ #define MSDC_EMMC_BOOTMODE1 (1) /* Reset CMD mode */ enum { - RESP_NONE = 0, - RESP_R1, - RESP_R2, - RESP_R3, - RESP_R4, - RESP_R5, - RESP_R6, - RESP_R7, - RESP_R1B + RESP_NONE = 0, + RESP_R1, + RESP_R2, + RESP_R3, + RESP_R4, + RESP_R5, + RESP_R6, + RESP_R7, + RESP_R1B }; /*--------------------------------------------------------------------------*/ @@ -253,7 +253,7 @@ enum { #define MSDC_PS_CDDEBOUNCE (0xf << 12) /* RW */ #define MSDC_PS_DAT (0xff << 16) /* R */ #define MSDC_PS_CMD (0x1 << 24) /* R */ -#define MSDC_PS_WP (0x1UL<< 31) /* R */ +#define MSDC_PS_WP (0x1UL << 31) /* R */ /* MSDC_INT mask */ #define MSDC_INT_MMCIRQ (0x1 << 0) /* W1C */ @@ -294,7 +294,7 @@ enum { /* MSDC_FIFOCS mask */ #define MSDC_FIFOCS_RXCNT (0xff << 0) /* R */ #define MSDC_FIFOCS_TXCNT (0xff << 16) /* R */ -#define MSDC_FIFOCS_CLR (0x1UL<< 31) /* RW */ +#define MSDC_FIFOCS_CLR (0x1UL << 31) /* RW */ /* SDC_CFG mask */ #define SDC_CFG_SDIOINTWKUP (0x1 << 0) /* RW */ @@ -314,7 +314,7 @@ enum { #define SDC_CMD_RW (0x1 << 13) /* RW */ #define SDC_CMD_STOP (0x1 << 14) /* RW */ #define SDC_CMD_GOIRQ (0x1 << 15) /* RW */ -#define SDC_CMD_BLKLEN (0xfff<< 16) /* RW */ +#define SDC_CMD_BLKLEN (0xfff << 16) /* RW */ #define SDC_CMD_AUTOCMD (0x3 << 28) /* RW */ #define SDC_CMD_VOLSWTH (0x1 << 30) /* RW */ @@ -396,7 +396,7 @@ enum { #define MSDC_PAD_CTL0_CLKSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL0_CLKIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL0_CLKTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL0_CLKRDSEL (0xffUL<< 24) /* RW */ +#define MSDC_PAD_CTL0_CLKRDSEL (0xffUL << 24) /* RW */ /* MSDC_PAD_CTL1 mask */ #define MSDC_PAD_CTL1_CMDDRVN (0x7 << 0) /* RW */ @@ -407,7 +407,7 @@ enum { #define MSDC_PAD_CTL1_CMDSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL1_CMDIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL1_CMDTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL1_CMDRDSEL (0xffUL<< 24) /* RW */ +#define MSDC_PAD_CTL1_CMDRDSEL (0xffUL << 24) /* RW */ /* MSDC_PAD_CTL2 mask */ #define MSDC_PAD_CTL2_DATDRVN (0x7 << 0) /* RW */ @@ -418,7 +418,7 @@ enum { #define MSDC_PAD_CTL2_DATIES (0x1 << 19) /* RW */ #define MSDC_PAD_CTL2_DATSMT (0x1 << 18) /* RW */ #define MSDC_PAD_CTL2_DATTDSEL (0xf << 20) /* RW */ -#define MSDC_PAD_CTL2_DATRDSEL (0xffUL<< 24) /* RW */ +#define MSDC_PAD_CTL2_DATRDSEL (0xffUL << 24) /* RW */ /* MSDC_PAD_TUNE mask */ #define MSDC_PAD_TUNE_DATWRDLY (0x1F << 0) /* RW */ @@ -438,11 +438,11 @@ enum { #define MSDC_DAT_RDDLY1_D6 (0x1F << 16) /* RW */ #define MSDC_DAT_RDDLY1_D7 (0x1F << 24) /* RW */ -#define MSDC_CKGEN_MSDC_DLY_SEL (0x1F<<10) -#define MSDC_INT_DAT_LATCH_CK_SEL (0x7<<7) -#define MSDC_CKGEN_MSDC_CK_SEL (0x1<<6) -#define CARD_READY_FOR_DATA (1<<8) -#define CARD_CURRENT_STATE(x) ((x&0x00001E00)>>9) +#define MSDC_CKGEN_MSDC_DLY_SEL (0x1F << 10) +#define MSDC_INT_DAT_LATCH_CK_SEL (0x7 << 7) +#define MSDC_CKGEN_MSDC_CK_SEL (0x1 << 6) +#define CARD_READY_FOR_DATA (1 << 8) +#define CARD_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /*--------------------------------------------------------------------------*/ /* Descriptor Structure */ @@ -974,27 +974,28 @@ static inline unsigned int uffs(unsigned int x) } return r; } + #define sdr_read8(reg) __raw_readb(reg) #define sdr_read16(reg) __raw_readw(reg) #define sdr_read32(reg) __raw_readl(reg) -#define sdr_write8(reg,val) __raw_writeb(val,reg) -#define sdr_write16(reg,val) __raw_writew(val,reg) -#define sdr_write32(reg,val) __raw_writel(val,reg) +#define sdr_write8(reg, val) __raw_writeb(val, reg) +#define sdr_write16(reg, val) __raw_writew(val, reg) +#define sdr_write32(reg, val) __raw_writel(val, reg) -#define sdr_set_bits(reg,bs) ((*(volatile u32*)(reg)) |= (u32)(bs)) -#define sdr_clr_bits(reg,bs) ((*(volatile u32*)(reg)) &= ~((u32)(bs))) +#define sdr_set_bits(reg, bs) ((*(volatile u32*)(reg)) |= (u32)(bs)) +#define sdr_clr_bits(reg, bs) ((*(volatile u32*)(reg)) &= ~((u32)(bs))) -#define sdr_set_field(reg,field,val) \ +#define sdr_set_field(reg, field, val) \ do { \ volatile unsigned int tv = sdr_read32(reg); \ tv &= ~(field); \ tv |= ((val) << (uffs((unsigned int)field) - 1)); \ - sdr_write32(reg,tv); \ -} while(0) -#define sdr_get_field(reg,field,val) \ + sdr_write32(reg, tv); \ +} while (0) +#define sdr_get_field(reg, field, val) \ do { \ volatile unsigned int tv = sdr_read32(reg); \ val = ((tv & (field)) >> (uffs((unsigned int)field) - 1)); \ -} while(0) +} while (0) #endif diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 85a1bfa1cc1a..3da610882763 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -80,7 +80,6 @@ #include /* end of +++ */ - #include #if 0 /* --- by chhung */ @@ -114,9 +113,9 @@ #define HOST_MAX_NUM (1) /* +/- by chhung */ -#if defined (CONFIG_SOC_MT7620) +#if defined(CONFIG_SOC_MT7620) #define HOST_MAX_MCLK (48000000) /* +/- by chhung */ -#elif defined (CONFIG_SOC_MT7621) +#elif defined(CONFIG_SOC_MT7621) #define HOST_MAX_MCLK (50000000) /* +/- by chhung */ #endif #define HOST_MIN_MCLK (260000) @@ -136,8 +135,8 @@ #define DEFAULT_DEBOUNCE (8) /* 8 cycles */ #define DEFAULT_DTOC (40) /* data timeout counter. 65536x40 sclk. */ -#define CMD_TIMEOUT (HZ/10) /* 100ms */ -#define DAT_TIMEOUT (HZ/2 * 5) /* 500ms x5 */ +#define CMD_TIMEOUT (HZ / 10) /* 100ms */ +#define DAT_TIMEOUT (HZ / 2 * 5) /* 500ms x5 */ #define MAX_DMA_CNT (64 * 1024 - 512) /* a single transaction for WIFI may be 50K*/ @@ -164,19 +163,19 @@ static int cd_active_low = 1; //#define PERI_MSDC2_PDN (17) //#define PERI_MSDC3_PDN (18) -struct msdc_host *msdc_6575_host[] = {NULL,NULL,NULL,NULL}; +struct msdc_host *msdc_6575_host[] = {NULL, NULL, NULL, NULL}; #if 0 /* --- by chhung */ /* gate means clock power down */ static int g_clk_gate = 0; #define msdc_gate_clock(id) \ do { \ g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while(0) + } while (0) /* not like power down register. 1 means clock on. */ #define msdc_ungate_clock(id) \ do { \ g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while(0) + } while (0) // do we need sync object or not void msdc_clk_status(int * status) @@ -202,7 +201,7 @@ struct msdc_hw msdc0_hw = { static struct resource mtk_sd_resources[] = { [0] = { .start = RALINK_MSDC_BASE, - .end = RALINK_MSDC_BASE+0x3fff, + .end = RALINK_MSDC_BASE + 0x3fff, .flags = IORESOURCE_MEM, }, [1] = { @@ -233,13 +232,13 @@ static int msdc_rsp[] = { }; /* For Inhanced DMA */ -#define msdc_init_gpd_ex(gpd,extlen,cmd,arg,blknum) \ +#define msdc_init_gpd_ex(gpd, extlen, cmd, arg, blknum) \ do { \ ((gpd_t*)gpd)->extlen = extlen; \ ((gpd_t*)gpd)->cmd = cmd; \ ((gpd_t*)gpd)->arg = arg; \ ((gpd_t*)gpd)->blknum = blknum; \ - }while(0) + } while (0) #define msdc_init_bd(bd, blkpad, dwpad, dptr, dlen) \ do { \ @@ -248,7 +247,7 @@ static int msdc_rsp[] = { ((bd_t*)bd)->dwpad = dwpad; \ ((bd_t*)bd)->ptr = (void*)dptr; \ ((bd_t*)bd)->buflen = dlen; \ - }while(0) + } while (0) #define msdc_txfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_TXCNT) >> 16) #define msdc_rxfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_RXCNT) >> 0) @@ -257,11 +256,10 @@ static int msdc_rsp[] = { #define msdc_fifo_read32() sdr_read32(MSDC_RXDATA) #define msdc_fifo_read8() sdr_read8(MSDC_RXDATA) - #define msdc_dma_on() sdr_clr_bits(MSDC_CFG, MSDC_CFG_PIO) #define msdc_dma_off() sdr_set_bits(MSDC_CFG, MSDC_CFG_PIO) -#define msdc_retry(expr,retry,cnt) \ +#define msdc_retry(expr, retry, cnt) \ do { \ int backup = cnt; \ while (retry) { \ @@ -271,7 +269,7 @@ static int msdc_rsp[] = { } \ } \ WARN_ON(retry == 0); \ - } while(0) + } while (0) #if 0 /* --- by chhung */ #define msdc_reset() \ @@ -280,44 +278,44 @@ static int msdc_rsp[] = { sdr_set_bits(MSDC_CFG, MSDC_CFG_RST); \ dsb(); \ msdc_retry(sdr_read32(MSDC_CFG) & MSDC_CFG_RST, retry, cnt); \ - } while(0) + } while (0) #else #define msdc_reset() \ do { \ int retry = 3, cnt = 1000; \ sdr_set_bits(MSDC_CFG, MSDC_CFG_RST); \ msdc_retry(sdr_read32(MSDC_CFG) & MSDC_CFG_RST, retry, cnt); \ - } while(0) + } while (0) #endif /* end of +/- */ #define msdc_clr_int() \ do { \ volatile u32 val = sdr_read32(MSDC_INT); \ sdr_write32(MSDC_INT, val); \ - } while(0) + } while (0) #define msdc_clr_fifo() \ do { \ int retry = 3, cnt = 1000; \ sdr_set_bits(MSDC_FIFOCS, MSDC_FIFOCS_CLR); \ msdc_retry(sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_CLR, retry, cnt); \ - } while(0) + } while (0) #define msdc_irq_save(val) \ do { \ val = sdr_read32(MSDC_INTEN); \ sdr_clr_bits(MSDC_INTEN, val); \ - } while(0) + } while (0) #define msdc_irq_restore(val) \ do { \ sdr_set_bits(MSDC_INTEN, val); \ - } while(0) + } while (0) /* clock source for host: global */ -#if defined (CONFIG_SOC_MT7620) +#if defined(CONFIG_SOC_MT7620) static u32 hclks[] = {48000000}; /* +/- by chhung */ -#elif defined (CONFIG_SOC_MT7621) +#elif defined(CONFIG_SOC_MT7621) static u32 hclks[] = {50000000}; /* +/- by chhung */ #endif @@ -352,11 +350,11 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */ #define sdc_is_busy() (sdr_read32(SDC_STS) & SDC_STS_SDCBUSY) #define sdc_is_cmd_busy() (sdr_read32(SDC_STS) & SDC_STS_CMDBUSY) -#define sdc_send_cmd(cmd,arg) \ +#define sdc_send_cmd(cmd, arg) \ do { \ sdr_write32(SDC_ARG, (arg)); \ sdr_write32(SDC_CMD, (cmd)); \ - } while(0) + } while (0) // can modify to read h/w register. //#define is_card_present(h) ((sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1); @@ -374,7 +372,7 @@ static unsigned int msdc_do_command(struct msdc_host *host, int tune, unsigned long timeout); -static int msdc_tune_cmdrsp(struct msdc_host*host,struct mmc_command *cmd); +static int msdc_tune_cmdrsp(struct msdc_host*host, struct mmc_command *cmd); #ifdef MT6575_SD_DEBUG static void msdc_dump_card_status(struct msdc_host *host, u32 status) @@ -561,7 +559,7 @@ static void msdc_eirq_cd(void *data) #if 0 static void msdc_tasklet_card(unsigned long arg) { - struct msdc_host *host = (struct msdc_host *)arg; + struct msdc_host *host = (struct msdc_host *)arg; #else static void msdc_tasklet_card(struct work_struct *work) { @@ -657,7 +655,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz) msdc_irq_save(flags); -#if defined (CONFIG_MT7621_FPGA) || defined (CONFIG_MT7628_FPGA) +#if defined(CONFIG_MT7621_FPGA) || defined(CONFIG_MT7628_FPGA) mode = 0x0; /* use divisor */ if (hz >= (hclk >> 1)) { div = 0; /* mean div = 1/2 */ @@ -703,7 +701,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz) msdc_set_timeout(host, host->timeout_ns, host->timeout_clks); // need? INIT_MSG("================"); - INIT_MSG("!!! Set<%dKHz> Source<%dKHz> -> sclk<%dKHz>", hz/1000, hclk/1000, sclk/1000); + INIT_MSG("!!! Set<%dKHz> Source<%dKHz> -> sclk<%dKHz>", hz / 1000, hclk / 1000, sclk / 1000); INIT_MSG("================"); msdc_irq_restore(flags); @@ -892,14 +890,14 @@ static void msdc_pm(pm_message_t state, void *data) host->pm_state = state; /* default PMSG_RESUME */ INIT_MSG("%s Suspend", evt == PM_EVENT_SUSPEND ? "PM" : "USR"); - if(host->hw->flags & MSDC_SYS_SUSPEND) /* set for card */ + if (host->hw->flags & MSDC_SYS_SUSPEND) /* set for card */ (void)mmc_suspend_host(host->mmc); else { // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* just for double confirm */ /* --- by chhung */ mmc_remove_host(host->mmc); } } else if (evt == PM_EVENT_RESUME || evt == PM_EVENT_USER_RESUME) { - if (!host->suspend){ + if (!host->suspend) { //ERR_MSG("warning: already resume"); return; } @@ -914,7 +912,7 @@ static void msdc_pm(pm_message_t state, void *data) host->pm_state = state; INIT_MSG("%s Resume", evt == PM_EVENT_RESUME ? "PM" : "USR"); - if(host->hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ + if (host->hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ (void)mmc_resume_host(host->mmc); } else { @@ -1016,7 +1014,7 @@ static unsigned int msdc_command_start(struct msdc_host *host, rawcmd &= ~(0x0FFF << 16); } - N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode , rawcmd, cmd->arg); + N_MSG(CMD, "CMD<%d><0x%.8x> Arg<0x%.8x>", opcode, rawcmd, cmd->arg); tmo = jiffies + timeout; @@ -1032,7 +1030,7 @@ static unsigned int msdc_command_start(struct msdc_host *host, goto end; } } - }else { + } else { for (;;) { if (!sdc_is_busy()) break; @@ -1078,7 +1076,7 @@ static unsigned int msdc_command_resp(struct msdc_host *host, //sdr_set_bits(MSDC_INTEN, wints); spin_unlock(&host->lock); - if(!wait_for_completion_timeout(&host->cmd_done, 10*timeout)){ + if (!wait_for_completion_timeout(&host->cmd_done, 10 * timeout)) { ERR_MSG("XXX CMD<%d> wait_for_completion timeout ARG<0x%.8x>", opcode, cmd->arg); cmd->error = (unsigned int)-ETIMEDOUT; msdc_reset(); @@ -1130,7 +1128,7 @@ static unsigned int msdc_command_resp(struct msdc_host *host, } /* memory card CRC */ - if(host->hw->flags & MSDC_REMOVABLE && cmd->error == (unsigned int)(-EIO) ) { + if (host->hw->flags & MSDC_REMOVABLE && cmd->error == (unsigned int)(-EIO)) { if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ msdc_abort_data(host); } else { @@ -1139,7 +1137,7 @@ static unsigned int msdc_command_resp(struct msdc_host *host, msdc_clr_fifo(); msdc_clr_int(); } - cmd->error = msdc_tune_cmdrsp(host,cmd); + cmd->error = msdc_tune_cmdrsp(host, cmd); } // check DAT0 @@ -1186,7 +1184,7 @@ static int msdc_pio_abort(struct msdc_host *host, struct mmc_data *data, unsigne ret = 1; } - if(ret) { + if (ret) { msdc_reset(); msdc_clr_fifo(); msdc_clr_int(); @@ -1208,7 +1206,7 @@ static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) u8 *u8ptr; u32 left = 0; u32 count, size = 0; - u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; + u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; unsigned long tmo = jiffies + DAT_TIMEOUT; sdr_set_bits(MSDC_INTEN, wints); @@ -1229,8 +1227,8 @@ static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) } u8ptr = (u8 *)ptr; - while(left) { - * u8ptr++ = msdc_fifo_read8(); + while (left) { + *u8ptr++ = msdc_fifo_read8(); left--; } } @@ -1247,7 +1245,7 @@ end: N_MSG(FIO, " PIO Read<%d>bytes", size); sdr_clr_bits(MSDC_INTEN, wints); - if(data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); + if (data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); return data->error; } @@ -1264,7 +1262,7 @@ static int msdc_pio_write(struct msdc_host* host, struct mmc_data *data) u8 *u8ptr; u32 left; u32 count, size = 0; - u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; + u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; unsigned long tmo = jiffies + DAT_TIMEOUT; sdr_set_bits(MSDC_INTEN, wints); @@ -1286,7 +1284,7 @@ static int msdc_pio_write(struct msdc_host* host, struct mmc_data *data) } u8ptr = (u8*)ptr; - while(left){ + while (left) { msdc_fifo_write8(*u8ptr); u8ptr++; left--; } @@ -1302,7 +1300,7 @@ static int msdc_pio_write(struct msdc_host* host, struct mmc_data *data) end: data->bytes_xfered += size; N_MSG(FIO, " PIO Write<%d>bytes", size); - if(data->error) ERR_MSG("write pio data->error<%d>", data->error); + if (data->error) ERR_MSG("write pio data->error<%d>", data->error); sdr_clr_bits(MSDC_INTEN, wints); return data->error; @@ -1323,7 +1321,7 @@ static void msdc_dma_resume(struct msdc_host *host) static void msdc_dma_start(struct msdc_host *host) { u32 base = host->base; - u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; + u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; sdr_set_bits(MSDC_INTEN, wints); //dsb(); /* --- by chhung */ @@ -1336,9 +1334,9 @@ static void msdc_dma_stop(struct msdc_host *host) { u32 base = host->base; //u32 retries=500; - u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR ; + u32 wints = MSDC_INTEN_XFER_COMPL | MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; - N_MSG(DMA, "DMA status: 0x%.8x",sdr_read32(MSDC_DMA_CFG)); + N_MSG(DMA, "DMA status: 0x%.8x", sdr_read32(MSDC_DMA_CFG)); //while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); @@ -1368,13 +1366,13 @@ static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) /* dump gpd */ ERR_MSG(".gpd<0x%.8x> gpd_phy<0x%.8x>", (int)gpd, (int)dma->gpd_addr); - ERR_MSG("...hwo <%d>", gpd->hwo ); - ERR_MSG("...bdp <%d>", gpd->bdp ); - ERR_MSG("...chksum<0x%.8x>", gpd->chksum ); + ERR_MSG("...hwo <%d>", gpd->hwo); + ERR_MSG("...bdp <%d>", gpd->bdp); + ERR_MSG("...chksum<0x%.8x>", gpd->chksum); //ERR_MSG("...intr <0x%.8x>", gpd->intr ); - ERR_MSG("...next <0x%.8x>", (int)gpd->next ); - ERR_MSG("...ptr <0x%.8x>", (int)gpd->ptr ); - ERR_MSG("...buflen<0x%.8x>", gpd->buflen ); + ERR_MSG("...next <0x%.8x>", (int)gpd->next); + ERR_MSG("...ptr <0x%.8x>", (int)gpd->ptr); + ERR_MSG("...buflen<0x%.8x>", gpd->buflen); //ERR_MSG("...extlen<0x%.8x>", gpd->extlen ); //ERR_MSG("...arg <0x%.8x>", gpd->arg ); //ERR_MSG("...blknum<0x%.8x>", gpd->blknum ); @@ -1386,13 +1384,13 @@ static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) p_to_v = ((u32)bd - (u32)dma->bd_addr); while (1) { ERR_MSG(".bd[%d]", i); i++; - ERR_MSG("...eol <%d>", ptr->eol ); - ERR_MSG("...chksum<0x%.8x>", ptr->chksum ); + ERR_MSG("...eol <%d>", ptr->eol); + ERR_MSG("...chksum<0x%.8x>", ptr->chksum); //ERR_MSG("...blkpad<0x%.8x>", ptr->blkpad ); //ERR_MSG("...dwpad <0x%.8x>", ptr->dwpad ); - ERR_MSG("...next <0x%.8x>", (int)ptr->next ); - ERR_MSG("...ptr <0x%.8x>", (int)ptr->ptr ); - ERR_MSG("...buflen<0x%.8x>", (int)ptr->buflen ); + ERR_MSG("...next <0x%.8x>", (int)ptr->next); + ERR_MSG("...ptr <0x%.8x>", (int)ptr->ptr); + ERR_MSG("...buflen<0x%.8x>", (int)ptr->buflen); if (ptr->eol == 1) { break; @@ -1413,6 +1411,7 @@ static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) static u8 msdc_dma_calcs(u8 *buf, u32 len) { u32 i, sum = 0; + for (i = 0; i < len; i++) { sum += buf[i]; } @@ -1442,7 +1441,7 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_XFERSZ, sg_dma_len(sg)); //#elif defined (CONFIG_RALINK_MT7621) || defined (CONFIG_RALINK_MT7628) else - sdr_write32((volatile u32*)(RALINK_MSDC_BASE+0xa8), sg_dma_len(sg)); + sdr_write32((volatile u32*)(RALINK_MSDC_BASE + 0xa8), sg_dma_len(sg)); //#endif sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, dma->burstsz); sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 0); @@ -1454,7 +1453,7 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) /* calculate the required number of gpd */ num = (sglen + MAX_BD_PER_GPD - 1) / MAX_BD_PER_GPD; - BUG_ON(num !=1 ); + BUG_ON(num != 1); gpd = dma->gpd; bd = dma->bd; @@ -1470,7 +1469,7 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) /* modify bd*/ for (j = 0; j < bdlen; j++) { msdc_init_bd(&bd[j], blkpad, dwpad, sg_dma_address(sg), sg_dma_len(sg)); - if(j == bdlen - 1) { + if (j == bdlen - 1) { bd[j].eol = 1; /* the last bd */ } else { bd[j].eol = 0; @@ -1542,8 +1541,8 @@ static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) struct mmc_data *data; u32 base = host->base; //u32 intsts = 0; - unsigned int left=0; - int dma = 0, read = 1, dir = DMA_FROM_DEVICE, send_type=0; + unsigned int left = 0; + int dma = 0, read = 1, dir = DMA_FROM_DEVICE, send_type = 0; #define SND_DAT 0 #define SND_CMD 1 @@ -1565,13 +1564,13 @@ static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) #endif /* end of --- */ if (!data) { - send_type=SND_CMD; + send_type = SND_CMD; if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) { goto done; } } else { BUG_ON(data->blksz > HOST_MAX_BLKSZ); - send_type=SND_DAT; + send_type = SND_DAT; data->error = 0; read = data->flags & MMC_DATA_READ ? 1 : 0; @@ -1620,7 +1619,7 @@ static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) msdc_dma_start(host); spin_unlock(&host->lock); - if(!wait_for_completion_timeout(&host->xfer_done, DAT_TIMEOUT)){ + if (!wait_for_completion_timeout(&host->xfer_done, DAT_TIMEOUT)) { ERR_MSG("XXX CMD<%d> wait xfer_done<%d> timeout!!", cmd->opcode, data->blocks * data->blksz); ERR_MSG(" DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); ERR_MSG(" DMA_CA = 0x%x", sdr_read32(MSDC_DMA_CA)); @@ -1642,7 +1641,7 @@ static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) /* Secondly: pio data phase */ if (read) { - if (msdc_pio_read(host, data)){ + if (msdc_pio_read(host, data)) { goto done; } } else { @@ -1654,7 +1653,7 @@ static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) /* For write case: make sure contents in fifo flushed to device */ if (!read) { while (1) { - left=msdc_txfifocnt(); + left = msdc_txfifocnt(); if (left == 0) { break; } @@ -1679,7 +1678,7 @@ static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) } // PIO mode /* Last: stop transfer */ - if (data->stop){ + if (data->stop) { if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0) { goto done; } @@ -1699,32 +1698,32 @@ done: host->blksz = 0; #if 0 // don't stop twice! - if(host->hw->flags & MSDC_REMOVABLE && data->error) { + if (host->hw->flags & MSDC_REMOVABLE && data->error) { msdc_abort_data(host); /* reset in IRQ, stop command has issued. -> No need */ } #endif - N_MSG(OPS, "CMD<%d> data<%s %s> blksz<%d> block<%d> error<%d>",cmd->opcode, (dma? "dma":"pio"), - (read ? "read ":"write") ,data->blksz, data->blocks, data->error); + N_MSG(OPS, "CMD<%d> data<%s %s> blksz<%d> block<%d> error<%d>", cmd->opcode, (dma ? "dma" : "pio"), + (read ? "read " : "write"), data->blksz, data->blocks, data->error); } #if 0 /* --- by chhung */ #if 1 //if(host->id==1) { - if(send_type==SND_CMD) { - if(cmd->opcode == MMC_SEND_STATUS) { - if((cmd->resp[0] & CARD_READY_FOR_DATA) ||(CARD_CURRENT_STATE(cmd->resp[0]) != 7)){ - N_MSG(OPS,"disable clock, CMD13 IDLE"); + if (send_type == SND_CMD) { + if (cmd->opcode == MMC_SEND_STATUS) { + if ((cmd->resp[0] & CARD_READY_FOR_DATA) || (CARD_CURRENT_STATE(cmd->resp[0]) != 7)) { + N_MSG(OPS, "disable clock, CMD13 IDLE"); msdc_gate_clock(host->id); } } else { - N_MSG(OPS,"disable clock, CMD<%d>", cmd->opcode); + N_MSG(OPS, "disable clock, CMD<%d>", cmd->opcode); msdc_gate_clock(host->id); } } else { - if(read) { - N_MSG(OPS,"disable clock!!! Read CMD<%d>",cmd->opcode); + if (read) { + N_MSG(OPS, "disable clock!!! Read CMD<%d>", cmd->opcode); msdc_gate_clock(host->id); } } @@ -1823,7 +1822,7 @@ static int msdc_tune_cmdrsp(struct msdc_host*host, struct mmc_command *cmd) /* Lv2: PAD_CMD_RESP_RXDLY[26:22] */ cur_rrdly = (orig_rrdly + rrdly + 1) % 32; sdr_set_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, cur_rrdly); - }while (++rrdly < 32); + } while (++rrdly < 32); return result; } @@ -1833,8 +1832,8 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) { struct msdc_host *host = mmc_priv(mmc); u32 base = host->base; - u32 ddr=0; - u32 dcrc=0; + u32 ddr = 0; + u32 dcrc = 0; u32 rxdly, cur_rxdly0, cur_rxdly1; u32 dsmpl, cur_dsmpl, orig_dsmpl; u32 cur_dat0, cur_dat1, cur_dat2, cur_dat3; @@ -1866,9 +1865,9 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) continue; } } - result = msdc_do_request(mmc,mrq); + result = msdc_do_request(mmc, mrq); - sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS|SDC_DCRC_STS_NEG, dcrc); /* RO */ + sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, dcrc); /* RO */ if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", (result == 0 && dcrc == 0) ? "PASS" : "FAIL", dcrc, @@ -1939,7 +1938,7 @@ done: return result; } -static int msdc_tune_bwrite(struct mmc_host *mmc,struct mmc_request *mrq) +static int msdc_tune_bwrite(struct mmc_host *mmc, struct mmc_request *mrq) { struct msdc_host *host = mmc_priv(mmc); u32 base = host->base; @@ -1955,7 +1954,7 @@ static int msdc_tune_bwrite(struct mmc_host *mmc,struct mmc_request *mrq) // MSDC_IOCON_DDR50CKD need to check. [Fix me] sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, orig_wrrdly); - sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl ); + sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl); /* Tune Method 2. just DAT0 */ sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); @@ -1993,7 +1992,7 @@ static int msdc_tune_bwrite(struct mmc_host *mmc,struct mmc_request *mrq) continue; } } - result = msdc_do_request(mmc,mrq); + result = msdc_do_request(mmc, mrq); ERR_MSG("TUNE_BWRITE<%s> DSPL<%d> DATWRDLY<%d> MSDC_DAT_RDDLY0<0x%x>", result == 0 ? "PASS" : "FAIL", @@ -2079,7 +2078,7 @@ static int msdc_tune_request(struct mmc_host *mmc, struct mmc_request *mrq) struct mmc_command *cmd; struct mmc_data *data; //u32 base = host->base; - int ret=0, read; + int ret = 0, read; cmd = mrq->cmd; data = mrq->cmd->data; @@ -2088,24 +2087,24 @@ static int msdc_tune_request(struct mmc_host *mmc, struct mmc_request *mrq) if (read) { if (data->error == (unsigned int)(-EIO)) { - ret = msdc_tune_bread(mmc,mrq); + ret = msdc_tune_bread(mmc, mrq); } } else { ret = msdc_check_busy(mmc, host); - if (ret){ + if (ret) { ERR_MSG("XXX cmd13 wait program done failed"); return ret; } /* CRC and TO */ /* Fix me: don't care card status? */ - ret = msdc_tune_bwrite(mmc,mrq); + ret = msdc_tune_bwrite(mmc, mrq); } return ret; } /* ops.request */ -static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) +static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct msdc_host *host = mmc_priv(mmc); @@ -2115,7 +2114,7 @@ static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) u32 ticks = 0, opcode = 0, sizes = 0, bRx = 0; #endif /* end of --- */ - if(host->mrq){ + if (host->mrq) { ERR_MSG("XXX host->mrq<0x%.8x>", (int)host->mrq); BUG(); } @@ -2146,9 +2145,9 @@ static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) host->mrq = mrq; - if (msdc_do_request(mmc,mrq)) { - if(host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) { - msdc_tune_request(mmc,mrq); + if (msdc_do_request(mmc, mrq)) { + if (host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) { + msdc_tune_request(mmc, mrq); } } @@ -2173,7 +2172,7 @@ static void msdc_ops_request(struct mmc_host *mmc,struct mmc_request *mrq) opcode = mrq->cmd->opcode; if (mrq->cmd->data) { sizes = mrq->cmd->data->blocks * mrq->cmd->data->blksz; - bRx = mrq->cmd->data->flags & MMC_DATA_READ ? 1 : 0 ; + bRx = mrq->cmd->data->flags & MMC_DATA_READ ? 1 : 0; } else { bRx = mrq->cmd->arg & 0x80000000 ? 1 : 0; } @@ -2222,7 +2221,7 @@ static void msdc_set_buswidth(struct msdc_host *host, u32 width) static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct msdc_host *host = mmc_priv(mmc); - struct msdc_hw *hw=host->hw; + struct msdc_hw *hw = host->hw; u32 base = host->base; u32 ddr = 0; @@ -2266,7 +2265,7 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) /* Clock control */ if (host->mclk != ios->clock) { - if(ios->clock > 25000000) { + if (ios->clock > 25000000) { //if (!(host->hw->flags & MSDC_REMOVABLE)) { INIT_MSG("SD data latch edge<%d>", hw->data_edge); sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, hw->cmd_edge); @@ -2391,7 +2390,7 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) u32 cmdsts = MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO | MSDC_INT_CMDRDY | MSDC_INT_ACMDCRCERR | MSDC_INT_ACMDTMO | MSDC_INT_ACMDRDY | MSDC_INT_ACMD19_DONE; - u32 datsts = MSDC_INT_DATCRCERR |MSDC_INT_DATTMO; + u32 datsts = MSDC_INT_DATCRCERR | MSDC_INT_DATTMO; u32 intsts = sdr_read32(MSDC_INT); u32 inten = sdr_read32(MSDC_INTEN); inten &= intsts; @@ -2400,7 +2399,7 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) /* MSG will cause fatal error */ /* card change interrupt */ - if (intsts & MSDC_INT_CDSC){ + if (intsts & MSDC_INT_CDSC) { if (mtk_sw_poll) return IRQ_HANDLED; IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts); @@ -2413,7 +2412,7 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) } /* sdio interrupt */ - if (intsts & MSDC_INT_SDIOIRQ){ + if (intsts & MSDC_INT_SDIOIRQ) { IRQ_MSG("XXX MSDC_INT_SDIOIRQ"); /* seems not sdio irq */ //mmc_signal_sdio_irq(host->mmc); } @@ -2432,11 +2431,11 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) msdc_clr_int(); atomic_set(&host->abort, 1); /* For PIO mode exit */ - if (intsts & MSDC_INT_DATTMO){ + if (intsts & MSDC_INT_DATTMO) { IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode); data->error = (unsigned int)-ETIMEDOUT; } - else if (intsts & MSDC_INT_DATCRCERR){ + else if (intsts & MSDC_INT_DATCRCERR) { IRQ_MSG("XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>", host->mrq->cmd->opcode, sdr_read32(SDC_DCRC_STS)); data->error = (unsigned int)-EIO; } @@ -2470,19 +2469,19 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) break; } } else if ((intsts & MSDC_INT_RSPCRCERR) || (intsts & MSDC_INT_ACMDCRCERR)) { - if(intsts & MSDC_INT_ACMDCRCERR){ - IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR",cmd->opcode); + if (intsts & MSDC_INT_ACMDCRCERR) { + IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR", cmd->opcode); } else { - IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR",cmd->opcode); + IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR", cmd->opcode); } cmd->error = (unsigned int)-EIO; } else if ((intsts & MSDC_INT_CMDTMO) || (intsts & MSDC_INT_ACMDTMO)) { - if(intsts & MSDC_INT_ACMDTMO){ - IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO",cmd->opcode); + if (intsts & MSDC_INT_ACMDTMO) { + IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO", cmd->opcode); } else { - IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO",cmd->opcode); + IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO", cmd->opcode); } cmd->error = (unsigned int)-ETIMEDOUT; msdc_reset(); @@ -2734,7 +2733,7 @@ static void msdc_init_gpd_bd(struct msdc_host *host, struct msdc_dma *dma) while (ptr != bd) { prev = ptr - 1; - prev->next = (void *)(dma->bd_addr + sizeof(bd_t) *(ptr - bd)); + prev->next = (void *)(dma->bd_addr + sizeof(bd_t) * (ptr - bd)); ptr = prev; } } @@ -2794,7 +2793,7 @@ static int msdc_drv_probe(struct platform_device *pdev) mmc->caps |= MMC_CAP_NEEDS_POLL; /* MMC core transfer sizes tunable parameters */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,10,0) +#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0) mmc->max_segs = MAX_HW_SGMTS; #else mmc->max_hw_segs = MAX_HW_SGMTS; @@ -2813,7 +2812,7 @@ static int msdc_drv_probe(struct platform_device *pdev) host->id = 0; host->error = 0; host->irq = irq; - host->base = (unsigned long) base; + host->base = (unsigned long)base; host->mclk = 0; /* mclk: the request clock of mmc sub-system */ host->hclk = hclks[hw->clk_src]; /* hclk: clock of clock source to msdc controller */ host->sclk = 0; /* sclk: the really clock after divition */ @@ -2871,7 +2870,7 @@ static int msdc_drv_probe(struct platform_device *pdev) #ifdef CONFIG_PM hw->register_pm(msdc_pm, (void*)host); /* combo_sdio_register_pm() */ #endif - if(hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ + if (hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ ERR_MSG("MSDC_SYS_SUSPEND and register_pm both set"); } //mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* pm not controlled by system but by client. */ /* --- by chhung */ @@ -3012,9 +3011,9 @@ static int __init mt_msdc_init(void) /* +++ by chhung */ u32 reg; -#if defined (CONFIG_MTD_ANY_RALINK) +#if defined(CONFIG_MTD_ANY_RALINK) extern int ra_check_flash_type(void); - if(ra_check_flash_type() == 2) { /* NAND */ + if (ra_check_flash_type() == 2) { /* NAND */ printk("%s: !!!!! SDXC Module Initialize Fail !!!!!", __func__); return 0; } @@ -3023,10 +3022,10 @@ static int __init mt_msdc_init(void) mtk_sd_device.dev.platform_data = &msdc0_hw; if (ralink_soc == MT762X_SOC_MT7620A || ralink_soc == MT762X_SOC_MT7621AT) { //#if defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3<<18); + reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 18); //#if defined (CONFIG_RALINK_MT7620) if (ralink_soc == MT762X_SOC_MT7620A) - reg |= 0x1<<18; + reg |= 0x1 << 18; //#endif } else { //#elif defined (CONFIG_RALINK_MT7628) @@ -3035,9 +3034,9 @@ static int __init mt_msdc_init(void) reg |= 0x1e << 16; sdr_write32((volatile u32*)(RALINK_SYSCTL_BASE + 0x3c), reg); - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3<<10); -#if defined (CONFIG_MTK_MMC_EMMC_8BIT) - reg |= 0x3<<26 | 0x3<<28 | 0x3<<30; + reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 10); +#if defined(CONFIG_MTK_MMC_EMMC_8BIT) + reg |= 0x3 << 26 | 0x3 << 28 | 0x3 << 30; msdc0_hw.data_pins = 8, #endif //#endif @@ -3053,7 +3052,7 @@ static int __init mt_msdc_init(void) } printk(KERN_INFO DRV_NAME ": MediaTek MT6575 MSDC Driver\n"); -#if defined (MT6575_SD_DEBUG) +#if defined(MT6575_SD_DEBUG) msdc_debug_proc_init(); #endif return 0; -- cgit v1.2.3-59-g8ed1b From 791e509cd0bb37ed1ce7805c682c7cfe61aa630b Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:21 +0200 Subject: staging: mt7621-mmc: Fix Pointer Location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix checkpatch error: POINTER_LOCATION Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/board.h | 2 +- drivers/staging/mt7621-mmc/dbg.c | 8 +++--- drivers/staging/mt7621-mmc/sd.c | 56 +++++++++++++++++++------------------- 3 files changed, 33 insertions(+), 33 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index 496357d1ce4d..b9cf7b875cfa 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -43,7 +43,7 @@ // #include /* end of chhung */ -typedef void (*sdio_irq_handler_t)(void*); /* external irq handler */ +typedef void (*sdio_irq_handler_t)(void *); /* external irq handler */ typedef void (*pm_callback_t)(pm_message_t state, void *data); #define MSDC_CD_PIN_EN (1 << 0) /* card detection pin is wired */ diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 215b2fc8c899..1ae9708efd20 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -117,9 +117,9 @@ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32) return ret; } -void msdc_sdio_profile(struct sdio_profile* result) +void msdc_sdio_profile(struct sdio_profile *result) { - struct cmd_profile* cmd; + struct cmd_profile *cmd; u32 i; printk("sdio === performance dump ===\n"); @@ -177,8 +177,8 @@ void msdc_sdio_profile(struct sdio_profile* result) //========= sdio command table =========== void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) { - struct sdio_profile* result = &sdio_perfomance; - struct cmd_profile* cmd; + struct sdio_profile *result = &sdio_perfomance; + struct cmd_profile *cmd; u32 block; if (sdio_pro_enable == 0) { diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 3da610882763..da1b0512e0be 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -178,7 +178,7 @@ static int g_clk_gate = 0; } while (0) // do we need sync object or not -void msdc_clk_status(int * status) +void msdc_clk_status(int *status) { *status = g_clk_gate; } @@ -234,19 +234,19 @@ static int msdc_rsp[] = { /* For Inhanced DMA */ #define msdc_init_gpd_ex(gpd, extlen, cmd, arg, blknum) \ do { \ - ((gpd_t*)gpd)->extlen = extlen; \ - ((gpd_t*)gpd)->cmd = cmd; \ - ((gpd_t*)gpd)->arg = arg; \ - ((gpd_t*)gpd)->blknum = blknum; \ + ((gpd_t *)gpd)->extlen = extlen; \ + ((gpd_t *)gpd)->cmd = cmd; \ + ((gpd_t *)gpd)->arg = arg; \ + ((gpd_t *)gpd)->blknum = blknum; \ } while (0) #define msdc_init_bd(bd, blkpad, dwpad, dptr, dlen) \ do { \ BUG_ON(dlen > 0xFFFFUL); \ - ((bd_t*)bd)->blkpad = blkpad; \ - ((bd_t*)bd)->dwpad = dwpad; \ - ((bd_t*)bd)->ptr = (void*)dptr; \ - ((bd_t*)bd)->buflen = dlen; \ + ((bd_t *)bd)->blkpad = blkpad; \ + ((bd_t *)bd)->dwpad = dwpad; \ + ((bd_t *)bd)->ptr = (void *)dptr; \ + ((bd_t *)bd)->buflen = dlen; \ } while (0) #define msdc_txfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_TXCNT) >> 16) @@ -358,7 +358,7 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */ // can modify to read h/w register. //#define is_card_present(h) ((sdr_read32(MSDC_PS) & MSDC_PS_CDSTS) ? 0 : 1); -#define is_card_present(h) (((struct msdc_host*)(h))->card_inserted) +#define is_card_present(h) (((struct msdc_host *)(h))->card_inserted) /* +++ by chhung */ #ifndef __ASSEMBLY__ @@ -372,7 +372,7 @@ static unsigned int msdc_do_command(struct msdc_host *host, int tune, unsigned long timeout); -static int msdc_tune_cmdrsp(struct msdc_host*host, struct mmc_command *cmd); +static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd); #ifdef MT6575_SD_DEBUG static void msdc_dump_card_status(struct msdc_host *host, u32 status) @@ -614,7 +614,7 @@ static u8 clk_src_bit[4] = { 0, 3, 5, 7 }; -static void msdc_select_clksrc(struct msdc_host* host, unsigned char clksrc) +static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc) { u32 val; u32 base = host->base; @@ -1253,7 +1253,7 @@ end: which means, memory card block read/write won't using pio then don't need to handle the CMD12 when data error. */ -static int msdc_pio_write(struct msdc_host* host, struct mmc_data *data) +static int msdc_pio_write(struct msdc_host *host, struct mmc_data *data) { u32 base = host->base; struct scatterlist *sg = data->sg; @@ -1283,7 +1283,7 @@ static int msdc_pio_write(struct msdc_host* host, struct mmc_data *data) left -= 4; } - u8ptr = (u8*)ptr; + u8ptr = (u8 *)ptr; while (left) { msdc_fifo_write8(*u8ptr); u8ptr++; left--; @@ -1441,7 +1441,7 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_XFERSZ, sg_dma_len(sg)); //#elif defined (CONFIG_RALINK_MT7621) || defined (CONFIG_RALINK_MT7628) else - sdr_write32((volatile u32*)(RALINK_MSDC_BASE + 0xa8), sg_dma_len(sg)); + sdr_write32((volatile u32 *)(RALINK_MSDC_BASE + 0xa8), sg_dma_len(sg)); //#endif sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_BRUSTSZ, dma->burstsz); sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_MODE, 0); @@ -1534,7 +1534,7 @@ static void msdc_set_blknum(struct msdc_host *host, u32 blknum) sdr_write32(SDC_BLK_NUM, blknum); } -static int msdc_do_request(struct mmc_host*mmc, struct mmc_request*mrq) +static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct msdc_host *host = mmc_priv(mmc); struct mmc_command *cmd; @@ -1765,7 +1765,7 @@ static int msdc_app_cmd(struct mmc_host *mmc, struct msdc_host *host) return err; } -static int msdc_tune_cmdrsp(struct msdc_host*host, struct mmc_command *cmd) +static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd) { int result = -1; u32 base = host->base; @@ -2757,7 +2757,7 @@ static int msdc_drv_probe(struct platform_device *pdev) mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); if (!mmc) return -ENOMEM; - hw = (struct msdc_hw*)pdev->dev.platform_data; + hw = (struct msdc_hw *)pdev->dev.platform_data; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_irq(pdev, 0); @@ -2859,16 +2859,16 @@ static int msdc_drv_probe(struct platform_device *pdev) if (hw->flags & MSDC_CD_PIN_EN) { /* not set for sdio */ if (hw->request_cd_eirq) { /* not set for MT6575 */ - hw->request_cd_eirq(msdc_eirq_cd, (void*)host); /* msdc_eirq_cd will not be used! */ + hw->request_cd_eirq(msdc_eirq_cd, (void *)host); /* msdc_eirq_cd will not be used! */ } } if (hw->request_sdio_eirq) /* set to combo_sdio_request_eirq() for WIFI */ - hw->request_sdio_eirq(msdc_eirq_sdio, (void*)host); /* msdc_eirq_sdio() will be called when EIRQ */ + hw->request_sdio_eirq(msdc_eirq_sdio, (void *)host); /* msdc_eirq_sdio() will be called when EIRQ */ if (hw->register_pm) {/* yes for sdio */ #ifdef CONFIG_PM - hw->register_pm(msdc_pm, (void*)host); /* combo_sdio_register_pm() */ + hw->register_pm(msdc_pm, (void *)host); /* combo_sdio_register_pm() */ #endif if (hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ ERR_MSG("MSDC_SYS_SUSPEND and register_pm both set"); @@ -2958,7 +2958,7 @@ static int msdc_drv_suspend(struct platform_device *pdev, pm_message_t state) struct msdc_host *host = mmc_priv(mmc); if (mmc && state.event == PM_EVENT_SUSPEND && (host->hw->flags & MSDC_SYS_SUSPEND)) { /* will set for card */ - msdc_pm(state, (void*)host); + msdc_pm(state, (void *)host); } return ret; @@ -2973,7 +2973,7 @@ static int msdc_drv_resume(struct platform_device *pdev) state.event = PM_EVENT_RESUME; if (mmc && (host->hw->flags & MSDC_SYS_SUSPEND)) {/* will set for card */ - msdc_pm(state, (void*)host); + msdc_pm(state, (void *)host); } /* This mean WIFI not controller by PM */ @@ -3022,7 +3022,7 @@ static int __init mt_msdc_init(void) mtk_sd_device.dev.platform_data = &msdc0_hw; if (ralink_soc == MT762X_SOC_MT7620A || ralink_soc == MT762X_SOC_MT7621AT) { //#if defined (CONFIG_RALINK_MT7620) || defined (CONFIG_RALINK_MT7621) - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 18); + reg = sdr_read32((volatile u32 *)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 18); //#if defined (CONFIG_RALINK_MT7620) if (ralink_soc == MT762X_SOC_MT7620A) reg |= 0x1 << 18; @@ -3030,18 +3030,18 @@ static int __init mt_msdc_init(void) } else { //#elif defined (CONFIG_RALINK_MT7628) /* TODO: maybe omitted when RAether already toggle AGPIO_CFG */ - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x3c)); + reg = sdr_read32((volatile u32 *)(RALINK_SYSCTL_BASE + 0x3c)); reg |= 0x1e << 16; - sdr_write32((volatile u32*)(RALINK_SYSCTL_BASE + 0x3c), reg); + sdr_write32((volatile u32 *)(RALINK_SYSCTL_BASE + 0x3c), reg); - reg = sdr_read32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 10); + reg = sdr_read32((volatile u32 *)(RALINK_SYSCTL_BASE + 0x60)) & ~(0x3 << 10); #if defined(CONFIG_MTK_MMC_EMMC_8BIT) reg |= 0x3 << 26 | 0x3 << 28 | 0x3 << 30; msdc0_hw.data_pins = 8, #endif //#endif } - sdr_write32((volatile u32*)(RALINK_SYSCTL_BASE + 0x60), reg); + sdr_write32((volatile u32 *)(RALINK_SYSCTL_BASE + 0x60), reg); //platform_device_register(&mtk_sd_device); /* end of +++ */ -- cgit v1.2.3-59-g8ed1b From b0318579c41e7646e56c72399163c57c986de16d Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:22 +0200 Subject: staging: mt7621-mmc: Remove unnecessary typedefs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes checkpatch warning: NEW_TYPEDEFS Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 2 +- drivers/staging/mt7621-mmc/dbg.h | 11 +- drivers/staging/mt7621-mmc/mt6575_sd.h | 305 +++++++++++++++++++-------------- drivers/staging/mt7621-mmc/sd.c | 52 +++--- 4 files changed, 206 insertions(+), 164 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 1ae9708efd20..e7677155a789 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -66,7 +66,7 @@ u32 dma_size[4] = { 512 }; -msdc_mode drv_mode[4] = { +enum msdc_mode drv_mode[4] = { MODE_SIZE_DEP, /* using DMA or not depend on the size */ MODE_SIZE_DEP, MODE_SIZE_DEP, diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index f4d32dd9a3f4..fdeefea7ed52 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -66,19 +66,20 @@ struct sdio_profile { }; //========================== -typedef enum { +enum msdc_dbg { SD_TOOL_ZONE = 0, SD_TOOL_DMA_SIZE = 1, SD_TOOL_PM_ENABLE = 2, SD_TOOL_SDIO_PROFILE = 3, -} msdc_dbg; +}; -typedef enum { +enum msdc_mode { MODE_PIO = 0, MODE_DMA = 1, MODE_SIZE_DEP = 2, -} msdc_mode; -extern msdc_mode drv_mode[4]; +}; + +extern enum msdc_mode drv_mode[4]; extern u32 dma_size[4]; /* Debug message event */ diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index bd555ebf85d3..99ca8b75711f 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -447,7 +447,7 @@ enum { /*--------------------------------------------------------------------------*/ /* Descriptor Structure */ /*--------------------------------------------------------------------------*/ -typedef struct { +struct gpd { u32 hwo:1; /* could be changed by hw */ u32 bdp:1; u32 rsv0:6; @@ -462,9 +462,9 @@ typedef struct { u32 arg; u32 blknum; u32 cmd; -} gpd_t; +}; -typedef struct { +struct bd { u32 eol:1; u32 rsv0:7; u32 chksum:8; @@ -476,13 +476,13 @@ typedef struct { void *ptr; u32 buflen:16; u32 rsv3:16; -} bd_t; +}; /*--------------------------------------------------------------------------*/ /* Register Debugging Structure */ /*--------------------------------------------------------------------------*/ -typedef struct { +struct msdc_cfg_reg { u32 msdc:1; u32 ckpwn:1; u32 rst:1; @@ -494,8 +494,9 @@ typedef struct { u32 ckdiv:8; u32 ckmod:2; u32 pad:14; -} msdc_cfg_reg; -typedef struct { +}; + +struct msdc_iocon_reg { u32 sdr104cksel:1; u32 rsmpl:1; u32 dsmpl:1; @@ -513,8 +514,9 @@ typedef struct { u32 d7spl:1; u32 riscsz:1; u32 pad2:7; -} msdc_iocon_reg; -typedef struct { +}; + +struct msdc_ps_reg { u32 cden:1; u32 cdsts:1; u32 pad1:10; @@ -523,8 +525,9 @@ typedef struct { u32 cmd:1; u32 pad2:6; u32 wp:1; -} msdc_ps_reg; -typedef struct { +}; + +struct msdc_int_reg { u32 mmcirq:1; u32 cdsc:1; u32 pad1:1; @@ -543,8 +546,9 @@ typedef struct { u32 datcrc:1; u32 atocmd19done:1; u32 pad2:15; -} msdc_int_reg; -typedef struct { +}; + +struct msdc_inten_reg { u32 mmcirq:1; u32 cdsc:1; u32 pad1:1; @@ -563,21 +567,25 @@ typedef struct { u32 datcrc:1; u32 atocmd19done:1; u32 pad2:15; -} msdc_inten_reg; -typedef struct { +}; + +struct msdc_fifocs_reg { u32 rxcnt:8; u32 pad1:8; u32 txcnt:8; u32 pad2:7; u32 clr:1; -} msdc_fifocs_reg; -typedef struct { +}; + +struct msdc_txdat_reg { u32 val; -} msdc_txdat_reg; -typedef struct { +}; + +struct msdc_rxdat_reg { u32 val; -} msdc_rxdat_reg; -typedef struct { +}; + +struct sdc_cfg_reg { u32 sdiowkup:1; u32 inswkup:1; u32 pad1:14; @@ -588,8 +596,9 @@ typedef struct { u32 intblkgap:1; u32 pad4:2; u32 dtoc:8; -} sdc_cfg_reg; -typedef struct { +}; + +struct sdc_cmd_reg { u32 cmd:6; u32 brk:1; u32 rsptyp:3; @@ -602,43 +611,54 @@ typedef struct { u32 atocmd:2; u32 volswth:1; u32 pad2:1; -} sdc_cmd_reg; -typedef struct { +}; + +struct sdc_arg_reg { u32 arg; -} sdc_arg_reg; -typedef struct { +}; + +struct sdc_sts_reg { u32 sdcbusy:1; u32 cmdbusy:1; u32 pad:29; u32 swrcmpl:1; -} sdc_sts_reg; -typedef struct { +}; + +struct sdc_resp0_reg { u32 val; -} sdc_resp0_reg; -typedef struct { +}; + +struct sdc_resp1_reg { u32 val; -} sdc_resp1_reg; -typedef struct { +}; + +struct sdc_resp2_reg { u32 val; -} sdc_resp2_reg; -typedef struct { +}; + +struct sdc_resp3_reg { u32 val; -} sdc_resp3_reg; -typedef struct { +}; + +struct sdc_blknum_reg { u32 num; -} sdc_blknum_reg; -typedef struct { +}; + +struct sdc_csts_reg { u32 sts; -} sdc_csts_reg; -typedef struct { +}; + +struct sdc_cstsen_reg { u32 sts; -} sdc_cstsen_reg; -typedef struct { +}; + +struct sdc_datcrcsts_reg { u32 datcrcsts:8; u32 ddrcrcsts:4; u32 pad:20; -} sdc_datcrcsts_reg; -typedef struct { +}; + +struct emmc_cfg0_reg { u32 bootstart:1; u32 bootstop:1; u32 bootmode:1; @@ -646,13 +666,15 @@ typedef struct { u32 bootwaidly:3; u32 bootsupp:1; u32 pad2:16; -} emmc_cfg0_reg; -typedef struct { +}; + +struct emmc_cfg1_reg { u32 bootcrctmc:16; u32 pad:4; u32 bootacktmc:12; -} emmc_cfg1_reg; -typedef struct { +}; + +struct emmc_sts_reg { u32 bootcrcerr:1; u32 bootackerr:1; u32 bootdattmo:1; @@ -661,28 +683,35 @@ typedef struct { u32 bootackrcv:1; u32 bootdatrcv:1; u32 pad:25; -} emmc_sts_reg; -typedef struct { +}; + +struct emmc_iocon_reg { u32 bootrst:1; u32 pad:31; -} emmc_iocon_reg; -typedef struct { +}; + +struct msdc_acmd_resp_reg { u32 val; -} msdc_acmd_resp_reg; -typedef struct { +}; + +struct msdc_acmd19_trg_reg { u32 tunesel:4; u32 pad:28; -} msdc_acmd19_trg_reg; -typedef struct { +}; + +struct msdc_acmd19_sts_reg { u32 val; -} msdc_acmd19_sts_reg; -typedef struct { +}; + +struct msdc_dma_sa_reg { u32 addr; -} msdc_dma_sa_reg; -typedef struct { +}; + +struct msdc_dma_ca_reg { u32 addr; -} msdc_dma_ca_reg; -typedef struct { +}; + +struct msdc_dma_ctrl_reg { u32 start:1; u32 stop:1; u32 resume:1; @@ -694,23 +723,27 @@ typedef struct { u32 brustsz:3; u32 pad4:1; u32 xfersz:16; -} msdc_dma_ctrl_reg; -typedef struct { +}; + +struct msdc_dma_cfg_reg { u32 status:1; u32 decsen:1; u32 pad1:2; u32 bdcsen:1; u32 gpdcsen:1; u32 pad2:26; -} msdc_dma_cfg_reg; -typedef struct { +}; + +struct msdc_dbg_sel_reg { u32 sel:16; u32 pad2:16; -} msdc_dbg_sel_reg; -typedef struct { +}; + +struct msdc_dbg_out_reg { u32 val; -} msdc_dbg_out_reg; -typedef struct { +}; + +struct msdc_pad_ctl0_reg { u32 clkdrvn:3; u32 rsv0:1; u32 clkdrvp:3; @@ -723,8 +756,9 @@ typedef struct { u32 clkies:1; u32 clktdsel:4; u32 clkrdsel:8; -} msdc_pad_ctl0_reg; -typedef struct { +}; + +struct msdc_pad_ctl1_reg { u32 cmddrvn:3; u32 rsv0:1; u32 cmddrvp:3; @@ -737,8 +771,9 @@ typedef struct { u32 cmdies:1; u32 cmdtdsel:4; u32 cmdrdsel:8; -} msdc_pad_ctl1_reg; -typedef struct { +}; + +struct msdc_pad_ctl2_reg { u32 datdrvn:3; u32 rsv0:1; u32 datdrvp:3; @@ -751,14 +786,16 @@ typedef struct { u32 daties:1; u32 dattdsel:4; u32 datrdsel:8; -} msdc_pad_ctl2_reg; -typedef struct { +}; + +struct msdc_pad_tune_reg { u32 wrrxdly:3; u32 pad1:5; u32 rdrxdly:8; u32 pad2:16; -} msdc_pad_tune_reg; -typedef struct { +}; + +struct msdc_dat_rddly0 { u32 dat0:5; u32 rsv0:3; u32 dat1:5; @@ -767,8 +804,9 @@ typedef struct { u32 rsv2:3; u32 dat3:5; u32 rsv3:3; -} msdc_dat_rddly0; -typedef struct { +}; + +struct msdc_dat_rddly1 { u32 dat4:5; u32 rsv4:3; u32 dat5:5; @@ -777,8 +815,9 @@ typedef struct { u32 rsv6:3; u32 dat7:5; u32 rsv7:3; -} msdc_dat_rddly1; -typedef struct { +}; + +struct msdc_hw_dbg_reg { u32 dbg0sel:8; u32 dbg1sel:6; u32 pad1:2; @@ -786,66 +825,68 @@ typedef struct { u32 pad2:2; u32 dbg3sel:6; u32 pad3:2; -} msdc_hw_dbg_reg; -typedef struct { +}; + +struct msdc_version_reg { u32 val; -} msdc_version_reg; -typedef struct { +}; + +struct msdc_eco_ver_reg { u32 val; -} msdc_eco_ver_reg; +}; struct msdc_regs { - msdc_cfg_reg msdc_cfg; /* base+0x00h */ - msdc_iocon_reg msdc_iocon; /* base+0x04h */ - msdc_ps_reg msdc_ps; /* base+0x08h */ - msdc_int_reg msdc_int; /* base+0x0ch */ - msdc_inten_reg msdc_inten; /* base+0x10h */ - msdc_fifocs_reg msdc_fifocs; /* base+0x14h */ - msdc_txdat_reg msdc_txdat; /* base+0x18h */ - msdc_rxdat_reg msdc_rxdat; /* base+0x1ch */ + struct msdc_cfg_reg msdc_cfg; /* base+0x00h */ + struct msdc_iocon_reg msdc_iocon; /* base+0x04h */ + struct msdc_ps_reg msdc_ps; /* base+0x08h */ + struct msdc_int_reg msdc_int; /* base+0x0ch */ + struct msdc_inten_reg msdc_inten; /* base+0x10h */ + struct msdc_fifocs_reg msdc_fifocs; /* base+0x14h */ + struct msdc_txdat_reg msdc_txdat; /* base+0x18h */ + struct msdc_rxdat_reg msdc_rxdat; /* base+0x1ch */ u32 rsv1[4]; - sdc_cfg_reg sdc_cfg; /* base+0x30h */ - sdc_cmd_reg sdc_cmd; /* base+0x34h */ - sdc_arg_reg sdc_arg; /* base+0x38h */ - sdc_sts_reg sdc_sts; /* base+0x3ch */ - sdc_resp0_reg sdc_resp0; /* base+0x40h */ - sdc_resp1_reg sdc_resp1; /* base+0x44h */ - sdc_resp2_reg sdc_resp2; /* base+0x48h */ - sdc_resp3_reg sdc_resp3; /* base+0x4ch */ - sdc_blknum_reg sdc_blknum; /* base+0x50h */ + struct sdc_cfg_reg sdc_cfg; /* base+0x30h */ + struct sdc_cmd_reg sdc_cmd; /* base+0x34h */ + struct sdc_arg_reg sdc_arg; /* base+0x38h */ + struct sdc_sts_reg sdc_sts; /* base+0x3ch */ + struct sdc_resp0_reg sdc_resp0; /* base+0x40h */ + struct sdc_resp1_reg sdc_resp1; /* base+0x44h */ + struct sdc_resp2_reg sdc_resp2; /* base+0x48h */ + struct sdc_resp3_reg sdc_resp3; /* base+0x4ch */ + struct sdc_blknum_reg sdc_blknum; /* base+0x50h */ u32 rsv2[1]; - sdc_csts_reg sdc_csts; /* base+0x58h */ - sdc_cstsen_reg sdc_cstsen; /* base+0x5ch */ - sdc_datcrcsts_reg sdc_dcrcsta; /* base+0x60h */ + struct sdc_csts_reg sdc_csts; /* base+0x58h */ + struct sdc_cstsen_reg sdc_cstsen; /* base+0x5ch */ + struct sdc_datcrcsts_reg sdc_dcrcsta; /* base+0x60h */ u32 rsv3[3]; - emmc_cfg0_reg emmc_cfg0; /* base+0x70h */ - emmc_cfg1_reg emmc_cfg1; /* base+0x74h */ - emmc_sts_reg emmc_sts; /* base+0x78h */ - emmc_iocon_reg emmc_iocon; /* base+0x7ch */ - msdc_acmd_resp_reg acmd_resp; /* base+0x80h */ - msdc_acmd19_trg_reg acmd19_trg; /* base+0x84h */ - msdc_acmd19_sts_reg acmd19_sts; /* base+0x88h */ + struct emmc_cfg0_reg emmc_cfg0; /* base+0x70h */ + struct emmc_cfg1_reg emmc_cfg1; /* base+0x74h */ + struct emmc_sts_reg emmc_sts; /* base+0x78h */ + struct emmc_iocon_reg emmc_iocon; /* base+0x7ch */ + struct msdc_acmd_resp_reg acmd_resp; /* base+0x80h */ + struct msdc_acmd19_trg_reg acmd19_trg; /* base+0x84h */ + struct msdc_acmd19_sts_reg acmd19_sts; /* base+0x88h */ u32 rsv4[1]; - msdc_dma_sa_reg dma_sa; /* base+0x90h */ - msdc_dma_ca_reg dma_ca; /* base+0x94h */ - msdc_dma_ctrl_reg dma_ctrl; /* base+0x98h */ - msdc_dma_cfg_reg dma_cfg; /* base+0x9ch */ - msdc_dbg_sel_reg dbg_sel; /* base+0xa0h */ - msdc_dbg_out_reg dbg_out; /* base+0xa4h */ + struct msdc_dma_sa_reg dma_sa; /* base+0x90h */ + struct msdc_dma_ca_reg dma_ca; /* base+0x94h */ + struct msdc_dma_ctrl_reg dma_ctrl; /* base+0x98h */ + struct msdc_dma_cfg_reg dma_cfg; /* base+0x9ch */ + struct msdc_dbg_sel_reg dbg_sel; /* base+0xa0h */ + struct msdc_dbg_out_reg dbg_out; /* base+0xa4h */ u32 rsv5[2]; u32 patch0; /* base+0xb0h */ u32 patch1; /* base+0xb4h */ u32 rsv6[10]; - msdc_pad_ctl0_reg pad_ctl0; /* base+0xe0h */ - msdc_pad_ctl1_reg pad_ctl1; /* base+0xe4h */ - msdc_pad_ctl2_reg pad_ctl2; /* base+0xe8h */ - msdc_pad_tune_reg pad_tune; /* base+0xech */ - msdc_dat_rddly0 dat_rddly0; /* base+0xf0h */ - msdc_dat_rddly1 dat_rddly1; /* base+0xf4h */ - msdc_hw_dbg_reg hw_dbg; /* base+0xf8h */ + struct msdc_pad_ctl0_reg pad_ctl0; /* base+0xe0h */ + struct msdc_pad_ctl1_reg pad_ctl1; /* base+0xe4h */ + struct msdc_pad_ctl2_reg pad_ctl2; /* base+0xe8h */ + struct msdc_pad_tune_reg pad_tune; /* base+0xech */ + struct msdc_dat_rddly0 dat_rddly0; /* base+0xf0h */ + struct msdc_dat_rddly1 dat_rddly1; /* base+0xf4h */ + struct msdc_hw_dbg_reg hw_dbg; /* base+0xf8h */ u32 rsv7[1]; - msdc_version_reg version; /* base+0x100h */ - msdc_eco_ver_reg eco_ver; /* base+0x104h */ + struct msdc_version_reg version; /* base+0x100h */ + struct msdc_eco_ver_reg eco_ver; /* base+0x104h */ }; struct scatterlist_ex { @@ -876,8 +917,8 @@ struct msdc_dma { u32 rsp; /* enhanced mode command response */ u32 autorsp; /* auto command response */ - gpd_t *gpd; /* pointer to gpd array */ - bd_t *bd; /* pointer to bd array */ + struct gpd *gpd; /* pointer to gpd array */ + struct bd *bd; /* pointer to bd array */ dma_addr_t gpd_addr; /* the physical address of gpd array */ dma_addr_t bd_addr; /* the physical address of bd array */ u32 used_gpd; /* the number of used gpd elements */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index da1b0512e0be..b21b781281e0 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -232,21 +232,21 @@ static int msdc_rsp[] = { }; /* For Inhanced DMA */ -#define msdc_init_gpd_ex(gpd, extlen, cmd, arg, blknum) \ +#define msdc_init_gpd_ex(_gpd, extlen, cmd, arg, blknum) \ do { \ - ((gpd_t *)gpd)->extlen = extlen; \ - ((gpd_t *)gpd)->cmd = cmd; \ - ((gpd_t *)gpd)->arg = arg; \ - ((gpd_t *)gpd)->blknum = blknum; \ + ((struct gpd *)_gpd)->extlen = extlen; \ + ((struct gpd *)_gpd)->cmd = cmd; \ + ((struct gpd *)_gpd)->arg = arg; \ + ((struct gpd *)_gpd)->blknum = blknum; \ } while (0) -#define msdc_init_bd(bd, blkpad, dwpad, dptr, dlen) \ +#define msdc_init_bd(_bd, blkpad, dwpad, dptr, dlen) \ do { \ BUG_ON(dlen > 0xFFFFUL); \ - ((bd_t *)bd)->blkpad = blkpad; \ - ((bd_t *)bd)->dwpad = dwpad; \ - ((bd_t *)bd)->ptr = (void *)dptr; \ - ((bd_t *)bd)->buflen = dlen; \ + ((struct bd *)_bd)->blkpad = blkpad; \ + ((struct bd *)_bd)->dwpad = dwpad; \ + ((struct bd *)_bd)->ptr = (void *)dptr; \ + ((struct bd *)_bd)->buflen = dlen; \ } while (0) #define msdc_txfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_TXCNT) >> 16) @@ -1352,9 +1352,9 @@ static void msdc_dma_stop(struct msdc_host *host) /* dump a gpd list */ static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) { - gpd_t *gpd = dma->gpd; - bd_t *bd = dma->bd; - bd_t *ptr; + struct gpd *gpd = dma->gpd; + struct bd *bd = dma->bd; + struct bd *ptr; int i = 0; int p_to_v; @@ -1427,8 +1427,8 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) u32 j, num, bdlen; u8 blkpad, dwpad, chksum; struct scatterlist *sg = dma->sg; - gpd_t *gpd; - bd_t *bd; + struct gpd *gpd; + struct bd *bd; switch (dma->mode) { case MSDC_MODE_DMA_BASIC: @@ -2708,32 +2708,32 @@ static void msdc_deinit_hw(struct msdc_host *host) /* init gpd and bd list in msdc_drv_probe */ static void msdc_init_gpd_bd(struct msdc_host *host, struct msdc_dma *dma) { - gpd_t *gpd = dma->gpd; - bd_t *bd = dma->bd; - bd_t *ptr, *prev; + struct gpd *gpd = dma->gpd; + struct bd *bd = dma->bd; + struct bd *ptr, *prev; /* we just support one gpd */ int bdlen = MAX_BD_PER_GPD; /* init the 2 gpd */ - memset(gpd, 0, sizeof(gpd_t) * 2); + memset(gpd, 0, sizeof(struct gpd) * 2); //gpd->next = (void *)virt_to_phys(gpd + 1); /* pointer to a null gpd, bug! kmalloc <-> virt_to_phys */ //gpd->next = (dma->gpd_addr + 1); /* bug */ - gpd->next = (void *)((u32)dma->gpd_addr + sizeof(gpd_t)); + gpd->next = (void *)((u32)dma->gpd_addr + sizeof(struct gpd)); //gpd->intr = 0; gpd->bdp = 1; /* hwo, cs, bd pointer */ //gpd->ptr = (void*)virt_to_phys(bd); gpd->ptr = (void *)dma->bd_addr; /* physical address */ - memset(bd, 0, sizeof(bd_t) * bdlen); + memset(bd, 0, sizeof(struct bd) * bdlen); ptr = bd + bdlen - 1; //ptr->eol = 1; /* 0 or 1 [Fix me]*/ //ptr->next = 0; while (ptr != bd) { prev = ptr - 1; - prev->next = (void *)(dma->bd_addr + sizeof(bd_t) * (ptr - bd)); + prev->next = (void *)(dma->bd_addr + sizeof(struct bd) * (ptr - bd)); ptr = prev; } } @@ -2834,8 +2834,8 @@ static int msdc_drv_probe(struct platform_device *pdev) mmc_dev(mmc)->dma_mask = NULL; /* using dma_alloc_coherent*/ /* todo: using 1, for all 4 slots */ - host->dma.gpd = dma_alloc_coherent(NULL, MAX_GPD_NUM * sizeof(gpd_t), &host->dma.gpd_addr, GFP_KERNEL); - host->dma.bd = dma_alloc_coherent(NULL, MAX_BD_NUM * sizeof(bd_t), &host->dma.bd_addr, GFP_KERNEL); + host->dma.gpd = dma_alloc_coherent(NULL, MAX_GPD_NUM * sizeof(struct gpd), &host->dma.gpd_addr, GFP_KERNEL); + host->dma.bd = dma_alloc_coherent(NULL, MAX_BD_NUM * sizeof(struct bd), &host->dma.bd_addr, GFP_KERNEL); BUG_ON((!host->dma.gpd) || (!host->dma.bd)); msdc_init_gpd_bd(host, &host->dma); /*for emmc*/ @@ -2936,8 +2936,8 @@ static int msdc_drv_remove(struct platform_device *pdev) #endif free_irq(host->irq, host); - dma_free_coherent(NULL, MAX_GPD_NUM * sizeof(gpd_t), host->dma.gpd, host->dma.gpd_addr); - dma_free_coherent(NULL, MAX_BD_NUM * sizeof(bd_t), host->dma.bd, host->dma.bd_addr); + dma_free_coherent(NULL, MAX_GPD_NUM * sizeof(struct gpd), host->dma.gpd, host->dma.gpd_addr); + dma_free_coherent(NULL, MAX_BD_NUM * sizeof(struct bd), host->dma.bd, host->dma.bd_addr); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -- cgit v1.2.3-59-g8ed1b From 178c153dbbe89cc54d642588247644ab9b54871e Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:23 +0200 Subject: staging: mt7621-mmc: Fix trailing statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix checkpatch error: TRAILING_STATEMENTS Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 25 ++++++++++++++++++------- drivers/staging/mt7621-mmc/dbg.h | 3 ++- drivers/staging/mt7621-mmc/sd.c | 39 ++++++++++++++++++++++++++------------- 3 files changed, 46 insertions(+), 21 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index e7677155a789..60c704d6adc2 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -194,7 +194,8 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) block = sizes / 512; if (block >= 99) { printk("cmd53 error blocks\n"); - while (1); + while (1) + ; } cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; } @@ -264,11 +265,14 @@ static ssize_t msdc_debug_proc_write(struct file *file, int id, zone; int mode, size; - if (count == 0)return -1; - if (count > 255)count = 255; + if (count == 0) + return -1; + if (count > 255) + count = 255; ret = copy_from_user(cmd_buf, buf, count); - if (ret < 0)return -1; + if (ret < 0) + return -1; cmd_buf[count] = '\0'; printk("msdc Write %s\n", cmd_buf); @@ -276,7 +280,9 @@ static ssize_t msdc_debug_proc_write(struct file *file, sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2); if (cmd == SD_TOOL_ZONE) { - id = p1; zone = p2; zone &= 0x3ff; + id = p1; + zone = p2; + zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); if (id >= 0 && id <= 3) { sd_debug_zone[id] = zone; @@ -289,7 +295,9 @@ static ssize_t msdc_debug_proc_write(struct file *file, printk("msdc host_id error when set debug zone\n"); } } else if (cmd == SD_TOOL_DMA_SIZE) { - id = p1 >> 4; mode = (p1 & 0xf); size = p2; + id = p1 >> 4; + mode = (p1 & 0xf); + size = p2; if (id >= 0 && id <= 3) { drv_mode[id] = mode; dma_size[id] = p2; @@ -310,7 +318,10 @@ static ssize_t msdc_debug_proc_write(struct file *file, gpt_enable = 1; } sdio_pro_enable = 1; - if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; + if (p2 == 0) + p2 = 1; + if (p2 >= 30) + p2 = 30; sdio_pro_time = p2; } else if (p1 == 0) { /* todo */ diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index fdeefea7ed52..5469c9d16804 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -105,7 +105,8 @@ extern unsigned int sd_debug_zone[4]; do { \ if (x) { \ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ - while (1); \ + while (1) \ + ; \ } \ } while (0) #endif /* end of +++ */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index b21b781281e0..2be6d192580a 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -263,7 +263,8 @@ static int msdc_rsp[] = { do { \ int backup = cnt; \ while (retry) { \ - if (!(expr)) break; \ + if (!(expr)) \ + break; \ if (cnt-- == 0) { \ retry--; mdelay(1); cnt = backup; \ } \ @@ -694,7 +695,8 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz) sdr_set_field(MSDC_CFG, MSDC_CFG_CKDIV, div); /* wait clock stable */ - while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)); + while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)) + ; host->sclk = sclk; host->mclk = hz; @@ -1245,7 +1247,8 @@ end: N_MSG(FIO, " PIO Read<%d>bytes", size); sdr_clr_bits(MSDC_INTEN, wints); - if (data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); + if (data->error) + ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); return data->error; } @@ -1300,7 +1303,8 @@ static int msdc_pio_write(struct msdc_host *host, struct mmc_data *data) end: data->bytes_xfered += size; N_MSG(FIO, " PIO Write<%d>bytes", size); - if (data->error) ERR_MSG("write pio data->error<%d>", data->error); + if (data->error) + ERR_MSG("write pio data->error<%d>", data->error); sdr_clr_bits(MSDC_INTEN, wints); return data->error; @@ -1340,7 +1344,8 @@ static void msdc_dma_stop(struct msdc_host *host) //while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); - while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); + while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) + ; //dsb(); /* --- by chhung */ sdr_clr_bits(MSDC_INTEN, wints); /* Not just xfer_comp */ @@ -1733,9 +1738,12 @@ done: #endif #endif /* end of --- */ - if (mrq->cmd->error) host->error = 0x001; - if (mrq->data && mrq->data->error) host->error |= 0x010; - if (mrq->stop && mrq->stop->error) host->error |= 0x100; + if (mrq->cmd->error) + host->error = 0x001; + if (mrq->data && mrq->data->error) + host->error |= 0x010; + if (mrq->stop && mrq->stop->error) + host->error |= 0x100; //if (host->error) ERR_MSG("host->error<%d>", host->error); @@ -1868,7 +1876,8 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) result = msdc_do_request(mmc, mrq); sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, dcrc); /* RO */ - if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; + if (!ddr) + dcrc &= ~SDC_DCRC_STS_NEG; ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", (result == 0 && dcrc == 0) ? "PASS" : "FAIL", dcrc, sdr_read32(MSDC_DAT_RDDLY0), sdr_read32(MSDC_DAT_RDDLY1), cur_dsmpl); @@ -2063,7 +2072,8 @@ static int msdc_check_busy(struct mmc_host *mmc, struct msdc_host *host) do { err = msdc_get_card_status(mmc, host, &status); - if (err) return err; + if (err) + return err; /* need cmd12? */ ERR_MSG("cmd<13> resp<0x%x>", status); } while (R1_CURRENT_STATE(status) == 7); @@ -2755,7 +2765,8 @@ static int msdc_drv_probe(struct platform_device *pdev) /* Allocate MMC host for this device */ mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); - if (!mmc) return -ENOMEM; + if (!mmc) + return -ENOMEM; hw = (struct msdc_hw *)pdev->dev.platform_data; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -2854,7 +2865,8 @@ static int msdc_drv_probe(struct platform_device *pdev) else ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host); - if (ret) goto release; + if (ret) + goto release; // mt65xx_irq_unmask(irq); /* --- by chhung */ if (hw->flags & MSDC_CD_PIN_EN) { /* not set for sdio */ @@ -2879,7 +2891,8 @@ static int msdc_drv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mmc); ret = mmc_add_host(mmc); - if (ret) goto free_irq; + if (ret) + goto free_irq; /* Config card detection pin and enable interrupts */ if (hw->flags & MSDC_CD_PIN_EN) { /* set for card */ -- cgit v1.2.3-59-g8ed1b From ba3979bd010b739103c765d36ad49c8e3c1e668f Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:24 +0200 Subject: staging: mt7621-mmc: Remove global initialise to 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix checkpatch error: GLOBAL_INITIALISERS Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 60c704d6adc2..1e4c95b659da 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -76,9 +76,9 @@ enum msdc_mode drv_mode[4] = { #if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) -u32 gpt_enable = 0; -u32 sdio_pro_enable = 0; /* make sure gpt is enabled */ -u32 sdio_pro_time = 0; /* no more than 30s */ +u32 gpt_enable; +u32 sdio_pro_enable; /* make sure gpt is enabled */ +u32 sdio_pro_time; /* no more than 30s */ struct sdio_profile sdio_perfomance = {0}; #if 0 /* --- chhung */ -- cgit v1.2.3-59-g8ed1b From e2031e730a25b4efdcfd7c3afc2c69405f3758f2 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:25 +0200 Subject: staging: mt7621-mmc: Fix style of braces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix checkpatch errors, warnings, checks about braces: BRACES, ELSE_AFTER_BRACE, OPEN_BRACE Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 31 +++---- drivers/staging/mt7621-mmc/mt6575_sd.h | 3 +- drivers/staging/mt7621-mmc/sd.c | 154 +++++++++++++-------------------- 3 files changed, 70 insertions(+), 118 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 1e4c95b659da..70f1abe7012d 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -105,9 +105,8 @@ u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32) if (new_H32 == old_H32) { ret = new_L32 - old_L32; } else if (new_H32 == (old_H32 + 1)) { - if (new_L32 > old_L32) { + if (new_L32 > old_L32) printk("msdc old_L<0x%x> new_L<0x%x>\n", old_L32, new_L32); - } ret = (0xffffffff - old_L32); ret += new_L32; } else { @@ -181,9 +180,8 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) struct cmd_profile *cmd; u32 block; - if (sdio_pro_enable == 0) { + if (sdio_pro_enable == 0) return; - } if (opcode == 52) { cmd = bRx ? &result->cmd52_rx : &result->cmd52_tx; @@ -204,21 +202,18 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) } /* update the members */ - if (ticks > cmd->max_tc) { + if (ticks > cmd->max_tc) cmd->max_tc = ticks; - } - if (cmd->min_tc == 0 || ticks < cmd->min_tc) { + if (cmd->min_tc == 0 || ticks < cmd->min_tc) cmd->min_tc = ticks; - } cmd->tot_tc += ticks; cmd->tot_bytes += sizes; cmd->count++; - if (bRx) { + if (bRx) result->total_rx_bytes += sizes; - } else { + else result->total_tx_bytes += sizes; - } result->total_tc += ticks; /* dump when total_tc > 30s */ @@ -286,12 +281,10 @@ static ssize_t msdc_debug_proc_write(struct file *file, printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); if (id >= 0 && id <= 3) { sd_debug_zone[id] = zone; - } - else if (id == 4) { + } else if (id == 4) { sd_debug_zone[0] = sd_debug_zone[1] = zone; sd_debug_zone[2] = sd_debug_zone[3] = zone; - } - else{ + } else { printk("msdc host_id error when set debug zone\n"); } } else if (cmd == SD_TOOL_DMA_SIZE) { @@ -301,14 +294,12 @@ static ssize_t msdc_debug_proc_write(struct file *file, if (id >= 0 && id <= 3) { drv_mode[id] = mode; dma_size[id] = p2; - } - else if (id == 4) { + } else if (id == 4) { drv_mode[0] = drv_mode[1] = mode; drv_mode[2] = drv_mode[3] = mode; dma_size[0] = dma_size[1] = p2; dma_size[2] = dma_size[3] = p2; - } - else{ + } else { printk("msdc host_id error when select mode\n"); } } else if (cmd == SD_TOOL_SDIO_PROFILE) { @@ -323,7 +314,7 @@ static ssize_t msdc_debug_proc_write(struct file *file, if (p2 >= 30) p2 = 30; sdio_pro_time = p2; - } else if (p1 == 0) { + } else if (p1 == 0) { /* todo */ sdio_pro_enable = 0; } diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index 99ca8b75711f..f6daaf69bcab 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -925,8 +925,7 @@ struct msdc_dma { u32 used_bd; /* the number of used bd elements */ }; -struct msdc_host -{ +struct msdc_host { struct msdc_hw *hw; struct mmc_host *mmc; /* mmc structure */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 2be6d192580a..ce5e47768422 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -590,9 +590,8 @@ static void msdc_tasklet_card(struct work_struct *work) host->card_inserted = inserted; if (change && !host->suspend) { - if (inserted) { + if (inserted) host->mmc->f_max = HOST_MAX_MCLK; // work around - } mmc_detect_change(host->mmc, msecs_to_jiffies(20)); } #else /* Make sure: handle the last interrupt */ @@ -789,11 +788,10 @@ void msdc_pin_reset(struct msdc_host *host, int mode) if (hw->config_gpio_pin) /* NULL */ hw->config_gpio_pin(MSDC_RST_PIN, pull); - if (mode == MSDC_PIN_PULL_UP) { + if (mode == MSDC_PIN_PULL_UP) sdr_clr_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); - } else { + else sdr_set_bits(EMMC_IOCON, EMMC_IOCON_BOOTRST); - } } } @@ -832,18 +830,16 @@ static void msdc_card_power(struct msdc_host *host, int on) if (on) { msdc_pin_config(host, MSDC_PIN_PULL_UP); - if (host->hw->ext_power_on) { + if (host->hw->ext_power_on) host->hw->ext_power_on(); - } else { + //else //msdc_vdd_on(host); // need todo card detection. - } msleep(1); } else { - if (host->hw->ext_power_off) { + if (host->hw->ext_power_off) host->hw->ext_power_off(); - } else { + //else //msdc_vdd_off(host); - } msdc_pin_config(host, MSDC_PIN_PULL_DOWN); msleep(1); } @@ -892,9 +888,9 @@ static void msdc_pm(pm_message_t state, void *data) host->pm_state = state; /* default PMSG_RESUME */ INIT_MSG("%s Suspend", evt == PM_EVENT_SUSPEND ? "PM" : "USR"); - if (host->hw->flags & MSDC_SYS_SUSPEND) /* set for card */ + if (host->hw->flags & MSDC_SYS_SUSPEND) /* set for card */ { (void)mmc_suspend_host(host->mmc); - else { + } else { // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* just for double confirm */ /* --- by chhung */ mmc_remove_host(host->mmc); } @@ -916,8 +912,7 @@ static void msdc_pm(pm_message_t state, void *data) INIT_MSG("%s Resume", evt == PM_EVENT_RESUME ? "PM" : "USR"); if (host->hw->flags & MSDC_SYS_SUSPEND) { /* will not set for WIFI */ (void)mmc_resume_host(host->mmc); - } - else { + } else { // host->mmc->pm_flags |= MMC_PM_IGNORE_PM_NOTIFY; /* --- by chhung */ mmc_add_host(host->mmc); } @@ -946,21 +941,21 @@ static unsigned int msdc_command_start(struct msdc_host *host, /* Protocol layer does not provide response type, but our hardware needs * to know exact type, not just size! */ - if (opcode == MMC_SEND_OP_COND || opcode == SD_APP_OP_COND) + if (opcode == MMC_SEND_OP_COND || opcode == SD_APP_OP_COND) { resp = RESP_R3; - else if (opcode == MMC_SET_RELATIVE_ADDR || opcode == SD_SEND_RELATIVE_ADDR) + } else if (opcode == MMC_SET_RELATIVE_ADDR || opcode == SD_SEND_RELATIVE_ADDR) { resp = (mmc_cmd_type(cmd) == MMC_CMD_BCR) ? RESP_R6 : RESP_R1; - else if (opcode == MMC_FAST_IO) + } else if (opcode == MMC_FAST_IO) { resp = RESP_R4; - else if (opcode == MMC_GO_IRQ_STATE) + } else if (opcode == MMC_GO_IRQ_STATE) { resp = RESP_R5; - else if (opcode == MMC_SELECT_CARD) + } else if (opcode == MMC_SELECT_CARD) { resp = (cmd->arg != 0) ? RESP_R1B : RESP_NONE; - else if (opcode == SD_IO_RW_DIRECT || opcode == SD_IO_RW_EXTENDED) + } else if (opcode == SD_IO_RW_DIRECT || opcode == SD_IO_RW_EXTENDED) { resp = RESP_R1; /* SDIO workaround. */ - else if (opcode == SD_SEND_IF_COND && (mmc_cmd_type(cmd) == MMC_CMD_BCR)) + } else if (opcode == SD_SEND_IF_COND && (mmc_cmd_type(cmd) == MMC_CMD_BCR)) { resp = RESP_R1; - else { + } else { switch (mmc_resp_type(cmd)) { case MMC_RSP_R1: resp = RESP_R1; @@ -1125,9 +1120,8 @@ static unsigned int msdc_command_resp(struct msdc_host *host, /* do we need to save card's RCA when SD_SEND_RELATIVE_ADDR */ - if (!tune) { + if (!tune) return cmd->error; - } /* memory card CRC */ if (host->hw->flags & MSDC_REMOVABLE && cmd->error == (unsigned int)(-EIO)) { @@ -1176,9 +1170,8 @@ static int msdc_pio_abort(struct msdc_host *host, struct mmc_data *data, unsigne int ret = 0; u32 base = host->base; - if (atomic_read(&host->abort)) { + if (atomic_read(&host->abort)) ret = 1; - } if (time_after(jiffies, tmo)) { data->error = (unsigned int)-ETIMEDOUT; @@ -1235,9 +1228,8 @@ static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) } } - if (msdc_pio_abort(host, data, tmo)) { + if (msdc_pio_abort(host, data, tmo)) goto end; - } } size += sg_dma_len(sg); sg = sg_next(sg); num--; @@ -1293,9 +1285,8 @@ static int msdc_pio_write(struct msdc_host *host, struct mmc_data *data) } } - if (msdc_pio_abort(host, data, tmo)) { + if (msdc_pio_abort(host, data, tmo)) goto end; - } } size += sg_dma_len(sg); sg = sg_next(sg); num--; @@ -1363,9 +1354,8 @@ static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) int i = 0; int p_to_v; - if (dma->mode != MSDC_MODE_DMA_DESC) { + if (dma->mode != MSDC_MODE_DMA_DESC) return; - } ERR_MSG("try to dump gpd and bd"); @@ -1397,9 +1387,8 @@ static void msdc_dma_dump(struct msdc_host *host, struct msdc_dma *dma) ERR_MSG("...ptr <0x%.8x>", (int)ptr->ptr); ERR_MSG("...buflen<0x%.8x>", (int)ptr->buflen); - if (ptr->eol == 1) { + if (ptr->eol == 1) break; - } /* find the next bd, virtual address of ptr->next */ /* don't need to enable when use malloc */ @@ -1417,9 +1406,8 @@ static u8 msdc_dma_calcs(u8 *buf, u32 len) { u32 i, sum = 0; - for (i = 0; i < len; i++) { + for (i = 0; i < len; i++) sum += buf[i]; - } return 0xFF - (u8)sum; } @@ -1474,11 +1462,10 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) /* modify bd*/ for (j = 0; j < bdlen; j++) { msdc_init_bd(&bd[j], blkpad, dwpad, sg_dma_address(sg), sg_dma_len(sg)); - if (j == bdlen - 1) { + if (j == bdlen - 1) bd[j].eol = 1; /* the last bd */ - } else { + else bd[j].eol = 0; - } bd[j].chksum = 0; /* checksume need to clear first */ bd[j].chksum = (chksum ? msdc_dma_calcs((u8 *)(&bd[j]), 16) : 0); sg++; @@ -1570,9 +1557,8 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) if (!data) { send_type = SND_CMD; - if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) { + if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) goto done; - } } else { BUG_ON(data->blksz > HOST_MAX_BLKSZ); send_type = SND_DAT; @@ -1584,13 +1570,12 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) host->blksz = data->blksz; /* deside the transfer mode */ - if (drv_mode[host->id] == MODE_PIO) { + if (drv_mode[host->id] == MODE_PIO) host->dma_xfer = dma = 0; - } else if (drv_mode[host->id] == MODE_DMA) { + else if (drv_mode[host->id] == MODE_DMA) host->dma_xfer = dma = 1; - } else if (drv_mode[host->id] == MODE_SIZE_DEP) { + else if (drv_mode[host->id] == MODE_SIZE_DEP) host->dma_xfer = dma = ((host->xfer_size >= dma_size[host->id]) ? 1 : 0); - } if (read) { if ((host->timeout_ns != data->timeout_ns) || @@ -1640,28 +1625,24 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) msdc_dma_stop(host); } else { /* Firstly: send command */ - if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) { + if (msdc_do_command(host, cmd, 1, CMD_TIMEOUT) != 0) goto done; - } /* Secondly: pio data phase */ if (read) { - if (msdc_pio_read(host, data)) { + if (msdc_pio_read(host, data)) goto done; - } } else { - if (msdc_pio_write(host, data)) { + if (msdc_pio_write(host, data)) goto done; - } } /* For write case: make sure contents in fifo flushed to device */ if (!read) { while (1) { left = msdc_txfifocnt(); - if (left == 0) { + if (left == 0) break; - } if (msdc_pio_abort(host, data, jiffies + DAT_TIMEOUT)) { break; /* Fix me: what about if data error, when stop ? how to? */ @@ -1684,9 +1665,8 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) /* Last: stop transfer */ if (data->stop) { - if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0) { + if (msdc_do_command(host, data->stop, 0, CMD_TIMEOUT) != 0) goto done; - } } } @@ -1813,9 +1793,8 @@ static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd) ERR_MSG("TUNE_CMD<%d> %s PAD_CMD_RESP_RXDLY[26:22]<%d> R_SMPL[1]<%d>", cmd->opcode, (result == 0) ? "PASS" : "FAIL", cur_rrdly, cur_rsmpl); - if (result == 0) { + if (result == 0) return 0; - } if (result != (unsigned int)(-EIO)) { ERR_MSG("TUNE_CMD<%d> Error<%d> not -EIO", cmd->opcode, result); return result; @@ -2009,8 +1988,7 @@ static int msdc_tune_bwrite(struct mmc_host *mmc, struct mmc_request *mrq) if (result == 0) { goto done; - } - else { + } else { /* there is a case: command timeout, and data phase not processed */ if (mrq->data->error != (unsigned int)(-EIO)) { ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", @@ -2058,9 +2036,8 @@ static int msdc_get_card_status(struct mmc_host *mmc, struct msdc_host *host, u3 err = msdc_do_command(host, &cmd, 1, CMD_TIMEOUT); - if (status) { + if (status) *status = cmd.resp[0]; - } return err; } @@ -2096,9 +2073,8 @@ static int msdc_tune_request(struct mmc_host *mmc, struct mmc_request *mrq) read = data->flags & MMC_DATA_READ ? 1 : 0; if (read) { - if (data->error == (unsigned int)(-EIO)) { + if (data->error == (unsigned int)(-EIO)) ret = msdc_tune_bread(mmc, mrq); - } } else { ret = msdc_check_busy(mmc, host); if (ret) { @@ -2147,18 +2123,16 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) spin_lock(&host->lock); #if 0 /* --- by chhung */ if (sdio_pro_enable) { //=== for sdio profile === - if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) { + if (mrq->cmd->opcode == 52 || mrq->cmd->opcode == 53) GPT_GetCounter64(&old_L32, &old_H32); - } } #endif /* end of --- */ host->mrq = mrq; if (msdc_do_request(mmc, mrq)) { - if (host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) { + if (host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) msdc_tune_request(mmc, mrq); - } } /* ==== when request done, check if app_cmd ==== */ @@ -2187,9 +2161,8 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) bRx = mrq->cmd->arg & 0x80000000 ? 1 : 0; } - if (!mrq->cmd->error) { + if (!mrq->cmd->error) msdc_performance(opcode, sizes, bRx, ticks); - } } } #endif /* end of --- */ @@ -2361,20 +2334,18 @@ static void msdc_ops_enable_sdio_irq(struct mmc_host *mmc, int enable) u32 tmp; if (hw->flags & MSDC_EXT_SDIO_IRQ) { /* yes for sdio */ - if (enable) { + if (enable) hw->enable_sdio_eirq(); /* combo_sdio_enable_eirq */ - } else { + else hw->disable_sdio_eirq(); /* combo_sdio_disable_eirq */ - } } else { ERR_MSG("XXX "); /* so never enter here */ tmp = sdr_read32(SDC_CFG); /* FIXME. Need to interrupt gap detection */ - if (enable) { + if (enable) tmp |= (SDC_CFG_SDIOIDE | SDC_CFG_SDIOINTWKUP); - } else { + else tmp &= ~(SDC_CFG_SDIOIDE | SDC_CFG_SDIOINTWKUP); - } sdr_write32(SDC_CFG, tmp); } } @@ -2444,16 +2415,15 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) if (intsts & MSDC_INT_DATTMO) { IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode); data->error = (unsigned int)-ETIMEDOUT; - } - else if (intsts & MSDC_INT_DATCRCERR) { + } else if (intsts & MSDC_INT_DATCRCERR) { IRQ_MSG("XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>", host->mrq->cmd->opcode, sdr_read32(SDC_DCRC_STS)); data->error = (unsigned int)-EIO; } //if(sdr_read32(MSDC_INTEN) & MSDC_INT_XFER_COMPL) { - if (host->dma_xfer) { + if (host->dma_xfer) complete(&host->xfer_done); /* Read CRC come fast, XFER_COMPL not enabled */ - } /* PIO mode can't do complete, because not init */ + /* PIO mode can't do complete, because not init */ } } @@ -2471,28 +2441,23 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) *rsp++ = sdr_read32(SDC_RESP1); *rsp++ = sdr_read32(SDC_RESP0); break; default: /* Response types 1, 3, 4, 5, 6, 7(1b) */ - if ((intsts & MSDC_INT_ACMDRDY) || (intsts & MSDC_INT_ACMD19_DONE)) { + if ((intsts & MSDC_INT_ACMDRDY) || (intsts & MSDC_INT_ACMD19_DONE)) *rsp = sdr_read32(SDC_ACMD_RESP); - } else { + else *rsp = sdr_read32(SDC_RESP0); - } break; } } else if ((intsts & MSDC_INT_RSPCRCERR) || (intsts & MSDC_INT_ACMDCRCERR)) { - if (intsts & MSDC_INT_ACMDCRCERR) { + if (intsts & MSDC_INT_ACMDCRCERR) IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR", cmd->opcode); - } - else { + else IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR", cmd->opcode); - } cmd->error = (unsigned int)-EIO; } else if ((intsts & MSDC_INT_CMDTMO) || (intsts & MSDC_INT_ACMDTMO)) { - if (intsts & MSDC_INT_ACMDTMO) { + if (intsts & MSDC_INT_ACMDTMO) IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO", cmd->opcode); - } - else { + else IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO", cmd->opcode); - } cmd->error = (unsigned int)-ETIMEDOUT; msdc_reset(); msdc_clr_fifo(); @@ -2502,9 +2467,8 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) } /* mmc irq interrupts */ - if (intsts & MSDC_INT_MMCIRQ) { + if (intsts & MSDC_INT_MMCIRQ) printk(KERN_INFO "msdc[%d] MMCIRQ: SDC_CSTS=0x%.8x\r\n", host->id, sdr_read32(SDC_CSTS)); - } #ifdef MT6575_SD_DEBUG { @@ -2531,7 +2495,6 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) int_reg->dattmo, int_reg->datcrc, int_reg->dmaqempty); - } #endif @@ -2786,9 +2749,8 @@ static int msdc_drv_probe(struct platform_device *pdev) /* For sd card: MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED, For sdio : MSDC_EXT_SDIO_IRQ | MSDC_HIGHSPEED */ - if (hw->flags & MSDC_HIGHSPEED) { + if (hw->flags & MSDC_HIGHSPEED) mmc->caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED; - } if (hw->data_pins == 4) { /* current data_pins are all 4*/ mmc->caps |= MMC_CAP_4_BIT_DATA; } else if (hw->data_pins == 8) { -- cgit v1.2.3-59-g8ed1b From a8bba47eb845deae4903abdb3febeaaf17fe6b1a Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 4 Apr 2018 22:15:27 +0200 Subject: staging: mt7621-mmc: Replace seq_printf with seq_puts where possible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace seq_printf with seq_puts when the string is const. Fix checkpatch warning: PREFER_SEQ_PUTS Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 70f1abe7012d..abf92a84a417 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -226,27 +226,27 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) //========== driver proc interface =========== static int msdc_debug_proc_read(struct seq_file *s, void *p) { - seq_printf(s, "\n=========================================\n"); - seq_printf(s, "Index<0> + Id + Zone\n"); - seq_printf(s, "-> PWR<9> WRN<8> | FIO<7> OPS<6> FUN<5> CFG<4> | INT<3> RSP<2> CMD<1> DMA<0>\n"); - seq_printf(s, "-> echo 0 3 0x3ff >msdc_bebug -> host[3] debug zone set to 0x3ff\n"); + seq_puts(s, "\n=========================================\n"); + seq_puts(s, "Index<0> + Id + Zone\n"); + seq_puts(s, "-> PWR<9> WRN<8> | FIO<7> OPS<6> FUN<5> CFG<4> | INT<3> RSP<2> CMD<1> DMA<0>\n"); + seq_puts(s, "-> echo 0 3 0x3ff >msdc_bebug -> host[3] debug zone set to 0x3ff\n"); seq_printf(s, "-> MSDC[0] Zone: 0x%.8x\n", sd_debug_zone[0]); seq_printf(s, "-> MSDC[1] Zone: 0x%.8x\n", sd_debug_zone[1]); seq_printf(s, "-> MSDC[2] Zone: 0x%.8x\n", sd_debug_zone[2]); seq_printf(s, "-> MSDC[3] Zone: 0x%.8x\n", sd_debug_zone[3]); - seq_printf(s, "Index<1> + ID:4|Mode:4 + DMA_SIZE\n"); - seq_printf(s, "-> 0)PIO 1)DMA 2)SIZE\n"); - seq_printf(s, "-> echo 1 22 0x200 >msdc_bebug -> host[2] size mode, dma when >= 512\n"); + seq_puts(s, "Index<1> + ID:4|Mode:4 + DMA_SIZE\n"); + seq_puts(s, "-> 0)PIO 1)DMA 2)SIZE\n"); + seq_puts(s, "-> echo 1 22 0x200 >msdc_bebug -> host[2] size mode, dma when >= 512\n"); seq_printf(s, "-> MSDC[0] mode<%d> size<%d>\n", drv_mode[0], dma_size[0]); seq_printf(s, "-> MSDC[1] mode<%d> size<%d>\n", drv_mode[1], dma_size[1]); seq_printf(s, "-> MSDC[2] mode<%d> size<%d>\n", drv_mode[2], dma_size[2]); seq_printf(s, "-> MSDC[3] mode<%d> size<%d>\n", drv_mode[3], dma_size[3]); - seq_printf(s, "Index<3> + SDIO_PROFILE + TIME\n"); - seq_printf(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); + seq_puts(s, "Index<3> + SDIO_PROFILE + TIME\n"); + seq_puts(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); seq_printf(s, "-> SDIO_PROFILE<%d> TIME<%ds>\n", sdio_pro_enable, sdio_pro_time); - seq_printf(s, "=========================================\n\n"); + seq_puts(s, "=========================================\n\n"); return 0; } -- cgit v1.2.3-59-g8ed1b From e1b8ebd25d72758535eaf78cf583a8291db85780 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Sat, 7 Apr 2018 10:16:22 +0200 Subject: staging: mt7621-mmc: Remove error message in debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the debug file in proc fs is not successfully created current code prints an error message, this is removed. de is also not an error pointer, so the IS_ERR() call leads to a static checker warning. The unused return value of the msdc_debug_proc_init function is also removed. Reported-by: Dan Carpenter Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 9 ++------- drivers/staging/mt7621-mmc/dbg.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index abf92a84a417..3ef36ab7138d 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -337,14 +337,9 @@ static const struct file_operations msdc_debug_fops = { .release = single_release, }; -int msdc_debug_proc_init(void) +void msdc_debug_proc_init(void) { - struct proc_dir_entry *de = proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); - - if (!de || IS_ERR(de)) - printk("!! Create MSDC debug PROC fail !!\n"); - - return 0; + proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); } EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 5469c9d16804..6f00fcdaba32 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -146,7 +146,7 @@ do { \ } while (0); #endif -int msdc_debug_proc_init(void); +void msdc_debug_proc_init(void); #if 0 /* --- chhung */ void msdc_init_gpt(void); -- cgit v1.2.3-59-g8ed1b From 2436c3156edfc127484c356f5dd6d713cf54d9f9 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Sat, 7 Apr 2018 10:16:23 +0200 Subject: staging: mt7621-mmc: Fix debug file world writable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the debug file in proc fs is world writable, remove the access for other. Reported-by: Dan Carpenter Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 3ef36ab7138d..ec95f6d49997 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -339,7 +339,7 @@ static const struct file_operations msdc_debug_fops = { void msdc_debug_proc_init(void) { - proc_create("msdc_debug", 0667, NULL, &msdc_debug_fops); + proc_create("msdc_debug", 0660, NULL, &msdc_debug_fops); } EXPORT_SYMBOL_GPL(msdc_debug_proc_init); #endif -- cgit v1.2.3-59-g8ed1b From 0e0836625b0a5efb1b86b2836b0d2349c66753de Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Sat, 7 Apr 2018 10:16:24 +0200 Subject: staging: mt7621-mmc: Fix: copy_from_user() returns a positive value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit copy_from_user() returns a positive value in case of an error, to fix this the check is turned around, also a better return value is chosen. Reported-by: Dan Carpenter Suggested-by: Dan Carpenter Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index ec95f6d49997..9a1809d74ea3 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -265,9 +265,8 @@ static ssize_t msdc_debug_proc_write(struct file *file, if (count > 255) count = 255; - ret = copy_from_user(cmd_buf, buf, count); - if (ret < 0) - return -1; + if (copy_from_user(cmd_buf, buf, count)) + return -EFAULT; cmd_buf[count] = '\0'; printk("msdc Write %s\n", cmd_buf); -- cgit v1.2.3-59-g8ed1b From 8cfb4937af9b214e9855b10dd9bac291bca263b8 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Wed, 18 Apr 2018 17:27:43 +0200 Subject: staging: mt7621-mmc: Change default transfer mode to DMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current default transfer is to use DMA or not depending on the size of the data. The upstream driver mtk-sd uses DMA all times, change the standard mode here to DMA for testing, if there are any performance problems with DMA for small data sizes. If not, the option for transfer mode should be removed in the future, Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 9a1809d74ea3..0d6e21557d8f 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -67,10 +67,10 @@ u32 dma_size[4] = { }; enum msdc_mode drv_mode[4] = { - MODE_SIZE_DEP, /* using DMA or not depend on the size */ - MODE_SIZE_DEP, - MODE_SIZE_DEP, - MODE_SIZE_DEP + MODE_DMA, /* using DMA always */ + MODE_DMA, + MODE_DMA, + MODE_DMA }; #if defined(MT6575_SD_DEBUG) -- cgit v1.2.3-59-g8ed1b From 67cfac33a83176766cea5427a010d9e4d3f1b784 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Sun, 29 Apr 2018 19:32:26 +0200 Subject: staging: mt7621-mmc: Remove transfer mode setting from proc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the transfer mode can be chosen between DMA, a size dependent mode and non-DMA by writing to a proc file. The upstream driver mtk-sd uses DMA all times. There is no apparent reason why somebody would like to change the transfer mode and the position of the setting in the debug part of the driver also indicates, that the option was used for debugging purposes. So it is removed to clean up the driver and bring it more in line with the upstream one. Signed-off-by: Christian Lütke-Stetzkamp Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 0d6e21557d8f..8f38484c8dbb 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -286,21 +286,6 @@ static ssize_t msdc_debug_proc_write(struct file *file, } else { printk("msdc host_id error when set debug zone\n"); } - } else if (cmd == SD_TOOL_DMA_SIZE) { - id = p1 >> 4; - mode = (p1 & 0xf); - size = p2; - if (id >= 0 && id <= 3) { - drv_mode[id] = mode; - dma_size[id] = p2; - } else if (id == 4) { - drv_mode[0] = drv_mode[1] = mode; - drv_mode[2] = drv_mode[3] = mode; - dma_size[0] = dma_size[1] = p2; - dma_size[2] = dma_size[3] = p2; - } else { - printk("msdc host_id error when select mode\n"); - } } else if (cmd == SD_TOOL_SDIO_PROFILE) { if (p1 == 1) { /* enable profile */ if (gpt_enable == 0) { -- cgit v1.2.3-59-g8ed1b From 1e653f4fd59376782d78ca187954fb29e7b53241 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Sun, 29 Apr 2018 19:32:27 +0200 Subject: staging: mt7621-mmc: Remove transfer mode setting variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the transfer mode can be chosen between DMA, a size dependent mode and non-DMA by writing to a proc file. The upstream driver mtk-sd uses DMA all times. The previous patch removed the ability to set that option. Now the remaining uses of the transfer mode setting variable are cleaned up, because it cannot be changed any more. Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 15 --------------- drivers/staging/mt7621-mmc/dbg.h | 1 - drivers/staging/mt7621-mmc/sd.c | 7 +------ 3 files changed, 1 insertion(+), 22 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 8f38484c8dbb..163c061b440c 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -66,13 +66,6 @@ u32 dma_size[4] = { 512 }; -enum msdc_mode drv_mode[4] = { - MODE_DMA, /* using DMA always */ - MODE_DMA, - MODE_DMA, - MODE_DMA -}; - #if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) @@ -235,14 +228,6 @@ static int msdc_debug_proc_read(struct seq_file *s, void *p) seq_printf(s, "-> MSDC[2] Zone: 0x%.8x\n", sd_debug_zone[2]); seq_printf(s, "-> MSDC[3] Zone: 0x%.8x\n", sd_debug_zone[3]); - seq_puts(s, "Index<1> + ID:4|Mode:4 + DMA_SIZE\n"); - seq_puts(s, "-> 0)PIO 1)DMA 2)SIZE\n"); - seq_puts(s, "-> echo 1 22 0x200 >msdc_bebug -> host[2] size mode, dma when >= 512\n"); - seq_printf(s, "-> MSDC[0] mode<%d> size<%d>\n", drv_mode[0], dma_size[0]); - seq_printf(s, "-> MSDC[1] mode<%d> size<%d>\n", drv_mode[1], dma_size[1]); - seq_printf(s, "-> MSDC[2] mode<%d> size<%d>\n", drv_mode[2], dma_size[2]); - seq_printf(s, "-> MSDC[3] mode<%d> size<%d>\n", drv_mode[3], dma_size[3]); - seq_puts(s, "Index<3> + SDIO_PROFILE + TIME\n"); seq_puts(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); seq_printf(s, "-> SDIO_PROFILE<%d> TIME<%ds>\n", sdio_pro_enable, sdio_pro_time); diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 6f00fcdaba32..9412d73f33a8 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -79,7 +79,6 @@ enum msdc_mode { MODE_SIZE_DEP = 2, }; -extern enum msdc_mode drv_mode[4]; extern u32 dma_size[4]; /* Debug message event */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index ddd0b301fef3..c1640689aded 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1374,12 +1374,7 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) host->blksz = data->blksz; /* deside the transfer mode */ - if (drv_mode[host->id] == MODE_PIO) - host->dma_xfer = 0; - else if (drv_mode[host->id] == MODE_DMA) - host->dma_xfer = 1; - else if (drv_mode[host->id] == MODE_SIZE_DEP) - host->dma_xfer = ((host->xfer_size >= dma_size[host->id]) ? 1 : 0); + host->dma_xfer = 1; dma = host->dma_xfer; if (read) { -- cgit v1.2.3-59-g8ed1b From f908abf3c63eaa8b7ab4df1a7869ef8395d231a9 Mon Sep 17 00:00:00 2001 From: Christian Lütke-Stetzkamp Date: Sun, 29 Apr 2018 19:32:28 +0200 Subject: staging: mt7621-mmc: Remove unused global dma_size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The global variable dma_size was previously used to select DMA or non-DMA transfer mode based on the size of the data that should be transferred. This option was removed preivously, so the variable is not used any more and can be removed. Signed-off-by: Christian Lütke-Stetzkamp Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 8 -------- drivers/staging/mt7621-mmc/dbg.h | 2 -- 2 files changed, 10 deletions(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 163c061b440c..d897b1216348 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -58,14 +58,6 @@ unsigned int sd_debug_zone[4] = { 0 }; -/* mode select */ -u32 dma_size[4] = { - 512, - 512, - 512, - 512 -}; - #if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 9412d73f33a8..5a25a69b00c9 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -79,8 +79,6 @@ enum msdc_mode { MODE_SIZE_DEP = 2, }; -extern u32 dma_size[4]; - /* Debug message event */ #define DBG_EVT_NONE (0) /* No event */ #define DBG_EVT_DMA (1 << 0) /* DMA related event */ -- cgit v1.2.3-59-g8ed1b From a5a5b283a22922bd4b7110006eae11e3439f9d8b Mon Sep 17 00:00:00 2001 From: Sankalp Negi Date: Thu, 31 May 2018 00:34:44 +0530 Subject: staging: mt7621-mmc: Fix line size exceeding 80 columns This patch fixes checkpatch.pl warning and check: WARNING: line over 80 characters CHECK: Alignment should match open parenthesis Signed-off-by: Sankalp Negi Reviewed-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-mmc/dbg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/staging/mt7621-mmc/dbg.c') diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index d897b1216348..6e4e223cddfb 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -229,7 +229,8 @@ static int msdc_debug_proc_read(struct seq_file *s, void *p) } static ssize_t msdc_debug_proc_write(struct file *file, - const char __user *buf, size_t count, loff_t *data) + const char __user *buf, + size_t count, loff_t *data) { int ret; -- cgit v1.2.3-59-g8ed1b