Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 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 | |
Laurent Pinchart | 4a606af2 | 2013-12-11 15:13:54 +0100 | [diff] [blame] | 21 | #include <linux/clk.h> |
| 22 | #include <linux/clkdev.h> |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 23 | #include <linux/init.h> |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 24 | #include <linux/of_platform.h> |
Magnus Damm | 3fbbcbd | 2013-11-20 09:02:31 +0900 | [diff] [blame] | 25 | #include <mach/common.h> |
Magnus Damm | 20c6125 | 2013-10-17 06:58:19 +0900 | [diff] [blame] | 26 | #include <mach/rcar-gen2.h> |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 27 | #include <mach/r8a7790.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | |
Magnus Damm | d144f36 | 2013-07-08 15:16:46 +0900 | [diff] [blame] | 30 | static void __init lager_add_standard_devices(void) |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 31 | { |
Laurent Pinchart | 4a606af2 | 2013-12-11 15:13:54 +0100 | [diff] [blame] | 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 |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 59 | r8a7790_clock_init(); |
Laurent Pinchart | 0ef3cde | 2013-12-11 15:13:52 +0100 | [diff] [blame] | 60 | #endif |
Laurent Pinchart | 4a606af2 | 2013-12-11 15:13:54 +0100 | [diff] [blame] | 61 | |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 62 | r8a7790_add_dt_devices(); |
Magnus Damm | 20c6125 | 2013-10-17 06:58:19 +0900 | [diff] [blame] | 63 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | static const char *lager_boards_compat_dt[] __initdata = { |
Laurent Pinchart | 1fb6814 | 2013-12-11 15:13:58 +0100 | [diff] [blame^] | 67 | "renesas,lager", |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 68 | "renesas,lager-reference", |
| 69 | NULL, |
| 70 | }; |
| 71 | |
| 72 | DT_MACHINE_START(LAGER_DT, "lager") |
Magnus Damm | ad09cb8 | 2013-08-29 08:22:07 +0900 | [diff] [blame] | 73 | .smp = smp_ops(r8a7790_smp_ops), |
Magnus Damm | 0efd7fa | 2013-08-08 07:27:01 +0900 | [diff] [blame] | 74 | .init_early = r8a7790_init_early, |
Magnus Damm | 50c517d | 2013-09-12 09:32:49 +0900 | [diff] [blame] | 75 | .init_time = rcar_gen2_timer_init, |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 76 | .init_machine = lager_add_standard_devices, |
Magnus Damm | 3fbbcbd | 2013-11-20 09:02:31 +0900 | [diff] [blame] | 77 | .init_late = shmobile_init_late, |
Simon Horman | 6dace67 | 2013-06-28 13:42:16 +0900 | [diff] [blame] | 78 | .dt_compat = lager_boards_compat_dt, |
| 79 | MACHINE_END |