Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp55386ybg; Mon, 8 Jun 2020 16:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIHxcB9WyGzjQCq8QXDESVRa7/rvpkEtIv/RYVzgM0NmS5M7P8ykMEh7gNsU/N1betrhpd X-Received: by 2002:a50:9b16:: with SMTP id o22mr23694631edi.130.1591658200412; Mon, 08 Jun 2020 16:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591658200; cv=none; d=google.com; s=arc-20160816; b=f41cCy8ZLQRBIgVsbx7eV4IHajaK6Tn6Dw0gP9uEh2Cs1Xu1SxZE3KPoCQssRiRG8U SGKWJGLJ/vRjb4vaSD3BFTXOvK8MhV1RTTU8NzHjNAac9CT6wgC974cC7GnUkRaVTWSC N6CV2P0rRCyrHmqla2OhL2LZutDoC3v9ZLcKG21FK3ALXUEWoCFQHZXgNCZXrXl0PVKG 1c3uRpNLK5N414XRZB414r0HG7lqHIQcrqZ4t8QvJFNGjRvjv1zKYwIXk5QLjHOj6iMy CW/MvCejvZtF1uBH69AQzczuIwW5eXOdhNCrKEi1hXt4xASTpr+HrargOOSDZs4QWVPw 4ENA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q0USvnRXZrChySxWX1eeolyH/2ZfiLulR4Wt3hOD9Ik=; b=FC06eFxdJ0oJ2kNKmw2sovcp8eKBlHKfdV4sDC4v39yh0INud5I3bNANsEwuuscHxN ONfhSM+PwinL76psls+cu2NLR1vs/q94SEEa5PQH3F/CquUrFLV0dt4Y52C7WjRJB+MG S6Rq5X3akgCkfhd0ZP8hqC56aYn8UakiiBWhd+fgMTlrkIh4kb/GYrzSSLM47D9qiUOZ 0RepoamYxI8GEzMvONiAM01YSPxecRmZ03M+bL1F/NudIKC2KAW+t92HWmKdBvLGJ4cf /O0TjwNkUimvZluC7AbtiWVX4aW1hcZTDNZ4i6sG9Zbh1dGdNqzPx9L64AgUUhKWe3Y6 oU9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ROP1rxkH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si9442324ejd.353.2020.06.08.16.16.13; Mon, 08 Jun 2020 16:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ROP1rxkH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729655AbgFHXOA (ORCPT + 99 others); Mon, 8 Jun 2020 19:14:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:58496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728162AbgFHXLe (ORCPT ); Mon, 8 Jun 2020 19:11:34 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B9DBD20897; Mon, 8 Jun 2020 23:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657893; bh=J2LPRJU66y4X8KcWE0g+592NbySdoJsVXoYtZI00P5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROP1rxkHmSif6KNnYX1KxXVihi18D7znAeCVKrM4JfqmcpMAO2N5DGoWqSkR+DckI 9bG3th7dla5RoL0AlyciPDYvYRlw+AqeKhvBN1HOydba8dt8EPmEJ1Ce/4CEhdQaSA +FZmqdizTHwRR7Bh7T/2UgUoC5LNoVvtimsm9Kl8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Manivannan Sadhasivam , Sasha Levin , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 248/274] mmc: owl-mmc: Respect the cmd->busy_timeout from the mmc core Date: Mon, 8 Jun 2020 19:05:41 -0400 Message-Id: <20200608230607.3361041-248-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson [ Upstream commit f37ac1ae3ca93d0995553ad9604a25eadfe9406d ] For commands that doesn't involve to prepare a data transfer, owl-mmc is using a fixed 30s response timeout. This is a bit problematic. For some commands it means waiting longer than needed for the completion 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 30s. 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: Manivannan Sadhasivam Signed-off-by: Ulf Hansson Link: https://lore.kernel.org/r/20200414161413.3036-8-ulf.hansson@linaro.org Signed-off-by: Sasha Levin --- drivers/mmc/host/owl-mmc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/owl-mmc.c b/drivers/mmc/host/owl-mmc.c index 01ffe51f413d..5e20c099fe03 100644 --- a/drivers/mmc/host/owl-mmc.c +++ b/drivers/mmc/host/owl-mmc.c @@ -92,6 +92,8 @@ #define OWL_SD_STATE_RC16ER BIT(1) #define OWL_SD_STATE_CRC7ER BIT(0) +#define OWL_CMD_TIMEOUT_MS 30000 + struct owl_mmc_host { struct device *dev; struct reset_control *reset; @@ -172,6 +174,7 @@ static void owl_mmc_send_cmd(struct owl_mmc_host *owl_host, struct mmc_command *cmd, struct mmc_data *data) { + unsigned long timeout; u32 mode, state, resp[2]; u32 cmd_rsp_mask = 0; @@ -239,7 +242,10 @@ static void owl_mmc_send_cmd(struct owl_mmc_host *owl_host, if (data) return; - if (!wait_for_completion_timeout(&owl_host->sdc_complete, 30 * HZ)) { + timeout = msecs_to_jiffies(cmd->busy_timeout ? cmd->busy_timeout : + OWL_CMD_TIMEOUT_MS); + + if (!wait_for_completion_timeout(&owl_host->sdc_complete, timeout)) { dev_err(owl_host->dev, "CMD interrupt timeout\n"); cmd->error = -ETIMEDOUT; return; -- 2.25.1