From patchwork Fri Aug 1 13:15:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 34702 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 791A820540 for ; Fri, 1 Aug 2014 13:15:12 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf25145789pdj.8 for ; Fri, 01 Aug 2014 06:15:11 -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 :in-reply-to:references: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=9nVAZcqgFdc0DNS1NzpF7l8lXjXYxSrT+Me9mdK6clQ=; b=Jc8fFvN3s1utLL7Tf2xHUdCxhXgGDOHrZoRH5xsVBD/eEaDcu+QhYUEH8yTzdaiFCW 9sqbbpQBA6irPau+zubSiRBXn9d7JlrjpbeN2q+JkVulKpM8Cr8nIZT5fhpIe75/anOx CIeSlY/NbZm7O91JbTMd1+Ku25+r+lUtc9KiaoiqBlaIMOmprHNk+cz7qJcljAJ/5CQQ 315oRrA3d6eUf7rKS9bWZAv4X6ug22hVIXTciBpgP3USW7Rz1hznaGnGdwbvo73MbbdP q/PFclch/3yTqljRG3bU0JZDRzvYoDic3h0RuQCbXtLYeoeIM9pZzgYp/TsSSVlzc8fe r39Q== X-Gm-Message-State: ALoCoQlDwVAREKIfDm1gsDCMVqPpkS8buWlELGx+E5wpvXtdtMFKJw0wEQ90g6EyL7S8YCvoCuFi X-Received: by 10.70.44.230 with SMTP id h6mr2185284pdm.7.1406898911796; Fri, 01 Aug 2014 06:15:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.233 with SMTP id j96ls1289158qgd.80.gmail; Fri, 01 Aug 2014 06:15:11 -0700 (PDT) X-Received: by 10.220.195.67 with SMTP id eb3mr5939840vcb.30.1406898911624; Fri, 01 Aug 2014 06:15:11 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id kk1si7161122vdb.19.2014.08.01.06.15.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Aug 2014 06:15:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so6651575vcb.9 for ; Fri, 01 Aug 2014 06:15:11 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr4960793vdb.27.1406898911223; Fri, 01 Aug 2014 06:15:11 -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.37.5 with SMTP id tc5csp109846vcb; Fri, 1 Aug 2014 06:15:10 -0700 (PDT) X-Received: by 10.68.69.3 with SMTP id a3mr5980453pbu.94.1406898910189; Fri, 01 Aug 2014 06:15:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lm5si9743548pab.182.2014.08.01.06.15.09 for ; Fri, 01 Aug 2014 06:15:10 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S1755328AbaHANPI (ORCPT + 6 others); Fri, 1 Aug 2014 09:15:08 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:42725 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754881AbaHANPG (ORCPT ); Fri, 1 Aug 2014 09:15:06 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s71DEOVP011929; Fri, 1 Aug 2014 08:14:24 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s71DEO0p015651; Fri, 1 Aug 2014 08:14:24 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Fri, 1 Aug 2014 08:14:24 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s71DEJla024048; Fri, 1 Aug 2014 08:14:22 -0500 From: Tero Kristo To: , , , , CC: , Subject: [PATCH 1/1] clk: ti: add support for external clock provider Date: Fri, 1 Aug 2014 16:15:48 +0300 Message-ID: <1406898948-26113-2-git-send-email-t-kristo@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406898948-26113-1-git-send-email-t-kristo@ti.com> References: <1406898948-26113-1-git-send-email-t-kristo@ti.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.178 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: , External clock provider can now be used to register external clocks under it. This is needed as the TI clock driver only registers clocks hierarchically under clock providers, and external clocks do not belong under any of the current ones. Signed-off-by: Tero Kristo Tested-by: Jyri Sarha --- .../devicetree/bindings/arm/omap/ext-clocks.txt | 32 ++++++++++++++++++++ arch/arm/mach-omap2/io.c | 12 ++++++-- drivers/clk/ti/clk.c | 23 ++++++++++++++ include/linux/clk/ti.h | 2 ++ 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/omap/ext-clocks.txt diff --git a/Documentation/devicetree/bindings/arm/omap/ext-clocks.txt b/Documentation/devicetree/bindings/arm/omap/ext-clocks.txt new file mode 100644 index 0000000..8e784bb --- /dev/null +++ b/Documentation/devicetree/bindings/arm/omap/ext-clocks.txt @@ -0,0 +1,32 @@ +TI external clock provider properties + +External clock provider is used to group SoC external board specific +clock nodes. A separate provider node is required as the TI clock +driver registers clocks hierarchically. + +Required properties: +- compatible: Shall be: "ti,external-clocks" +- clocks: Contains the external clocks for the board +- clockdomains: Contains the external clockdomains for the board + +Example: + +ext_clocks { + compatible = "ti,external-clocks"; + + ext_clocks: clocks { + }; + + ext_clockdomains: clockdomains { + }; +}; + +... + +&ext_clocks { + gpio_test_clock { + compatible = "gpio-clock"; + #clock-cells = <0>; + enable-gpios = <&gpio5 25 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 8f55945..77be18b 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include @@ -729,8 +731,14 @@ int __init omap_clk_init(void) return 0; ret = of_prcm_init(); - if (!ret) - ret = omap_clk_soc_init(); + if (ret) + return ret; + + ret = ti_dt_clk_ext_init(); + if (ret) + return ret; + + ret = omap_clk_soc_init(); return ret; } diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index b1a6f71..c84ce4d 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -165,3 +165,26 @@ void ti_dt_clk_init_provider(struct device_node *parent, int index) kfree(retry); } } + +static struct of_device_id ti_ext_clk_match_table[] = { + { .compatible = "ti,external-clocks" }, + { } +}; + +/** + * ti_dt_clk_ext_init - initialize external clocks from DT + * + * Some clocks are provided from external chips outside the main SoC. + * The details for these are given under a special DT node, which will + * be parsed by this function. + */ +int ti_dt_clk_ext_init(void) +{ + struct device_node *np; + + for_each_matching_node(np, ti_ext_clk_match_table) { + ti_dt_clk_init_provider(np, -1); + } + + return 0; +} diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h index e8d8a35..188270c 100644 --- a/include/linux/clk/ti.h +++ b/include/linux/clk/ti.h @@ -310,6 +310,8 @@ int am43xx_dt_clk_init(void); int omap2420_dt_clk_init(void); int omap2430_dt_clk_init(void); +int ti_dt_clk_ext_init(void); + #ifdef CONFIG_OF void of_ti_clk_allow_autoidle_all(void); void of_ti_clk_deny_autoidle_all(void);