From patchwork Tue Jun 7 13:02:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 9161131 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 E7FBB60467 for ; Tue, 7 Jun 2016 13:02:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D967925D91 for ; Tue, 7 Jun 2016 13:02:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE27428179; Tue, 7 Jun 2016 13:02:36 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 CC3B727B13 for ; Tue, 7 Jun 2016 13:02:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755339AbcFGNCd (ORCPT ); Tue, 7 Jun 2016 09:02:33 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:37554 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755302AbcFGNCc (ORCPT ); Tue, 7 Jun 2016 09:02:32 -0400 Received: by mail-wm0-f51.google.com with SMTP id k204so68224063wmk.0 for ; Tue, 07 Jun 2016 06:02:31 -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=8Ie9GBmLJ23GasBcQGWwZtSDgcdLdK+gEDqSdGB0Bxg=; b=ec4pwRg8UMEbFckRQ8Wlr90BWtSdgltMIc+XNAuGvf7cfl++Vbq0xo3fTbphDnd7mp b7s5u7/drhaSf4ZDdshoacnFdnVBURvss2jIG+XabTaNvMkzKK3IOKphARy9+nx1KgMb KZUSZYn6gs6y95wPsrq9fYwKFZWQ/t/wmfWCI= 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=8Ie9GBmLJ23GasBcQGWwZtSDgcdLdK+gEDqSdGB0Bxg=; b=PaQNmk/xN+mCYMk3tC0RQN36e1RFV473epjBnL2a5ZaBPe3F8O9NosdNSDWJcjKlDR 0t5MtI+6jKc33Gc2xWF3y91sQfD42H8VTlOdHsI0CGsnbC3IfpqDOlm/5cDRNfqfyDdk uwBAel68m/y79Bw0gs+8/lJ7N6LfhXOf1ShuNoKqpodq/2+o+pSq1dO3Em8ghFo//dlz Rl6MKF0RHT9bGhOlJWCKsncu/GJmDfxUSOtcOBs6D+RdHo2F7BMUn+6TC/aoQ8tSP8cV HJNtD8oZX0EQw4/3+ZZDUpUbQgN9zJmV5zE7fgIKNqCfAgVYcqojIUvpIqEMufHcquY9 Q2GQ== X-Gm-Message-State: ALyK8tKJohVJyKhv1wogOERIv1s4FG2AO3jnS+6hpoOUrrgHYZqMi/peMW/9j25Bi5y8rZHY X-Received: by 10.28.134.199 with SMTP id i190mr2777984wmd.26.1465304550487; Tue, 07 Jun 2016 06:02:30 -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 j9sm25393794wju.46.2016.06.07.06.02.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Jun 2016 06:02:29 -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 Cc: peter.griffin@linaro.org, lee.jones@linaro.org, linux-mmc@vger.kernel.org, Arnd Bergmann Subject: [PATCH] mmc: core: Fix mmc_select_hs200() regression in v4.7-rc. Date: Tue, 7 Jun 2016 14:02:23 +0100 Message-Id: <1465304543-23988-1-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 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 mmc_select_bus_width() returns bus width (4 or 8) on success or zero if unsupported. If bus width is set successfully we then wish to switch to HS200 mode. This avoids the following error message in v4.70-rc2 [ 2.523674] mmc0: mmc_select_hs200 failed, error 3 [ 2.528516] mmc0: error 3 whilst initialising MMC card With this patch card is enumerated correctly [ 2.468065] mmc0: new HS200 MMC card at address 0001 [ 2.468335] mmcblk0: mmc0:0001 P1XXXX 7.20 GiB [ 2.468441] mmcblk0boot0: mmc0:0001 P1XXXX partition 1 2.00 MiB [ 2.468552] mmcblk0boot1: mmc0:0001 P1XXXX partition 2 2.00 MiB [ 2.468651] mmcblk0rpmb: mmc0:0001 P1XXXX partition 3 128 KiB [ 2.469269] mmcblk0: p1 Fixes: 287980e (remove lots of IS_ERR_VALUE abuses) Signed-off-by: Peter Griffin Cc: Arnd Bergmann --- 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 c984321..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) { + 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) { + if (err > 0) { err = mmc_select_hs_ddr(card); if (err) goto free_card;