mmc_test: block addressed cards

This patch fixes a bug in the multiblock write tests where the written
data is read back for verifying one block at a time. The tests in
mmc_test assumes that all cards are byte addressable.

This will cause the multi block write tests to fail, leading the user of
the mmc_test driver thinking there is something wrong with the sdhci
driver they are testing.

The start address for the block is calculated as: blocknum * 512. For
block addressable cards the blocknum alone should be used.

Signed-off-by: Johan Kristell <johan.kristell@axis.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Johan Kristell and committed by
Linus Torvalds
c286d03c 93716b94

+6 -3
+6 -3
drivers/mmc/card/mmc_test.c
··· 74 } 75 76 mrq->cmd->arg = dev_addr; 77 mrq->cmd->flags = MMC_RSP_R1 | MMC_CMD_ADTC; 78 79 if (blocks == 1) ··· 193 } 194 195 for (i = 0;i < BUFFER_SIZE / 512;i++) { 196 - ret = mmc_test_buffer_transfer(test, test->buffer, i * 512, 512, 1); 197 if (ret) 198 return ret; 199 } ··· 222 memset(test->buffer, 0, 512); 223 224 for (i = 0;i < BUFFER_SIZE / 512;i++) { 225 - ret = mmc_test_buffer_transfer(test, test->buffer, i * 512, 512, 1); 226 if (ret) 227 return ret; 228 } ··· 429 for (i = 0;i < sectors;i++) { 430 ret = mmc_test_buffer_transfer(test, 431 test->buffer + i * 512, 432 - dev_addr + i * 512, 512, 0); 433 if (ret) 434 return ret; 435 }
··· 74 } 75 76 mrq->cmd->arg = dev_addr; 77 + if (!mmc_card_blockaddr(test->card)) 78 + mrq->cmd->arg <<= 9; 79 + 80 mrq->cmd->flags = MMC_RSP_R1 | MMC_CMD_ADTC; 81 82 if (blocks == 1) ··· 190 } 191 192 for (i = 0;i < BUFFER_SIZE / 512;i++) { 193 + ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1); 194 if (ret) 195 return ret; 196 } ··· 219 memset(test->buffer, 0, 512); 220 221 for (i = 0;i < BUFFER_SIZE / 512;i++) { 222 + ret = mmc_test_buffer_transfer(test, test->buffer, i, 512, 1); 223 if (ret) 224 return ret; 225 } ··· 426 for (i = 0;i < sectors;i++) { 427 ret = mmc_test_buffer_transfer(test, 428 test->buffer + i * 512, 429 + dev_addr + i, 512, 0); 430 if (ret) 431 return ret; 432 }