Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Samsung's S5PC110/S5PV210 flattened device tree enabled machine.
0004 //
0005 // Copyright (c) 2013-2014 Samsung Electronics Co., Ltd.
0006 // Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
0007 // Tomasz Figa <t.figa@samsung.com>
0008 
0009 #include <linux/of_fdt.h>
0010 #include <linux/of_platform.h>
0011 
0012 #include <asm/mach/arch.h>
0013 #include <asm/mach/map.h>
0014 #include <asm/system_misc.h>
0015 
0016 #include "common.h"
0017 #include "regs-clock.h"
0018 
0019 static int __init s5pv210_fdt_map_sys(unsigned long node, const char *uname,
0020                     int depth, void *data)
0021 {
0022     struct map_desc iodesc;
0023     const __be32 *reg;
0024     int len;
0025 
0026     if (!of_flat_dt_is_compatible(node, "samsung,s5pv210-clock"))
0027         return 0;
0028 
0029     reg = of_get_flat_dt_prop(node, "reg", &len);
0030     if (reg == NULL || len != (sizeof(unsigned long) * 2))
0031         return 0;
0032 
0033     iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
0034     iodesc.length = be32_to_cpu(reg[1]) - 1;
0035     iodesc.virtual = (unsigned long)S3C_VA_SYS;
0036     iodesc.type = MT_DEVICE;
0037     iotable_init(&iodesc, 1);
0038 
0039     return 1;
0040 }
0041 
0042 static void __init s5pv210_dt_map_io(void)
0043 {
0044     debug_ll_io_init();
0045 
0046     of_scan_flat_dt(s5pv210_fdt_map_sys, NULL);
0047 }
0048 
0049 static void s5pv210_dt_restart(enum reboot_mode mode, const char *cmd)
0050 {
0051     __raw_writel(0x1, S5P_SWRESET);
0052 }
0053 
0054 static void __init s5pv210_dt_init_late(void)
0055 {
0056     platform_device_register_simple("s5pv210-cpufreq", -1, NULL, 0);
0057     s5pv210_pm_init();
0058 }
0059 
0060 static char const *const s5pv210_dt_compat[] __initconst = {
0061     "samsung,s5pc110",
0062     "samsung,s5pv210",
0063     NULL
0064 };
0065 
0066 DT_MACHINE_START(S5PV210_DT, "Samsung S5PC110/S5PV210-based board")
0067     .dt_compat = s5pv210_dt_compat,
0068     .map_io = s5pv210_dt_map_io,
0069     .restart = s5pv210_dt_restart,
0070     .init_late = s5pv210_dt_init_late,
0071 MACHINE_END