From patchwork Thu May 22 15:55:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Bresticker X-Patchwork-Id: 351547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F3651140088 for ; Fri, 23 May 2014 01:55:46 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752095AbaEVPzp (ORCPT ); Thu, 22 May 2014 11:55:45 -0400 Received: from mail-ob0-f201.google.com ([209.85.214.201]:39370 "EHLO mail-ob0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751591AbaEVPzo (ORCPT ); Thu, 22 May 2014 11:55:44 -0400 Received: by mail-ob0-f201.google.com with SMTP id wn1so751182obc.4 for ; Thu, 22 May 2014 08:55:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zUpEC5vohqNwWssCa2GxNNMSxwvytaPyJ6iwe6XMzg8=; b=T4qqreKxU1WKgWk5ufTVskcOT1b6IkZGCicnhy8NCHAcXoLo1Qz8iHwPmqn1gdKLV8 Er0XEeEyX4lbF65DeZTkwqdAPD00RGX+xcC5Hb+TviYLCt7dzxJra3cx/nLKf7LefsxI BJhvC70SkG/uP2jEUlCymiHVNjaWpi4GWZl7LF7rFZKZ2SVagFckw5hH8yxOkbTHKuHI er7Z31OrLPfLsFFhvyZ3vO9AAcXPLnl/ivsP/ECWjrKQoIpvdPDVgR5R1fMTtCZuCmew VESST07K0sdfcmXH0FBLqUvPPedg6mhL16vXJ0IF0ed1Sy4QqvwnfSjbWOdD5HrKdFDQ xz6w== X-Gm-Message-State: ALoCoQl1JGLTnEsIl/C0P5sa1LU+1LpgSLoi9VL/InUipYM4oB2XWENucONcJd446CWsOkR0U4o4 X-Received: by 10.42.236.68 with SMTP id kj4mr22695800icb.6.1400774144300; Thu, 22 May 2014 08:55:44 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id n68si13903yhj.5.2014.05.22.08.55.44 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 May 2014 08:55:44 -0700 (PDT) Received: from abrestic.mtv.corp.google.com (abrestic.mtv.corp.google.com [172.22.72.111]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 2641931C1F3; Thu, 22 May 2014 08:55:44 -0700 (PDT) Received: by abrestic.mtv.corp.google.com (Postfix, from userid 137652) id DFCE52209D9; Thu, 22 May 2014 08:55:43 -0700 (PDT) From: Andrew Bresticker To: Chris Ball , Ulf Hansson , Stephen Warren , Thierry Reding Cc: linux-mmc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Andrew Bresticker Subject: [PATCH v3 2/2] mmc: tegra: fix reporting of base clock frequency Date: Thu, 22 May 2014 08:55:36 -0700 Message-Id: <1400774136-12396-2-git-send-email-abrestic@chromium.org> X-Mailer: git-send-email 1.9.1.423.g4596e3a In-Reply-To: <1400774136-12396-1-git-send-email-abrestic@chromium.org> References: <1400774136-12396-1-git-send-email-abrestic@chromium.org> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Tegra SDHCI controllers, by default, report a base clock frequency of 208Mhz in SDHCI_CAPABILTIES which may or may not be equal to the actual base clock frequency. This is because the clock rate is configured by the clock controller, which is external to the SD/MMC controller. Since the SD/MMC controller has no knowledge of how this clock is configured, it will simply report the maximum frequency. While the reported value can be overridden by setting BASE_CLK_FREQ in VENDOR_CLOCK_CTRL on Tegra30 and later SoCs, just set CAP_CLOCK_BASE_BROKEN and supply sdhci_pltfm_clk_get_max_clock(), which simply does a clk_get_rate(), as the get_max_clock() callback. Signed-off-by: Andrew Bresticker Tested-by: Stephen Warren Acked-by: Stephen Warren Signed-off-by: Ulf Hansson --- Changes from v2: - rebased on mmc-next Changes from v1: - fixed up commit message per Stephen's suggestions --- drivers/mmc/host/sdhci-tegra.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 4375cd4..d93a063 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -154,13 +154,15 @@ static const struct sdhci_ops tegra_sdhci_ops = { .set_bus_width = tegra_sdhci_set_bus_width, .reset = tegra_sdhci_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, + .get_max_clock = sdhci_pltfm_clk_get_max_clock, }; static const struct sdhci_pltfm_data sdhci_tegra20_pdata = { .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | - SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, + SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .ops = &tegra_sdhci_ops, }; @@ -175,7 +177,8 @@ static const struct sdhci_pltfm_data sdhci_tegra30_pdata = { SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | - SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, + SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .ops = &tegra_sdhci_ops, }; @@ -191,7 +194,8 @@ static const struct sdhci_pltfm_data sdhci_tegra114_pdata = { SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | SDHCI_QUIRK_SINGLE_POWER_WRITE | SDHCI_QUIRK_NO_HISPD_BIT | - SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC, + SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | + SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .ops = &tegra_sdhci_ops, };