From patchwork Wed May 28 13:47:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 31070 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E90C320068 for ; Wed, 28 May 2014 13:48:09 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id jt11sf51589307pbb.2 for ; Wed, 28 May 2014 06:48:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=nVwJzu6LDM42HPdIHJSIAFCOZBbChRpnl+/tNNaznes=; b=CyL61CFqnHQUQGycDjTzYU1WrCju9JZxxlhEEWFrGZya91ZSGVc991x/+cksnzgibc XPvCdnWY9wL5MMn4CU+NVBeqK7MlrqrNvMmKw6wvCS2jDDW8Q9/iM5nFeXUaLzSqyyOT 3VEok3hZfx3mNWZ91uwApFsYgPcm0d5ZvJOZ8+JU51+7mvXcVdf3/zFqkK909nRugtx2 0SQXPdTIvXepo/wCzkoehgZMDSyo+pB5ekQYXxWApOey5yxImFlbkNFcJkZJu8E7gKG7 nSbSeJHKsp64bPjFSeYZ47PB8Ce99egzor4Repp0RQRxFofAuNyEa7bTgWFIphIfXS+p f/mg== X-Gm-Message-State: ALoCoQkQsO5OJGUpCAHiMdFHzRJ2rrVaUsxCNEfExLUfGgsyc0kACewNgx00PkaE60KvomijXUqJ X-Received: by 10.66.137.105 with SMTP id qh9mr9977571pab.30.1401284889215; Wed, 28 May 2014 06:48:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.203 with SMTP id h69ls113346qgh.56.gmail; Wed, 28 May 2014 06:48:09 -0700 (PDT) X-Received: by 10.52.93.201 with SMTP id cw9mr868009vdb.80.1401284889048; Wed, 28 May 2014 06:48:09 -0700 (PDT) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id k4si10572367vch.63.2014.05.28.06.48.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 28 May 2014 06:48:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.176 as permitted sender) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id jz11so12319596veb.7 for ; Wed, 28 May 2014 06:48:09 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr34459288vcb.0.1401284888961; Wed, 28 May 2014 06:48:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp204427vcb; Wed, 28 May 2014 06:48:08 -0700 (PDT) X-Received: by 10.66.120.201 with SMTP id le9mr45746774pab.98.1401284887018; Wed, 28 May 2014 06:48:07 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gp6si23823337pac.215.2014.05.28.06.48.03 for ; Wed, 28 May 2014 06:48:03 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754368AbaE1Nrx (ORCPT + 27 others); Wed, 28 May 2014 09:47:53 -0400 Received: from mail-we0-f175.google.com ([74.125.82.175]:49492 "EHLO mail-we0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754320AbaE1Nru (ORCPT ); Wed, 28 May 2014 09:47:50 -0400 Received: by mail-we0-f175.google.com with SMTP id p10so2477215wes.34 for ; Wed, 28 May 2014 06:47:49 -0700 (PDT) X-Received: by 10.194.176.37 with SMTP id cf5mr27303758wjc.79.1401284869455; Wed, 28 May 2014 06:47:49 -0700 (PDT) Received: from srini-ThinkPad-X1-Carbon-2nd.dlink.com (host-78-149-4-211.as13285.net. [78.149.4.211]) by mx.google.com with ESMTPSA id s9sm17016112wix.13.2014.05.28.06.47.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 May 2014 06:47:48 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: Russell King , Ulf Hansson , linux-mmc@vger.kernel.org Cc: Chris Ball , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linus.walleij@linaro.org, Srinivas Kandagatla Subject: [PATCH v4 11/13] mmc: mmci: add f_max to variant structure Date: Wed, 28 May 2014 14:47:42 +0100 Message-Id: <1401284862-16894-1-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401284608-16428-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1401284608-16428-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: srinivas.kandagatla@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Srinivas Kandagatla Some of the controller have maximum supported frequency, This patch adds support in variant data structure to specify such restrictions. This gives more flexibility in calculating the f_max before passing it to mmc-core. Signed-off-by: Srinivas Kandagatla --- drivers/mmc/host/mmci.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index fd40f9a..202f2d5 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -67,6 +67,7 @@ static unsigned int fmax = 515633; * @blksz_datactrl4: true if Block size is at b4..b16 position in datactrl * register * @pwrreg_powerup: power up value for MMCIPOWER register + * @f_max: maximum clk frequency supported by the controller. * @signal_direction: input/out direction of bus signals can be indicated * @pwrreg_clkgate: MMCIPOWER register must be used to gate the clock * @busy_detect: true if busy detection on dat0 is supported @@ -87,6 +88,7 @@ struct variant_data { bool blksz_datactrl16; bool blksz_datactrl4; u32 pwrreg_powerup; + u32 f_max; bool signal_direction; bool pwrreg_clkgate; bool busy_detect; @@ -98,6 +100,7 @@ static struct variant_data variant_arm = { .fifohalfsize = 8 * 4, .datalength_bits = 16, .pwrreg_powerup = MCI_PWR_UP, + .f_max = 100000000, }; static struct variant_data variant_arm_extended_fifo = { @@ -105,6 +108,7 @@ static struct variant_data variant_arm_extended_fifo = { .fifohalfsize = 64 * 4, .datalength_bits = 16, .pwrreg_powerup = MCI_PWR_UP, + .f_max = 100000000, }; static struct variant_data variant_arm_extended_fifo_hwfc = { @@ -113,6 +117,7 @@ static struct variant_data variant_arm_extended_fifo_hwfc = { .clkreg_enable = MCI_ARM_HWFCEN, .datalength_bits = 16, .pwrreg_powerup = MCI_PWR_UP, + .f_max = 100000000, }; static struct variant_data variant_u300 = { @@ -123,6 +128,7 @@ static struct variant_data variant_u300 = { .datalength_bits = 16, .sdio = true, .pwrreg_powerup = MCI_PWR_ON, + .f_max = 100000000, .signal_direction = true, .pwrreg_clkgate = true, .pwrreg_nopower = true, @@ -136,6 +142,7 @@ static struct variant_data variant_nomadik = { .sdio = true, .st_clkdiv = true, .pwrreg_powerup = MCI_PWR_ON, + .f_max = 100000000, .signal_direction = true, .pwrreg_clkgate = true, .pwrreg_nopower = true, @@ -152,6 +159,7 @@ static struct variant_data variant_ux500 = { .sdio = true, .st_clkdiv = true, .pwrreg_powerup = MCI_PWR_ON, + .f_max = 100000000, .signal_direction = true, .pwrreg_clkgate = true, .busy_detect = true, @@ -171,6 +179,7 @@ static struct variant_data variant_ux500v2 = { .st_clkdiv = true, .blksz_datactrl16 = true, .pwrreg_powerup = MCI_PWR_ON, + .f_max = 100000000, .signal_direction = true, .pwrreg_clkgate = true, .busy_detect = true, @@ -189,6 +198,7 @@ static struct variant_data variant_qcom = { .blksz_datactrl4 = true, .datalength_bits = 24, .pwrreg_powerup = MCI_PWR_UP, + .f_max = 208000000, }; static int mmci_card_busy(struct mmc_host *mmc) @@ -1485,8 +1495,8 @@ static int mmci_probe(struct amba_device *dev, * so we try to adjust the clock down to this, * (if possible). */ - if (host->mclk > 100000000) { - ret = clk_set_rate(host->clk, 100000000); + if (host->mclk > host->variant->f_max) { + ret = clk_set_rate(host->clk, host->variant->f_max); if (ret < 0) goto clk_disable; host->mclk = clk_get_rate(host->clk);