-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLK: TI: add support for clockdomain binding
Some OMAP clocks require knowledge about their parent clockdomain for book keeping purposes. This patch creates a new DT binding for TI clockdomains, which act as a collection of device clocks. Clockdomain itself is rather misleading name for the hardware functionality, as at least on OMAP4 / OMAP5 / DRA7 the clockdomains can be collections of either clocks and/or IP blocks, thus idle-domain or such might be more appropriate. For most cases on these SoCs, the kernel doesn't even need the information and the mappings can be ignored. Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
- Loading branch information
Tero Kristo
authored and
Mike Turquette
committed
Jan 17, 2014
1 parent
f60b1ea
commit 3cd4a59
Showing
4 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
Documentation/devicetree/bindings/clock/ti/clockdomain.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Binding for Texas Instruments clockdomain. | ||
|
||
Binding status: Unstable - ABI compatibility may be broken in the future | ||
|
||
This binding uses the common clock binding[1] in consumer role. | ||
Every clock on TI SoC belongs to one clockdomain, but software | ||
only needs this information for specific clocks which require | ||
their parent clockdomain to be controlled when the clock is | ||
enabled/disabled. This binding doesn't define a new clock | ||
binding type, it is used to group existing clock nodes under | ||
hardware hierarchy. | ||
|
||
[1] Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
|
||
Required properties: | ||
- compatible : shall be "ti,clockdomain" | ||
- #clock-cells : from common clock binding; shall be set to 0. | ||
- clocks : link phandles of clocks within this domain | ||
|
||
Examples: | ||
dss_clkdm: dss_clkdm { | ||
compatible = "ti,clockdomain"; | ||
clocks = <&dss1_alwon_fck_3430es2>, <&dss_ick_3430es2>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ifneq ($(CONFIG_OF),) | ||
obj-y += clk.o autoidle.o | ||
obj-y += clk.o autoidle.o clockdomain.o | ||
clk-common = dpll.o composite.o divider.o gate.o \ | ||
fixed-factor.o | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* OMAP clockdomain support | ||
* | ||
* Copyright (C) 2013 Texas Instruments, Inc. | ||
* | ||
* Tero Kristo <t-kristo@ti.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
* kind, whether express or implied; without even the implied warranty | ||
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#include <linux/clk-provider.h> | ||
#include <linux/slab.h> | ||
#include <linux/of.h> | ||
#include <linux/of_address.h> | ||
#include <linux/clk/ti.h> | ||
|
||
#undef pr_fmt | ||
#define pr_fmt(fmt) "%s: " fmt, __func__ | ||
|
||
static void __init of_ti_clockdomain_setup(struct device_node *node) | ||
{ | ||
struct clk *clk; | ||
struct clk_hw *clk_hw; | ||
const char *clkdm_name = node->name; | ||
int i; | ||
int num_clks; | ||
|
||
num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells"); | ||
|
||
for (i = 0; i < num_clks; i++) { | ||
clk = of_clk_get(node, i); | ||
if (__clk_get_flags(clk) & CLK_IS_BASIC) { | ||
pr_warn("can't setup clkdm for basic clk %s\n", | ||
__clk_get_name(clk)); | ||
continue; | ||
} | ||
clk_hw = __clk_get_hw(clk); | ||
to_clk_hw_omap(clk_hw)->clkdm_name = clkdm_name; | ||
omap2_init_clk_clkdm(clk_hw); | ||
} | ||
} | ||
|
||
static struct of_device_id ti_clkdm_match_table[] __initdata = { | ||
{ .compatible = "ti,clockdomain" }, | ||
{ } | ||
}; | ||
|
||
/** | ||
* ti_dt_clockdomains_setup - setup device tree clockdomains | ||
* | ||
* Initializes clockdomain nodes for a SoC. This parses through all the | ||
* nodes with compatible = "ti,clockdomain", and add the clockdomain | ||
* info for all the clocks listed under these. This function shall be | ||
* called after rest of the DT clock init has completed and all | ||
* clock nodes have been registered. | ||
*/ | ||
void __init ti_dt_clockdomains_setup(void) | ||
{ | ||
struct device_node *np; | ||
for_each_matching_node(np, ti_clkdm_match_table) { | ||
of_ti_clockdomain_setup(np); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters