Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21354851ybl; Mon, 6 Jan 2020 03:02:20 -0800 (PST) X-Google-Smtp-Source: APXvYqxhtJ6MkWdmODbF6UiDghpbFwAx2MBJPxIi1AUXdRb9TkZcUy8qpThV1HiRUYKtFLem7ooP X-Received: by 2002:a9d:7305:: with SMTP id e5mr109924959otk.64.1578308540244; Mon, 06 Jan 2020 03:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578308540; cv=none; d=google.com; s=arc-20160816; b=TA4ReSPnNR+zinM9VDqOG8grFYCEIzD8hrtbphEf9Qq8h1W4KKrWM0VbuGIujDuygz 9jekmiuCXDn/xqdl5s0Z98cCx03asvNLIABwl142tMaMfCYhMxMhUWrVlZt8aGCDHio8 VCg1AhWqrgktrgS/PirOYWY+Ha6O4n4YzcOMNPU4o8vABTfnB0iQPUuFYaI4Pvt2+8So SarQeXKyQXLrFeeLYlFOzrGfKjQJRSxkG03ZVPRGK0VA13kFDLXGxmrZbJ5BG0H0vVoX XJxm45BB6VALLd2Uml0g8ofX4EiV892g8S3Da4Pf0C0oASOFddc+fEbz0YzOpWC+FfZL hvCg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tyR7RY4j5vigXodKKfJc6EaOKgFAKmeLtj9iUUvThaE=; b=kXALTstUTdAwYj1PKZokSsXzavjJ6PxXN7pCqt7Rvvj3/GTdVIvyq+GyJE8Q+0Bazb 1Ayvu2blAO/MoyjOi0O67b+qXprpJDMG5PYS0laTHTsKR7oqClzLDP4ep6cFSaC2dEPe Vde1ZwYtsXPgh5yE147kLuTv+xiSNRDZJ7NWuPhpXJEaZqhbHfyhWpFjad4rZgPzQozB JopLsi9Tzc4mSL9u8Z3X0DgRkGbcfipNEoPPt8uQxVur3U6u4fi9w1NlcBJmYAJDtuV0 Nt33+idMzjhzHb3BUXD6y87klrrIT1FQzaQbsSMvGRsL+bWVPCcBFKjys1K7vhkggmSR 2H9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=n5N0lsLr; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n7si35622016otk.277.2020.01.06.03.02.08; Mon, 06 Jan 2020 03:02:20 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=n5N0lsLr; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbgAFLBA (ORCPT + 99 others); Mon, 6 Jan 2020 06:01:00 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:59216 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgAFLA7 (ORCPT ); Mon, 6 Jan 2020 06:00:59 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 006B0qqb071019; Mon, 6 Jan 2020 05:00:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1578308452; bh=tyR7RY4j5vigXodKKfJc6EaOKgFAKmeLtj9iUUvThaE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=n5N0lsLr0DZLD1GL9d41e8uPO/H+7tk0r/+FRyh0vQEHsWM1tArJxPq0I8KehFcuH +5SmSIKT6yUuVkjWGtk+r9rYzeIQADWnNEiimEuY0LlMlGXas76Arei1wcWk8EGlYL d02IW+QEAIbCvU3Dq/BCgDlV519s4v66kdUidI7M= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 006B0qt6101400 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 6 Jan 2020 05:00:52 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 6 Jan 2020 05:00:52 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 6 Jan 2020 05:00:52 -0600 Received: from a0230074-OptiPlex-7010.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 006B00Jv007044; Mon, 6 Jan 2020 05:00:46 -0600 From: Faiz Abbas To: , , , CC: , , , , , , Subject: [PATCH v4 06/11] mmc: sdhci: Refactor sdhci_set_timeout() Date: Mon, 6 Jan 2020 16:31:28 +0530 Message-ID: <20200106110133.13791-7-faiz_abbas@ti.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20200106110133.13791-1-faiz_abbas@ti.com> References: <20200106110133.13791-1-faiz_abbas@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Faiz Abbas --- drivers/mmc/host/sdhci.c | 36 +++++++++++++++++++----------------- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 56f46bd7cdad..adb3e8ccefb8 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1004,27 +1004,29 @@ void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable) } EXPORT_SYMBOL_GPL(sdhci_set_data_timeout_irq); -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; + bool too_big = false; + u8 count = sdhci_calc_timeout(host, cmd, &too_big); - if (host->ops->set_timeout) { - host->ops->set_timeout(host, cmd); - } else { - bool too_big = false; - - 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_initialize_data(struct sdhci_host *host, diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 928c6f35fcad..1fe230c2ed84 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -804,5 +804,6 @@ void sdhci_send_tuning(struct sdhci_host *host, u32 opcode); void sdhci_abort_tuning(struct sdhci_host *host, u32 opcode); void sdhci_switch_external_dma(struct sdhci_host *host, bool en); void sdhci_set_data_timeout_irq(struct sdhci_host *host, bool enable); +void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd); #endif /* __SDHCI_HW_H */ -- 2.19.2