Skip to content

Commit ff21c01

Browse files
committed
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.
1 parent 1fe6122 commit ff21c01

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎drivers/mmc/card/block.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
13221322
brq->data.blocks = 1;
13231323
}
13241324

1325-
if (brq->data.blocks > 1 || do_rel_wr) {
1325+
if (brq->data.blocks > 1 || do_rel_wr || card->host->caps2 & MMC_CAP2_FORCE_MULTIBLOCK) {
13261326
/* SPI multiblock writes terminate using a special
13271327
* token, not a STOP_TRANSMISSION request.
13281328
*/

‎drivers/mmc/host/sdhci-bcm2708.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,9 @@ static int sdhci_bcm2708_probe(struct platform_device *pdev)
12661266

12671267
if (allow_highspeed)
12681268
host->mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
1269+
1270+
/* single block writes cause data loss with some SD cards! */
1271+
host->mmc->caps2 |= MMC_CAP2_FORCE_MULTIBLOCK;
12691272
#endif
12701273

12711274
ret = sdhci_add_host(host);

‎include/linux/mmc/host.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ struct mmc_host {
281281
MMC_CAP2_PACKED_WR)
282282
#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
283283
#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
284+
#define MMC_CAP2_FORCE_MULTIBLOCK (1 << 31) /* Always use multiblock transfers */
284285

285286
mmc_pm_flag_t pm_caps; /* supported pm features */
286287

0 commit comments

Comments
 (0)