ARM: shmobile: koelsch-reference: Instantiate clkdevs for SCIF and CMT
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 11 Dec 2013 14:13:55 +0000 (15:13 +0100)
committerSimon Horman <horms+renesas@verge.net.au>
Thu, 19 Dec 2013 10:08:25 +0000 (19:08 +0900)
Now that the common clock framework is supported, the clock lookup
entries in clock-r8a7791.c are not registered anymore. Devices must
instead reference their clocks in the device tree. However, SCIF and CMT
devices are still instantiated through platform code, and thus need a
clock lookup entry.

Retrieve the SCIF and CMT clock entries by name and register clkdevs for
the corresponding devices. This will be removed when the SCIF and CMT
devices will be instantiated from the device tree.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
arch/arm/mach-shmobile/board-koelsch-reference.c

index 4b48e2d4dec44ee56d3fa22ff8a43ef6d0a9755a..e1c787e639eb28b16e83a2ed553bfbf3cd793c82 100644 (file)
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/clk.h>
+#include <linux/clkdev.h>
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <mach/common.h>
 
 static void __init koelsch_add_standard_devices(void)
 {
-#ifndef CONFIG_COMMON_CLK
+#ifdef CONFIG_COMMON_CLK
+       /*
+        * This is a really crude hack to provide clkdev support to the SCIF
+        * and CMT devices until they get moved to DT.
+        */
+       static const char * const scif_names[] = {
+               "scifa0", "scifa1", "scifb0", "scifb1", "scifb2", "scifa2",
+               "scif0", "scif1", "scif2", "scif3", "scif4", "scif5", "scifa3",
+               "scifa4", "scifa5",
+       };
+       struct clk *clk;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
+               clk = clk_get(NULL, scif_names[i]);
+               if (clk) {
+                       clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
+                       clk_put(clk);
+               }
+       }
+
+       clk = clk_get(NULL, "cmt0");
+       if (clk) {
+               clk_register_clkdev(clk, NULL, "sh_cmt.0");
+               clk_put(clk);
+       }
+#else
        r8a7791_clock_init();
 #endif
        r8a7791_add_dt_devices();