]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: core: fix multi-bit bus width without high-speed mode
authorAnssi Hannula <anssi.hannula@bitwise.fi>
Mon, 13 Feb 2017 11:46:41 +0000 (13:46 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:27:13 +0000 (02:27 +0000)
commit 3d4ef329757cfd5e0b23cce97cdeca7e2df89c99 upstream.

Commit 577fb13199b1 ("mmc: rework selection of bus speed mode")
refactored bus width selection code to mmc_select_bus_width().

However, it also altered the behavior to not call the selection code in
non-high-speed modes anymore.

This causes 1-bit mode to always be used when the high-speed mode is not
enabled, even though 4-bit and 8-bit bus are valid bus widths in the
backwards-compatibility (legacy) mode as well (see e.g. 5.3.2 Bus Speed
Modes in JEDEC 84-B50). This results in a significant regression in
transfer speeds.

Fix the code to allow 4-bit and 8-bit widths even without high-speed
mode, as before.

Tested with a Zynq-7000 PicoZed 7020 board.

Fixes: 577fb13199b1 ("mmc: rework selection of bus speed mode")
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/mmc/core/mmc.c

index 094ba8b8dc3a6dd538a9bcd1332f5b4eb64c028f..d87f81f3eae448f0ecf5fa9aead2d3bf6ef4b332 100644 (file)
@@ -1391,10 +1391,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
                err = mmc_select_hs400(card);
                if (err)
                        goto err;
-       } else if (mmc_card_hs(card)) {
+       } else {
                /* Select the desired bus width optionally */
                err = mmc_select_bus_width(card);
-               if (!IS_ERR_VALUE(err)) {
+               if (!IS_ERR_VALUE(err) && mmc_card_hs(card)) {
                        err = mmc_select_hs_ddr(card);
                        if (err)
                                goto err;