From patchwork Tue Apr 14 16:14:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 185417 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1601897ilf; Tue, 14 Apr 2020 09:14:44 -0700 (PDT) X-Received: by 2002:a2e:9906:: with SMTP id v6mr523290lji.21.1586880884267; Tue, 14 Apr 2020 09:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586880884; cv=none; d=google.com; s=arc-20160816; b=kT47oBesMcVpTTZ/i5quuo0H4Y+Q6MHxX06v4eOQAaLtxuFSwaAG3fSc9J/xAOI/oW 9NcDu9M9qmptLHpq6LXGjU+7wxjGrpmQe0kIc2PyaR1HlN+42mQswFlD+FOnhqw5/Isq kfUxuZKBZJ74aombvoUBb9Bn1YSeK05S8CV7JElR+xHNNwZ0DmX5H7Pwv3VoJWcplmNt ooQ3NNgFasarh021Bp0LDPTU8xKz5OHUUSRcebf0HZzyJdPSzCMVXGoB2BLS1NwdHXWX mQY7JkKhx8CGulqiUjnLuyHBFHVW4vwdQOH0HPnWxN+iNqQu7vQG/SC88mJequogZz0P yL5A== 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=/312L/upfEChd0s382iQNZQsylwgFpiUnUGKm/8Pqvw=; b=AvYwcwYVeNw7eKj3T5wFZuw/Ch3+NUBC9vltJzNYmjjuAW6NUJNfF4t+gNkkiNNW2z t6Qm/TpGGOouZe7tRcPo2V+zfm4zgXszMtCPqOYfOG9kUrB23jozdX8stPAHXUJO8P97 tkouFLYDXfeXAS0k1qu9kUy98QD9q6oj8rUD02/e651yCEhtILJnzhtg/+A9Ivqco6ZC 2GACWo6PFHPMLJlOwuPzd98S1pbzj2+Kp1e0wDvNGVz0sJDPgczF8ky/VZIXIhgUbhAg KXWqS8hLK1KmJEN/aLOB+x9Fv/mnnE6xEN8l/thieQCrHWClCWFu2eA/RGx+D9JRdhHE Yu6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ewtb/Sjv"; 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 s11sor7936461ljg.28.2020.04.14.09.14.44 for (Google Transport Security); Tue, 14 Apr 2020 09:14:44 -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="ewtb/Sjv"; 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=/312L/upfEChd0s382iQNZQsylwgFpiUnUGKm/8Pqvw=; b=ewtb/Sjv8qGxJkOLX8vFzllchdK+d63Agydpogc3xu9EWnW7sINf01LNLZr5F8lZ7m VKx/mY1H0STlDsoXdidmIqKXssqv59IO3BKPS7vPf8WeK/2LEoT/REqBM5zoPOK8KSx4 hKzh3bTWZ7G9jFv33mXoUF9O8eFD2SpEjbItujfK2lcvzT8XdjC3Zp+oC/owtYVLIhkd 8wSbxrI0cSuqD/hqScIH0hts1KqMvhcUSau+VTEZFQPZxTBGB1Trbce0a85Ghy4MNHgN poMPTZnQ/juiYaOjvLAKVzP1bn0QnZOUErsCG9jXqoHPzSsBeSa82hRjyem2wyIaptSS SafA== 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=/312L/upfEChd0s382iQNZQsylwgFpiUnUGKm/8Pqvw=; b=NWg+lerMoICnqTDcMxPQ83BLICS3mTvIiognA4rGmYBK/JPKqMREnG8zPrhCZjcOvz ScIXX7KDaHD0diKT4i/lgi44EYS885bajSOMyvFSbAl1HzMaCnnKVVe0KLFf05OT63V0 XlbbLzBPb3aoBDegyJEVDkxvt46bBbZZ/KqKQpDmqmo8oUXtptLh7KUwOKbNHo1lFTN/ Qi+Zpof8NGgGVLlJn5tQKZKgnjITWG11QV7kov/oCTYvzwG62XA9pzE4kmEPgZ4vNJ2i krHmgWx9HAt001R1vQ6pB6fNTq1RhpB+RNZ5TVmJqfp/IyR5uLRwAgZKvRGT+ZUpso9a IUUQ== X-Gm-Message-State: AGi0PuaWb0xVwx8O0qKMS25C+kKNawhmquysVHDAD9yWDPkk3Z96FTHw O5kJq2sQ8/+Y54n/ziYu5BWLgSLH X-Google-Smtp-Source: APiQypK+AncAZzjPieY0AwSjLMdIGFpdociGqq4Q/Jmw54Oy3dhS1HYlzAy2E9ByK9t60IfuE7yAKQ== X-Received: by 2002:a05:651c:48a:: with SMTP id s10mr537009ljc.226.1586880883857; Tue, 14 Apr 2020 09:14:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 09:14:42 -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 15/19] mmc: tifm_sd: Inform the mmc core about the maximum busy timeout Date: Tue, 14 Apr 2020 18:14:09 +0200 Message-Id: <20200414161413.3036-16-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 1s timeout used by tifm_sd. 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 1s, like erase (CMD38) for example. Cc: Alex Dubov Signed-off-by: Ulf Hansson --- drivers/mmc/host/tifm_sd.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index 54271b92ee59..5987656e0474 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c @@ -73,6 +73,8 @@ module_param(fixed_timeout, bool, 0644); #define TIFM_MMCSD_MAX_BLOCK_SIZE 0x0800UL +#define TIFM_MMCSD_REQ_TIMEOUT_MS 1000 + enum { CMD_READY = 0x0001, FIFO_READY = 0x0002, @@ -959,7 +961,12 @@ static int tifm_sd_probe(struct tifm_dev *sock) host = mmc_priv(mmc); tifm_set_drvdata(sock, mmc); host->dev = sock; - host->timeout_jiffies = msecs_to_jiffies(1000); + host->timeout_jiffies = msecs_to_jiffies(TIFM_MMCSD_REQ_TIMEOUT_MS); + /* + * We use a fixed request timeout of 1s, hence inform the core about it. + * A future improvement should instead respect the cmd->busy_timeout. + */ + mmc->max_busy_timeout = TIFM_MMCSD_REQ_TIMEOUT_MS; tasklet_init(&host->finish_tasklet, tifm_sd_end_cmd, (unsigned long)host);