From patchwork Wed Jan 29 22:38:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 23908 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D30FF20300 for ; Wed, 29 Jan 2014 22:38:34 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id oy12sf6068846veb.2 for ; Wed, 29 Jan 2014 14:38:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=q5yKR00hnc2nddI4NuI/BQXEQghKqIIb+GnphVtz9MI=; b=W5JyWea3hpa62rLIwdPC+H61gN+iS0GswSJ2SxEKDK/ljt1cP5Lj9pGRLNgVgTjLoe g/j6/54VLabvKTnETDTmyvM2FSbgMg41sjfP09zg2twLrGyiVVxXJ3znjhiu4g7R85zu gRlCp4kwIrUC0EocpRKM2GjavfrTdfaIF+4i6d2otxd+pSUZ8rJjCEIgUkPGYCcckqPk 9jCW6a16BoDDZ5nXO4Via6J6SYm+V+ynMfXuHB0SEbsOrpNCzRSAiruUYCP/zq/T9mdn xt9K88NBpEXUNKYI8nX+XINmDRz2ByVGNtJNeAzILWbm93jDGXByfI/ZKZd2xGLtOdDW 49bQ== X-Gm-Message-State: ALoCoQlp4jXLo1CWnM4pJkaVp5fJ+78LX4VQbCoPuE3iyAMd0MTnFlBdxJrL0fupx3m9YkpZ0Xsg X-Received: by 10.236.102.40 with SMTP id c28mr3574223yhg.11.1391035114042; Wed, 29 Jan 2014 14:38:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.71 with SMTP id c65ls319694qge.4.gmail; Wed, 29 Jan 2014 14:38:33 -0800 (PST) X-Received: by 10.58.37.67 with SMTP id w3mr4324933vej.22.1391035113874; Wed, 29 Jan 2014 14:38:33 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id a3si1240941ved.117.2014.01.29.14.38.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so1622987veb.2 for ; Wed, 29 Jan 2014 14:38:33 -0800 (PST) X-Received: by 10.58.29.42 with SMTP id g10mr3002662veh.28.1391035113784; Wed, 29 Jan 2014 14:38:33 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp152486vcz; Wed, 29 Jan 2014 14:38:32 -0800 (PST) X-Received: by 10.152.219.37 with SMTP id pl5mr784070lac.36.1391035111903; Wed, 29 Jan 2014 14:38:31 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id uf1si1983961lbb.19.2014.01.29.14.38.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.179 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so1959767lbv.38 for ; Wed, 29 Jan 2014 14:38:31 -0800 (PST) X-Received: by 10.152.28.137 with SMTP id b9mr7222829lah.4.1391035111222; Wed, 29 Jan 2014 14:38:31 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id wt2sm3998221lbb.2.2014.01.29.14.38.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 14:38:30 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Dong Aisheng , Stephen Warren , Vladimir Zapolskiy , Adrian Hunter , Ulf Hansson Subject: [PATCH 10/13] mmc: block: Respect hw busy detection in card_busy_detect() Date: Wed, 29 Jan 2014 23:38:02 +0100 Message-Id: <1391035085-2747-11-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391035085-2747-1-git-send-email-ulf.hansson@linaro.org> References: <1391035085-2747-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently for write request we don't trust the hw busy detection to be fully handled by host, thus we also poll the card's status until we see it's gets out of the busy state. Still there are scenarios where it will a benefit to trust the hw busy detection done by the host, since no additional polling is needed. Let's prepare card_busy_detect() to be able to handle this. Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 9568999..fec5e98 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -751,7 +751,7 @@ static int get_card_status(struct mmc_card *card, u32 *status, int retries) } static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, - struct request *req, int *gen_err) + bool hw_busy_detect, struct request *req, int *gen_err) { unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); int err = 0; @@ -771,6 +771,11 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, *gen_err = 1; } + /* We may rely on the host hw to handle busy detection.*/ + if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) && + hw_busy_detect) + break; + /* * Timeout if the device never becomes ready for data and never * leaves the program state. @@ -1210,7 +1215,8 @@ static int mmc_blk_err_check(struct mmc_card *card, gen_err = 1; } - err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, req, &gen_err); + err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, false, req, + &gen_err); if (err) return MMC_BLK_CMD_ERR; }