diff mbox

[[RFC] 3/5] MMC: Toshiba eMMC - Split 8K-unaligned accesses.

Message ID 1299295274-32130-4-git-send-email-andreiw@motorola.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrei Warkentin March 5, 2011, 3:21 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig
index 063fa16..af2800e 100644
--- a/drivers/mmc/card/Kconfig
+++ b/drivers/mmc/card/Kconfig
@@ -21,6 +21,14 @@  config MMC_BLOCK_QUIRKS
        help
          Say Y here to enable various workarounds for known cards.
 
+config MMC_BLOCK_QUIRK_TOSHIBA_32NM
+       tristate "Toshiba MMC 32nm technology flash device quirks"
+       depends on MMC_BLOCK_QUIRKS
+       default n
+       help
+         Say Y if you have a Toshiba 32nm technology flash device,
+	 such as MMC32G or MMC16G eMMCs.
+
 config MMC_BLOCK_BOUNCE
 	bool "Use bounce buffer for simple hosts"
 	depends on MMC_BLOCK
diff --git a/drivers/mmc/card/block-quirks.c b/drivers/mmc/card/block-quirks.c
index e122a74..c142ffb 100644
--- a/drivers/mmc/card/block-quirks.c
+++ b/drivers/mmc/card/block-quirks.c
@@ -15,6 +15,23 @@ 
 #include "queue.h"
 #include "blk.h"
 
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM
+static int toshiba_32nm_probe(struct mmc_blk_data *md, struct mmc_card *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;
+	return 0;
+}
+#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
+
+
 /*
    Caveat: Because this list is just looked up with a linear
    search, take care that either overlapping revision ranges
@@ -22,6 +39,10 @@ 
    a given revision has the desired effect.
 */
 struct mmc_blk_quirk mmc_blk_quirks[] = {
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM
+        MMC_BLK_QUIRK("MMC16G", 0x11, 0x0, toshiba_32nm_probe),
+        MMC_BLK_QUIRK("MMC32G", 0x11, 0x0100, toshiba_32nm_probe),
+#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
 };
 
 static int mmc_blk_quirk_cmp(const struct mmc_blk_quirk *quirk,
@@ -49,3 +70,4 @@  struct mmc_blk_quirk *mmc_blk_quirk_find(struct mmc_card *card)
 
 	return NULL;
 }
+