From patchwork Mon Feb 13 11:46:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 9569415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F9D660572 for ; Mon, 13 Feb 2017 11:56:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27E9127FAC for ; Mon, 13 Feb 2017 11:56:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B00927FB1; Mon, 13 Feb 2017 11:56:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FE5527FAC for ; Mon, 13 Feb 2017 11:56:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbdBML4D (ORCPT ); Mon, 13 Feb 2017 06:56:03 -0500 Received: from mail.bitwise.fi ([109.204.228.163]:38786 "EHLO mail.bitwise.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752207AbdBML4D (ORCPT ); Mon, 13 Feb 2017 06:56:03 -0500 X-Greylist: delayed 527 seconds by postgrey-1.27 at vger.kernel.org; Mon, 13 Feb 2017 06:56:02 EST Received: from localhost (localhost [127.0.0.1]) by mail.bitwise.fi (Postfix) with ESMTP id 7FA326039C; Mon, 13 Feb 2017 13:47:13 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at mail.bitwise.fi Received: from mail.bitwise.fi ([127.0.0.1]) by localhost (mail.bitwise.fi [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EiYu5tnf5E2Z; Mon, 13 Feb 2017 13:47:13 +0200 (EET) Received: from localhost.sec.bitwise.fi (fw1.dmz.bitwise.fi [192.168.69.1]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: anssiha) by mail.bitwise.fi (Postfix) with ESMTPSA id E83636037C; Mon, 13 Feb 2017 13:47:12 +0200 (EET) From: Anssi Hannula To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, Seungwon Jeon , stable@vger.kernel.org Subject: [PATCH] mmc: core: fix multi-bit bus width without high-speed mode Date: Mon, 13 Feb 2017 13:46:41 +0200 Message-Id: <20170213114641.372-1-anssi.hannula@bitwise.fi> X-Mailer: git-send-email 2.8.3 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Anssi Hannula Cc: Seungwon Jeon Cc: Fixes: 577fb13199b1 ("mmc: rework selection of bus speed mode") --- drivers/mmc/core/mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index b61b52f9..0fccca0 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1706,10 +1706,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, err = mmc_select_hs400(card); if (err) goto free_card; - } else if (mmc_card_hs(card)) { + } else { /* Select the desired bus width optionally */ err = mmc_select_bus_width(card); - if (err > 0) { + if (err > 0 && mmc_card_hs(card)) { err = mmc_select_hs_ddr(card); if (err) goto free_card;