Permalink
Browse files

sdhci-bcm2708: use multiblock-type transfers for single blocks

There are issues with both single block reads (missed completion)
and writes (data loss in some cases!). Just don't do single block
transfers anymore, and treat them like multiblock transfers. This
adds a quirk for this and uses it.
  • Loading branch information...
1 parent 8b1821c commit f20f6ae0c3a1338a67be8848f9f2613b9d562b2d @grigorig grigorig committed Jul 31, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 drivers/mmc/card/block.c
  2. +3 −0 drivers/mmc/host/sdhci-bcm2708.c
  3. +1 −0 include/linux/mmc/host.h
@@ -965,7 +965,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
if (disable_multi && brq->data.blocks > 1)
brq->data.blocks = 1;
- if (brq->data.blocks > 1 || do_rel_wr) {
+ if (brq->data.blocks > 1 || do_rel_wr || card->host->caps2 & MMC_CAP2_FORCE_MULTIBLOCK) {
/* SPI multiblock writes terminate using a special
* token, not a STOP_TRANSMISSION request.
*/
@@ -1392,6 +1392,9 @@ static int __devinit sdhci_bcm2708_probe(struct platform_device *pdev)
if (allow_highspeed)
host->mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
+
+ /* single block writes cause data loss with some SD cards! */
+ host->mmc->caps2 |= MMC_CAP2_FORCE_MULTIBLOCK;
#endif
ret = sdhci_add_host(host);
@@ -242,6 +242,7 @@ struct mmc_host {
#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
+#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 4) /* Always use multiblock transfers */
mmc_pm_flag_t pm_caps; /* supported pm features */
unsigned int power_notify_type;

0 comments on commit f20f6ae

Please sign in to comment.