Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp505952ybh; Thu, 12 Mar 2020 06:09:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvEFU3GuaVCai3snOlLP6TWeNzZXWRa1EM883DoVoUQr9amJ9PMbji3FR41SE+1XyrtSr0d X-Received: by 2002:aca:1913:: with SMTP id l19mr2384655oii.47.1584018589188; Thu, 12 Mar 2020 06:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584018589; cv=none; d=google.com; s=arc-20160816; b=C7Q0bu+JXokPbtaMlR7KC5320QbNCJry7GLW1F2CVOTNpah44L+tJpZlxGpdgQcA5m vvIV+H+LsQ+Wz3vkdaJbrUUnE1j5cpSuJB/SHnxcJY1N9SXSLEjpnUDw3NCmgys9ciye 5wUpgn1oMJ+2jIi3rOiFv6/4A3t7X648D5HPw4ldpQKM76pZSHxXQ0G+KYDgDawAnUru R8f5wjrc2qa8LBk2B5efh4KDXr9pH+HJwtuDlMxdfSwn2SZ2ntlBdYKc4C689yoa/aOr LVg46DsWP/z1LvLm4B3f2Je6M3e2IukwJ3pVDSACxoaqyTlHk71/QKR2dS+xXMBUPNVl cRjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=615uTM0DnrncREOe2KMCqisaLBgj11Sr3HONWNz+aSc=; b=JhnMUjx0t6G0GYguR6QK+byF+lKJ86OVupxdWh32vv/NKvg8quHW8WTZ6vkzoozLlf sEzWbKauVX3Prj3H6uOP48Sx4wOEA8luPzhDJ49iTm9acjb3Fhm0Orbxec1gSYPQ2jic 3I0fSLduvU8c5jDS5GYnv1P64fdG5yI+KjJBR2v8HZxt8S+EBJzL7CGTfDpmhXC/z9HR jiApDdt9/vviNnc3VbsEGt44qvEBP9Je6zlmePE/Ms8oQb/i/Ckl2+D9EMGDH6hfiV/e TqjWxWtm+BxtXM6Mg8rtboNnZ+P09XDzSXPLuysuhwqpMgoxKrkj6btRShKOjj66/KR3 rOtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FFA0e+6c; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w25si2839951otp.288.2020.03.12.06.09.31; Thu, 12 Mar 2020 06:09:49 -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; dkim=pass header.i=@linaro.org header.s=google header.b=FFA0e+6c; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727241AbgCLNIt (ORCPT + 99 others); Thu, 12 Mar 2020 09:08:49 -0400 Received: from mail-ua1-f65.google.com ([209.85.222.65]:44964 "EHLO mail-ua1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbgCLNIt (ORCPT ); Thu, 12 Mar 2020 09:08:49 -0400 Received: by mail-ua1-f65.google.com with SMTP id a33so2058177uad.11 for ; Thu, 12 Mar 2020 06:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=615uTM0DnrncREOe2KMCqisaLBgj11Sr3HONWNz+aSc=; b=FFA0e+6cg+LOma5AcX0rPtuPzExG8R49KllYxY8XJbVvagwzpy9nhwUHm5t9SIwSDy bIzg+HNhDxnf6ntIDVKSACZilQ8647xb610y0PnN0o/9fG6oi2a0T0X/eRAW46ViGKz6 N/+r6mj2bo5SqTs4xFusTNw0mlF3J3Vgeyu6l6W8ylRpdonjlvQqi71TxR47PvvnY7BH RGjFyIOKFeOYJR5bUqiJb+rgBnLLJlgXQb9Pszr1VbbXmNQyyRPd3n+Rj39QzqJKzidI /cTQ90+22AWOQng+9JbvAkZJMaFdP139HdHJQTXrcUAfNkdFGXmDBXHVGsFVMlGaZ9o/ 49zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=615uTM0DnrncREOe2KMCqisaLBgj11Sr3HONWNz+aSc=; b=EMY2QfJ/7Cdvm9cBC4epXDji7rhbqLTFhJe87NhTHpom09Y6QJ9gQAYuN2Tb1zHgV4 31DYsY49YSo6GiagjaJjazoZpn22yGfrPviwg97xow/kRwVlhCHdc+cJKAWTHLtFLhKo EAlmygzuYp263HGAPrdDO83/vewW12cYV2K6siChYhHiyBnywpgpjeCqB3gi1g61hExl otsAlqPrKi8+7THiBPL7Fwp9uGE03hPAER0ioqgqCsi95fyS1z9OmIVHCNga32xHnZ/m QdIWwZ/YGTj9qoLzkSqWPvmIkXJ8+Gmzf6gySlfFLDxOuk2GTmZKO+ct0HvhI1ymV8OG y//g== X-Gm-Message-State: ANhLgQ1M0v+dVxcJpSSAwA0eamGJoyrlIWoHDAuUkP5bR2A0YuDSPC1g mjNGUCAyghsENieV5bb7s7hHezTbsWAcV+hVzTtVJQ== X-Received: by 2002:a9f:3046:: with SMTP id i6mr4835277uab.15.1584018527825; Thu, 12 Mar 2020 06:08:47 -0700 (PDT) MIME-Version: 1.0 References: <1583886030-11339-1-git-send-email-skomatineni@nvidia.com> In-Reply-To: <1583886030-11339-1-git-send-email-skomatineni@nvidia.com> From: Ulf Hansson Date: Thu, 12 Mar 2020 14:08:11 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] sdhci: tegra: Implement Tegra specific set_timeout callback To: Sowjanya Komatineni Cc: Adrian Hunter , Bradley Bolen , Thierry Reding , Jon Hunter , Aniruddha Tvs Rao , linux-tegra , Linux Kernel Mailing List , "linux-mmc@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org -trimmed cc list On Thu, 12 Mar 2020 at 00:51, Sowjanya Komatineni wrote: > > Tegra host supports HW busy detection and timeouts based on the > count programmed in SDHCI_TIMEOUT_CONTROL register and max busy > timeout it supports is 11s in finite busy wait mode. > > Some operations like SLEEP_AWAKE, ERASE and flush cache through > SWITCH commands take longer than 11s and Tegra host supports > infinite HW busy wait mode where HW waits forever till the card > is busy without HW timeout. > > This patch implements Tegra specific set_timeout sdhci_ops to allow > switching between finite and infinite HW busy detection wait modes > based on the device command expected operation time. > > Signed-off-by: Sowjanya Komatineni Applied for next, thanks! We should probably tag this for stable as well, don't you think? Kind regards Uffe > --- > drivers/mmc/host/sdhci-tegra.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c > index a25c3a4..fa8f6a4 100644 > --- a/drivers/mmc/host/sdhci-tegra.c > +++ b/drivers/mmc/host/sdhci-tegra.c > @@ -45,6 +45,7 @@ > #define SDHCI_TEGRA_CAP_OVERRIDES_DQS_TRIM_SHIFT 8 > > #define SDHCI_TEGRA_VENDOR_MISC_CTRL 0x120 > +#define SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT BIT(0) > #define SDHCI_MISC_CTRL_ENABLE_SDR104 0x8 > #define SDHCI_MISC_CTRL_ENABLE_SDR50 0x10 > #define SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300 0x20 > @@ -1227,6 +1228,34 @@ static u32 sdhci_tegra_cqhci_irq(struct sdhci_host *host, u32 intmask) > return 0; > } > > +static void tegra_sdhci_set_timeout(struct sdhci_host *host, > + struct mmc_command *cmd) > +{ > + u32 val; > + > + /* > + * HW busy detection timeout is based on programmed data timeout > + * counter and maximum supported timeout is 11s which may not be > + * enough for long operations like cache flush, sleep awake, erase. > + * > + * ERASE_TIMEOUT_LIMIT bit of VENDOR_MISC_CTRL register allows > + * host controller to wait for busy state until the card is busy > + * without HW timeout. > + * > + * So, use infinite busy wait mode for operations that may take > + * more than maximum HW busy timeout of 11s otherwise use finite > + * busy wait mode. > + */ > + val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL); > + if (cmd && cmd->busy_timeout >= 11 * HZ) > + val |= SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT; > + else > + val &= ~SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT; > + sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_MISC_CTRL); > + > + __sdhci_set_timeout(host, cmd); > +} > + > static const struct cqhci_host_ops sdhci_tegra_cqhci_ops = { > .write_l = tegra_cqhci_writel, > .enable = sdhci_tegra_cqe_enable, > @@ -1366,6 +1395,7 @@ static const struct sdhci_ops tegra210_sdhci_ops = { > .set_uhs_signaling = tegra_sdhci_set_uhs_signaling, > .voltage_switch = tegra_sdhci_voltage_switch, > .get_max_clock = tegra_sdhci_get_max_clock, > + .set_timeout = tegra_sdhci_set_timeout, > }; > > static const struct sdhci_pltfm_data sdhci_tegra210_pdata = { > @@ -1403,6 +1433,7 @@ static const struct sdhci_ops tegra186_sdhci_ops = { > .voltage_switch = tegra_sdhci_voltage_switch, > .get_max_clock = tegra_sdhci_get_max_clock, > .irq = sdhci_tegra_cqhci_irq, > + .set_timeout = tegra_sdhci_set_timeout, > }; > > static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { > -- > 2.7.4 >