From patchwork Thu Aug 21 13:49:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 35767 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 B790320540 for ; Thu, 21 Aug 2014 13:50:22 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id et14sf75355520pad.6 for ; Thu, 21 Aug 2014 06:50:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=uLPnoKudRvPA3tjoDYrydQYLkJmfYtZ+I1pEbyxgM/Q=; b=DFHvVLxUHP/mfsmpO5lJABPsnFWFR9CjCxvax7nMf8mgJ1njWofkmTiLdE61ZXP90u ZVqyHYsWIvQ0RVNvknpzHIeFK1/WY1CAE0peppKWffBK30J4wXf9QRE3yLmpXeAWqLyY /tCBW8A1pni0ogmzJdfEmuDOlCWDn+/X113D9dHur3bdyXz4okeH5rpxU498EGKRoPyE nq6fLqL78fwS9tqY/CJKerwCTJHc04G7ruUiNLqNQts9V05MCHyZn1MF7QDaTt5uWy6/ DNl4BFyjC0xFLOpDd0emDmWsSlZlVFvGBLmtye96idw3zmz6UybDt9RJS859JjWY/bys 7r4A== X-Gm-Message-State: ALoCoQk2LvrZFa46B4AMh5Fo9kOMUM2cGa/2Mg+mRHIDs7u+eWxJUeTWmeHmtyy/csPn2T+EjPfK X-Received: by 10.66.246.229 with SMTP id xz5mr28804898pac.34.1408629022019; Thu, 21 Aug 2014 06:50:22 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.141 with SMTP id s13ls671343qga.6.gmail; Thu, 21 Aug 2014 06:50:21 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr42219615vcn.16.1408629021849; Thu, 21 Aug 2014 06:50:21 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id n4si12331664vda.71.2014.08.21.06.50.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Aug 2014 06:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so10754653vcb.31 for ; Thu, 21 Aug 2014 06:50:21 -0700 (PDT) X-Received: by 10.52.243.10 with SMTP id wu10mr459406vdc.45.1408629021754; Thu, 21 Aug 2014 06:50:21 -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.221.45.67 with SMTP id uj3csp137362vcb; Thu, 21 Aug 2014 06:50:21 -0700 (PDT) X-Received: by 10.66.141.109 with SMTP id rn13mr63270088pab.117.1408629020929; Thu, 21 Aug 2014 06:50:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cj8si29679911pad.40.2014.08.21.06.50.19 for ; Thu, 21 Aug 2014 06:50:20 -0700 (PDT) Received-SPF: none (google.com: linux-omap-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 S1755251AbaHUNuP (ORCPT + 6 others); Thu, 21 Aug 2014 09:50:15 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:60196 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755098AbaHUNuN (ORCPT ); Thu, 21 Aug 2014 09:50:13 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s7LDnJVL006969; Thu, 21 Aug 2014 08:49:19 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7LDnJ17024391; Thu, 21 Aug 2014 08:49:19 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Thu, 21 Aug 2014 08:49:19 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7LDnGkO006109; Thu, 21 Aug 2014 08:49:16 -0500 From: Tero Kristo To: CC: , Mike Turquette , Paul Walmsley , Tony Lindgren , Mark Rutland , Peter Ujfalusi , Jyri Sarha , Stefan Assmann Subject: [PATCH] clk: ti: change clock init to use generic of_clk_init Date: Thu, 21 Aug 2014 16:49:19 +0300 Message-ID: <1408628959-32442-1-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: t-kristo@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 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: , Previously, the TI clock driver initialized all the clocks hierarchically under each separate clock provider node. Now, each clock that requires IO access will instead check their parent node to find out which IO range to use. This patch allows the TI clock driver to use a few new features provided by the generic of_clk_init, and also allows registration of clock nodes outside the clock hierarchy (for example, any external clocks.) Signed-off-by: Tero Kristo Cc: Mike Turquette Cc: Paul Walmsley Cc: Tony Lindgren Cc: Mark Rutland Cc: Peter Ujfalusi Cc: Jyri Sarha Cc: Stefan Assmann Tested-by: Jyri Sarha --- arch/arm/mach-omap2/io.c | 10 ++++++++-- arch/arm/mach-omap2/prm_common.c | 2 -- drivers/clk/ti/clk.c | 31 ++++++++++++++++--------------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 5d0667c..3325df6 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -734,8 +734,14 @@ int __init omap_clk_init(void) ti_clk_init_features(); ret = of_prcm_init(); - if (!ret) - ret = omap_clk_soc_init(); + if (ret) + return ret; + + of_clk_init(NULL); + + ti_dt_clockdomains_setup(); + + ret = omap_clk_soc_init(); return ret; } diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 76ca320..3b89080 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c @@ -525,8 +525,6 @@ int __init of_prcm_init(void) memmap_index++; } - ti_dt_clockdomains_setup(); - return 0; } diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index b1a6f71..f7201d0 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -25,8 +25,8 @@ #undef pr_fmt #define pr_fmt(fmt) "%s: " fmt, __func__ -static int ti_dt_clk_memmap_index; struct ti_clk_ll_ops *ti_clk_ll_ops; +static struct device_node *clocks_node_ptr[CLK_MAX_MEMMAPS]; /** * ti_dt_clocks_register - register DT alias clocks during boot @@ -108,9 +108,21 @@ void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index) struct clk_omap_reg *reg; u32 val; u32 tmp; + int i; reg = (struct clk_omap_reg *)&tmp; - reg->index = ti_dt_clk_memmap_index; + + for (i = 0; i < CLK_MAX_MEMMAPS; i++) { + if (clocks_node_ptr[i] == node->parent) + break; + } + + if (i == CLK_MAX_MEMMAPS) { + pr_err("clk-provider not found for %s!\n", node->name); + return NULL; + } + + reg->index = i; if (of_property_read_u32_index(node, "reg", index, &val)) { pr_err("%s must have reg[%d]!\n", node->name, index); @@ -133,15 +145,10 @@ void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index) */ void ti_dt_clk_init_provider(struct device_node *parent, int index) { - const struct of_device_id *match; - struct device_node *np; struct device_node *clocks; - of_clk_init_cb_t clk_init_cb; struct clk_init_item *retry; struct clk_init_item *tmp; - ti_dt_clk_memmap_index = index; - /* get clocks for this parent */ clocks = of_get_child_by_name(parent, "clocks"); if (!clocks) { @@ -149,14 +156,8 @@ void ti_dt_clk_init_provider(struct device_node *parent, int index) return; } - for_each_child_of_node(clocks, np) { - match = of_match_node(&__clk_of_table, np); - if (!match) - continue; - clk_init_cb = (of_clk_init_cb_t)match->data; - pr_debug("%s: initializing: %s\n", __func__, np->name); - clk_init_cb(np); - } + /* add clocks node info */ + clocks_node_ptr[index] = clocks; list_for_each_entry_safe(retry, tmp, &retry_list, link) { pr_debug("retry-init: %s\n", retry->node->name);