Skip to content

Commit

Permalink
sdhci-bcm2708: use multiblock-type transfers for single blocks
Browse files Browse the repository at this point in the history
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
grigorig committed Jul 31, 2012
1 parent 8b1821c commit f20f6ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mmc/card/block.c
Expand Up @@ -965,7 +965,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
if (disable_multi && brq->data.blocks > 1) if (disable_multi && brq->data.blocks > 1)
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 /* SPI multiblock writes terminate using a special
* token, not a STOP_TRANSMISSION request. * token, not a STOP_TRANSMISSION request.
*/ */
Expand Down
3 changes: 3 additions & 0 deletions drivers/mmc/host/sdhci-bcm2708.c
Expand Up @@ -1392,6 +1392,9 @@ static int __devinit sdhci_bcm2708_probe(struct platform_device *pdev)


if (allow_highspeed) if (allow_highspeed)
host->mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_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 #endif


ret = sdhci_add_host(host); ret = sdhci_add_host(host);
Expand Down
1 change: 1 addition & 0 deletions include/linux/mmc/host.h
Expand Up @@ -242,6 +242,7 @@ struct mmc_host {
#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ #define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ #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_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 */ mmc_pm_flag_t pm_caps; /* supported pm features */
unsigned int power_notify_type; unsigned int power_notify_type;
Expand Down

0 comments on commit f20f6ae

Please sign in to comment.