From patchwork Thu May 22 16:24:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 4224331 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 531999F36A for ; Thu, 22 May 2014 16:27:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 312962020F for ; Thu, 22 May 2014 16:27:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 F39082034B for ; Thu, 22 May 2014 16:27:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnVoa-0005cC-8n; Thu, 22 May 2014 16:25:56 +0000 Received: from ns.mm-sol.com ([37.157.136.199] helo=extserv.mm-sol.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnVoB-0005JJ-Eq for linux-arm-kernel@lists.infradead.org; Thu, 22 May 2014 16:25:32 +0000 Received: from mms.wifi.mm-sol.com (unknown [37.157.136.206]) by extserv.mm-sol.com (Postfix) with ESMTPSA id EF585C7A5; Thu, 22 May 2014 19:25:09 +0300 (EEST) From: Georgi Djakov To: mturquette@linaro.org, linux@arm.linux.org.uk, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, sboyd@codeaurora.org, rdunlap@infradead.org Subject: [PATCH v1 2/5] clk: qcom: Allow an override function to be passed as data Date: Thu, 22 May 2014 19:24:42 +0300 Message-Id: <1400775885-10296-3-git-send-email-gdjakov@mm-sol.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1400775885-10296-1-git-send-email-gdjakov@mm-sol.com> References: <1400775885-10296-1-git-send-email-gdjakov@mm-sol.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140522_092531_712138_F04CA2BF X-CRM114-Status: GOOD ( 11.83 ) X-Spam-Score: -0.7 (/) Cc: devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Georgi Djakov 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=-2.5 required=5.0 tests=BAYES_00,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 The APQ8084 and MSM8974 SoCs share a lot of clock data. Instead of duplicating all the data, we can add the support for APQ8084 into the MSM8974 code and just describe the differences by using an override function. This patch applies to the clk-next tree and the following patchset on top of it: https://lkml.org/lkml/2014/5/16/666 Signed-off-by: Georgi Djakov --- drivers/clk/qcom/gcc-msm8974.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/clk/qcom/gcc-msm8974.c b/drivers/clk/qcom/gcc-msm8974.c index 33eb051..58cb2f5 100644 --- a/drivers/clk/qcom/gcc-msm8974.c +++ b/drivers/clk/qcom/gcc-msm8974.c @@ -2674,14 +2674,6 @@ static const struct qcom_cc_desc gcc_msm8974_desc = { .num_resets = ARRAY_SIZE(gcc_msm8974_resets), }; -static const struct of_device_id gcc_msm8974_match_table[] = { - { .compatible = "qcom,gcc-msm8974" }, - { .compatible = "qcom,gcc-msm8974pro" , .data = (void *)1UL }, - { .compatible = "qcom,gcc-msm8974pro-ac", .data = (void *)1UL }, - { } -}; -MODULE_DEVICE_TABLE(of, gcc_msm8974_match_table); - static void msm8974_pro_clock_override(void) { sdcc1_apps_clk_src_init.parent_names = gcc_xo_gpll0_gpll4; @@ -2697,20 +2689,31 @@ static void msm8974_pro_clock_override(void) &gcc_sdcc1_cdccal_ff_clk.clkr; } +static const struct of_device_id gcc_msm8974_match_table[] = { + { .compatible = "qcom,gcc-msm8974" }, + { .compatible = "qcom,gcc-msm8974pro", + .data = &msm8974_pro_clock_override }, + { .compatible = "qcom,gcc-msm8974pro-ac", + .data = &msm8974_pro_clock_override }, + { } +}; +MODULE_DEVICE_TABLE(of, gcc_msm8974_match_table); + static int gcc_msm8974_probe(struct platform_device *pdev) { struct clk *clk; struct device *dev = &pdev->dev; - bool pro; const struct of_device_id *id; + void (*overrides)(void); id = of_match_device(gcc_msm8974_match_table, dev); if (!id) return -ENODEV; - pro = !!(id->data); - if (pro) - msm8974_pro_clock_override(); + if (id->data) { + overrides = id->data; + overrides(); + } /* Temporary until RPM clocks supported */ clk = clk_register_fixed_rate(dev, "xo", NULL, CLK_IS_ROOT, 19200000);