Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 1 | /* |
| 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 Horman | a92fbd0 | 2014-05-15 20:32:06 +0900 | [diff] [blame] | 22 | #include <linux/clk/shmobile.h> |
| 23 | #include <linux/clocksource.h> |
Simon Horman | f8fba0c | 2014-05-15 20:32:03 +0900 | [diff] [blame] | 24 | #include <linux/of_platform.h> |
Geert Uytterhoeven | 1b55353 | 2014-06-20 18:53:05 +0200 | [diff] [blame] | 25 | |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 26 | #include <asm/irq.h> |
| 27 | #include <asm/mach/arch.h> |
Geert Uytterhoeven | 1b55353 | 2014-06-20 18:53:05 +0200 | [diff] [blame] | 28 | |
Simon Horman | 2b2084e | 2014-05-15 20:32:07 +0900 | [diff] [blame] | 29 | #include "clock.h" |
Magnus Damm | fd44aa5 | 2014-06-17 16:47:37 +0900 | [diff] [blame] | 30 | #include "common.h" |
Magnus Damm | b6bab12 | 2014-06-17 16:47:29 +0900 | [diff] [blame] | 31 | #include "irqs.h" |
Geert Uytterhoeven | 1b55353 | 2014-06-20 18:53:05 +0200 | [diff] [blame] | 32 | #include "r8a7779.h" |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 33 | |
Simon Horman | a92fbd0 | 2014-05-15 20:32:06 +0900 | [diff] [blame] | 34 | static void __init marzen_init_timer(void) |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 35 | { |
Simon Horman | a92fbd0 | 2014-05-15 20:32:06 +0900 | [diff] [blame] | 36 | r8a7779_clocks_init(r8a7779_read_mode_pins()); |
Simon Horman | a92fbd0 | 2014-05-15 20:32:06 +0900 | [diff] [blame] | 37 | clocksource_of_init(); |
| 38 | } |
| 39 | |
Simon Horman | 2b2084e | 2014-05-15 20:32:07 +0900 | [diff] [blame] | 40 | /* |
| 41 | * This is a really crude hack to provide clkdev support to platform |
| 42 | * devices until they get moved to DT. |
| 43 | */ |
| 44 | static const struct clk_name clk_names[] __initconst = { |
Simon Horman | 2b2084e | 2014-05-15 20:32:07 +0900 | [diff] [blame] | 45 | { "tmu0", "fck", "sh-tmu.0" }, |
| 46 | }; |
Simon Horman | 2b2084e | 2014-05-15 20:32:07 +0900 | [diff] [blame] | 47 | |
Simon Horman | a92fbd0 | 2014-05-15 20:32:06 +0900 | [diff] [blame] | 48 | static void __init marzen_init(void) |
| 49 | { |
Simon Horman | 2b2084e | 2014-05-15 20:32:07 +0900 | [diff] [blame] | 50 | shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 51 | r8a7779_add_standard_devices_dt(); |
Simon Horman | f8fba0c | 2014-05-15 20:32:03 +0900 | [diff] [blame] | 52 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
Kuninori Morimoto | 7d4bde8 | 2013-10-02 01:39:48 -0700 | [diff] [blame] | 53 | r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */ |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | static const char *marzen_boards_compat_dt[] __initdata = { |
Simon Horman | 04d3e8a | 2014-05-15 20:32:10 +0900 | [diff] [blame] | 57 | "renesas,marzen", |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 58 | "renesas,marzen-reference", |
| 59 | NULL, |
| 60 | }; |
| 61 | |
| 62 | DT_MACHINE_START(MARZEN, "marzen") |
| 63 | .smp = smp_ops(r8a7779_smp_ops), |
| 64 | .map_io = r8a7779_map_io, |
Simon Horman | 17ed9ef | 2014-05-16 13:43:00 +0900 | [diff] [blame] | 65 | .init_early = shmobile_init_delay, |
Simon Horman | a92fbd0 | 2014-05-15 20:32:06 +0900 | [diff] [blame] | 66 | .init_time = marzen_init_timer, |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 67 | .nr_irqs = NR_IRQS_LEGACY, |
| 68 | .init_irq = r8a7779_init_irq_dt, |
| 69 | .init_machine = marzen_init, |
Simon Horman | 73d6a69 | 2013-01-29 11:40:18 +0900 | [diff] [blame] | 70 | .dt_compat = marzen_boards_compat_dt, |
| 71 | MACHINE_END |