Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp107764ybg; Mon, 8 Jun 2020 17:48:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/hDthWSVM05NhZ92AumtY6DP/I9/uYgR8VxaDtXiL0TWmk66P8/icd3bAq1ytjloJJS39 X-Received: by 2002:a17:906:9a02:: with SMTP id ai2mr22535833ejc.97.1591663721298; Mon, 08 Jun 2020 17:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663721; cv=none; d=google.com; s=arc-20160816; b=XYCfarmTwlnHXMXRNTeOv5NQ7qbFV+d6LyZMm3S2g+rrC98pAmF29S0EaA/iGxmKhW d2BrBQBmOxiBF20HzxwGSu4CAYC/pYcc0nqkBL7yFxs5nFOpzC8G6JsioqAu17Bgq1q2 ev4GYNTW0rpsGpswFwqFKfjI/wQvFc2V+5mmo8lI8M/hLlt+hKdVN0hamMm1d+eDgq60 9vUvOEYPFttYqLjDU/QVEoSehoJgdqresEgNxqMJmDkVDXRAlmIU6h76Sw2wLyZRHrFg HjJASy1sWxuS3EJEW7vq3AFjVHWixoYmPmQ3Z6YLZIS1vQKv58des1q/mm9/FbkkMLDf OyGA== 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=YJR4nZLmK7NM2jC8j9JSeVgMPtg4RmT4cBY4Omxbkm4=; b=Tr/0nXWW2tAgbs4BQYcxpPmpjZv5TT/4w3ofK6dmQQqjPd+O6q2rtQ4t2Me1LtiOFD iL26jfXIflh93VdZUnAsxXHHNI2onWRWdlsE3YgvTgg5qoANBr9gMHNdqc1bXu42OzJj zawJvfHOamvgjhdzBx117eXXHsYS6oPbpVVx1TzxJKE3wUY9mILpWkv8PR6IgIdb3m5r xIHBAWgltSecm9Fot5cGnW7C11wtSVCEtiHRg8Ch1O29WW0Ma17i0iM99sme6ffef0G0 OeROQjBSznwbvPGOgKqTB+nG94F+CyjYrtvzloW+5+AEqC9gIl/aKVNESk6MJpALm+4K AHaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iluAK68K; 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 dp4si12074412ejc.258.2020.06.08.17.48.18; Mon, 08 Jun 2020 17:48:41 -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=iluAK68K; 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 S1732150AbgFIAqj (ORCPT + 99 others); Mon, 8 Jun 2020 20:46:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:58518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728921AbgFHXLe (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 DCC4520B80; Mon, 8 Jun 2020 23:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657894; bh=MHM7Fdo3PdvDzgIUfO+YIaHewyH4D4uZ7SHnfgDihPg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iluAK68K3XCbUd6pabxdzmQnvDv1UPkro4P5up3qXriIlofEhweh7ViGvBSbKgSUF 4dVe2MKovDO/1FDnca0DKbzJf6bpP/veWPa53lmQeS9djduk0B7EAn3eCCXCCQJzlo SIysFlyzDNyrfccFjriX67ukmYF8eECR/jR4hU+M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Bruce Chang , Harald Welte , Sasha Levin , linux-mmc@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 249/274] mmc: via-sdmmc: Respect the cmd->busy_timeout from the mmc core Date: Mon, 8 Jun 2020 19:05:42 -0400 Message-Id: <20200608230607.3361041-249-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 966244ccd2919e28f25555a77f204cd1c109cad8 ] Using a fixed 1s timeout for all commands (and data transfers) 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 1s. 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: Bruce Chang Cc: Harald Welte Signed-off-by: Ulf Hansson Link: https://lore.kernel.org/r/20200414161413.3036-17-ulf.hansson@linaro.org Signed-off-by: Sasha Levin --- drivers/mmc/host/via-sdmmc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c index e48bddd95ce6..ef95bce50889 100644 --- a/drivers/mmc/host/via-sdmmc.c +++ b/drivers/mmc/host/via-sdmmc.c @@ -319,6 +319,8 @@ struct via_crdr_mmc_host { /* some devices need a very long delay for power to stabilize */ #define VIA_CRDR_QUIRK_300MS_PWRDELAY 0x0001 +#define VIA_CMD_TIMEOUT_MS 1000 + static const struct pci_device_id via_ids[] = { {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_9530, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0,}, @@ -551,14 +553,17 @@ static void via_sdc_send_command(struct via_crdr_mmc_host *host, { void __iomem *addrbase; struct mmc_data *data; + unsigned int timeout_ms; u32 cmdctrl = 0; WARN_ON(host->cmd); data = cmd->data; - mod_timer(&host->timer, jiffies + HZ); host->cmd = cmd; + timeout_ms = cmd->busy_timeout ? cmd->busy_timeout : VIA_CMD_TIMEOUT_MS; + mod_timer(&host->timer, jiffies + msecs_to_jiffies(timeout_ms)); + /*Command index*/ cmdctrl = cmd->opcode << 8; -- 2.25.1