Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp995826ybt; Fri, 19 Jun 2020 21:00:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgKl5WM8SxiRmUUKyKVVhR7ajEuqHutN3BuAYh77ZDnN3CMEGssWB1fSUfBEua5pIEDPxH X-Received: by 2002:a05:6402:3c1:: with SMTP id t1mr6621459edw.350.1592625627086; Fri, 19 Jun 2020 21:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592625627; cv=none; d=google.com; s=arc-20160816; b=hRnRqNBG/S2R4fbF71fV7Ymk6WAG09yBrpo2JtWfOVNxsYH3nXTBUVN8IISjKOCaXA PQ5Kv2yu1Tml4ZlypIu+uRIqnQDYPt1mZY4ydqOTB0wjzjAA0pUuemfnin76XW5Apm7c RSQZFQvH+27OVQiy9gtvpG2Ia9A+k3VyY8dUuvkwMUzYkFkibqkYU6slNYgih965TXBF Tkj61FfV5Yi8/4A4AEIAV8r/BeXivKt73fdxJ28T7taUlEodvW8IbGuga5DmP+3i8hKv xm5/PaoAKE0HJQf3IolpD7mfbquQiDFQjtEc9uW1Rl/GwUWatQeGB3viWc3A1R3rDvYm nF/A== 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=RfSfkN707Jz8SujEecb+LAZjvWdCkD9X0+alWMH8wwg=; b=dNsCbyvc4Atos8mx72Nrm7OFsW+u3N3pR7itS+2Q+BiC0EdUIpmCRf0BN2GVIThp1X vHli4YCi655JSvHhBstkuWlpIjRxiSVGJYEtnEHivQwLoFjrJ5Y2SFkV/s818KJaUBVG O2x+T2kdVJhO03YNgjgFhUWbHH/EjeyK1MgBf1pHhIhFg2+tmD0JUFY3t87zyjd3HhYY wJFzod4p0Y9uqk5bXJ8mUf6RdtcmVOw76SFybBNrAu4Z57WArBl0HKSnBPX5AFxdhFCj EA4Gupq3qRrqJuKW0gqI5kfC4XSAEQgmHUsJYdNuzRq9eAPkFiKO+BpJMuXe55I+H625 nS8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rrATLhzR; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si5069664ejw.42.2020.06.19.21.00.04; Fri, 19 Jun 2020 21:00:27 -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=rrATLhzR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389797AbgFSQdP (ORCPT + 99 others); Fri, 19 Jun 2020 12:33:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:45620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389500AbgFSOvs (ORCPT ); Fri, 19 Jun 2020 10:51:48 -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 2AF2521556; Fri, 19 Jun 2020 14:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578308; bh=dA8deVe8Oc5xCiWh0RcR44ajduoZk4p5UPFlT99UIfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrATLhzR8YKbxn+eb4qJDtLixNX7bV01PAWjiTQAfJLIpE0y/ZQNp8+hhZpEYkj0d HUmA/EFOQUSaP+Vfp9bBPCwhonp9BuA5L6YgFVQX6LH5drBjVRL65/5Iwr8RR9oZXT X4MjFoqQH/ofW/1tfa7iWQ50+dI+rZJWwngpB9j4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruce Chang , Harald Welte , Ulf Hansson , Sasha Levin Subject: [PATCH 4.14 133/190] mmc: via-sdmmc: Respect the cmd->busy_timeout from the mmc core Date: Fri, 19 Jun 2020 16:32:58 +0200 Message-Id: <20200619141640.275240310@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141633.446429600@linuxfoundation.org> References: <20200619141633.446429600@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 a838bf5480d8..a863a345fc59 100644 --- a/drivers/mmc/host/via-sdmmc.c +++ b/drivers/mmc/host/via-sdmmc.c @@ -323,6 +323,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,}, @@ -555,14 +557,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