From patchwork Fri May 25 06:17:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 10426449 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 F2ABC601D5 for ; Fri, 25 May 2018 06:18:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3A8D2900C for ; Fri, 25 May 2018 06:18:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D814129113; Fri, 25 May 2018 06:18:15 +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.4 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_WEB 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 7D9462900C for ; Fri, 25 May 2018 06:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752842AbeEYGSO (ORCPT ); Fri, 25 May 2018 02:18:14 -0400 Received: from lucky1.263xmail.com ([211.157.147.134]:33542 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbeEYGSO (ORCPT ); Fri, 25 May 2018 02:18:14 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id EE8B48E49; Fri, 25 May 2018 14:18:11 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id C32483BD; Fri, 25 May 2018 14:18:10 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: ulf.hansson@linaro.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <483f5c12025b4a400eb2870de7102a84> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 15099ZQGUO5; Fri, 25 May 2018 14:18:11 +0800 (CST) From: Shawn Lin To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, Martin Hicks , Shawn Lin Subject: [PATCH 04/11] mmc: core: Adjust the checking for device status in mmc_send_status_error() Date: Fri, 25 May 2018 14:17:52 +0800 Message-Id: <1527229072-217039-1-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527228930-216210-1-git-send-email-shawn.lin@rock-chips.com> References: <1527228930-216210-1-git-send-email-shawn.lin@rock-chips.com> 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_send_status_error() gives up checking for bit 17 and bit 18 in device status, and add checking for unlocked status. Refer to the comment in mmc_send_status_error() for details. Signed-off-by: Shawn Lin --- drivers/mmc/core/mmc_ops.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 6e8826e..04a5443 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -418,8 +418,16 @@ static int mmc_send_status_error(struct mmc_host *host, u32 status, if (unlikely(mmc_host_is_spi(host))) return (status & R1_SPI_ILLEGAL_COMMAND) ? -EBADMSG : 0; - - if (status & 0xFDFFA000) + /* + * Per JESD84-B51 spec, section 6.13, table 68(Device + * status), bit 17 and bit 18 are obsolete and hosts + * should ignore these bits. And bit 15 means device + * is locked but not unlocked by CMD42 prior to any + * operations which need check busy, which is also not + * allowed. So here give up checking bit 17 and bit 18, + * and add checking for bit 25. + */ + if (status & 0xFFF9A000) pr_warn("%s: unexpected status %#x after switch\n", mmc_hostname(host), status); if (status & R1_SWITCH_ERROR)