Browse Source

Merge branch 'fixes' into next

Ulf Hansson 6 years ago
parent
commit
a7d247f5fb
1 changed files with 10 additions and 0 deletions
  1. 10 0
      drivers/mmc/core/block.c

+ 10 - 0
drivers/mmc/core/block.c

@@ -1370,6 +1370,16 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
 		brq->data.blocks = card->host->max_blk_count;
 		brq->data.blocks = card->host->max_blk_count;
 
 
 	if (brq->data.blocks > 1) {
 	if (brq->data.blocks > 1) {
+		/*
+		 * Some SD cards in SPI mode return a CRC error or even lock up
+		 * completely when trying to read the last block using a
+		 * multiblock read command.
+		 */
+		if (mmc_host_is_spi(card->host) && (rq_data_dir(req) == READ) &&
+		    (blk_rq_pos(req) + blk_rq_sectors(req) ==
+		     get_capacity(md->disk)))
+			brq->data.blocks--;
+
 		/*
 		/*
 		 * After a read error, we redo the request one sector
 		 * After a read error, we redo the request one sector
 		 * at a time in order to accurately determine which
 		 * at a time in order to accurately determine which