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