These cards show abysmal write performance when
writes < 12K that are 8K unaligned cross an 8K barrier.

Change-Id: I3b015a93ae21d077b447e7d6fbe81255dbd2b0df
Signed-off-by: Andrei Warkentin <andr...@motorola.com>
---
 drivers/mmc/card/Kconfig |    9 +++++++++
 drivers/mmc/card/block.c |   20 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig
index 86948f9..1a9e4aa 100644
--- a/drivers/mmc/card/Kconfig
+++ b/drivers/mmc/card/Kconfig
@@ -14,6 +14,15 @@ config MMC_BLOCK
          mount the filesystem. Almost everyone wishing MMC support
          should say Y or M here.
 
+config MMC_BLOCK_QUIRK_TOSHIBA_32NM
+       tristate "Toshiba MMC 32nm technology flash device quirks"
+       depends on MMC_BLOCK
+       default n
+       help
+         Say Y if you have a Toshiba 32nm technology flash device,
+        such as MMC32G or MMC16G eMMCs. This enables a performance
+        improvement for flash page unaligned writes.
+
 config MMC_BLOCK_BOUNCE
        bool "Use bounce buffer for simple hosts"
        depends on MMC_BLOCK
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index a8f18c7..5250748 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -729,8 +729,28 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct 
mmc_card *card)
        return 0;
 }
 
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM
+static void toshiba_32nm_fixup(struct mmc_card *card, int data)
+{
+       struct mmc_blk_data *md = mmc_get_drvdata(card);
+       printk(KERN_INFO "Applying Toshiba 32nm workarounds\n");
+
+       /* Page size 8K, this card doesn't like unaligned writes
+          across 8K boundary. */
+       md->write_align_size = 8192;
+
+       /* Doing the alignment for accesses > 12K seems to
+          result in decreased perf. */
+       md->write_align_limit = 12288;
+}
+#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
+
 static const struct mmc_fixup blk_fixups[] =
 {
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM
+       MMC_FIXUP("MMC16G", 0x11, 0x0, toshiba_32nm_fixup, 0),
+       MMC_FIXUP("MMC32G", 0x11, 0x0100, toshiba_32nm_fixup, 0),
+#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
        END_FIXUP
 };
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to