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