From patchwork Tue Apr 14 16:13:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 185407 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1601579ilf; Tue, 14 Apr 2020 09:14:26 -0700 (PDT) X-Received: by 2002:a2e:909a:: with SMTP id l26mr550342ljg.177.1586880866452; Tue, 14 Apr 2020 09:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586880866; cv=none; d=google.com; s=arc-20160816; b=PdDZCGzp6rrtuimLvRbBp0r53k5a/FB1dHwAgA3pzXOP5513HL2zNcyuaf1xCotTS+ xPOuR/zIlgagixrEQjBbOACmnAsmd5FJ2isji2/r7NoQ2kqNfQ/eFmFeq5UXhWjF1NRI AT/gYIV4BvPKlnxdoAPKpS75vcYU8duf++VvJi5t/U9BUvnc13E+zRBN7E3/LeXs6VeZ SAe1nPgWHBAWkLIwMl/7dzLMmuzYFeauNX7lOK90w/kJRQpgPlFQZYCFwWS7lXDNJjKx NvG1F7rKVwf77NJBszkz5PeQWpN6bWxXc3RuTIQxtIU6GprLw96La4Vo9SVz+0O+kf4a T6oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=MbZ0bEn9Rkc/WddH3A2e/7d/+RZVhN7mNCvo/MSHe3k=; b=nh+K5m36wg07+ebd+f2sQQIveAdXrUOrrY6KZg8uLa5Ko7qH/H3BLSQ5RtrkxC/ngk QFIZoaRZyGUye/o/4CYDESjqC9d/RrcU+tvxLybWDU6NczyGj2bwfRJHaJVeXY8/vQIl 6ogwVBXFHenqdJ9Z+hBZdGWLfZFgLj1rDFR5t2ucsTdOOTrUEGILMJTQoOeFQrxwRO/I JW72AF2ltOtQcfmy+uITDzw22Zkz70RhXv8QyLa4HylwawxrU34kW5ygSp7w99MX7FAX eeSJVcq5JooIOzsPGn/JqFi4h+KxaX7C1lRmP8CntorcngY2wNKL+UpFoh4e4YcWlVKn v9AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZEexuQi/"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 17sor4110172lfy.7.2020.04.14.09.14.26 for (Google Transport Security); Tue, 14 Apr 2020 09:14:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ZEexuQi/"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MbZ0bEn9Rkc/WddH3A2e/7d/+RZVhN7mNCvo/MSHe3k=; b=ZEexuQi/A2O3CvayF+xs3mZjQ7ctNr77NL88nKPyhYIfba/s1GZuKnyt7YOYQLlhvF 14o/+QF0aB52arqna+S6vf5YYH2caKXTWSCH0jihMDUwbyl/01ttUld4onk1crr1CGgs yh2h6J9e8EU/xa+iHKQmOpeiUC1DYFvGQ1kJaw8XyxEuVDxqTyh7CIoZ7zpRbT4GAyPw IgmlxC1TiP/19sq1GYu+bsaV9/RKs2bmnh2IVLuOg/3ZwhUY7f9kmclduJOK46v6vMNS IGQcb2+kTu+mNHDWUsnsYm4ARypBCDB2n2cY03HJ72hq9nS8YkHHp7A7L/TCiwBIX5xL oHuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MbZ0bEn9Rkc/WddH3A2e/7d/+RZVhN7mNCvo/MSHe3k=; b=JPkpxLGTBMiWtFkU986Ngr2llDxjNOmf7N0BMlmrKu+ewFWHjT6AhvjqsI3NLRkw69 e6GO9w509k5qRQIoravHDKdn5Ul3IoXh7LgJzpyEEcPaja2FC4Fl1A0+QMBb1rQOBp5m 0Bc1kN13EktD6JTvsnMUKgTi1o0VhJ+NFmoaFKRG4d2aTIVlxkXX9E1hjfom6Nt/vhml 2qS56lqYZOjrJHP3WvexPgnnSUhdFsVriKtKttPjc362GJU1ohnPnSbu5xnppRpRT9T9 ZF/W/EONqvvHHhZ/4FBHqFfvqo8QTCHR/8D9n77BDeMmzkBqFkquzxuPF0iv5wwARXLa i2Ig== X-Gm-Message-State: AGi0PuamjKOlxtDnFShoOj3uBW37UEgkfS76P9X+3VYiVfcj7F/CBCHj dDn/hU2cxDbLLqH4AODCsiNKkPq+ X-Google-Smtp-Source: APiQypIxTTwRXx9V/9uIe1PK0wt899qbViA+d4WR7UWfvLYqgI6bQ3LbehyqfhP0/7toD588uaw9CA== X-Received: by 2002:a05:6512:3e2:: with SMTP id n2mr340858lfq.129.1586880865981; Tue, 14 Apr 2020 09:14:25 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-181-131.NA.cust.bahnhof.se. [98.128.181.131]) by smtp.gmail.com with ESMTPSA id a26sm9330669ljn.22.2020.04.14.09.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 09:14:25 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Linus Walleij , Rui Miguel Silva , Johan Hovold , Alex Elder , Greg Kroah-Hartman , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Bruce Chang , Harald Welte , Alex Dubov , Sascha Sommer , Manivannan Sadhasivam , mirq-linux@rere.qmqm.pl, Jesper Nilsson , Lars Persson , Paul Cercueil , Ludovic Desroches , Nicolas Ferre Subject: [PATCH 05/19] mmc: usdhi6rol0: Inform the mmc core about the maximum busy timeout Date: Tue, 14 Apr 2020 18:13:59 +0200 Message-Id: <20200414161413.3036-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200414161413.3036-1-ulf.hansson@linaro.org> References: <20200414161413.3036-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Some commands uses R1B responses, which means the card may assert the DAT0 line to signal busy for a period of time, after it has received the command. The mmc core normally specifies the busy period for the command in the cmd->busy_timeout. Ideally the driver should respect it, but that requires quite some update of the code, so let's defer that to someone with the HW at hand. Instead, let's inform the mmc core about the maximum supported busy timeout in ->max_busy_timeout during ->probe(). This value corresponds to the fixed 4s timeout used by usdhi6rol0. In this way, we let the mmc core validate the needed timeout, which may lead to that it converts from a R1B into a R1 response and then use CMD13 to poll for busy completion. In other words, this change enables support for commands with longer busy periods than 4s, like erase (CMD38) for example. Cc: Jesper Nilsson Cc: Lars Persson Signed-off-by: Ulf Hansson --- drivers/mmc/host/usdhi6rol0.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.20.1 Acked-by: Jesper Nilsson diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c index 9a0b1e4e405d..369b8dee2e3d 100644 --- a/drivers/mmc/host/usdhi6rol0.c +++ b/drivers/mmc/host/usdhi6rol0.c @@ -136,6 +136,8 @@ #define USDHI6_MIN_DMA 64 +#define USDHI6_REQ_TIMEOUT_MS 4000 + enum usdhi6_wait_for { USDHI6_WAIT_FOR_REQUEST, USDHI6_WAIT_FOR_CMD, @@ -1763,7 +1765,12 @@ static int usdhi6_probe(struct platform_device *pdev) host = mmc_priv(mmc); host->mmc = mmc; host->wait = USDHI6_WAIT_FOR_REQUEST; - host->timeout = msecs_to_jiffies(4000); + host->timeout = msecs_to_jiffies(USDHI6_REQ_TIMEOUT_MS); + /* + * We use a fixed timeout of 4s, hence inform the core about it. A + * future improvement should instead respect the cmd->busy_timeout. + */ + mmc->max_busy_timeout = USDHI6_REQ_TIMEOUT_MS; host->pinctrl = devm_pinctrl_get(&pdev->dev); if (IS_ERR(host->pinctrl)) {