diff mbox

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

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

Commit Message

Andrei Warkentin March 1, 2011, 10:09 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig
index 063fa16..6d9f391 100644
--- a/drivers/mmc/card/Kconfig
+++ b/drivers/mmc/card/Kconfig
@@ -21,6 +21,13 @@  config MMC_BLOCK_QUIRKS
        help
          Say Y here to enable various workarounds for known cards.
 
+config MMC_BLOCK_QUIRK_TOSHIBA_MMC32G
+       tristate "Toshiba MMC32G quirks"
+       depends on MMC_BLOCK_QUIRKS
+       default n
+       help
+         Say Y if you have a Toshiba MMC32G eMMC card.
+
 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 ceae70c..8aea551 100644
--- a/drivers/mmc/card/block-quirks.c
+++ b/drivers/mmc/card/block-quirks.c
@@ -109,3 +109,33 @@  int mmc_blk_quirk_register(struct mmc_blk_quirk *quirk, bool is_mmc)
 	rb_insert_color(&quirk->rb_node, &quirk_tree[!is_mmc]);
 	return 0;
 }
+
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_MMC32G
+static int toshiba_mmc32g(struct mmc_blk_data *md, struct mmc_card *card)
+{
+	printk(KERN_INFO "Applying Toshiba MMC32G workarounds\n");
+
+	/* Page size 8K, this card doesn't like unaligned writes
+	   across 8K boundary. */
+	md->write_align_size = 8192;
+	return 0;
+}
+
+static struct mmc_blk_quirk toshiba_mmc32g_q = {
+	.name = "MMC32G",
+	.manfid = 0x11,
+	.oemid = 0x0100,
+
+	/* Any date, any revision, */
+	.rev_start = 0,
+	.rev_end = (u64) -1,
+	.probe = toshiba_mmc32g
+};
+
+int __init mmc_toshiba_quirks(void)
+{
+	return mmc_blk_quirk_register(&toshiba_mmc32g_q, true);
+}
+
+device_initcall(mmc_toshiba_quirks);
+#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_MMC32G */