blob: 83e656ea95ae13f1ed23003d6872479370e43abc [file] [log] [blame]
Mateusz Krawczukadbd1ad2013-09-28 18:25:28 +02001/*
2 * Samsung's S5PC110/S5PV210 flattened device tree enabled machine.
3 *
4 * Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
5 * Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
6 * Tomasz Figa <t.figa@samsung.com>
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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/of_fdt.h>
14#include <linux/of_platform.h>
15
16#include <asm/mach/arch.h>
17#include <asm/mach/map.h>
18#include <asm/system_misc.h>
19
20#include <plat/map-base.h>
Mateusz Krawczukadbd1ad2013-09-28 18:25:28 +020021
Tomasz Figa0a90d4d2014-07-02 19:37:45 +020022#include "common.h"
Kukjin Kim9740bdd2014-08-01 03:22:04 +090023#include "regs-clock.h"
Tomasz Figa0a90d4d2014-07-02 19:37:45 +020024
Mateusz Krawczukadbd1ad2013-09-28 18:25:28 +020025static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
26 int depth, void *data)
27{
28 struct map_desc iodesc;
29 const __be32 *reg;
30 int len;
31
32 if (!of_flat_dt_is_compatible(node, "samsung,s5pv210-clock"))
33 return 0;
34
35 reg = of_get_flat_dt_prop(node, "reg", &len);
36 if (reg == NULL || len != (sizeof(unsigned long) * 2))
37 return 0;
38
39 iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
40 iodesc.length = be32_to_cpu(reg[1]) - 1;
41 iodesc.virtual = (unsigned long)S3C_VA_SYS;
42 iodesc.type = MT_DEVICE;
43 iotable_init(&iodesc, 1);
44
45 return 1;
46}
47
48static void __init s5pv210_dt_map_io(void)
49{
50 debug_ll_io_init();
51
52 of_scan_flat_dt(s5pv210_fdt_map_sys, NULL);
53}
54
55static void s5pv210_dt_restart(enum reboot_mode mode, const char *cmd)
56{
57 __raw_writel(0x1, S5P_SWRESET);
58}
59
Tomasz Figa0a90d4d2014-07-02 19:37:45 +020060static void __init s5pv210_dt_init_late(void)
61{
Tomasz Figa7d6764b2014-07-03 17:48:48 +020062 platform_device_register_simple("s5pv210-cpufreq", -1, NULL, 0);
Tomasz Figa0a90d4d2014-07-02 19:37:45 +020063 s5pv210_pm_init();
64}
65
Uwe Kleine-König543c5042015-02-18 21:01:45 +010066static char const *const s5pv210_dt_compat[] __initconst = {
Mateusz Krawczukadbd1ad2013-09-28 18:25:28 +020067 "samsung,s5pc110",
68 "samsung,s5pv210",
69 NULL
70};
71
72DT_MACHINE_START(S5PV210_DT, "Samsung S5PC110/S5PV210-based board")
73 .dt_compat = s5pv210_dt_compat,
74 .map_io = s5pv210_dt_map_io,
75 .restart = s5pv210_dt_restart,
Tomasz Figa0a90d4d2014-07-02 19:37:45 +020076 .init_late = s5pv210_dt_init_late,
Mateusz Krawczukadbd1ad2013-09-28 18:25:28 +020077MACHINE_END