aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/samsung
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2013-03-18 00:43:56 -0400
committerKukjin Kim <kgene.kim@samsung.com>2013-03-28 01:46:33 -0400
commit5e2e0195ec89d8e266a2530ffec335c483c64899 (patch)
tree17da880c25938d08d4649f3607b757d94c9f3716 /drivers/clk/samsung
parent6e92bf5a01afb1f897aa15a34517da07d7c0c320 (diff)
clk: samsung: add infrastructure to add separate aliases
The current code adds aliases, if necessary, directly when adding the clock, limiting the number of possible aliases to one. Some platforms need more than one alias, like the hsmmc pclocks on s3c2416 which need a "hsmmc" and "mmc_busclk.0" alias for the s3c- sdhci driver. Therefore add the possibility to separately add clock aliases for previously created clocks. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Mike Turquette <mturquette@linaro.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'drivers/clk/samsung')
-rw-r--r--drivers/clk/samsung/clk.c33
-rw-r--r--drivers/clk/samsung/clk.h21
2 files changed, 54 insertions, 0 deletions
diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c
index 1ed571606395..82f27f644dae 100644
--- a/drivers/clk/samsung/clk.c
+++ b/drivers/clk/samsung/clk.c
@@ -97,6 +97,39 @@ void samsung_clk_add_lookup(struct clk *clk, unsigned int id)
97 clk_table[id] = clk; 97 clk_table[id] = clk;
98} 98}
99 99
100/* register a list of aliases */
101void __init samsung_clk_register_alias(struct samsung_clock_alias *list,
102 unsigned int nr_clk)
103{
104 struct clk *clk;
105 unsigned int idx, ret;
106
107 if (!clk_table) {
108 pr_err("%s: clock table missing\n", __func__);
109 return;
110 }
111
112 for (idx = 0; idx < nr_clk; idx++, list++) {
113 if (!list->id) {
114 pr_err("%s: clock id missing for index %d\n", __func__,
115 idx);
116 continue;
117 }
118
119 clk = clk_table[list->id];
120 if (!clk) {
121 pr_err("%s: failed to find clock %d\n", __func__,
122 list->id);
123 continue;
124 }
125
126 ret = clk_register_clkdev(clk, list->alias, list->dev_name);
127 if (ret)
128 pr_err("%s: failed to register lookup %s\n",
129 __func__, list->alias);
130 }
131}
132
100/* register a list of fixed clocks */ 133/* register a list of fixed clocks */
101void __init samsung_clk_register_fixed_rate( 134void __init samsung_clk_register_fixed_rate(
102 struct samsung_fixed_rate_clock *list, unsigned int nr_clk) 135 struct samsung_fixed_rate_clock *list, unsigned int nr_clk)
diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h
index 26a752b18f88..6bacd6fa0200 100644
--- a/drivers/clk/samsung/clk.h
+++ b/drivers/clk/samsung/clk.h
@@ -23,6 +23,25 @@
23#include <mach/map.h> 23#include <mach/map.h>
24 24
25/** 25/**
26 * struct samsung_clock_alias: information about mux clock
27 * @id: platform specific id of the clock.
28 * @dev_name: name of the device to which this clock belongs.
29 * @alias: optional clock alias name to be assigned to this clock.
30 */
31struct samsung_clock_alias {
32 unsigned int id;
33 const char *dev_name;
34 const char *alias;
35};
36
37#define ALIAS(_id, dname, a) \
38 { \
39 .id = _id, \
40 .dev_name = dname, \
41 .alias = a, \
42 }
43
44/**
26 * struct samsung_fixed_rate_clock: information about fixed-rate clock 45 * struct samsung_fixed_rate_clock: information about fixed-rate clock
27 * @id: platform specific id of the clock. 46 * @id: platform specific id of the clock.
28 * @name: name of this fixed-rate clock. 47 * @name: name of this fixed-rate clock.
@@ -251,6 +270,8 @@ extern void __init samsung_clk_of_register_fixed_ext(
251 270
252extern void samsung_clk_add_lookup(struct clk *clk, unsigned int id); 271extern void samsung_clk_add_lookup(struct clk *clk, unsigned int id);
253 272
273extern void samsung_clk_register_alias(struct samsung_clock_alias *list,
274 unsigned int nr_clk);
254extern void __init samsung_clk_register_fixed_rate( 275extern void __init samsung_clk_register_fixed_rate(
255 struct samsung_fixed_rate_clock *clk_list, unsigned int nr_clk); 276 struct samsung_fixed_rate_clock *clk_list, unsigned int nr_clk);
256extern void __init samsung_clk_register_fixed_factor( 277extern void __init samsung_clk_register_fixed_factor(