From patchwork Wed Jun 8 10:27:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 9164205 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 5F25860832 for ; Wed, 8 Jun 2016 10:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50F8C24151 for ; Wed, 8 Jun 2016 10:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44F0626B4A; Wed, 8 Jun 2016 10:29:45 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C94AC24151 for ; Wed, 8 Jun 2016 10:29:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAail-0005w8-2K; Wed, 08 Jun 2016 10:28:23 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAaih-0005fq-Bs for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2016 10:28:20 +0000 Received: by mail-wm0-x22c.google.com with SMTP id k204so10226134wmk.0 for ; Wed, 08 Jun 2016 03:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6oDwSG28M72ch/GoruFQFX4qA/4/Fu9liSqZ3CWz+dw=; b=g+0r6va0O9qvWDdgCCLKnqI+RP7vRFKUZr8ZGfou6KcxvN7dMDQZLF60DSVTLhSn2Y wCa1eeR8wRiZ2UVKMTNzNJoKizKFPzsiopn+Mf1ZJpDSocvg2vTYpJqtlpoq+aBFjHv7 2B9chbMZlmH3FsDqxDsPZFZEgZSpeEroG8+fw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6oDwSG28M72ch/GoruFQFX4qA/4/Fu9liSqZ3CWz+dw=; b=FnOzcv7u8btKZia8Tc9T/tWLdxw1ifM8ReDkjXKPqWC3DZVvHtw1ZDGcLI+WXOYFH9 f8X+DIX6NHbG6JaHFP/XvGxMo50PdZgjg53vy6xWG7UBhwHTdqLLmcOQDF7R7qqhi7cF O9YO1kHi6GtGU6nHe86W9zz54h4g0kH11vjiI7uRhYHPw5+oQEgHT4TlOw6Z4JyAv+Co FjvhppBALERSxAFhqIfm01v+6+di8651UgUio6hca5Mj5ri2Nelw1oF+ysDkD7S3M1Wl matZKhD3x3EFK1VhtWpgaQPlQA1YV1Xnx5poOBumRIGSoJCAjcztt4Ok4s4+/6XCr+Ww fRjg== X-Gm-Message-State: ALyK8tJCMHm4rBMC0jzVFe0EJXho4i+8ufLAMME8tHjAR6r5/tyfnm/iS6KzEpteOXcsF8Xk X-Received: by 10.194.188.116 with SMTP id fz20mr3731670wjc.163.1465381677687; Wed, 08 Jun 2016 03:27:57 -0700 (PDT) Received: from localhost.localdomain (cpc84731-aztw28-2-0-cust112.18-1.cable.virginm.net. [82.37.67.113]) by smtp.gmail.com with ESMTPSA id kc2sm729719wjb.5.2016.06.08.03.27.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 03:27:56 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@stlinux.com, ulf.hansson@linaro.org, adrian.hunter@intel.com Subject: [PATCH v2] mmc: core: Only change mode if mmc_select_bus_width() is successful. Date: Wed, 8 Jun 2016 11:27:52 +0100 Message-Id: <1465381672-9772-1-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_032819_598942_6F047B82 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.griffin@linaro.org, linux-mmc@vger.kernel.org, Chen-Yu Tsai , lee.jones@linaro.org, Arnd Bergmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP mmc_select_bus_width() returns bus width (4 or 8) on success or zero if unsupported. So only change mode if setting the bus width is successful. Fixes f741494 mmc: fix mmc mode selection for HS-DDR and higher Fixes: 287980e (remove lots of IS_ERR_VALUE abuses) Signed-off-by: Peter Griffin Cc: Chen-Yu Tsai Cc: Arnd Bergmann --- v2: Rebase on v4.7-rc2 which includes a fix from Chen-Yu and update commit message. --- 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 5d438ad..aafb73d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card) * switch to HS200 mode if bus width is set successfully. */ err = mmc_select_bus_width(card); - if (err >= 0) { + if (err > 0) { val = EXT_CSD_TIMING_HS200 | card->drive_strength << EXT_CSD_DRV_STR_SHIFT; err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, @@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } else if (mmc_card_hs(card)) { /* Select the desired bus width optionally */ err = mmc_select_bus_width(card); - if (err >= 0) { + if (err > 0) { err = mmc_select_hs_ddr(card); if (err) goto free_card;