platform: msm_shared: Add support for byte addressing
For emmc cards which are less than 4GB, the card uses byte
addressing. The existing driver considered only device with
block addressing which caused transfer timeout on old cards
which use byte addressing.
CRs-Fixed: 592695
Change-Id: Idc6300ebb79c472fb9b0d6f4b6a23d6b26c8dfc5
diff --git a/platform/msm_shared/mmc_sdhci.c b/platform/msm_shared/mmc_sdhci.c
index 42d6963..c8caf66 100644
--- a/platform/msm_shared/mmc_sdhci.c
+++ b/platform/msm_shared/mmc_sdhci.c
@@ -1737,7 +1737,16 @@
else
cmd.cmd_index = CMD18_READ_MULTIPLE_BLOCK;
- cmd.argument = blk_addr;
+ /*
+ * Standard emmc cards use byte mode addressing
+ * convert the block address to byte address before
+ * sending the command
+ */
+ if (card->type == MMC_TYPE_STD_MMC)
+ cmd.argument = blk_addr * card->block_size;
+ else
+ cmd.argument = blk_addr;
+
cmd.cmd_type = SDHCI_CMD_TYPE_NORMAL;
cmd.resp_type = SDHCI_CMD_RESP_R1;
cmd.trans_mode = SDHCI_MMC_READ;
@@ -1799,7 +1808,15 @@
else
cmd.cmd_index = CMD25_WRITE_MULTIPLE_BLOCK;
- cmd.argument = blk_addr;
+ /*
+ * Standard emmc cards use byte mode addressing
+ * convert the block address to byte address before
+ * sending the command
+ */
+ if (card->type == MMC_TYPE_STD_MMC)
+ cmd.argument = blk_addr * card->block_size;
+ else
+ cmd.argument = blk_addr;
cmd.cmd_type = SDHCI_CMD_TYPE_NORMAL;
cmd.resp_type = SDHCI_CMD_RESP_R1;
cmd.trans_mode = SDHCI_MMC_WRITE;