public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* MMC - Driver hangs if using bad SDCard
@ 2010-05-21 12:13 Radovan Lekanovic
  0 siblings, 0 replies; only message in thread
From: Radovan Lekanovic @ 2010-05-21 12:13 UTC (permalink / raw)
  To: linux-mmc

Hi
 
I have experienced problems with the MMC driver if using an bad SD card the MMC 
driver ends up in an infinite loop in file block.c function mmc_blk_issue_rq.
 
if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) {
                                                                                       
do {
                                                                                                                    
int err;
 
                                                                                                                    
cmd.opcode = MMC_SEND_STATUS;
                                                                                                                    
cmd.arg = card->rca << 16;
                                                                                                                    
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
                                                                                                                    
err = mmc_wait_for_cmd(card->host, &cmd, 5);
                                                                                                                    
if (err) {
                                                                                                                                                 
printk(KERN_ERR "%s: error %d requesting status\n",
                                                                                                                                                        
req->rq_disk->disk_name, err);
                                                                                                                                                 
goto cmd_err;
                                                                                                                    
}
                                                                                                                    
/*
                                                                                                                     
* Some cards mishandle the status bits,
                                                                                                                     
* so make sure to check both the busy
                                                                                                                     
* indication and the card state.
                                                                                                                     
*/
                                                                                       
} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
                                                                                                                    
(R1_CURRENT_STATE(cmd.resp[0]) == 7));
 
 
The problem is that  R1_CURRENT_STATE(cmd.resp[0]) == 7 will always be TRUE. 
This problem will drain the battery on portabel devices.
The card works fine on other devices.
My idea to solve this problem is to break this loop by an timer if it take too 
long time for the SD-Card to replay. Will that solution break anything? Any 
other better solutions?
 
BR
Lekan


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-21 12:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-21 12:13 MMC - Driver hangs if using bad SDCard Radovan Lekanovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox