Skip to content

Commit 2bf22b3

Browse files
Paul Walmsleycjb
authored andcommitted
mmc: core: add workaround for controllers with broken multiblock reads
Due to hardware bugs, some MMC host controllers don't support multiple-block reads[1]. To resolve, add a new MMC capability flag, MMC_CAP2_NO_MULTI_READ, which can be set by affected host controller drivers. When this capability is set, all reads will be issued one sector at a time. 1. See for example Advisory 2.1.1.128 "MMC: Multiple Block Read Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_ Revision F (October 2010) (SPRZ278F), available from http://focus.ti.com/lit/er/sprz278f/sprz278f.pdf Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Dave Hylands <dhylands@gmail.com> Tested-by: Steve Sakoman <sakoman@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent b6ad726 commit 2bf22b3

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎drivers/mmc/card/block.c‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,13 +1030,20 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
10301030
if (brq->data.blocks > card->host->max_blk_count)
10311031
brq->data.blocks = card->host->max_blk_count;
10321032

1033-
/*
1034-
* After a read error, we redo the request one sector at a time
1035-
* in order to accurately determine which sectors can be read
1036-
* successfully.
1037-
*/
1038-
if (disable_multi && brq->data.blocks > 1)
1039-
brq->data.blocks = 1;
1033+
if (brq->data.blocks > 1) {
1034+
/*
1035+
* After a read error, we redo the request one sector
1036+
* at a time in order to accurately determine which
1037+
* sectors can be read successfully.
1038+
*/
1039+
if (disable_multi)
1040+
brq->data.blocks = 1;
1041+
1042+
/* Some controllers can't do multiblock reads due to hw bugs */
1043+
if (card->host->caps2 & MMC_CAP2_NO_MULTI_READ &&
1044+
rq_data_dir(req) == READ)
1045+
brq->data.blocks = 1;
1046+
}
10401047

10411048
if (brq->data.blocks > 1 || do_rel_wr) {
10421049
/* SPI multiblock writes terminate using a special

‎include/linux/mmc/host.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ struct mmc_host {
241241
#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
242242
#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
243243
#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
244+
#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
244245

245246
mmc_pm_flag_t pm_caps; /* supported pm features */
246247
unsigned int power_notify_type;

0 commit comments

Comments
 (0)