From patchwork Fri May 23 12:33:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 4232031 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5CD41BF90B for ; Fri, 23 May 2014 12:33:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 870A220386 for ; Fri, 23 May 2014 12:33:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A047020295 for ; Fri, 23 May 2014 12:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751951AbaEWMdd (ORCPT ); Fri, 23 May 2014 08:33:33 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:43534 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751911AbaEWMdc (ORCPT ); Fri, 23 May 2014 08:33:32 -0400 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:a236:9fff:fe00:814]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Wnoeg-0006lt-Jg; Fri, 23 May 2014 14:32:58 +0200 Received: from sha by dude.hi.pengutronix.de with local (Exim 4.82) (envelope-from ) id 1Wnoen-0001YH-HP; Fri, 23 May 2014 14:33:05 +0200 From: Sascha Hauer To: linux-mmc@vger.kernel.org Cc: Shawn Guo , , kernel@pengutronix.de, Sascha Hauer Subject: [PATCH 1/5] mmc: sdhci-esdhc-imx: add f_max field to private data Date: Fri, 23 May 2014 14:33:00 +0200 Message-Id: <1400848384-3226-2-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.0.0.rc0 In-Reply-To: <1400848384-3226-1-git-send-email-s.hauer@pengutronix.de> References: <1400848384-3226-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:a236:9fff:fe00:814 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mmc@vger.kernel.org Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver filled in the clk and clock fields in struct sdhci_pltfm_host, but they are unused in the sdhci-pltfm code and only ever used it for internal use. This adds a field f_max to private data and uses it instead. Signed-off-by: Sascha Hauer --- drivers/mmc/host/sdhci-esdhc-imx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index b841bb7..d530820 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -152,6 +152,7 @@ struct pltfm_imx_data { struct pinctrl_state *pins_200mhz; const struct esdhc_soc_data *socdata; struct esdhc_platform_data boarddata; + unsigned long f_max; struct clk *clk_ipg; struct clk *clk_ahb; struct clk *clk_per; @@ -574,19 +575,16 @@ static unsigned int esdhc_pltfm_get_max_clock(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct pltfm_imx_data *imx_data = pltfm_host->priv; - struct esdhc_platform_data *boarddata = &imx_data->boarddata; - if (boarddata->f_max && (boarddata->f_max < pltfm_host->clock)) - return boarddata->f_max; - else - return pltfm_host->clock; + return imx_data->f_max; } static unsigned int esdhc_pltfm_get_min_clock(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = pltfm_host->priv; - return pltfm_host->clock / 256 / 16; + return imx_data->f_max / 256 / 16; } static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, @@ -594,7 +592,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct pltfm_imx_data *imx_data = pltfm_host->priv; - unsigned int host_clock = pltfm_host->clock; + unsigned int host_clock = clk_get_rate(imx_data->clk_per); int pre_div = 2; int div = 1; u32 temp, val; @@ -994,8 +992,6 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) goto free_sdhci; } - pltfm_host->clk = imx_data->clk_per; - pltfm_host->clock = clk_get_rate(pltfm_host->clk); clk_prepare_enable(imx_data->clk_per); clk_prepare_enable(imx_data->clk_ipg); clk_prepare_enable(imx_data->clk_ahb); @@ -1051,6 +1047,10 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev) host->mmc->parent->platform_data); } + imx_data->f_max = clk_get_rate(imx_data->clk_per); + if (boarddata->f_max && boarddata->f_max < imx_data->f_max) + imx_data->f_max = boarddata->f_max; + /* write_protect */ if (boarddata->wp_type == ESDHC_WP_GPIO) { err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);