MMC: disable multiblock reads on controllers that don't support them
Subsystems (4)
cover MMC: disable multiblock reads on controllers that don't support them
Hello,
Some MMC controller instances integrated on older OMAP34xx/35xx chips don't work correctly with multiple-block reads, due to a hardware bug. This series fixes the problem by adding an MMC capability flag for this case and making the appropriate changes to the MMC core code and OMAP HSMMC driver to support this.
Once this series is merged, a subsequent patch will be needed by us OMAP folks to pass the appropriate device data via hwmod - this will be posted separately.
- Paul
---
mmc_errata_2.1.1.128_fix_3.2
text data bss dec hex filename
6325283 655708 5591124 12572115 bfd5d3 vmlinux.omap2plus_defconfig.orig
6329423 655700 5591124 12576247 bfe5f7 vmlinux.omap2plus_defconfig.patched
Paul Walmsley (2):
MMC: add workaround for controllers with broken multiblock reads
MMC: omap_hsmmc: disable multiblock reads when platform_data indicates that they are broken
arch/arm/plat-omap/include/plat/mmc.h | 19 ++++++++++++++++++- drivers/mmc/card/block.c | 21 ++++++++++++++------- drivers/mmc/host/omap_hsmmc.c | 4 ++++ include/linux/mmc/host.h | 1 + 4 files changed, 37 insertions(+), 8 deletions(-)
PATCH 1/2 MMC: 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_CAP_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
--- drivers/mmc/card/block.c | 21 ++++++++++++++------- include/linux/mmc/host.h | 1 + 2 files changed, 15 insertions(+), 7 deletions(-)
drivers/mmc/card/block.c +14 -7
@@ -954,13 +954,20 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,if (brq->data.blocks > card->host->max_blk_count) brq->data.blocks = card->host->max_blk_count; -/* -* After a read error, we redo the request one sector at a time -* in order to accurately determine which sectors can be read -* successfully. -*/ -if (disable_multi && brq->data.blocks >1 ) - brq->data.blocks =1 ; +if (brq->data.blocks >1 ) { +/* +* After a read error, we redo the request one sector +* at a time in order to accurately determine which +* sectors can be read successfully. +*/ +if (disable_multi) + brq->data.blocks =1 ; + +/* Some controllers can't do multiblock reads due to hw bugs */ +if (card->host->caps &MMC_CAP_NO_MULTI_READ && +rq_data_dir (req) ==READ ) + brq->data.blocks =1 ; + }if (brq->data.blocks >1 || do_rel_wr) {/* SPI multiblock writes terminate using a special
include/linux/mmc/host.h +1 -0
@@ -229,6 +229,7 @@ struct mmc_host {#define MMC_CAP_MAX_CURRENT_600 (1 << 28)/* Host max current limit is 600mA */ #define MMC_CAP_MAX_CURRENT_800 (1 << 29)/* Host max current limit is 800mA */ #define MMC_CAP_CMD23 (1 << 30)/* CMD23 supported. */ +#define MMC_CAP_NO_MULTI_READ (1 << 31)/* Multiblock reads don't work */ mmc_pm_flag_t pm_caps;/* supported pm features */
PATCH 2/2 MMC: omap_hsmmc: disable multiblock reads when platform_data indicates that they are broken
In reply to Paul WalmsleyWhen device data indicates that multiple block reads are not supported on a given HSMMC controller instance, log a message to the console, and pass the appropriate MMC capability flag to the MMC core.
--- arch/arm/plat-omap/include/plat/mmc.h | 19 ++++++++++++++++++- drivers/mmc/host/omap_hsmmc.c | 4 ++++ 2 files changed, 22 insertions(+), 1 deletions(-)
arch/arm/plat-omap/include/plat/mmc.h +18 -1
@@ -31,7 +31,24 @@#define OMAP_MMC_MAX_SLOTS 2 -#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(1) +/* +* struct omap_mmc_dev_attr.flags possibilities +* +* OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can +* operate with either 1.8Vdc or 3.0Vdc card voltages; this flag +* should be set if this is the case. See for example Section 22.5.3 +* "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia +* Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R). +* +* OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers +* don't work correctly on some MMC controller instances on some +* OMAP3 SoCs; this flag should be set if this is the case. 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). +*/ +#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0) +#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)struct omap_mmc_dev_attr {u8 flags;
drivers/mmc/host/omap_hsmmc.c +4 -0
@@ -1943,6 +1943,10 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_context_save (host); mmc->caps |=MMC_CAP_DISABLE ; +if (host->pdata->controller_flags &OMAP_HSMMC_BROKEN_MULTIBLOCK_READ ) { +dev_info (&pdev->dev,"multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n" ); + mmc->caps |=MMC_CAP_NO_MULTI_READ ; + }pm_runtime_enable (host->dev);pm_runtime_get_sync (host->dev);
cover MMC: disable multiblock reads on controllers that don't support them
In reply to Paul WalmsleyQuoted 11 lines · Paul Walmsley
Hello,
Some MMC controller instances integrated on older OMAP34xx/35xx chips don't work correctly with multiple-block reads, due to a hardware bug. This series fixes the problem by adding an MMC capability flag for this case and making the appropriate changes to the MMC core code and OMAP HSMMC driver to support this.
Once this series is merged, a subsequent patch will be needed by us OMAP folks to pass the appropriate device data via hwmod - this will be posted separately.
I tested these patches with my own version of the above mentioned hwmod patch on:
3503 - ES2.1 and ES3.1
3530 - ES3.1
3703 - ES1.2
3730 - ES1.0
All worked successfully.
cover MMC: disable multiblock reads on controllers that don't support them
In reply to Paul WalmsleyHi Paul,
Quoted 9 lines · Paul Walmsley
Some MMC controller instances integrated on older OMAP34xx/35xx chips don't work correctly with multiple-block reads, due to a hardware bug. This series fixes the problem by adding an MMC capability flag for this case and making the appropriate changes to the MMC core code and OMAP HSMMC driver to support this.
Once this series is merged, a subsequent patch will be needed by us OMAP folks to pass the appropriate device data via hwmod - this will be posted separately.
Thanks, both pushed to mmc-next for 3.2.
We've run out of MMC caps nad moved onto CAPS2, so I modified these patches to define and test MMC_CAP2_NO_MULTI_READ instead of MMC_CAP_NO_MULTI_READ:
http://dev.laptop.org/git/users/cjb/mmc/commit/?h=mmc-next&id=a4b35b6acf2e9edc52132d34015f0a90b02e2df2
http://dev.laptop.org/git/users/cjb/mmc/commit/?h=mmc-next&id=6d621423128909f09072835445ce36dd357a758a
(This shouldn't affect your hwmod patch, since that just uses an OMAP-internal flag.)
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child