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: 3474021 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F3DBB9F2E9 for ; Mon, 13 Jan 2014 09:16:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 593E32010E for ; Mon, 13 Jan 2014 09:16:25 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE44B200D9 for ; Mon, 13 Jan 2014 09:16:23 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2dcS-0006kR-Id; Mon, 13 Jan 2014 09:15:40 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2dcF-0000O6-2A; Mon, 13 Jan 2014 09:15:27 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W2dby-0000K2-Cp for linux-arm-kernel@lists.infradead.org; Mon, 13 Jan 2014 09:15:11 +0000 Received: by mail-pb0-f49.google.com with SMTP id jt11so7006291pbb.22 for ; Mon, 13 Jan 2014 01:14:48 -0800 (PST) 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=p67BYyVwRNP1sN68Kqc5uIcvjcq+GrtAw4QZWr2TFLA=; b=NTOYi0vkSRCz8L0J4aVxcAH+GMhknv5AcJuAF2RRU9BlK+j9vx7CgUoHMLkNf6d4Ef ibnYUL/TzwbRqaEWzDuoPUiT1smn0XTun+xlcf6ycVECaV3MfziNMtU9YWECdczrV6RG YK18t1lAhYpFLrWESC9MqPgwkJF2yZlykRN948BiN2e1iPwU3UxXmaxDh+NBNpo9oO8l H/z522BpfLoll8OeDSym5aYCkVJSZWE/aPf7H8V/+rPckImpZYz4IYvPeXz5ri0srm4A 3iLfaW1/nP3biRswnRiEaJBxv0jSnJyDUNT9AZaElC3mps7kR4D17j/qqfm1eXtFVcwo +pHg== X-Gm-Message-State: ALoCoQmW7ThMpu/hRLfijKKi33UjnsXivJghtC30sFDvWiTJMzGBMyzuNrV7eHKDCo1Hdzr2q0Wz 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140113_041510_550378_EAEA2EF0 X-CRM114-Status: GOOD ( 13.79 ) X-Spam-Score: -2.6 (--) Cc: devicetree@vger.kernel.org, Zhangfei Gao , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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 Acked-by: Seungwon Jeon --- .../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[] = {