From: Andrei Warkentin <andreiw@motorola.com>
To: linux-mmc@vger.kernel.org
Cc: Andrei Warkentin <andreiw@motorola.com>
Subject: [[RFC] 4/5] MMC: Block quirks request adjust support.
Date: Fri, 4 Mar 2011 21:21:13 -0600 [thread overview]
Message-ID: <1299295274-32130-5-git-send-email-andreiw@motorola.com> (raw)
In-Reply-To: <1299295274-32130-4-git-send-email-andreiw@motorola.com>
Lets a card specific quirk affect how MMC requests are made.
Necessary for Toshiba block-splitting part reliability workaround.
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
---
drivers/mmc/card/blk.h | 9 ++++++---
drivers/mmc/card/block-quirks.c | 5 ++---
drivers/mmc/card/block.c | 12 ++++++++----
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/card/blk.h b/drivers/mmc/card/blk.h
index 3e7b8e6..3e72b67 100644
--- a/drivers/mmc/card/blk.h
+++ b/drivers/mmc/card/blk.h
@@ -18,7 +18,7 @@ struct mmc_blk_data;
card->cid.year, \
card->cid.month)
-#define MMC_BLK_QUIRK_VERSION(_name, _manfid, _oemid, _rev_start, _rev_end, _probe) \
+#define MMC_BLK_QUIRK_VERSION(_name, _manfid, _oemid, _rev_start, _rev_end, _probe, _adjust) \
{ \
.name = (_name), \
.manfid = (_manfid), \
@@ -26,10 +26,11 @@ struct mmc_blk_data;
.rev_start = (_rev_start), \
.rev_end = (_rev_end), \
.probe = (_probe), \
+ .adjust = (_adjust), \
}
-#define MMC_BLK_QUIRK(_name, _manfid, _oemid, _probe) \
- MMC_BLK_QUIRK_VERSION(_name, _manfid, _oemid, 0, -1ull, _probe)
+#define MMC_BLK_QUIRK(_name, _manfid, _oemid, _probe, _adjust) \
+ MMC_BLK_QUIRK_VERSION(_name, _manfid, _oemid, 0, -1ull, _probe, _adjust)
extern struct mmc_blk_quirk *mmc_blk_quirk_find(struct mmc_card *card);
#else
@@ -51,6 +52,7 @@ struct mmc_blk_quirk {
unsigned int manfid;
unsigned short oemid;
int (*probe)(struct mmc_blk_data *, struct mmc_card *);
+ void (*adjust)(struct mmc_queue *, struct request *, struct mmc_request *);
};
/*
@@ -65,6 +67,7 @@ struct mmc_blk_data {
unsigned int read_only;
unsigned int write_align_size;
unsigned int write_align_limit;
+ struct mmc_blk_quirk *quirk;
};
#endif
diff --git a/drivers/mmc/card/block-quirks.c b/drivers/mmc/card/block-quirks.c
index c142ffb..4afa872 100644
--- a/drivers/mmc/card/block-quirks.c
+++ b/drivers/mmc/card/block-quirks.c
@@ -31,7 +31,6 @@ static int toshiba_32nm_probe(struct mmc_blk_data *md, struct mmc_card *card)
}
#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
@@ -40,8 +39,8 @@ 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),
- MMC_BLK_QUIRK("MMC32G", 0x11, 0x0100, toshiba_32nm_probe),
+ MMC_BLK_QUIRK("MMC16G", 0x11, 0x0, toshiba_32nm_probe, NULL),
+ MMC_BLK_QUIRK("MMC32G", 0x11, 0x0100, toshiba_32nm_probe, NULL),
#endif /* CONFIG_MMC_BLOCK_QUIRK_TOSHIBA_32NM */
};
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 8640902..52e66d6 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -413,6 +413,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
brq.data.sg = mq->sg;
brq.data.sg_len = mmc_queue_map_sg(mq);
+#ifdef CONFIG_MMC_BLOCK_QUIRKS
+ if (md->quirk && md->quirk->adjust)
+ md->quirk->adjust(mq, req, &brq.mrq);
+#endif /* CONFIG_MMC_BLOCK_QUIRKS */
+
/*
* Adjust the sg list so it is the same size as the
* request.
@@ -719,7 +724,6 @@ mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card)
static int mmc_blk_probe(struct mmc_card *card)
{
struct mmc_blk_data *md;
- struct mmc_blk_quirk *quirk;
int err;
char cap_str[10];
@@ -738,9 +742,9 @@ static int mmc_blk_probe(struct mmc_card *card)
if (err)
goto out;
- quirk = mmc_blk_quirk_find(card);
- if (quirk && quirk->probe)
- err = quirk->probe(md, card);
+ md->quirk = mmc_blk_quirk_find(card);
+ if (md->quirk && md->quirk->probe)
+ err = md->quirk->probe(md, card);
if (err)
goto out;
--
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 ` Andrei Warkentin [this message]
2011-03-05 3:21 ` [[RFC] 5/5] MMC: Toshiba eMMC - Part reliability improvement Andrei Warkentin
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-5-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).