From patchwork Fri Jun 19 14:32:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 191229 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp645049ilo; Fri, 19 Jun 2020 08:46:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaSDBejI2bOp80q6YFJUrJFJguQgAAJz/iyf22HWrxSmHxXiTiCMWJRS10N4JHkAm8FEmC X-Received: by 2002:a17:906:b7cd:: with SMTP id fy13mr4100073ejb.443.1592581604080; Fri, 19 Jun 2020 08:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592581604; cv=none; d=google.com; s=arc-20160816; b=ZGa5yLbpvdqAAy+/0AS45phI8jIwnwsjF/6uhATK6ZzUkySNRBIP2sGAyFUxC3hJ6v BG6y746WU9T5fzlk83wcm336GddTdRdboEZkIc1zN0WUHeZwOGt+mohL//owtmKFMxKb jYlxU1KyK3XG0DoV5173iqdtTN22AebRJ1AHa9xC3h6Bi3+pQPwExe0n/6Hkni1BUpIV W1OwXE90Ra2alH0BMBttU7XKuizA/D2px/j4DXHn9z9era00ov4etylp+J3eNxGszm7l uLUzYKXCPjBQtZ+dE86djK5EJMKlpz7dsgsikVvDCQFZYtCSAdjIluDHY0Rpk85WQOqF DKqA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q0USvnRXZrChySxWX1eeolyH/2ZfiLulR4Wt3hOD9Ik=; b=Zz+Wzr8Xo6wV7WXarBmw0lH72KhrnA5LU3lzGH2x+PHT7aD1HiJ8q5O2L62rwc2KPa vWs25G76FtGvQYvHboyX+L/xOrEj3XC9MYU1ag265JXlj2A87W7mS/w3V9q62uTrOpdz MZLLK5kKhVBat5baPOyQ1Myu2ZQ3NwYSyU7UZBU4cjz5xE75vwqbEOO9CLlR1Tvha0RZ Ac9RnHsG2wP+ilfue+wqjHLu4pXc0bFL3oTrWupS+CIXmJdce/lDdlASiClfEsQJ2gvX vzoa6oIojXyvO1A/TnmVnlcvOl4vdrs8GsWotY2Em/zZs5Bj8oYSqNUbZ1I8sGywZ2dZ btlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0IcM2cnl; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si4129562ejp.589.2020.06.19.08.46.43; Fri, 19 Jun 2020 08:46:44 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=0IcM2cnl; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392229AbgFSPqf (ORCPT + 15 others); Fri, 19 Jun 2020 11:46:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:58322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404325AbgFSP0d (ORCPT ); Fri, 19 Jun 2020 11:26:33 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7DDAE21582; Fri, 19 Jun 2020 15:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580392; bh=J2LPRJU66y4X8KcWE0g+592NbySdoJsVXoYtZI00P5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0IcM2cnlxnsM+EEH/6SmHk8ajhTP1ViMTFf2rVzzk0xxvl7LIhPGrkFImDZmxzdXE Lqaq/PHXX0nWSy2fxNKiUIvDTb9aTOgRes/i3/PvIXBsKaWgjwoxBzf3cXCFEEbi57 5OBIBH5V6unZXZJdZLkVhW0B7H2HmGNPUaVeyxo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Ulf Hansson , Sasha Levin Subject: [PATCH 5.7 231/376] mmc: owl-mmc: Respect the cmd->busy_timeout from the mmc core Date: Fri, 19 Jun 2020 16:32:29 +0200 Message-Id: <20200619141721.255466678@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.25.1 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;