Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1144457ybh; Thu, 12 Mar 2020 18:12:58 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtSdW1yrExq4Et0AKXrlJVidkY6R0NA4vEvskIz2i+oAeF9uL3FEOk0aLzkVmFNS9t9qdn2 X-Received: by 2002:a9d:7458:: with SMTP id p24mr9180886otk.197.1584061978720; Thu, 12 Mar 2020 18:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584061978; cv=none; d=google.com; s=arc-20160816; b=OxsQhhf+JA+XrVHvTaYuEvqur7aNu3S5uOXxFD5AyaIlCO4j5u4+oRJ8mXpY91wFvV 9mxftdMPia+Ofb+8TvTsVfV8w2lfXaxT5CGTB2B1CvEgE/b61N/fbRkAqsroQOYFJHk7 AIxXnaoHuCoUE1JtfH6CmhLqKYghLkqHEfGxilm9oJgvZ/Y5G33Pt+Zbr3ByL3VeUX9c XwqFM954GSpWYhc+K6YGM5LeE3sP3y8XXFAiK/fnewEim+pRgcKAt1z/xpoZLAXXh3co W5vblWuXVtOqy1N8wme4FntEnWiPLdnUxGTG/FM/QWHQGHdjmfV7x3x8DOZbzVEsje9i iOig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=wQq/j0PPWfAM06xD9I+x6gyyDyOtoO6z6OjWSmmz7+I=; b=IkBu+lx+5lGdjkmW9QTEDuKfdkQtaLKZIj1bUFdt0hMAPqcApmlXtPxG+fzpmTkcZI H0ZLtMp87QjH+UOv9OkQSJXIFdXPuVQS/B0iIEuZWdk0KrKXJ3pR8cTFPhHWvwUJlnAx iiuUGf9ejxH2fzxkE8rpKXaGznexTexjIeO6raemJbCDjS71+EDlf2XxcS3QbTeSQy22 UdvnK6+K+gZwsYL7umdRKrXyFP8SRyz8I6wDKahj6UorItE0LcZqyjx2IYN8/0auit22 DBYsaKMxvLbYZvzOZ6ZSt3oNC3ve1FtZjqnEzPBQonLSmwgo6KZTrsu8tAg2rygy2GGv bShg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si3803865otj.242.2020.03.12.18.12.47; Thu, 12 Mar 2020 18:12:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727126AbgCMBL0 (ORCPT + 99 others); Thu, 12 Mar 2020 21:11:26 -0400 Received: from 97-93-29-23.dhcp.snlo.ca.charter.com ([97.93.29.23]:54444 "EHLO skomatineni-linux.nvidia.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726971AbgCMBL0 (ORCPT ); Thu, 12 Mar 2020 21:11:26 -0400 Received: by skomatineni-linux.nvidia.com (Postfix, from userid 1000) id 402D0104006E; Mon, 9 Mar 2020 17:13:27 -0700 (PDT) From: Sowjanya Komatineni To: adrian.hunter@intel.com, ulf.hansson@linaro.org, baolin.wang@linaro.org, kstewart@linuxfoundation.org, tglx@linutronix.de, bradleybolen@gmail.com, gregkh@linuxfoundation.org, thierry.reding@gmail.com, jonathanh@nvidia.com Cc: skomatineni@nvidia.com, anrao@nvidia.com, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Subject: [PATCH v1 1/3] mmc: core: Add capability for hosts supporting long HW busy wait Date: Mon, 9 Mar 2020 17:13:23 -0700 Message-Id: <1583799205-8442-1-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some mmc operation like SLEEP_AWAKE and cache flush through SWITCH command takes longer time and for host controllers supporting HW busy detection, core driver converts R1B type to R1 type response for these commands if operation time is more than HW busy timeout and uses SW poll for busy state. This patch adds a host capability MMC_CAP2_LONG_WAIT_HW_BUSY for hosts supporting long or infinite busy wait of HW busy detection for these long mmc operations and prevents core driver from converting R1B to R1 response type. Signed-off-by: Sowjanya Komatineni --- drivers/mmc/core/mmc.c | 3 ++- drivers/mmc/core/mmc_ops.c | 3 ++- include/linux/mmc/host.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c2abd41..5aea3a6 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1916,7 +1916,8 @@ static int mmc_sleep(struct mmc_host *host) * from doing hw busy detection, which is done by converting to a R1 * response instead of a R1B. */ - if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) { + if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout) && + !(host->caps2 & MMC_CAP2_LONG_WAIT_HW_BUSY)) { cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; } else { cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index aa0cab1..251b4c7 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -579,7 +579,8 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, * the host to avoid HW busy detection, by converting to a R1 response * instead of a R1B. */ - if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) + if (host->max_busy_timeout && (timeout_ms > host->max_busy_timeout) && + !(host->caps2 & MMC_CAP2_LONG_WAIT_HW_BUSY)) use_r1b_resp = false; cmd.opcode = MMC_SWITCH; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 6aaa15e..1cda4dd 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -371,6 +371,7 @@ struct mmc_host { #define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */ #define MMC_CAP2_AVOID_3_3V (1 << 25) /* Host must negotiate down from 3.3V */ #define MMC_CAP2_MERGE_CAPABLE (1 << 26) /* Host can merge a segment over the segment size */ +#define MMC_CAP2_LONG_WAIT_HW_BUSY (1 << 27) /* Host can support long busy timeout, do not convert R1B to R1 response */ int fixed_drv_type; /* fixed driver type for non-removable media */ -- 2.7.4