Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp911341ybz; Fri, 17 Apr 2020 12:16:03 -0700 (PDT) X-Google-Smtp-Source: APiQypIi7mlCDQVQHxLNU6FN1UEPvAYQVx2nd3elYn9rlMfvPgt+AJyTij5aVPuRpc1vxGU5HJRS X-Received: by 2002:a17:906:4cd2:: with SMTP id q18mr4618615ejt.70.1587150963561; Fri, 17 Apr 2020 12:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587150963; cv=none; d=google.com; s=arc-20160816; b=Pi88R6u6NGlsBBWe5FNBKBqtbrutyOus+4A9udYKf36BdKXxm2pG1SsuurJ11wZ0fz 3fmwkHGXOfr9GrWkMZYUs4igXyHCxfJuFErAx/Wb5dCul5lggKdc2JlwnTCtOb8XMaan vIZwft7BgIigtwpIoDs5SREvdl5L9pwU1UdjM/QhcHyMiA+VhjAld850DMlbnN2zx8Wm ix0jeVY/WV1BmudBdIg2ss5bZQxEdg4yGsCDj4vWVqJIWiQyOPfsWhHeS70vamURXKbi j2J4te5ZlIKJ8iEjlIeLuLMCcAP9vSWkltjEaXzhqChyWTqgv6KvZOxwectxy9fVt4nY Jjcw== 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=jucYYXaEgM81yFida5zPSb+TSOsW7vWjx1U1P0KlM2u9vpRwkU9UchRlYFZExkQ3SS x4qo5RijIxL2nm8e2nRu/i7dQmHH7BNjUE2rEb3xcrmkse3kHGbVPbvUi+RyMjzFq6FU otcb9/rzWujBTe75o7fMlGFesoI+s3mbVq8sdy8tsc96g6jd5cJ1coOKejJEullqZMws ULshRdsUOCIMY//J7uE+TYnk4YiVOMxbq6Zp2grzLXNAgszksNo2pqqGy2ukvwebPyrI ANuUoIltjPni+MsB1Tseq/A2wfSHHXK8SJb+6KHksT0ViOtl0VjKINcByjED1HeXVA8p 1G4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=jRTWFtiR; 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 o5si2051680edv.507.2020.04.17.12.15.35; Fri, 17 Apr 2020 12:16:03 -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=jRTWFtiR; 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 S1730377AbgDQTOZ (ORCPT + 99 others); Fri, 17 Apr 2020 15:14:25 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:10562 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730125AbgDQTOW (ORCPT ); Fri, 17 Apr 2020 15:14:22 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 17 Apr 2020 12:14:09 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 17 Apr 2020 12:14:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 17 Apr 2020 12:14:22 -0700 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 17 Apr 2020 19:14:22 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 17 Apr 2020 19:14:21 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.171.241]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 17 Apr 2020 12:14:21 -0700 From: Sowjanya Komatineni To: , , , , , , , , , , CC: , , , , Subject: [PATCH 4.19.113 1/3] mmc: sdhci: Refactor sdhci_set_timeout() Date: Fri, 17 Apr 2020 12:14:02 -0700 Message-ID: <1587150844-12003-2-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1587150844-12003-1-git-send-email-skomatineni@nvidia.com> References: <1587150844-12003-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=1587150849; 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=jRTWFtiRL97HpRStxzJoEVsS5Xi0h2kQ07x7IfiRaF+faWXtTufbc8dKBjbHJKyBI oSqpLsX1VFOu0fsedDdL7VWFXBPZKI0Vq7ERUg0WTZ13lX+VmJf7Z4ybD6Q8OCZOY/ G0Wp8+ONzbPrD4ZgOmNRb672zovrQ7sSdE88y552fr0CCsM58My1Rc1iUgWc9aUG9m +QITDTOT1246beFUNcA5FilSffU/WlkMmrAXYo7x5JbB6j5xp+eawSLSzCIXVJKikd d29FRSh9f+WiUkJyDtnerj3W3LocoM9uuZvMUb/Ta9PQgwfhJh+aci/zOfMBMM7zrD w/21Ol7hzj35Q== 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