xref: /openbmc/linux/arch/arm/mach-s5pv210/s5pv210.c (revision 2359ccdd)
1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Samsung's S5PC110/S5PV210 flattened device tree enabled machine.
4 //
5 // Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
6 // Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
7 // Tomasz Figa <t.figa@samsung.com>
8 
9 #include <linux/of_fdt.h>
10 #include <linux/of_platform.h>
11 
12 #include <asm/mach/arch.h>
13 #include <asm/mach/map.h>
14 #include <asm/system_misc.h>
15 
16 #include <plat/map-base.h>
17 
18 #include "common.h"
19 #include "regs-clock.h"
20 
21 static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
22 					int depth, void *data)
23 {
24 	struct map_desc iodesc;
25 	const __be32 *reg;
26 	int len;
27 
28 	if (!of_flat_dt_is_compatible(node, "samsung,s5pv210-clock"))
29 		return 0;
30 
31 	reg = of_get_flat_dt_prop(node, "reg", &len);
32 	if (reg == NULL || len != (sizeof(unsigned long) * 2))
33 		return 0;
34 
35 	iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
36 	iodesc.length = be32_to_cpu(reg[1]) - 1;
37 	iodesc.virtual = (unsigned long)S3C_VA_SYS;
38 	iodesc.type = MT_DEVICE;
39 	iotable_init(&iodesc, 1);
40 
41 	return 1;
42 }
43 
44 static void __init s5pv210_dt_map_io(void)
45 {
46 	debug_ll_io_init();
47 
48 	of_scan_flat_dt(s5pv210_fdt_map_sys, NULL);
49 }
50 
51 static void s5pv210_dt_restart(enum reboot_mode mode, const char *cmd)
52 {
53 	__raw_writel(0x1, S5P_SWRESET);
54 }
55 
56 static void __init s5pv210_dt_init_late(void)
57 {
58 	platform_device_register_simple("s5pv210-cpufreq", -1, NULL, 0);
59 	s5pv210_pm_init();
60 }
61 
62 static char const *const s5pv210_dt_compat[] __initconst = {
63 	"samsung,s5pc110",
64 	"samsung,s5pv210",
65 	NULL
66 };
67 
68 DT_MACHINE_START(S5PV210_DT, "Samsung S5PC110/S5PV210-based board")
69 	.dt_compat = s5pv210_dt_compat,
70 	.map_io = s5pv210_dt_map_io,
71 	.restart = s5pv210_dt_restart,
72 	.init_late = s5pv210_dt_init_late,
73 MACHINE_END
74