blob: a6e271d92af04b4fb7037f615684d0508375a844 [file] [log] [blame]
Simon Horman6dace672013-06-28 13:42:16 +09001/*
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
Laurent Pinchart4a606af22013-12-11 15:13:54 +010021#include <linux/clk.h>
22#include <linux/clkdev.h>
Simon Horman6dace672013-06-28 13:42:16 +090023#include <linux/init.h>
Simon Horman6dace672013-06-28 13:42:16 +090024#include <linux/of_platform.h>
Magnus Damm3fbbcbd2013-11-20 09:02:31 +090025#include <mach/common.h>
Magnus Damm20c61252013-10-17 06:58:19 +090026#include <mach/rcar-gen2.h>
Simon Horman6dace672013-06-28 13:42:16 +090027#include <mach/r8a7790.h>
28#include <asm/mach/arch.h>
29
Magnus Dammd144f362013-07-08 15:16:46 +090030static void __init lager_add_standard_devices(void)
Simon Horman6dace672013-06-28 13:42:16 +090031{
Laurent Pinchart4a606af22013-12-11 15:13:54 +010032#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
Simon Horman6dace672013-06-28 13:42:16 +090059 r8a7790_clock_init();
Laurent Pinchart0ef3cde2013-12-11 15:13:52 +010060#endif
Laurent Pinchart4a606af22013-12-11 15:13:54 +010061
Simon Horman6dace672013-06-28 13:42:16 +090062 r8a7790_add_dt_devices();
Magnus Damm20c61252013-10-17 06:58:19 +090063 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Simon Horman6dace672013-06-28 13:42:16 +090064}
65
66static const char *lager_boards_compat_dt[] __initdata = {
Laurent Pinchart1fb68142013-12-11 15:13:58 +010067 "renesas,lager",
Simon Horman6dace672013-06-28 13:42:16 +090068 "renesas,lager-reference",
69 NULL,
70};
71
72DT_MACHINE_START(LAGER_DT, "lager")
Magnus Dammad09cb82013-08-29 08:22:07 +090073 .smp = smp_ops(r8a7790_smp_ops),
Magnus Damm0efd7fa2013-08-08 07:27:01 +090074 .init_early = r8a7790_init_early,
Magnus Damm50c517d2013-09-12 09:32:49 +090075 .init_time = rcar_gen2_timer_init,
Simon Horman6dace672013-06-28 13:42:16 +090076 .init_machine = lager_add_standard_devices,
Magnus Damm3fbbcbd2013-11-20 09:02:31 +090077 .init_late = shmobile_init_late,
Simon Horman6dace672013-06-28 13:42:16 +090078 .dt_compat = lager_boards_compat_dt,
79MACHINE_END