From: Andrei Warkentin <andreiw@motorola.com>
To: linux-mmc@vger.kernel.org
Cc: Andrei Warkentin <andreiw@motorola.com>
Subject: [[RFC] 5/5] MMC: Toshiba eMMC - Part reliability improvement.
Date: Fri, 4 Mar 2011 21:21:14 -0600 [thread overview]
Message-ID: <1299295274-32130-6-git-send-email-andreiw@motorola.com> (raw)
In-Reply-To: <1299295274-32130-5-git-send-email-andreiw@motorola.com>
Split-up accesses into smaller chunks, to improve
lifespan, by using 8K reliable writes into 8K Buffer A,
instead of 4MB Buffer B, reducing number of 4MB write-erase
cycles. Upper and lower bounds should be experimentally
found to match the desired performance/reliability
characteristics.
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
---
drivers/mmc/card/Kconfig | 31 ++++++++++++++++++++++++
drivers/mmc/card/block-quirks.c | 50 +++++++++++++++++++++++++++++++++++++-
2 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/card/Kconfig b/drivers/mmc/card/Kconfig
index af2800e..5c2f090 100644
--- a/drivers/mmc/card/Kconfig
+++ b/drivers/mmc/card/Kconfig
@@ -29,6 +29,37 @@ config MMC_BLOCK_QUIRK_TOSHIBA_32NM
Say Y if you have a Toshiba 32nm technology flash device,
such as MMC32G or MMC16G eMMCs.
+config MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL
+ tristate "Toshiba MMC 32nm reliability quirk"
+ depends on MMC_BLOCK_QUIRK_TOSHIBA_32NM
+ default n
+ help
+ Say Y if you want to enable the improved reliability workaround
+ for your Toshiba 32nm parts. This will result in certain-sized
+ writes to be split up into 8K chunks, to ensure they are placed
+ in the smaller 8KB buffer instead of the 4MB buffer, which should
+ reduce the number of flash write-erase cycles and improve
+ reliability. By default accesses in the 24k-32k range are
+ split.
+
+config MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL_L
+ hex "Toshiba reliability lower bound (in blocks)"
+ depends on MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL
+ default "30"
+ help
+ Accesses smaller than the lower bound will not be split.
+ This value should be experimentally found to match load
+ and performance characteristics.
+
+config MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL_U
+ hex "Toshiba reliability upper bound (in blocks)"
+ depends on MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL
+ default "40"
+ help
+ Accesses bigger than the upper bound will not be split.
+ This value should be experimentally found to match load
+ and performance characteristics.
+
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 4afa872..c918e12 100644
--- a/drivers/mmc/card/block-quirks.c
+++ b/drivers/mmc/card/block-quirks.c
@@ -9,8 +9,10 @@
*
*/
#include <linux/kernel.h>
+#include <linux/blkdev.h>
#include <linux/semaphore.h>
#include <linux/mmc/card.h>
+#include <linux/mmc/mmc.h>
#include "queue.h"
#include "blk.h"
@@ -19,6 +21,11 @@
static int toshiba_32nm_probe(struct mmc_blk_data *md, struct mmc_card *card)
{
printk(KERN_INFO "Applying Toshiba 32nm workarounds\n");
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL
+ printk(KERN_INFO "Toshiba 32nm reliability splits over 0x%x-0x%x blocks\n",
+ CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL_L,
+ CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL_U);
+#endif
/* Page size 8K, this card doesn't like unaligned writes
across 8K boundary. */
@@ -29,6 +36,43 @@ static int toshiba_32nm_probe(struct mmc_blk_data *md, struct mmc_card *card)
md->write_align_limit = 12288;
return 0;
}
+
+#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL
+static void toshiba_32nm_adjust(struct mmc_queue *mq,
+ struct request *req,
+ struct mmc_request *mrq)
+{
+
+ int err;
+ struct mmc_command cmd;
+ struct mmc_blk_data *md = mq->data;
+ struct mmc_card *card = md->queue.card;
+
+ if (rq_data_dir(req) != WRITE)
+ return;
+
+ if (blk_rq_sectors(req) > CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL_U ||
+ blk_rq_sectors(req) < CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL_L)
+ return;
+
+ /* 8K chunks */
+ if (mrq->data->blocks > 16)
+ mrq->data->blocks = 16;
+
+ /*
+ We know what the valid values for this card are,
+ no need to check EXT_CSD_REL_WR_SEC_C.
+ */
+ cmd.opcode = MMC_SET_BLOCK_COUNT | (1 << 31);
+ cmd.arg = mrq->data->blocks;
+ cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+ err = mmc_wait_for_cmd(card->host, &cmd, 0);
+ if (!err)
+ mrq->stop = NULL;
+}
+#else
+#define toshiba_32nm_adjust NULL
+#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM_REL */
#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
/*
@@ -39,8 +83,10 @@ static int toshiba_32nm_probe(struct mmc_blk_data *md, struct mmc_card *card)
*/
struct mmc_blk_quirk mmc_blk_quirks[] = {
#ifdef CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM
- MMC_BLK_QUIRK("MMC16G", 0x11, 0x0, toshiba_32nm_probe, NULL),
- MMC_BLK_QUIRK("MMC32G", 0x11, 0x0100, toshiba_32nm_probe, NULL),
+ MMC_BLK_QUIRK("MMC16G", 0x11, 0x0,
+ toshiba_32nm_probe, toshiba_32nm_adjust),
+ MMC_BLK_QUIRK("MMC32G", 0x11, 0x0100,
+ toshiba_32nm_probe, toshiba_32nm_adjust),
#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
};
--
1.7.0.4
next prev parent reply other threads:[~2011-03-05 2:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 22:09 MMC block quirk support + Toshiba performance quirk Andrei Warkentin
2011-03-01 22:09 ` [RFC 1/3] MMC: Adjust unaligned write accesses Andrei Warkentin
2011-03-01 22:09 ` [RFC 2/3] MMC: Add block quirks support Andrei Warkentin
2011-03-02 17:19 ` Arnd Bergmann
2011-03-02 20:48 ` Andrei Warkentin
2011-03-02 21:04 ` Arnd Bergmann
2011-03-02 21:19 ` Andrei Warkentin
2011-03-01 22:09 ` [RFC 3/3] MMC: Toshiba eMMC - Split 8K-unaligned accesses Andrei Warkentin
2011-03-05 3:21 ` MMC block quirk support + Toshiba quirks Andrei Warkentin
2011-03-05 3:21 ` [[RFC] 1/5] MMC: Adjust unaligned write accesses Andrei Warkentin
2011-03-05 3:21 ` [[RFC] 2/5] MMC: Add block quirks support Andrei Warkentin
2011-03-05 3:21 ` [[RFC] 3/5] MMC: Toshiba eMMC - Split 8K-unaligned accesses Andrei Warkentin
2011-03-05 3:21 ` [[RFC] 4/5] MMC: Block quirks request adjust support Andrei Warkentin
2011-03-05 3:21 ` Andrei Warkentin [this message]
2011-03-06 12:28 ` [[RFC] 2/5] MMC: Add block quirks support Linus Walleij
2011-03-06 21:20 ` Linus Walleij
2011-03-07 8:16 ` Andrei Warkentin
2011-03-07 20:39 ` Andrei Warkentin
2011-03-07 20:51 ` Andrei Warkentin
2011-03-08 20:28 ` Linus Walleij
2011-03-08 20:34 ` Andrei Warkentin
2011-03-08 20:57 ` Andrei Warkentin
2011-03-08 10:37 ` Tardy, Pierre
2011-03-08 16:21 ` Arnd Bergmann
[not found] ` <201103081542.46831.arnd@arndb.de>
2011-03-08 20:27 ` Andrei Warkentin
2011-03-13 13:48 ` MMC " Andrei Warkentin
2011-03-13 13:48 ` [PATCH 1/2] MMC: Extends card quicks with MMC/SD quirks matching the CID Andrei Warkentin
2011-03-13 14:55 ` Arnd Bergmann
2011-04-11 20:55 ` Chris Ball
2011-04-11 21:25 ` Andrei Warkentin
2011-04-11 22:02 ` [PATCH] " Andrei Warkentin
2011-04-11 21:50 ` Chris Ball
2011-04-11 21:47 ` Andrei Warkentin
2011-03-13 13:48 ` [PATCH 2/2] MMC: Support for block quirks Andrei Warkentin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299295274-32130-6-git-send-email-andreiw@motorola.com \
--to=andreiw@motorola.com \
--cc=linux-mmc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).