diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2014-02-16 16:32:00 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-02-16 22:10:06 -0500 |
commit | 189ef3d62df6701e58d216cf81277b88bb4ac7a8 (patch) | |
tree | 100f975297b92597403f6568844562c1a7d52cb5 | |
parent | 433aa851d4b32dc3b3de1e84dc20b57e157b25b9 (diff) |
ARM: shmobile: koelsch-reference: Refactor clock lookup hack
Make the clock lookup hack more generic to ease the addition of more
devices.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/board-koelsch-reference.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/arch/arm/mach-shmobile/board-koelsch-reference.c b/arch/arm/mach-shmobile/board-koelsch-reference.c index feb8d97ea2f7..42c6eb4c3e67 100644 --- a/arch/arm/mach-shmobile/board-koelsch-reference.c +++ b/arch/arm/mach-shmobile/board-koelsch-reference.c | |||
@@ -32,30 +32,42 @@ static void __init koelsch_add_standard_devices(void) | |||
32 | { | 32 | { |
33 | #ifdef CONFIG_COMMON_CLK | 33 | #ifdef CONFIG_COMMON_CLK |
34 | /* | 34 | /* |
35 | * This is a really crude hack to provide clkdev support to the SCIF | 35 | * This is a really crude hack to provide clkdev support to the CMT and |
36 | * and CMT devices until they get moved to DT. | 36 | * DU devices until they get moved to DT. |
37 | */ | 37 | */ |
38 | static const char * const scif_names[] = { | 38 | static const struct clk_name { |
39 | "scifa0", "scifa1", "scifb0", "scifb1", "scifb2", "scifa2", | 39 | const char *clk; |
40 | "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scifa3", | 40 | const char *con_id; |
41 | "scifa4", "scifa5", | 41 | const char *dev_id; |
42 | } clk_names[] = { | ||
43 | { "cmt0", NULL, "sh_cmt.0" }, | ||
44 | { "scifa0", NULL, "sh-sci.0" }, | ||
45 | { "scifa1", NULL, "sh-sci.1" }, | ||
46 | { "scifb0", NULL, "sh-sci.2" }, | ||
47 | { "scifb1", NULL, "sh-sci.3" }, | ||
48 | { "scifb2", NULL, "sh-sci.4" }, | ||
49 | { "scifa2", NULL, "sh-sci.5" }, | ||
50 | { "scif0", NULL, "sh-sci.6" }, | ||
51 | { "scif1", NULL, "sh-sci.7" }, | ||
52 | { "scif2", NULL, "sh-sci.8" }, | ||
53 | { "scif3", NULL, "sh-sci.9" }, | ||
54 | { "scif4", NULL, "sh-sci.10" }, | ||
55 | { "scif5", NULL, "sh-sci.11" }, | ||
56 | { "scifa3", NULL, "sh-sci.12" }, | ||
57 | { "scifa4", NULL, "sh-sci.13" }, | ||
58 | { "scifa5", NULL, "sh-sci.14" }, | ||
42 | }; | 59 | }; |
43 | struct clk *clk; | 60 | struct clk *clk; |
44 | unsigned int i; | 61 | unsigned int i; |
45 | 62 | ||
46 | for (i = 0; i < ARRAY_SIZE(scif_names); ++i) { | 63 | for (i = 0; i < ARRAY_SIZE(clk_names); ++i) { |
47 | clk = clk_get(NULL, scif_names[i]); | 64 | clk = clk_get(NULL, clk_names[i].clk); |
48 | if (!IS_ERR(clk)) { | 65 | if (!IS_ERR(clk)) { |
49 | clk_register_clkdev(clk, NULL, "sh-sci.%u", i); | 66 | clk_register_clkdev(clk, clk_names[i].con_id, |
67 | clk_names[i].dev_id); | ||
50 | clk_put(clk); | 68 | clk_put(clk); |
51 | } | 69 | } |
52 | } | 70 | } |
53 | |||
54 | clk = clk_get(NULL, "cmt0"); | ||
55 | if (!IS_ERR(clk)) { | ||
56 | clk_register_clkdev(clk, NULL, "sh_cmt.0"); | ||
57 | clk_put(clk); | ||
58 | } | ||
59 | #else | 71 | #else |
60 | r8a7791_clock_init(); | 72 | r8a7791_clock_init(); |
61 | #endif | 73 | #endif |