* [PATCH 1/2] MMC: add workaround for controllers with broken multiblock reads
2011-10-06 20:50 [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them Paul Walmsley
@ 2011-10-06 20:50 ` Paul Walmsley
2011-10-06 20:50 ` [PATCH 2/2] MMC: omap_hsmmc: disable multiblock reads when platform_data indicates that they are broken Paul Walmsley
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Paul Walmsley @ 2011-10-06 20:50 UTC (permalink / raw)
To: linux-arm-kernel
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
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Dave Hylands <dhylands@gmail.com>
Cc: Steve Sakoman <sakoman@gmail.com>
Cc: Chris Ball <cjb@laptop.org>
---
drivers/mmc/card/block.c | 21 ++++++++++++++-------
include/linux/mmc/host.h | 1 +
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 1ff5486..927f9d5 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -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
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1d09562..745f506 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -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 */
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] MMC: omap_hsmmc: disable multiblock reads when platform_data indicates that they are broken
2011-10-06 20:50 [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them Paul Walmsley
2011-10-06 20:50 ` [PATCH 1/2] MMC: add workaround for controllers with broken multiblock reads Paul Walmsley
@ 2011-10-06 20:50 ` Paul Walmsley
2011-10-07 23:22 ` [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them Steve Sakoman
2011-10-24 9:27 ` Chris Ball
3 siblings, 0 replies; 5+ messages in thread
From: Paul Walmsley @ 2011-10-06 20:50 UTC (permalink / raw)
To: linux-arm-kernel
When 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.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Dave Hylands <dhylands@gmail.com>
Cc: Steve Sakoman <sakoman@gmail.com>
Cc: Chris Ball <cjb@laptop.org>
---
arch/arm/plat-omap/include/plat/mmc.h | 19 ++++++++++++++++++-
drivers/mmc/host/omap_hsmmc.c | 4 ++++
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index c7b8741..94cf70a 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -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;
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21e4a79..9e8fc75 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -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);
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them
2011-10-06 20:50 [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them Paul Walmsley
2011-10-06 20:50 ` [PATCH 1/2] MMC: add workaround for controllers with broken multiblock reads Paul Walmsley
2011-10-06 20:50 ` [PATCH 2/2] MMC: omap_hsmmc: disable multiblock reads when platform_data indicates that they are broken Paul Walmsley
@ 2011-10-07 23:22 ` Steve Sakoman
2011-10-24 9:27 ` Chris Ball
3 siblings, 0 replies; 5+ messages in thread
From: Steve Sakoman @ 2011-10-07 23:22 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Oct 6, 2011 at 1:50 PM, Paul Walmsley <paul@pwsan.com> wrote:
> 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.
Tested-by: Steve Sakoman <steve@sakoman.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them
2011-10-06 20:50 [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them Paul Walmsley
` (2 preceding siblings ...)
2011-10-07 23:22 ` [PATCH 0/2] MMC: disable multiblock reads on controllers that don't support them Steve Sakoman
@ 2011-10-24 9:27 ` Chris Ball
3 siblings, 0 replies; 5+ messages in thread
From: Chris Ball @ 2011-10-24 9:27 UTC (permalink / raw)
To: linux-arm-kernel
Hi Paul,
On Thu, Oct 06 2011, Paul Walmsley wrote:
> 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.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread