blob: 21b3e1ca226159e7a87e5ddd71565a7278dd2db6 [file] [log] [blame]
Simon Horman73d6a692013-01-29 11:40:18 +09001/*
2 * marzen board support - Reference DT implementation
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2013 Simon Horman
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
Simon Hormana92fbd02014-05-15 20:32:06 +090022#include <linux/clk/shmobile.h>
23#include <linux/clocksource.h>
Simon Hormanf8fba0c2014-05-15 20:32:03 +090024#include <linux/of_platform.h>
Geert Uytterhoeven1b553532014-06-20 18:53:05 +020025
Simon Horman73d6a692013-01-29 11:40:18 +090026#include <asm/irq.h>
27#include <asm/mach/arch.h>
Geert Uytterhoeven1b553532014-06-20 18:53:05 +020028
Simon Horman2b2084e2014-05-15 20:32:07 +090029#include "clock.h"
Magnus Dammfd44aa52014-06-17 16:47:37 +090030#include "common.h"
Magnus Dammb6bab122014-06-17 16:47:29 +090031#include "irqs.h"
Geert Uytterhoeven1b553532014-06-20 18:53:05 +020032#include "r8a7779.h"
Simon Horman73d6a692013-01-29 11:40:18 +090033
Simon Hormana92fbd02014-05-15 20:32:06 +090034static void __init marzen_init_timer(void)
Simon Horman73d6a692013-01-29 11:40:18 +090035{
Simon Hormana92fbd02014-05-15 20:32:06 +090036 r8a7779_clocks_init(r8a7779_read_mode_pins());
Simon Hormana92fbd02014-05-15 20:32:06 +090037 clocksource_of_init();
38}
39
Simon Horman2b2084e2014-05-15 20:32:07 +090040/*
41 * This is a really crude hack to provide clkdev support to platform
42 * devices until they get moved to DT.
43 */
44static const struct clk_name clk_names[] __initconst = {
Simon Horman2b2084e2014-05-15 20:32:07 +090045 { "tmu0", "fck", "sh-tmu.0" },
46};
Simon Horman2b2084e2014-05-15 20:32:07 +090047
Simon Hormana92fbd02014-05-15 20:32:06 +090048static void __init marzen_init(void)
49{
Simon Horman2b2084e2014-05-15 20:32:07 +090050 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
Simon Horman73d6a692013-01-29 11:40:18 +090051 r8a7779_add_standard_devices_dt();
Simon Hormanf8fba0c2014-05-15 20:32:03 +090052 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Kuninori Morimoto7d4bde82013-10-02 01:39:48 -070053 r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
Simon Horman73d6a692013-01-29 11:40:18 +090054}
55
56static const char *marzen_boards_compat_dt[] __initdata = {
Simon Horman04d3e8a2014-05-15 20:32:10 +090057 "renesas,marzen",
Simon Horman73d6a692013-01-29 11:40:18 +090058 "renesas,marzen-reference",
59 NULL,
60};
61
62DT_MACHINE_START(MARZEN, "marzen")
63 .smp = smp_ops(r8a7779_smp_ops),
64 .map_io = r8a7779_map_io,
Simon Horman17ed9ef2014-05-16 13:43:00 +090065 .init_early = shmobile_init_delay,
Simon Hormana92fbd02014-05-15 20:32:06 +090066 .init_time = marzen_init_timer,
Simon Horman73d6a692013-01-29 11:40:18 +090067 .nr_irqs = NR_IRQS_LEGACY,
68 .init_irq = r8a7779_init_irq_dt,
69 .init_machine = marzen_init,
Simon Horman73d6a692013-01-29 11:40:18 +090070 .dt_compat = marzen_boards_compat_dt,
71MACHINE_END