From patchwork Tue Feb 4 18:17:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Towle X-Patchwork-Id: 3585201 Return-Path: X-Original-To: patchwork-linux-sh@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 EECE99F2E9 for ; Wed, 5 Feb 2014 08:52:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2962B20170 for ; Wed, 5 Feb 2014 08:52:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C4C820163 for ; Wed, 5 Feb 2014 08:52:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750886AbaBEIw4 (ORCPT ); Wed, 5 Feb 2014 03:52:56 -0500 Received: from 82-68-191-81.dsl.posilan.com ([82.68.191.81]:49533 "EHLO xk120" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750789AbaBEIwz (ORCPT ); Wed, 5 Feb 2014 03:52:55 -0500 Received: from william by xk120 with local (Exim 4.80) (envelope-from ) id 1WAkZ3-0007S1-3e; Tue, 04 Feb 2014 18:17:41 +0000 From: William Towle To: linux-kernel@lists.codethink.co.uk, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org, laurent.pinchart+renesas@ideasonboard.com, horms+renesas@verge.net.au, magnus.damm@gmail.com, mturquette@linaro.org Cc: William Towle Subject: [PATCH 3/3] clk: shmobile: handle multiple parent clocks for cpg clocks Date: Tue, 4 Feb 2014 18:17:38 +0000 Message-Id: <1391537858-28593-4-git-send-email-william.towle@codethink.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1391537858-28593-1-git-send-email-william.towle@codethink.co.uk> References: <1391537858-28593-1-git-send-email-william.towle@codethink.co.uk> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 current action on registering the cpg_clocks is to have them all registered with a single parent clock. This is not the correct action, as some of the clocks such as the SDHI and QSPI are actually parented to PLL1 or PLL1/2. This also requires a change to the device-tree files to make sure that appropriate parent clocks are assigned. [ben.dooks@codethink.co.uk: updated patch description] Signed-off-by: William Towle Reviewed-by: Ben Dooks --- drivers/clk/shmobile/clk-rcar-gen2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c index df4a1e6..57bc2e4 100644 --- a/drivers/clk/shmobile/clk-rcar-gen2.c +++ b/drivers/clk/shmobile/clk-rcar-gen2.c @@ -185,7 +185,7 @@ static u32 cpg_mode __initdata; static struct clk * __init rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, const struct cpg_pll_config *config, - const char *name) + const char *name, int index) { const struct clk_div_table *table = NULL; const char *parent_name = "main"; @@ -193,8 +193,13 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg, unsigned int mult = 1; unsigned int div = 1; + parent_name = of_clk_get_parent_name(np, index); + if (!parent_name) { + pr_err("no parent set for clocks array\n"); + return ERR_PTR(-ENOENT); + } + if (!strcmp(name, "main")) { - parent_name = of_clk_get_parent_name(np, 0); div = config->extal_div; } else if (!strcmp(name, "pll0")) { /* PLL0 is a configurable multiplier clock. Register it as a @@ -279,7 +284,7 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np) of_property_read_string_index(np, "clock-output-names", i, &name); - clk = rcar_gen2_cpg_register_clock(np, cpg, config, name); + clk = rcar_gen2_cpg_register_clock(np, cpg, config, name, i); if (IS_ERR(clk)) pr_err("%s: failed to register %s %s clock (%ld)\n", __func__, np->name, name, PTR_ERR(clk));