From patchwork Tue Apr 14 16:13:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 185405 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1601501ilf; Tue, 14 Apr 2020 09:14:23 -0700 (PDT) X-Received: by 2002:a2e:9907:: with SMTP id v7mr518889lji.199.1586880863273; Tue, 14 Apr 2020 09:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586880863; cv=none; d=google.com; s=arc-20160816; b=i+i+fNoKx6/u8TScvkukdaDuxIjY2HgcwB7V7SWSf7waXEKoGe4q7qVpPuz+aPRhxw GavyAOYMLqCmhoTlXMKc5VZ0bLo0h1+PHIZZgzRBjDqcAoMuv/6EjiD7S/pMrLnmYu/7 Xmqc2i0IFJM0ATkl3a1ktU0Q8o2FP6+PDh4UvrkoG0W+UAClYVywyeh3Psa7AxLdg45e sGPPKu2YR6SOLNqtzbUlt03qX+HqUvT1MFb8d4qz8XWKDbhhsl8sX6CUwT5jazlaodes UCCu2WiwklPtzEDZ3PXAdc8m14w96myumWtrHXs7Mnbo97WKcTKuckzCma7TqFbbkWKX fP8g== 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=/u7NC6yDRYNMvCAgPxU0HxDtYNDMqbE9FekEfbQcOQI=; b=Lv44J1wOClquie7Xk5gfm57G3wEfDZ9EMbW/cZFXqXUOZwTo0kh4h6qjZNWjB7K5cm ELXVBwRPHKTN/lbbeF0c9vQxWmi+mqilHPS70X7EwYxGx/x1tYTXP7gDHOs9DyXP3A/a 2wxiythpiQClGiSijf2NXEyFEuUIWHkUpgl7Nqitdn1E4b6EbBkofuZ7XQy9p+TQJtTX iX/hxNnj87UtXNUW81mIdBz/IkzoEMLaCKFft2NZApLBOAhb98Zz0dRjUiWZtjD+Fv2F 3pjYfV2d9jArUOmmaRyqOFHQTtl8UDjFVb9o3beUo8Asm3OQb/Yj+0lcMx0b+txLYNAA U6BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qe5pJo5d; 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 a19sor2557759ljb.25.2020.04.14.09.14.23 for (Google Transport Security); Tue, 14 Apr 2020 09:14:23 -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=Qe5pJo5d; 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=/u7NC6yDRYNMvCAgPxU0HxDtYNDMqbE9FekEfbQcOQI=; b=Qe5pJo5dEPudnBkoPikQMvE6hJ5ljLrOG38fGhfx5vrpBWxgRFNkeMDiieUT4RPMKa 5tTXHjKo6VeyWJDk8FlOCDwYNQzttV9GQEzosgU1ZSjFxvd+Dq26m5WuGJeOZ8f9NqzE jaqiLnetGzYTiXYEo1xZkCXVigQlaMmQ2J7s8IEL4zGBbBWp2DPjlI8o6u97IGuaJp/8 Oc5ZmJSfEV2qR74c1BtvuVO8zmNBb41B6VdWHFJOTInSFFij49C0Cu7s7+ATtWogKlIJ 3aXD5TmWUp01eerr7G4uhVPyPv73AFEUABXEBFz7G0RZj12RgibE/4NZFBiqSYvAv1Ru VKIA== 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=/u7NC6yDRYNMvCAgPxU0HxDtYNDMqbE9FekEfbQcOQI=; b=L2UVUDUqb0SvjJIE0hHUpSG50Ia+gM58UQLCdDf5bBpIySl2OjYbPuMRlOMLHjtPEE TATzSMmR32GFxhY+g7K4m6NHNgUq3bSGOYr3qMB/qWttUvQH54dTES54IIaLqv6sMlBi zH1J/cG0vTYcu/nG68Om4xdx2TGtOVEnGo0WpB+HtaMmzk/zG9wCVWU9pgie+iisDlun csKOEsiyFrx3yZqhxbu86W/LUMFAfo0emwQxg4ODp9TusfOs4H6qmVsmbow3eiND29Xh N5iBFnbSkHO1kpfVg/ZcV4WHBSgpDZdkTCjq0cltEeSd7dl5AwMBhzxidfvl56JHzq7J Wy+w== X-Gm-Message-State: AGi0Publou3992GVjTKZR8iBpHBwQXQsp9xMYL1ewoSDlnljvPL9X5ZI hDUNsqbBonEHMmbdzOk4aYHMKfpG X-Google-Smtp-Source: APiQypIgOtfZ87J/KQSZFiapD6CrLOavQOnvdrCDtYDXFD5vzNbytd1wC7vz/1FKmxXrpSQWSVJX1w== X-Received: by 2002:a2e:a179:: with SMTP id u25mr568229ljl.192.1586880862780; Tue, 14 Apr 2020 09:14:22 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 09:14:22 -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 03/19] mmc: atmel-mci: Respect the cmd->busy_timeout from the mmc core Date: Tue, 14 Apr 2020 18:13:57 +0200 Message-Id: <20200414161413.3036-4-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 Using a fixed 2s timeout for all commands is a bit problematic. For some commands it means waiting longer than needed for the timer to expire, which may not a big issue, but still. For other commands, like for an erase (CMD38) that uses a R1B response, may require longer timeouts than 2s. In these cases, we may end up treating the command as it failed, while it just needed some more time to complete successfully. Fix the problem by respecting the cmd->busy_timeout, which is provided by the mmc core. Cc: Ludovic Desroches Cc: Nicolas Ferre Signed-off-by: Ulf Hansson --- drivers/mmc/host/atmel-mci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.20.1 Acked-by: Ludovic Desroches diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 7292970065b6..5cb692687698 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -809,6 +809,9 @@ static u32 atmci_prepare_command(struct mmc_host *mmc, static void atmci_send_command(struct atmel_mci *host, struct mmc_command *cmd, u32 cmd_flags) { + unsigned int timeout_ms = cmd->busy_timeout ? cmd->busy_timeout : + ATMCI_CMD_TIMEOUT_MS; + WARN_ON(host->cmd); host->cmd = cmd; @@ -819,8 +822,7 @@ static void atmci_send_command(struct atmel_mci *host, atmci_writel(host, ATMCI_ARGR, cmd->arg); atmci_writel(host, ATMCI_CMDR, cmd_flags); - mod_timer(&host->timer, - jiffies + msecs_to_jiffies(ATMCI_CMD_TIMEOUT_MS)); + mod_timer(&host->timer, jiffies + msecs_to_jiffies(timeout_ms)); } static void atmci_send_stop_cmd(struct atmel_mci *host, struct mmc_data *data)