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/platform_device.h>
11
12#include <asm/mach/arch.h>
13#include <asm/mach/map.h>
14#include <asm/system_misc.h>
15
16#include "common.h"
17#include "regs-clock.h"
18
19static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
20 int depth, void *data)
21{
22 struct map_desc iodesc;
23 const __be32 *reg;
24 int len;
25
26 if (!of_flat_dt_is_compatible(node, name: "samsung,s5pv210-clock"))
27 return 0;
28
29 reg = of_get_flat_dt_prop(node, name: "reg", size: &len);
30 if (reg == NULL || len != (sizeof(unsigned long) * 2))
31 return 0;
32
33 iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
34 iodesc.length = be32_to_cpu(reg[1]) - 1;
35 iodesc.virtual = (unsigned long)S3C_VA_SYS;
36 iodesc.type = MT_DEVICE;
37 iotable_init(&iodesc, 1);
38
39 return 1;
40}
41
42static void __init s5pv210_dt_map_io(void)
43{
44 debug_ll_io_init();
45
46 of_scan_flat_dt(it: s5pv210_fdt_map_sys, NULL);
47}
48
49static void s5pv210_dt_restart(enum reboot_mode mode, const char *cmd)
50{
51 __raw_writel(0x1, S5P_SWRESET);
52}
53
54static void __init s5pv210_dt_init_late(void)
55{
56 platform_device_register_simple(name: "s5pv210-cpufreq", id: -1, NULL, num: 0);
57 s5pv210_pm_init();
58}
59
60static char const *const s5pv210_dt_compat[] __initconst = {
61 "samsung,s5pc110",
62 "samsung,s5pv210",
63 NULL
64};
65
66DT_MACHINE_START(S5PV210_DT, "Samsung S5PC110/S5PV210-based board")
67 .dt_compat = s5pv210_dt_compat,
68 .map_io = s5pv210_dt_map_io,
69 .restart = s5pv210_dt_restart,
70 .init_late = s5pv210_dt_init_late,
71MACHINE_END
72

source code of linux/arch/arm/mach-s5pv210/s5pv210.c