aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-02-16 16:31:58 -0500
committerSimon Horman <horms+renesas@verge.net.au>2014-02-16 22:00:23 -0500
commit9a8c3ab9c0286a6c81012eaf9e95ec2d3e58d21f (patch)
tree2448daf4f8db0ac1a4cbefea9b7f6edbad9da216
parent849f7b6c10d8016b55e13b7ad2e9f299e2da817b (diff)
ARM: shmobile: lager-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> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index dc8d76b9a9f1..634ef15e73e3 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -31,30 +31,37 @@ static void __init lager_add_standard_devices(void)
31{ 31{
32#ifdef CONFIG_COMMON_CLK 32#ifdef CONFIG_COMMON_CLK
33 /* 33 /*
34 * This is a really crude hack to provide clkdev support to the SCIF 34 * This is a really crude hack to provide clkdev support to platform
35 * and CMT devices until they get moved to DT. 35 * devices until they get moved to DT.
36 */ 36 */
37 static const char * const scif_names[] = { 37 static const struct clk_name {
38 "scifa0", "scifa1", "scifb0", "scifb1", 38 const char *clk;
39 "scifb2", "scifa2", "scif0", "scif1", 39 const char *con_id;
40 "hscif0", "hscif1", 40 const char *dev_id;
41 } clk_names[] = {
42 { "cmt0", NULL, "sh_cmt.0" },
43 { "scifa0", NULL, "sh-sci.0" },
44 { "scifa1", NULL, "sh-sci.1" },
45 { "scifb0", NULL, "sh-sci.2" },
46 { "scifb1", NULL, "sh-sci.3" },
47 { "scifb2", NULL, "sh-sci.4" },
48 { "scifa2", NULL, "sh-sci.5" },
49 { "scif0", NULL, "sh-sci.6" },
50 { "scif1", NULL, "sh-sci.7" },
51 { "hscif0", NULL, "sh-sci.8" },
52 { "hscif1", NULL, "sh-sci.9" },
41 }; 53 };
42 struct clk *clk; 54 struct clk *clk;
43 unsigned int i; 55 unsigned int i;
44 56
45 for (i = 0; i < ARRAY_SIZE(scif_names); ++i) { 57 for (i = 0; i < ARRAY_SIZE(clk_names); ++i) {
46 clk = clk_get(NULL, scif_names[i]); 58 clk = clk_get(NULL, clk_names[i].clk);
47 if (!IS_ERR(clk)) { 59 if (!IS_ERR(clk)) {
48 clk_register_clkdev(clk, NULL, "sh-sci.%u", i); 60 clk_register_clkdev(clk, clk_names[i].con_id,
61 clk_names[i].dev_id);
49 clk_put(clk); 62 clk_put(clk);
50 } 63 }
51 } 64 }
52
53 clk = clk_get(NULL, "cmt0");
54 if (!IS_ERR(clk)) {
55 clk_register_clkdev(clk, NULL, "sh_cmt.0");
56 clk_put(clk);
57 }
58#else 65#else
59 r8a7790_clock_init(); 66 r8a7790_clock_init();
60#endif 67#endif