From patchwork Fri Jun 19 14:32:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 191258 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp686489ilo; Fri, 19 Jun 2020 09:33:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxAsDXuRbENTsEmOkL/OMPm/K7uaODNrDpTXlpQfWB4BnyKfywmotLPqSQi8DuZCC5nN14 X-Received: by 2002:a50:fb14:: with SMTP id d20mr4154562edq.209.1592584390811; Fri, 19 Jun 2020 09:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592584390; cv=none; d=google.com; s=arc-20160816; b=UHUPlU3NNZJ37iBcY4ays5ANfrx4doibh8TwuCefFPCFWCKXiyLEj0tTN/1o21P6vF urEY2hbLm8UA31nQ05nhmCKq/aPlBnMqR6BRpi9ZpKySrnXlASpNSrqT52BZM6MWYR2s Gq9eXbRW396O7gwHXMWQKu0vWhoSntSQ858O21voEf2IEHVmHZAEmy1bUIgqEH0bL7hN JgOSSJMGR54r2ATG7E5yDEh4qaNcYua1qJn4I8rFrqY+YEoGw5KNao+B5w1mjZ1hir7l b+GKMWkJU/xCTW6cq1gnG+QTYxfmqNZofN2r5PUo9Ms3pk+GPkVBnOGPc9nvDbxJFHrn 5c1Q== 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=BKNBXCrDRcaDuu76eBdcN4XZANIUUgY2doZ7tW0x5ufA/69aAY7FeYcT96IWOQX09O Ioh/TsNfitU7RFTTjn9lIwKDoJcePlgY/DgglvnYgn5/hlVuKzGOaGASbvt5T6JJvSnF YjoVq+/rB5fGoby7zUEWNfWQ9hYOl9GGmpZGEO4fHSjKPVYY3Ww1N7Vei/O7+rPi+dg5 P9tjH0jbvscpmLb8f3s/3eeCWF5xCRDWxk+E2JN5cW9ITw9vMFi5ekLHo3N1pcrlvv1m ++Nr+xc1aY3RYiT4VIWZJLVYYleH3OCbZqkH+tZOy6nuWuyejw4ijND/znTMAIg0Uv/J p14g== 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 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 r6si3861773eja.531.2020.06.19.09.33.10; Fri, 19 Jun 2020 09:33:10 -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=rrATLhzR; 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 S2394998AbgFSQdD (ORCPT + 15 others); Fri, 19 Jun 2020 12:33:03 -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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.25.1 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;