From patchwork Fri May 25 06:18:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 10426455 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 4DBF8602D8 for ; Fri, 25 May 2018 06:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E2612949C for ; Fri, 25 May 2018 06:19:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3276129548; Fri, 25 May 2018 06:19:01 +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 C012C2949C for ; Fri, 25 May 2018 06:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935747AbeEYGS6 (ORCPT ); Fri, 25 May 2018 02:18:58 -0400 Received: from lucky1.263xmail.com ([211.157.147.131]:59758 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932304AbeEYGS4 (ORCPT ); Fri, 25 May 2018 02:18:56 -0400 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.242]) by lucky1.263xmail.com (Postfix) with ESMTP id CC41A96A80; Fri, 25 May 2018 14:18:52 +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 A28343D3; Fri, 25 May 2018 14:18:51 +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: <009d7531da1e773bba1d74ae191e0594> 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 292854Z497S; Fri, 25 May 2018 14:18:53 +0800 (CST) From: Shawn Lin To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, Martin Hicks , Shawn Lin Subject: [PATCH 07/11] mmc: core: Consider R1_READY_FOR_DATA as a busy indication in mmc_poll_for_busy() Date: Fri, 25 May 2018 14:18:30 +0800 Message-Id: <1527229110-217188-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 Per JESD85-B51, section 6.6.8.1, it says "Some Devices may require long and unpredictable times to write a block of data. After receiving a block of data and completing the CRC check, the Device will begin writing and hold the DAT0 line low. The host may poll the status of the Device with a SEND_STATUS command(CMD13) at any time, and the Device will respond with its status (except in Sleep state). The status bit READY_FOR_DATA indicates whether the Device can accept new data or not." That describes the busy condition for data write that we should consider R1_READY_FOR_DATA as a busy indication. And R1_READY_FOR_DATA shouldn't happen as well when doing switch and erase stuff, Signed-off-by: Shawn Lin --- drivers/mmc/core/mmc_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 959b8cd..1288802 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -507,7 +507,8 @@ static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms, err = mmc_send_status_error(host, status, true); if (err) return err; - busy = R1_CURRENT_STATE(status) == R1_STATE_PRG; + busy = R1_CURRENT_STATE(status) == R1_STATE_PRG + || !(status & R1_READY_FOR_DATA); } }