From patchwork Wed Apr 20 16:51:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aisheng Dong X-Patchwork-Id: 8893131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4B4DBF29F for ; Wed, 20 Apr 2016 17:00:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC9922020F for ; Wed, 20 Apr 2016 17:00:45 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 0296F20114 for ; Wed, 20 Apr 2016 17:00:45 +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 1asvTL-0007bP-EX; Wed, 20 Apr 2016 16:59:27 +0000 Received: from mail-by2on0093.outbound.protection.outlook.com ([207.46.100.93] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asvTG-0007QC-AI for linux-arm-kernel@lists.infradead.org; Wed, 20 Apr 2016 16:59:23 +0000 Received: from BN3PR0301CA0016.namprd03.prod.outlook.com (10.160.180.154) by BN1PR0301MB0705.namprd03.prod.outlook.com (10.160.78.12) with Microsoft SMTP Server (TLS) id 15.1.466.19; Wed, 20 Apr 2016 16:59:00 +0000 Received: from BY2FFO11OLC011.protection.gbl (2a01:111:f400:7c0c::103) by BN3PR0301CA0016.outlook.office365.com (2a01:111:e400:4000::26) with Microsoft SMTP Server (TLS) id 15.1.466.19 via Frontend Transport; Wed, 20 Apr 2016 16:59:01 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11OLC011.mail.protection.outlook.com (10.1.15.22) with Microsoft SMTP Server (TLS) id 15.1.472.8 via Frontend Transport; Wed, 20 Apr 2016 16:59:00 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u3KGws5X023885; Wed, 20 Apr 2016 09:58:55 -0700 From: Dong Aisheng To: Subject: [PATCH 1/3] mmc: core: fix using wrong io voltage if mmc_select_hs200 fails Date: Thu, 21 Apr 2016 00:51:30 +0800 Message-ID: <1461171092-30631-1-git-send-email-aisheng.dong@nxp.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131056451404593689; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(6806005)(106466001)(1220700001)(2351001)(33646002)(229853001)(5008740100001)(1096002)(104016004)(2906002)(4326007)(92566002)(19580405001)(105606002)(81166005)(19580395003)(47776003)(586003)(87936001)(86362001)(36756003)(50466002)(85426001)(189998001)(77096005)(110136002)(48376002)(50226001)(50986999)(5003940100001)(7059030)(15760500001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0705; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC011; 1:lf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TEaevceqjDUOh6JsO9ve+/t99/SpLgM3Wurs0S0h8fG60JdMVaaF+JOX8KniOH8FXiIjet7yad0fh9mz81HjSh3EqT1uRghG9w=; 25:2AUrS477wNkDfI1OvuZ1M1380IXIH/C5sNlMewCZlMUZ4CpkrsatzB/PpsLg5cm9yVmXTrpl5ZQf5WHrz/pfzkKhFr7VM9rIcIx9ysbDCpY0vriSzniErkG8LTGUxmPHz04+1LD/gu/uU5iSOf8DB0hRdck4p5zBGiDwa1j8wOZRBZ8OjKM7Pf+fy7/k35etF469ob0flRS4wgH2/mhRwQVbJf9gY9OGeEC5xnJQAkOR2NOm+JHJW0QzfYgyRWsfuTgvyjrfkb9BMZ/QrhkUpNRK2c/qaA5ShZqwnPwVKMNbr4xY5iKduhueJE92Yq9bandHR2lcOUPhJK/ywg4wdg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0301MB0705; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(8121501046)(5005006)(13017025)(13015025)(13023025)(13024025)(10201501046)(3002001)(6055026); SRVR:BN1PR0301MB0705; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0705; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0705; 4:TDImVctnrg/FLHHBOJjMdfR9KIDX1vLNxX0ip7/KB9eim2BPQbtK6PCG+Ega3h2LFPYJDJteV891kE1+WVD7WKUERlJKHFWrXeDhMnTUTYXZcr6EdZ2r8GxPBpPuyHthPGbmfG9gvCNGzYKXcycWZLTgJs6tOADv/+ps0oWGX14Um1pogQ13VYtslQbgLqVBZgm3ElYCIGd4IAjEjS+DwaPHgYhQzTz3WHUkOYW57DDRqPC0Laye0osiOikjx3rxjpiKc3NKUkaEXI6uSIITeE8e7uiT2XmFskSdqKDVN88Kkdrx3zmn3AQSFOnV/xr2zpddH17mgV05u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66g4wNIT?= =?us-ascii?Q?f2zhOADXswdMpNCdUrcDLZN982yLCMnSEDjBG1SlpcyAW5BDe4NacGGm8ctZ?= =?us-ascii?Q?OdqnE2XJv3sBB1nVR3ZyStpSOT660fVkin0hFgfTDrVJDzDVl/q/ym6fqwWu?= =?us-ascii?Q?DY+3i5pmICPsZ3u3fGMDIqHEbBirlcAIBwVzAoyfAdFUjUuE3KNXOmXm8+au?= =?us-ascii?Q?ujDJhI9nNxg64sffTf8ixtOudbzBhTZVnm6+HOD1NbYe1I46zHzbUty3I2wj?= =?us-ascii?Q?tC+GXV5JPtqxATX12T9Ez2Y9kdxzcKohXYg2b1+3DJhTBc0W1SDoKEiuVXIg?= =?us-ascii?Q?CDA0mZ0Wrr9JjK/UdMf62EXi6?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0705; 5:xNratPTqXzFYWZWfKHchyXWUOkpE6/o5NCLM/Yxthsn+XQQM0QAOn8FSrYQY/8xC41QHnbyGJIGZHs+8Unrs80N+WqmIzO9uta36mFWJCupZdR0rEDn9OmlMsYzu6ss5CQqfo5cx0jRV3Y4IScPDpgPJ3TQwI2z+EZa1WSAeB0yGlPr3cjq2PpiiRlUQ2LTw2eKKwLKobMYQkTivWrwjQw==; 24:TCpmCkNRm6Bx/nSeUdPabj1FtMrnMsN2OVf5r1GOflYixsjS2nf6p2/AKZtDPIPta2YhHhI2yeBXte6qyl8v7dK2fCQjKj6bNUWeVikfiwk=; 7:ewYHwko4wizKVxC+srWf56lBPwzAUVsN6plDBN4KHxvUB5msNHbTHVxY2WmZUm7SJReqVtYM69EpsOYrbHFpmwVJbT/Q9jEMyt9/wkAWoTUXE34Psb/z4z4QAH10BFLbBaqXbP82+6GqCBnTWQi0BcQOnlBk14ru5K//btSGDX3tNcmQD5L3vsT18qIUz8WSfTo93FUCZkbTY7/Aa1bOLIa76GCu6ehd2pqoLviyV5Y= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2016 16:59:00.1317 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0705 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160420_095922_478557_1A2ED3CC X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: -1.9 (-) 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: aisheng.dong@nxp.com, ulf.hansson@linaro.org, dongas86@gmail.com, chris@printf.net, haibo.chen@nxp.com, adrian.hunter@intel.com, shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently MMC core will keep going if HS200/HS timing switch failed with -EBADMSG error by the assumption that the old timing is still valid. However, for mmc_select_hs200 case, the signal voltage may have already been switched. If the timing switch failed, we should fall back to the old voltage in case the card is continue run with legacy timing. If fall back signal voltage failed, we explicitly report an EIO error to force retry during the next power cycle. Signed-off-by: Dong Aisheng --- drivers/mmc/core/mmc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index b8aa12c..f6683a9 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1245,9 +1245,11 @@ static int mmc_select_hs200(struct mmc_card *card) struct mmc_host *host = card->host; bool send_status = true; unsigned int old_timing; + unsigned int old_signal_voltage; int err = -EINVAL; u8 val; + old_signal_voltage = host->ios.signal_voltage; if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_2V) err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); @@ -1256,7 +1258,7 @@ static int mmc_select_hs200(struct mmc_card *card) /* If fails try again during next card power cycle */ if (err) - goto err; + return err; mmc_select_driver_type(card); @@ -1290,9 +1292,14 @@ static int mmc_select_hs200(struct mmc_card *card) } } err: - if (err) + if (err) { + /* fall back to the old signal voltage, if fails report error */ + if (__mmc_set_signal_voltage(host, old_signal_voltage)) + err = -EIO; + pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), __func__, err); + } return err; }