From patchwork Mon Feb 27 08:29:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Lin X-Patchwork-Id: 9592829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2633601D7 for ; Mon, 27 Feb 2017 08:34:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95E0328433 for ; Mon, 27 Feb 2017 08:34:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A4842843E; Mon, 27 Feb 2017 08:34:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AB2E28441 for ; Mon, 27 Feb 2017 08:34:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751705AbdB0Idn (ORCPT ); Mon, 27 Feb 2017 03:33:43 -0500 Received: from lucky1.263xmail.com ([211.157.147.130]:41741 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751663AbdB0Id1 (ORCPT ); Mon, 27 Feb 2017 03:33:27 -0500 Received: from shawn.lin?rock-chips.com (unknown [192.168.167.129]) by lucky1.263xmail.com (Postfix) with ESMTP id 37BF31EEFC2; Mon, 27 Feb 2017 16:33:19 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 212C339C; Mon, 27 Feb 2017 16:33:20 +0800 (CST) X-RL-SENDER: shawn.lin@rock-chips.com X-FST-TO: ulf.hansson@linaro.org X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: shawn.lin@rock-chips.com X-UNIQUE-TAG: <07da97ea7da68ff71900d49576ac4bb0> X-ATTACHMENT-NUM: 0 X-SENDER: lintao@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 30859M5G4NG; Mon, 27 Feb 2017 16:33:20 +0800 (CST) From: Shawn Lin To: Ulf Hansson , Adrian Hunter Cc: linux-mmc@vger.kernel.org, Anssi Hannula , Masahiro Yamada , Shawn Lin Subject: [RFC PATCH v2 2/4] mmc: sdhci: get the timeout_clk from callback in Hz Date: Mon, 27 Feb 2017 16:29:02 +0800 Message-Id: <1488184144-122285-3-git-send-email-shawn.lin@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1488184144-122285-1-git-send-email-shawn.lin@rock-chips.com> References: <1488184144-122285-1-git-send-email-shawn.lin@rock-chips.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We expect all the variant host drivers to return the timeout clk rate in Hz unit so that it's more easy for us to work through all cases in one place. Signed-off-by: Shawn Lin --- Changes in v2: None drivers/mmc/host/sdhci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6fdd7a7..9707f11 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -3101,6 +3101,7 @@ int sdhci_setup_host(struct sdhci_host *host) unsigned int override_timeout_clk; u32 max_clk; int ret; + bool skip_div; WARN_ON(host == NULL); if (host == NULL) @@ -3292,7 +3293,9 @@ int sdhci_setup_host(struct sdhci_host *host) if (host->timeout_clk == 0) { if (host->ops->get_timeout_clock) { host->timeout_clk = - host->ops->get_timeout_clock(host); + DIV_ROUND_UP(host->ops->get_timeout_clock(host), 1000); + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) + skip_div = true; } else { pr_err("%s: Hardware doesn't specify timeout clock frequency.\n", mmc_hostname(mmc)); @@ -3301,7 +3304,7 @@ int sdhci_setup_host(struct sdhci_host *host) } } - if (host->caps & SDHCI_TIMEOUT_CLK_UNIT) + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT && !skip_div) host->timeout_clk *= 1000; if (override_timeout_clk)