From patchwork Tue Mar 19 14:26:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 2301071 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 8354EDFB79 for ; Tue, 19 Mar 2013 14:30:27 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHxVd-0005mK-Ok; Tue, 19 Mar 2013 14:27:25 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHxVa-0005la-VA for linux-arm-kernel@lists.infradead.org; Tue, 19 Mar 2013 14:27:23 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2JER7QP003490; Tue, 19 Mar 2013 09:27:07 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2JER7lY007427; Tue, 19 Mar 2013 09:27:07 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 19 Mar 2013 09:27:07 -0500 Received: from localhost.localdomain (h112-117.vpn.ti.com [172.24.112.117]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2JER1Cs025611; Tue, 19 Mar 2013 09:27:05 -0500 From: Roger Quadros To: , Subject: [RFC][PATCH 1/2] ARM: OMAP4: clock: Add device tree support for AUXCLKs Date: Tue, 19 Mar 2013 16:26:59 +0200 Message-ID: <1363703220-4777-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1363703220-4777-1-git-send-email-rogerq@ti.com> References: <1363703220-4777-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130319_102723_086840_BE3EB66B X-CRM114-Status: GOOD ( 17.89 ) X-Spam-Score: -9.4 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -2.5 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-usb@vger.kernel.org, linux@arm.linux.org.uk, devicetree-discuss@lists.ozlabs.org, rnayak@ti.com, linux-kernel@vger.kernel.org, balbi@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rogerq@ti.com 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Register a device tree clock provider for AUX clocks on the OMAP4 SoC. Also provide the binding information. Signed-off-by: Roger Quadros --- .../devicetree/bindings/clock/omap4-clock.txt | 32 ++++++++++++++++++ arch/arm/boot/dts/omap4.dtsi | 5 +++ arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/cclock44xx_data.c | 35 ++++++++++++++++++++ arch/arm/mach-omap2/clock44xx.h | 1 + arch/arm/mach-omap2/common.h | 9 +++++ arch/arm/mach-omap2/io.c | 6 +++ 7 files changed, 89 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/omap4-clock.txt diff --git a/Documentation/devicetree/bindings/clock/omap4-clock.txt b/Documentation/devicetree/bindings/clock/omap4-clock.txt new file mode 100644 index 0000000..9d5448b --- /dev/null +++ b/Documentation/devicetree/bindings/clock/omap4-clock.txt @@ -0,0 +1,32 @@ +* Clock bindings for Texas Instruments OMAP4 SCRM clocks + +Required properties: +- compatible: Should be "ti,omap4-scrm" +- #clock-cells: Should be <1> + +The clock consumer should specify the desired clock by having the clock +ID in its "clocks" phandle cell. The following is a full list of SCRM +clocks and IDs. + + Clock ID + ------------------ + auxclk0_ck 0 + auxclk1_ck 1 + auxclk1_ck 1 + auxclk1_ck 1 + auxclk1_ck 1 + +Example: + +aux_clks: scrmclks { + compatible = "ti,omap4-scrm"; + #clock-cells = <1>; +}; + +hsusb1_phy: hsusb1_phy { + compatible = "usb-nop-xceiv"; + reset-supply = <&hsusb1_reset>; + clocks = <&aux_clks 3>; + clock-names = "main_clk"; + clock-frequency = <19200000>; +}; diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index b7db1a2..97de56c 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -101,6 +101,11 @@ ti,hwmods = "counter_32k"; }; + aux_clks: scrmclks { + compatible = "ti,omap4-scrm"; + #clock-cells = <1>; + }; + omap4_pmx_core: pinmux@4a100040 { compatible = "ti,omap4-padconf", "pinctrl-single"; reg = <0x4a100040 0x0196>; diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 0274ff7..23f2064 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -158,7 +158,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") .init_irq = omap_gic_of_init, .init_machine = omap_generic_init, .init_late = omap4430_init_late, - .init_time = omap4_local_timer_init, + .init_time = omap4_init_time, .dt_compat = omap4_boards_compat, .restart = omap44xx_restart, MACHINE_END diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c index 3d58f33..bfc46c1 100644 --- a/arch/arm/mach-omap2/cclock44xx_data.c +++ b/arch/arm/mach-omap2/cclock44xx_data.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "soc.h" #include "iomap.h" @@ -1663,6 +1664,40 @@ static struct omap_clk omap44xx_clks[] = { CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X), }; +static struct clk *scrm_clks[] = { + &auxclk0_ck, + &auxclk1_ck, + &auxclk2_ck, + &auxclk3_ck, + &auxclk4_ck, + &auxclk5_ck, +}; + +static struct clk_onecell_data scrm_data; + +#ifdef CONFIG_OF +int __init omap4_clk_init_dt(void) +{ + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "ti,omap4-scrm"); + if (np) { + scrm_data.clks = scrm_clks; + scrm_data.clk_num = ARRAY_SIZE(scrm_clks); + of_clk_add_provider(np, of_clk_src_onecell_get, &scrm_data); + } + + return 0; +} + +#else + +int __init omap4_clk_init_dt(void) +{ + return 0; +} +#endif /* CONFIG_OF */ + int __init omap4xxx_clk_init(void) { u32 cpu_clkflg; diff --git a/arch/arm/mach-omap2/clock44xx.h b/arch/arm/mach-omap2/clock44xx.h index 287a46f..6395f63 100644 --- a/arch/arm/mach-omap2/clock44xx.h +++ b/arch/arm/mach-omap2/clock44xx.h @@ -16,5 +16,6 @@ #define OMAP4430_REGM4XEN_MULT 4 int omap4xxx_clk_init(void); +int omap4_clk_init_dt(void); #endif diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index 0a6b9c7..1941d1c 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -98,6 +98,7 @@ void am35xx_init_early(void); void ti81xx_init_early(void); void am33xx_init_early(void); void omap4430_init_early(void); +void omap4_init_time(void); void omap5_init_early(void); void omap3_init_late(void); /* Do not use this one */ void omap4430_init_late(void); @@ -143,6 +144,14 @@ static inline void omap44xx_restart(char mode, const char *cmd) } #endif +#ifdef CONFIG_ARCH_OMAP4 +void omap4_init_time(void); +#else +static inline void omap4_init_time(void) +{ +} +#endif + /* This gets called from mach-omap2/io.c, do not call this */ void __init omap2_set_globals_tap(u32 class, void __iomem *tap); diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 2c3fdd6..c504363 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -603,6 +603,12 @@ void __init omap4430_init_late(void) omap4_pm_init(); omap2_clk_enable_autoidle_all(); } + +void __init omap4_init_time(void) +{ + omap4_clk_init_dt(); + omap4_local_timer_init(); +} #endif #ifdef CONFIG_SOC_OMAP5