From patchwork Tue Nov 21 13:42:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 10068165 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 B38486022E for ; Tue, 21 Nov 2017 13:48:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A70A5286B8 for ; Tue, 21 Nov 2017 13:48:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BA1728AE2; Tue, 21 Nov 2017 13:48:00 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 4B36428A7F for ; Tue, 21 Nov 2017 13:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751965AbdKUNoA (ORCPT ); Tue, 21 Nov 2017 08:44:00 -0500 Received: from mga02.intel.com ([134.134.136.20]:13823 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751944AbdKUNn5 (ORCPT ); Tue, 21 Nov 2017 08:43:57 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Nov 2017 05:43:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,432,1505804400"; d="scan'208";a="5344755" Received: from ahunter-desktop.fi.intel.com ([10.237.72.168]) by fmsmga001.fm.intel.com with ESMTP; 21 Nov 2017 05:43:51 -0800 From: Adrian Hunter To: Ulf Hansson Cc: linux-mmc , linux-block , linux-kernel , Bough Chen , Alex Lemberg , Mateusz Nowak , Yuliy Izrailov , Jaehoon Chung , Dong Aisheng , Das Asutosh , Zhangfei Gao , Sahitya Tummala , Harjani Ritesh , Venu Byravarasu , Linus Walleij , Shawn Lin , Bartlomiej Zolnierkiewicz , Christoph Hellwig Subject: [PATCH V14 09/24] mmc: block: Make card_busy_detect() accumulate all response error bits Date: Tue, 21 Nov 2017 15:42:35 +0200 Message-Id: <1511271770-3444-10-git-send-email-adrian.hunter@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511271770-3444-1-git-send-email-adrian.hunter@intel.com> References: <1511271770-3444-1-git-send-email-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make card_busy_detect() accumulate all response error bits. Later patches will make use of this. Signed-off-by: Adrian Hunter --- drivers/mmc/core/block.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 130ce94fdaf2..607774fcb9f5 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -959,7 +959,7 @@ static inline bool mmc_blk_in_tran_state(u32 status) } static int card_busy_detect(struct mmc_card *card, bool hw_busy_detect, - struct request *req, bool *gen_err) + struct request *req, u32 *resp_errs) { struct mmc_queue_req *mqrq = req_to_mmc_queue_req(req); struct mmc_data *data = &mqrq->brq.data; @@ -979,11 +979,9 @@ static int card_busy_detect(struct mmc_card *card, bool hw_busy_detect, return err; } - if (status & R1_ERROR) { - pr_err("%s: %s: error sending status cmd, status %#x\n", - req->rq_disk->disk_name, __func__, status); - *gen_err = true; - } + /* Accumulate any response error bits seen */ + if (resp_errs) + *resp_errs |= status; /* We may rely on the host hw to handle busy detection.*/ if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) && @@ -1011,6 +1009,22 @@ static int card_busy_detect(struct mmc_card *card, bool hw_busy_detect, return err; } +static int card_busy_detect_err(struct mmc_card *card, bool hw_busy_detect, + struct request *req, bool *gen_err) +{ + u32 resp_errs = 0; + int err; + + err = card_busy_detect(card, hw_busy_detect, req, &resp_errs); + if (resp_errs & R1_ERROR) { + pr_err("%s: %s: error sending status cmd, status %#x\n", + req->rq_disk->disk_name, __func__, resp_errs); + *gen_err = true; + } + + return err; +} + static int send_stop(struct mmc_card *card, unsigned int timeout_ms, struct request *req, bool *gen_err, u32 *stop_status) { @@ -1053,7 +1067,7 @@ static int send_stop(struct mmc_card *card, unsigned int timeout_ms, *gen_err = true; } - return card_busy_detect(card, use_r1b_resp, req, gen_err); + return card_busy_detect_err(card, use_r1b_resp, req, gen_err); } #define ERR_NOMEDIUM 3 @@ -1588,7 +1602,7 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card, gen_err = true; } - err = card_busy_detect(card, false, req, &gen_err); + err = card_busy_detect_err(card, false, req, &gen_err); if (err) return MMC_BLK_CMD_ERR; }