Linux 3.14.25
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / arm / mach-shmobile / board-lager-reference.c
1 /*
2  * Lager board support - Reference DT implementation
3  *
4  * Copyright (C) 2013  Renesas Solutions Corp.
5  * Copyright (C) 2013  Simon Horman
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include <linux/clk.h>
22 #include <linux/clkdev.h>
23 #include <linux/init.h>
24 #include <linux/of_platform.h>
25 #include <mach/common.h>
26 #include <mach/rcar-gen2.h>
27 #include <mach/r8a7790.h>
28 #include <asm/mach/arch.h>
29
30 static void __init lager_add_standard_devices(void)
31 {
32 #ifdef CONFIG_COMMON_CLK
33         /*
34          * This is a really crude hack to provide clkdev support to the SCIF
35          * and CMT devices until they get moved to DT.
36          */
37         static const char * const scif_names[] = {
38                 "scifa0", "scifa1", "scifb0", "scifb1",
39                 "scifb2", "scifa2", "scif0", "scif1",
40                 "hscif0", "hscif1",
41         };
42         struct clk *clk;
43         unsigned int i;
44
45         for (i = 0; i < ARRAY_SIZE(scif_names); ++i) {
46                 clk = clk_get(NULL, scif_names[i]);
47                 if (clk) {
48                         clk_register_clkdev(clk, NULL, "sh-sci.%u", i);
49                         clk_put(clk);
50                 }
51         }
52
53         clk = clk_get(NULL, "cmt0");
54         if (clk) {
55                 clk_register_clkdev(clk, NULL, "sh_cmt.0");
56                 clk_put(clk);
57         }
58 #else
59         r8a7790_clock_init();
60 #endif
61
62         r8a7790_add_dt_devices();
63         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
64 }
65
66 static const char *lager_boards_compat_dt[] __initdata = {
67         "renesas,lager",
68         "renesas,lager-reference",
69         NULL,
70 };
71
72 DT_MACHINE_START(LAGER_DT, "lager")
73         .smp            = smp_ops(r8a7790_smp_ops),
74         .init_early     = r8a7790_init_early,
75         .init_time      = rcar_gen2_timer_init,
76         .init_machine   = lager_add_standard_devices,
77         .init_late      = shmobile_init_late,
78         .dt_compat      = lager_boards_compat_dt,
79 MACHINE_END