Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp135374ybz; Fri, 24 Apr 2020 13:09:33 -0700 (PDT) X-Google-Smtp-Source: APiQypIpCJK70ENmZbv2vQ6FEScTixUDZFmTdTbjGpl0nkhcbka0RlsUvzPxCgta1fdmAjtoMx4B X-Received: by 2002:a17:906:c10c:: with SMTP id do12mr8563938ejc.182.1587758972915; Fri, 24 Apr 2020 13:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587758972; cv=none; d=google.com; s=arc-20160816; b=qBPdc/u7lkh7b9K9HwceUDo9hLd/i2+DnvjRHsOcC/WME6i34d3jwTObwaeA0EG3Dy fT7hQORGsK/cGGsooMzM9trONPcfsLL5mzpQdQ4Td+ELLh7pWvqQMPJkWKXVjFqnYPlw xEZP7bQt8A2iTPMy9Je+oVsaA3gi35ysVKMgxyhgaN2cHS/zIrR2N87IVv+VKilFnFM7 Lds7CNzgvIDjTHySS/efpz7ZVysm7j0qQ4i/O1gfyzBjgZ5vHUZuQdNLPg+x4Or2uBrF 8diHGZJeJz4f9DIhxCmIQovpqFhY6pzPqxvJsqFRtl4CylmFW6ZA+b+4/TOEVZvGNnrS NPvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=YC4YvFj7wnCG+fm55jVe+LTRiqbi7dfas2ZLEtr2Hq4=; b=C2RFVs7oIiptqx/flTYxfMHcX0CTc9v6QtJK89gODOU13k3I9hk9bo7bUry/dNdoJ/ CmRBdjOs9ximgxK5LXIDTOl5Sutgy6NxBdbfg4AtO3vkhoO4lyWgzMARZmWPjZZCPxpO L0JfkxObeKcHCOsaGR/XcBr9Kv6oVMRZjyiJ5xG5Lo5jr+Tos4wLI7JAIrhMljiDSv1/ wLlB/zVBCdEaCN4g+zWtllsWKm8RrR739DFyrPxpnsJeDeKYKOu4PSDHrTO6xFCIeqYi 53zyg6ej/eQefcflh6TGcExqvUI/Y5QahQlXPHMoxuufz2TU+VCsBz7LNhffauoyRQyp CRcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ZzIXx+YW; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw22si3612973edb.418.2020.04.24.13.09.09; Fri, 24 Apr 2020 13:09:32 -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=@nvidia.com header.s=n1 header.b=ZzIXx+YW; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729501AbgDXUHG (ORCPT + 99 others); Fri, 24 Apr 2020 16:07:06 -0400 Received: from hqnvemgate24.nvidia.com ([216.228.121.143]:3488 "EHLO hqnvemgate24.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729434AbgDXUGz (ORCPT ); Fri, 24 Apr 2020 16:06:55 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate24.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 24 Apr 2020 13:04:57 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 24 Apr 2020 13:06:55 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 24 Apr 2020 13:06:55 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 24 Apr 2020 20:06:55 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 24 Apr 2020 20:06:55 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.165.152]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 24 Apr 2020 13:06:55 -0700 From: Sowjanya Komatineni To: , , , , , , , , , CC: , , , , Subject: [PATCH 4.19.113 1/3] mmc: sdhci: Refactor sdhci_set_timeout() Date: Fri, 24 Apr 2020 13:06:50 -0700 Message-ID: <1587758812-3331-2-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587758812-3331-1-git-send-email-skomatineni@nvidia.com> References: <1587758812-3331-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1587758697; bh=YC4YvFj7wnCG+fm55jVe+LTRiqbi7dfas2ZLEtr2Hq4=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=ZzIXx+YWvfiWV+jUp5tq7K0sjejuIiq9dRrl22PFEHjtqCsuH9wOxfu9cJl6ux5TK qYH7zDeUahxrnl7F+4g1EvflxA7IEGNmZe7FkSTmm7TMoQsvqYa7TsnQ0zt928Vbzw 6Vttz2V5csvDWAaFuVcw1Sn5GTlLuH9Pd0Cz5d9ny8crtrxAS1TIcEIFpCQjyKCv19 sySfYH5dEYlXLjyZAhTEguUi0hp636LUeL8khr/cJzYrRo/7tbo99qyfw/L6EW+j+X 4rFFnGN+xrbXWxwBy9jQWqDO1I4vdsH3CYv4eoziOQ9tT09+eo+U/HGHjxRJb2Tv81 d0bJXJKQ6PZdg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 7d76ed77cfbd ("mmc: sdhci: Refactor sdhci_set_timeout()") Refactor sdhci_set_timeout() such that platform drivers can do some functionality in a set_timeout() callback and then call __sdhci_set_timeout() to complete the operation. Cc: Signed-off-by: Faiz Abbas Signed-off-by: Sowjanya Komatineni --- drivers/mmc/host/sdhci.c | 38 ++++++++++++++++++++------------------ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 5a7fd89..c941e81 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -860,27 +860,29 @@ static void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable) sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); } -static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) +void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) { - u8 count; - - if (host->ops->set_timeout) { - host->ops->set_timeout(host, cmd); - } else { - bool too_big = false; - - count = sdhci_calc_timeout(host, cmd, &too_big); + bool too_big = false; + u8 count = sdhci_calc_timeout(host, cmd, &too_big); + + if (too_big && + host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) { + sdhci_calc_sw_timeout(host, cmd); + sdhci_set_data_timeout_irq(host, false); + } else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) { + sdhci_set_data_timeout_irq(host, true); + } - if (too_big && - host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) { - sdhci_calc_sw_timeout(host, cmd); - sdhci_set_data_timeout_irq(host, false); - } else if (!(host->ier & SDHCI_INT_DATA_TIMEOUT)) { - sdhci_set_data_timeout_irq(host, true); - } + sdhci_writeb(host, count, SDHCI_TIMEOUT_CONTROL); +} +EXPORT_SYMBOL_GPL(__sdhci_set_timeout); - sdhci_writeb(host, count, SDHCI_TIMEOUT_CONTROL); - } +static void sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd) +{ + if (host->ops->set_timeout) + host->ops->set_timeout(host, cmd); + else + __sdhci_set_timeout(host, cmd); } static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_command *cmd) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c0372e3..15ef9c6 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -759,5 +759,6 @@ void sdhci_start_tuning(struct sdhci_host *host); void sdhci_end_tuning(struct sdhci_host *host); void sdhci_reset_tuning(struct sdhci_host *host); void sdhci_send_tuning(struct sdhci_host *host, u32 opcode); +void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd); #endif /* __SDHCI_HW_H */ -- 2.7.4