ixp4xx: remove linux 3.10 support
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-3.10 / 0022-sdhci-bcm2708-use-multiblock-type-transfers-for-sing.patch
1 From d91049bd18e847ba86d661889b92a25cd7ce53cc Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Wed, 3 Jul 2013 00:42:49 +0100
4 Subject: [PATCH 022/196] sdhci-bcm2708: use multiblock-type transfers for
5 single blocks
6
7 There are issues with both single block reads (missed completion)
8 and writes (data loss in some cases!). Just don't do single block
9 transfers anymore, and treat them like multiblock transfers. This
10 adds a quirk for this and uses it.
11 ---
12 drivers/mmc/card/block.c | 2 +-
13 drivers/mmc/host/sdhci-bcm2708.c | 3 +++
14 include/linux/mmc/host.h | 1 +
15 3 files changed, 5 insertions(+), 1 deletion(-)
16
17 diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
18 index 9aca946..0d0c4ad 100644
19 --- a/drivers/mmc/card/block.c
20 +++ b/drivers/mmc/card/block.c
21 @@ -1333,7 +1333,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
22 brq->data.blocks = 1;
23 }
24
25 - if (brq->data.blocks > 1 || do_rel_wr) {
26 + if (brq->data.blocks > 1 || do_rel_wr || card->host->caps2 & MMC_CAP2_FORCE_MULTIBLOCK) {
27 /* SPI multiblock writes terminate using a special
28 * token, not a STOP_TRANSMISSION request.
29 */
30 diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
31 index 326b962..c6d6bb0 100644
32 --- a/drivers/mmc/host/sdhci-bcm2708.c
33 +++ b/drivers/mmc/host/sdhci-bcm2708.c
34 @@ -1266,6 +1266,9 @@ static int sdhci_bcm2708_probe(struct platform_device *pdev)
35
36 if (allow_highspeed)
37 host->mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
38 +
39 + /* single block writes cause data loss with some SD cards! */
40 + host->mmc->caps2 |= MMC_CAP2_FORCE_MULTIBLOCK;
41 #endif
42
43 ret = sdhci_add_host(host);
44 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
45 index e326ae2..70020e3 100644
46 --- a/include/linux/mmc/host.h
47 +++ b/include/linux/mmc/host.h
48 @@ -281,6 +281,7 @@ struct mmc_host {
49 #define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
50 MMC_CAP2_PACKED_WR)
51 #define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
52 +#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */
53
54 mmc_pm_flag_t pm_caps; /* supported pm features */
55
56 --
57 1.9.1
58