From patchwork Mon Jan 13 09:14:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 23154 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 48982216D9 for ; Mon, 13 Jan 2014 09:14:51 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kp14sf3379806pab.10 for ; Mon, 13 Jan 2014 01:14:50 -0800 (PST) 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=p67BYyVwRNP1sN68Kqc5uIcvjcq+GrtAw4QZWr2TFLA=; b=l3tM70litqy5hkTk2H8YfqOKpqT2xSMlcqBwlk9nScOZC5GlA6MSqJjYi+WbsdP7xx 4BED0m93oD0w/FxaH3x9Qslm8NZjiSa/1nJxln0V3sQZF6XJ3VoZ1jPDauM7EuIzvZbe ONF/VcIecVIETGXK5uqURGdhGZ16AkKwRcp5IfRb7NzT33cylg5w8IqSzfcap7MJ0sHQ v0OjxKH0rpuewHEho0izh6I/eSKXOGylS/wqFqLBKVNDahKV4MUz/0WHYqkkxxIvnSsS UK2uGXeADhut9d+hi0g8JGlV0PR9kCzEU0siKmgP3Q0w6HUhpFRN5/SODn3DzatCtiO7 w6Qg== X-Gm-Message-State: ALoCoQktMkFeBJCAoKNR9xNe+N25gltK7LZKJJeHHyixISTZVZtCWeSGyOsa8lz47wWpP32mf3Ef X-Received: by 10.68.197.73 with SMTP id is9mr4103235pbc.0.1389604490545; Mon, 13 Jan 2014 01:14:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.100 with SMTP id g4ls457911qez.1.gmail; Mon, 13 Jan 2014 01:14:50 -0800 (PST) X-Received: by 10.52.167.163 with SMTP id zp3mr10458vdb.82.1389604490385; Mon, 13 Jan 2014 01:14:50 -0800 (PST) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id j1si199041vcs.66.2014.01.13.01.14.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 01:14:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.53; Received: by mail-vb0-f53.google.com with SMTP id p17so850047vbe.26 for ; Mon, 13 Jan 2014 01:14:50 -0800 (PST) X-Received: by 10.58.116.239 with SMTP id jz15mr1697673veb.26.1389604490315; Mon, 13 Jan 2014 01:14:50 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp113915ved; Mon, 13 Jan 2014 01:14:49 -0800 (PST) X-Received: by 10.68.223.9 with SMTP id qq9mr28384659pbc.58.1389604489140; Mon, 13 Jan 2014 01:14:49 -0800 (PST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by mx.google.com with ESMTPS id l8si15085999pao.297.2014.01.13.01.14.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 01:14:49 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of zhangfei.gao@linaro.org) client-ip=209.85.220.51; Received: by mail-pa0-f51.google.com with SMTP id fb1so823702pad.24 for ; Mon, 13 Jan 2014 01:14:48 -0800 (PST) X-Received: by 10.68.241.234 with SMTP id wl10mr27969510pbc.121.1389604488731; Mon, 13 Jan 2014 01:14:48 -0800 (PST) Received: from localhost.localdomain ([180.150.157.4]) by mx.google.com with ESMTPSA id y9sm46811507pas.10.2014.01.13.01.14.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 01:14:48 -0800 (PST) From: Zhangfei Gao To: Chris Ball , Arnd Bergmann , Mike Turquette , Jaehoon Chung , Seungwon Jeon , Haojian Zhuang , brooke.wangzhigang@huawei.com Cc: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, devicetree@vger.kernel.org, Zhangfei Gao Subject: [PATCH 2/2] mmc: dw_mmc: k3: remove clk_table Date: Mon, 13 Jan 2014 17:14:29 +0800 Message-Id: <1389604469-8064-3-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389604469-8064-1-git-send-email-zhangfei.gao@linaro.org> References: <1389604469-8064-1-git-send-email-zhangfei.gao@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhangfei.gao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Remove clk_table and directly use ios->clock as clock source rate. Abstract init clock rate and max clock limitation in clk.c Signed-off-by: Zhangfei Gao --- .../devicetree/bindings/mmc/k3-dw-mshc.txt | 14 ------- drivers/mmc/host/dw_mmc-k3.c | 41 +------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt index d7e2d7f159bb..b8653ea97957 100644 --- a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt +++ b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt @@ -14,18 +14,6 @@ Required Properties: * compatible: should be one of the following. - "hisilicon,hi4511-dw-mshc": for controllers with hi4511 specific extentions. -* clock-freq-table: should be the frequency (in Hz) array of the ciu clock - in each supported mode. - 0. CIU clock rate in Hz for DS mode - 1. CIU clock rate in Hz for MMC HS mode - 2. CIU clock rate in Hz for SD HS mode - 3. CIU clock rate in Hz for SDR12 mode - 4. CIU clock rate in Hz for SDR25 mode - 5. CIU clock rate in Hz for SDR50 mode - 6. CIU clock rate in Hz for SDR104 mode - 7. CIU clock rate in Hz for DDR50 mode - 8. CIU clock rate in Hz for HS200 mode - Example: /* for Hi3620 */ @@ -39,8 +27,6 @@ Example: #size-cells = <0>; clocks = <&mmc_clock HI3620_SD_CIUCLK>, <&clock HI3620_DDRC_PER_CLK>; clock-names = "ciu", "biu"; - clock-freq-table = - <25000000 0 50000000 25000000 50000000 100000000 0 50000000>; }; /* Board portion */ diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c index 68e5e428e8f6..84e1a670f8c7 100644 --- a/drivers/mmc/host/dw_mmc-k3.c +++ b/drivers/mmc/host/dw_mmc-k3.c @@ -18,56 +18,19 @@ #include "dw_mmc.h" #include "dw_mmc-pltfm.h" -#define MAX_NUMS 10 -struct dw_mci_k3_priv_data { - u32 clk_table[MAX_NUMS]; -}; - static void dw_mci_k3_set_ios(struct dw_mci *host, struct mmc_ios *ios) { - struct dw_mci_k3_priv_data *priv = host->priv; - u32 rate = priv->clk_table[ios->timing]; int ret; - if (!rate) { - dev_warn(host->dev, - "no specified rate in timing %u\n", ios->timing); - return; - } - - ret = clk_set_rate(host->ciu_clk, rate); + ret = clk_set_rate(host->ciu_clk, ios->clock); if (ret) - dev_warn(host->dev, "failed to set clock rate %uHz\n", rate); + dev_warn(host->dev, "failed to set rate %uHz\n", ios->clock); host->bus_hz = clk_get_rate(host->ciu_clk); } -static int dw_mci_k3_parse_dt(struct dw_mci *host) -{ - struct dw_mci_k3_priv_data *priv; - struct device_node *node = host->dev->of_node; - struct property *prop; - const __be32 *cur; - u32 val, num = 0; - - priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) { - dev_err(host->dev, "mem alloc failed for private data\n"); - return -ENOMEM; - } - host->priv = priv; - - of_property_for_each_u32(node, "clock-freq-table", prop, cur, val) { - if (num >= MAX_NUMS) - break; - priv->clk_table[num++] = val; - } - return 0; -} - static const struct dw_mci_drv_data k3_drv_data = { .set_ios = dw_mci_k3_set_ios, - .parse_dt = dw_mci_k3_parse_dt, }; static const struct of_device_id dw_mci_k3_match[] = {